use of org.apache.metron.common.configuration.ParserConfigurations in project metron by apache.
the class KafkaWriterTest method createConfiguration.
public WriterConfiguration createConfiguration(final Map<String, Object> parserConfig) {
ParserConfigurations configurations = new ParserConfigurations();
configurations.updateSensorParserConfig(SENSOR_TYPE, new SensorParserConfig() {
{
setParserConfig(parserConfig);
}
});
return new ParserWriterConfiguration(configurations);
}
use of org.apache.metron.common.configuration.ParserConfigurations in project metron by apache.
the class ParserRunnerImplTest method setup.
@BeforeEach
@SuppressWarnings("unchecked")
public void setup() throws IOException {
parserConfigurations = new ParserConfigurations();
SensorParserConfig broConfig = SensorParserConfig.fromBytes(broConfigString.getBytes(StandardCharsets.UTF_8));
SensorParserConfig snortConfig = SensorParserConfig.fromBytes(snortConfigString.getBytes(StandardCharsets.UTF_8));
parserConfigurations.updateSensorParserConfig("bro", broConfig);
parserConfigurations.updateSensorParserConfig("snort", snortConfig);
parserConfigurations.updateGlobalConfig(JSONUtils.INSTANCE.load(globalConfigString, JSONUtils.MAP_SUPPLIER));
parserRunner = new ParserRunnerImpl(new HashSet<>(Arrays.asList("bro", "snort")));
broParser = mock(MessageParser.class);
snortParser = mock(MessageParser.class);
stellarFilter = mock(StellarFilter.class);
// mockStatic(ReflectionUtils.class);
// mockStatic(Filters.class);
when(broParser.getReadCharset()).thenReturn(StandardCharsets.UTF_8);
// when(ReflectionUtils.createInstance("org.apache.metron.parsers.bro.BasicBroParser")).thenReturn(broParser);
// when(ReflectionUtils.createInstance("org.apache.metron.parsers.snort.BasicSnortParser")).thenReturn(snortParser);
// when(Filters.get("org.apache.metron.parsers.filters.StellarFilter", broConfig.getParserConfig()))
// .thenReturn(stellarFilter);
}
Aggregations