@@ -77,7 +77,9 @@ public class TeragrepSyntaxTests {
7777 "teragrep_syslog_stream" ,
7878 "teragrep_syslog_stream_host_port" ,
7979 "teragrep_foreachbatch" ,
80- "teragrep_foreachbatch_transformStatement"
80+ "teragrep_foreachbatch_transformStatement" ,
81+ "teragrep_config_set" ,
82+ "teragrep_config_get"
8183 })
8284 public void teragrepSyntaxParseTest (String arg ) {
8385 String fileName = "src/test/resources/antlr4/commands/teragrep/" + arg + ".txt" ;
@@ -277,7 +279,7 @@ void syslogStreamTest(String arg) { // includes an eval command in the end of th
277279 String syslogPath = "/root/transformStatement/teragrepTransformation/t_execParameter/t_syslogModeParameter" ;
278280 String evalPath = "/root/transformStatement/transformStatement/evalTransformation" ;
279281
280- NodeList syslogNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , syslogPath , true ));
282+ NodeList syslogNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , syslogPath , false ));
281283 NodeList evalNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , evalPath , false ));
282284
283285 // Check that 1 found
@@ -384,7 +386,7 @@ void testRegexExtractWithParams(String arg) {
384386 String regexPath = "/root/transformStatement/teragrepTransformation/t_execParameter/t_regexextractParameter/t_regexParameter" ;
385387 String inputPath = "/root/transformStatement/teragrepTransformation/t_execParameter/t_regexextractParameter/t_inputParameter" ;
386388 String outputPath = "/root/transformStatement/teragrepTransformation/t_execParameter/t_regexextractParameter/t_outputParameter" ;
387- NodeList regexextractNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , regexextractPath , true ));
389+ NodeList regexextractNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , regexextractPath , false ));
388390 NodeList regexNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , regexPath , false ));
389391 NodeList inputNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , inputPath , false ));
390392 NodeList outputNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , outputPath , false ));
@@ -427,4 +429,37 @@ void testTeragrepForEachBatchWithTransformStatement(String arg) {
427429 assertEquals (1 , febParamNodes .getLength ());
428430 assertEquals (1 , transformStmtNodes .getLength ());
429431 }
432+
433+ @ ParameterizedTest
434+ @ ValueSource (strings = {
435+ "teragrep_config_set" ,
436+ })
437+ void testTeragrepSetConfig (String arg ) {
438+ ParserStructureTestingUtility pstu = new ParserStructureTestingUtility ();
439+ String fileName = "src/test/resources/antlr4/commands/teragrep/" + arg + ".txt" ;
440+
441+ String configKeyPath = "/root/transformStatement/teragrepTransformation/t_setParameter/t_setConfigParameter/t_configKeyParameter" ;
442+ String configValuePath = "/root/transformStatement/teragrepTransformation/t_setParameter/t_setConfigParameter/t_configValueParameter" ;
443+ NodeList configKeyNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , configKeyPath , false ));
444+ NodeList configValueNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , configValuePath , false ));
445+
446+ assertEquals (1 , configKeyNodes .getLength ());
447+ assertEquals (1 , configValueNodes .getLength ());
448+ }
449+
450+ @ ParameterizedTest
451+ @ ValueSource (strings = {
452+ "teragrep_config_get" ,
453+ })
454+ void testTeragrepGetConfig (String arg ) {
455+ ParserStructureTestingUtility pstu = new ParserStructureTestingUtility ();
456+ String fileName = "src/test/resources/antlr4/commands/teragrep/" + arg + ".txt" ;
457+
458+ String configGetPath = "/root/transformStatement/teragrepTransformation/t_getParameter/value" ;
459+ NodeList configGetNodes = Assertions .assertDoesNotThrow (() -> (NodeList ) pstu .xpathQueryFile (fileName , configGetPath , false ));
460+
461+ Assertions .assertEquals (2 , configGetNodes .getLength ());
462+ Assertions .assertEquals ("get" , configGetNodes .item (0 ).getTextContent ());
463+ Assertions .assertEquals ("config" , configGetNodes .item (1 ).getTextContent ());
464+ }
430465}
0 commit comments