Search in sources :

Example 1 with StellarFilter

use of org.apache.metron.parsers.filters.StellarFilter 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);
}
Also used : MessageParser(org.apache.metron.parsers.interfaces.MessageParser) ParserConfigurations(org.apache.metron.common.configuration.ParserConfigurations) StellarFilter(org.apache.metron.parsers.filters.StellarFilter) SensorParserConfig(org.apache.metron.common.configuration.SensorParserConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ParserConfigurations (org.apache.metron.common.configuration.ParserConfigurations)1 SensorParserConfig (org.apache.metron.common.configuration.SensorParserConfig)1 StellarFilter (org.apache.metron.parsers.filters.StellarFilter)1 MessageParser (org.apache.metron.parsers.interfaces.MessageParser)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1