http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/fireeye/BasicFireEyeParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/fireeye/BasicFireEyeParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/fireeye/BasicFireEyeParserTest.java deleted file mode 100644 index 7a5d2e6..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/fireeye/BasicFireEyeParserTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.fireeye; - -import java.util.Map; -import java.util.Map.Entry; -import java.time.Year; -import java.time.ZonedDateTime; -import java.time.ZoneOffset; - -import org.apache.metron.parsers.AbstractParserConfigTest; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class BasicFireEyeParserTest extends AbstractParserConfigTest { - - @Before - public void setUp() throws Exception { - inputStrings = super.readTestDataFromFile("src/test/resources/logData/FireEyeParserTest.txt"); - parser = new BasicFireEyeParser(); - } - - @SuppressWarnings({"rawtypes"}) - @Test - public void testParse() throws ParseException { - for (String inputString : inputStrings) { - JSONObject parsed = parser.parse(inputString.getBytes()).get(0); - Assert.assertNotNull(parsed); - - JSONParser parser = new JSONParser(); - - Map json = (Map) parser.parse(parsed.toJSONString()); - - Assert.assertNotNull(json); - Assert.assertFalse(json.isEmpty()); - - for (Object o : json.entrySet()) { - Entry entry = (Entry) o; - String key = (String) entry.getKey(); - String value = json.get(key).toString(); - Assert.assertNotNull(value); - } - } - } - - private final static String fireeyeMessage = "<164>Mar 19 05:24:39 10.220.15.15 fenotify-851983.alert: CEF:0|FireEye|CMS|7.2.1.244420|DM|domain-match|1|rt=Feb 09 2015 12:28:26 UTC dvc=10.201.78.57 cn3Label=cncPort cn3=53 cn2Label=sid cn2=80494706 shost=dev001srv02.example.com proto=udp cs5Label=cncHost cs5=mfdclk001.org dvchost=DEVFEYE1 spt=54527 dvc=10.100.25.16 smac=00:00:0c:07:ac:00 cn1Label=vlan cn1=0 externalId=851983 cs4Label=link cs4=https://DEVCMS01.example.com/event_stream/events_for_bot?ev_id\\=851983 dmac=00:1d:a2:af:32:a1 cs1Label=sname cs1=Trojan.Generic.DNS"; - - @SuppressWarnings("rawtypes") - @Test - public void testTimestampParsing() throws ParseException { - JSONObject parsed = parser.parse(fireeyeMessage.getBytes()).get(0); - JSONParser parser = new JSONParser(); - Map json = (Map) parser.parse(parsed.toJSONString()); - long expectedTimestamp = ZonedDateTime.of(Year.now(ZoneOffset.UTC).getValue(), 3, 19, 5, 24, 39, 0, ZoneOffset.UTC).toInstant().toEpochMilli(); - Assert.assertEquals(expectedTimestamp, json.get("timestamp")); - } -}
http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokBuilderTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokBuilderTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokBuilderTest.java new file mode 100644 index 0000000..57e206f --- /dev/null +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokBuilderTest.java @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.metron.parsers.grok; + +import com.google.common.collect.ImmutableMap; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import oi.thekraken.grok.api.Grok; +import org.apache.metron.test.utils.ResourceCopier; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class GrokBuilderTest { + + @BeforeClass + public static void before() throws Exception { + ResourceCopier.copyResources(Paths.get("./src/test/resources/"), Paths.get("./target")); + ResourceCopier.copyResources(Paths.get("./src/test/resources/"), Paths.get("./target/hdfs")); + } + + @Test + public void withParserConfiguration() throws Exception { + Map<String, Object> parserConfig = new HashMap<>(); + parserConfig.put("grokPath", "/patterns/test"); + parserConfig.put("patternLabel", "YAF_TIME_FORMAT"); + Map<String, Object> globalConfig = ImmutableMap.of("metron.apps.hdfs.dir", "./target/hdfs"); + parserConfig.put("globalConfig", globalConfig); + + Grok grok = new GrokBuilder().withParserConfiguration(parserConfig).withLoadCommon(false) + .build(); + Assert.assertNotNull(grok); + } + + @Test + public void withOutParserConfiguration() throws Exception { + String grokPath = "/patterns/test"; + String patternLabel = "YAF_TIME_FORMAT"; + + Grok grok = new GrokBuilder().withPatternLabel(patternLabel).withGrokPath(grokPath) + .withLoadCommon(false).build(); + Assert.assertNotNull(grok); + } + + @Test + public void withReader() throws Exception { + InputStreamReader reader = new InputStreamReader( + new FileInputStream(new File("./target/patterns/test"))); + Grok grok = new GrokBuilder().withReader(reader).withLoadCommon(false).build(); + Assert.assertNotNull(grok); + } + + @Test + public void withPatternsCommonDir() throws Exception { + Map<String, Object> parserConfig = new HashMap<>(); + parserConfig.put("grokPath", "/patterns/test"); + parserConfig.put("patternLabel", "YAF_TIME_FORMAT"); + Map<String, Object> globalConfig = ImmutableMap.of("metron.apps.hdfs.dir", "./target/hdfs"); + parserConfig.put("globalConfig", globalConfig); + + Grok grok = new GrokBuilder().withParserConfiguration(parserConfig) + .withPatternsCommonDir("/otherPatterns/common").build(); + Assert.assertNotNull(grok); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokParserTest.java new file mode 100644 index 0000000..4fe68aa --- /dev/null +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/GrokParserTest.java @@ -0,0 +1,106 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.metron.parsers.grok; + +import com.google.common.collect.MapDifference; +import com.google.common.collect.Maps; +import java.nio.file.Paths; +import org.apache.metron.test.utils.ResourceCopier; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public abstract class GrokParserTest { + @BeforeClass + public static void beforeClass() throws IOException { + ResourceCopier.copyResources(Paths.get("./src/main/resources"), Paths.get("./target")); + } + + @Test + public void test() throws IOException, ParseException { + + Map<String, Object> parserConfig = new HashMap<>(); + parserConfig.put("grokPath", getGrokPath()); + parserConfig.put("patternLabel", getGrokPatternLabel()); + parserConfig.put("timestampField", getTimestampField()); + parserConfig.put("dateFormat", getDateFormat()); + parserConfig.put("timeFields", getTimeFields()); + + Map<String, Object> globalConfig = new HashMap<>(); + globalConfig.put("metron.apps.hdfs.dir","./target/"); + parserConfig.put("globalConfig",globalConfig); + + GrokParser grokParser = new GrokParser(); + grokParser.configure(parserConfig); + grokParser.init(); + + JSONParser jsonParser = new JSONParser(); + Map<String,String> testData = getTestData(); + for( Map.Entry<String,String> e : testData.entrySet() ){ + + JSONObject expected = (JSONObject) jsonParser.parse(e.getValue()); + byte[] rawMessage = e.getKey().getBytes(); + + List<JSONObject> parsedList = grokParser.parse(rawMessage); + Assert.assertEquals(1, parsedList.size()); + compare(expected, parsedList.get(0)); + } + + } + + public boolean compare(JSONObject expected, JSONObject actual) { + MapDifference mapDifferences = Maps.difference(expected, actual); + if (mapDifferences.entriesOnlyOnLeft().size() > 0) Assert.fail("Expected JSON has extra parameters: " + mapDifferences.entriesOnlyOnLeft()); + if (mapDifferences.entriesOnlyOnRight().size() > 0) Assert.fail("Actual JSON has extra parameters: " + mapDifferences.entriesOnlyOnRight()); + Map actualDifferences = new HashMap(); + if (mapDifferences.entriesDiffering().size() > 0) { + Map differences = Collections.unmodifiableMap(mapDifferences.entriesDiffering()); + for (Object key : differences.keySet()) { + Object expectedValueObject = expected.get(key); + Object actualValueObject = actual.get(key); + if (expectedValueObject instanceof Long || expectedValueObject instanceof Integer) { + Long expectedValue = Long.parseLong(expectedValueObject.toString()); + Long actualValue = Long.parseLong(actualValueObject.toString()); + if (!expectedValue.equals(actualValue)) { + actualDifferences.put(key, differences.get(key)); + } + } else { + actualDifferences.put(key, differences.get(key)); + } + } + } + if (actualDifferences.size() > 0) Assert.fail("Expected and Actual JSON values don't match: " + actualDifferences); + return true; + } + + public abstract Map getTestData(); + public abstract String getGrokPath(); + public abstract String getGrokPatternLabel(); + public abstract List<String> getTimeFields(); + public abstract String getDateFormat(); + public abstract String getTimestampField(); +} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/SampleGrokParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/SampleGrokParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/SampleGrokParserTest.java new file mode 100644 index 0000000..892f3c5 --- /dev/null +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/grok/SampleGrokParserTest.java @@ -0,0 +1,97 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.metron.parsers.grok; + +import org.adrianwalker.multilinestring.Multiline; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SampleGrokParserTest extends GrokParserTest { + + /** + * { + * "roct":0, + * "end_reason":"idle", + * "ip_dst_addr":"10.0.2.15", + * "iflags":"AS", + * "rpkt":0, + * "original_string":"1453994987000|2016-01-28 15:29:48| 0.000| 0.000| 6| 216.21.170.221| 80| 10.0.2.15|39468| AS| 0| 0| 0|22efa001|00000000|000|000| 1| 44| 0| 0| 0|idle", + * "tag":0, + * "risn":0, + * "ip_dst_port":39468, + * "ruflags":0, + * "app":0, + * "protocol":6 + * ,"isn":"22efa001", + * "uflags":0,"duration":"0.000", + * "oct":44, + * "ip_src_port":80, + * "end_time":1453994988000, + * "start_time":1453994987000 + * "timestamp":1453994987000, + * "riflags":0, + * "rtt":"0.000", + * "rtag":0, + * "pkt":1, + * "ip_src_addr":"216.21.170.221" + * } + */ + @Multiline + public String result; + + + @Override + public Map getTestData() { + + Map testData = new HashMap<String,String>(); + String input = "1453994987000|2016-01-28 15:29:48| 0.000| 0.000| 6| 216.21.170.221| 80| 10.0.2.15|39468| AS| 0| 0| 0|22efa001|00000000|000|000| 1| 44| 0| 0| 0|idle"; + testData.put(input,result); + return testData; + + } + + @Override + public String getGrokPath() { + return "/patterns/test"; + } + + @Override + public String getGrokPatternLabel() { + return "YAF_DELIMITED"; + } + + @Override + public List<String> getTimeFields() { + return new ArrayList<String>() {{ + add("end_time"); + }}; + } + + @Override + public String getDateFormat() { + return "yyyy-MM-dd HH:mm:ss"; + } + + @Override + public String getTimestampField() { + return "start_time"; + } +} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/AsaIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/AsaIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/AsaIntegrationTest.java deleted file mode 100644 index 3ff07ad..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/AsaIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.integration; - -import org.apache.metron.parsers.integration.validation.SampleDataValidation; - -import java.util.ArrayList; -import java.util.List; - -public class AsaIntegrationTest extends ParserIntegrationTest { - @Override - String getSensorType() { - return "asa"; - } - - @Override - List<ParserValidation> getValidations() { - return new ArrayList<ParserValidation>() {{ - add(new SampleDataValidation()); - }}; - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/BroIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/BroIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/BroIntegrationTest.java deleted file mode 100644 index c9cfe0a..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/BroIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.integration; - -import org.apache.metron.parsers.integration.validation.SampleDataValidation; - -import java.util.ArrayList; -import java.util.List; - -public class BroIntegrationTest extends ParserIntegrationTest { - @Override - String getSensorType() { - return "bro"; - } - - @Override - List<ParserValidation> getValidations() { - return new ArrayList<ParserValidation>() {{ - add(new SampleDataValidation()); - }}; - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/JSONMapIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/JSONMapIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/JSONMapIntegrationTest.java index 13a7835..1391238 100644 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/JSONMapIntegrationTest.java +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/JSONMapIntegrationTest.java @@ -24,12 +24,12 @@ import java.util.List; public class JSONMapIntegrationTest extends ParserIntegrationTest { @Override - String getSensorType() { + public String getSensorType() { return "jsonMap"; } @Override - List<ParserValidation> getValidations() { + public List<ParserValidation> getValidations() { return new ArrayList<ParserValidation>() {{ add(new SampleDataValidation()); }}; http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/ParserIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/ParserIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/ParserIntegrationTest.java index cd3d005..8805d61 100644 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/ParserIntegrationTest.java +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/ParserIntegrationTest.java @@ -17,51 +17,57 @@ */ package org.apache.metron.parsers.integration; -import com.google.common.base.Function; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; import org.apache.metron.TestConstants; -import org.apache.metron.common.Constants; -import org.apache.metron.enrichment.integration.components.ConfigUploadComponent; -import org.apache.metron.integration.*; -import org.apache.metron.integration.components.KafkaComponent; -import org.apache.metron.integration.processors.KafkaMessageSet; -import org.apache.metron.integration.components.ZKServerComponent; -import org.apache.metron.integration.processors.KafkaProcessor; +import org.apache.metron.bundles.BundleClassLoaders; +import org.apache.metron.bundles.ExtensionManager; +import org.apache.metron.integration.BaseIntegrationTest; +import org.apache.metron.integration.ProcessorResult; import org.apache.metron.integration.utils.TestUtils; -import org.apache.metron.parsers.integration.components.ParserTopologyComponent; import org.apache.metron.test.TestDataType; +import org.apache.metron.test.utils.ResourceCopier; import org.apache.metron.test.utils.SampleDataUtils; -import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import javax.annotation.Nullable; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.*; - public abstract class ParserIntegrationTest extends BaseIntegrationTest { protected List<byte[]> inputMessages; + @AfterClass + public static void after(){ + BundleClassLoaders.reset(); + ExtensionManager.reset(); + } + @BeforeClass + public static void before() throws IOException { + ResourceCopier.copyResources(Paths.get("./src/main/resources"), Paths.get("./target")); - protected String readGlobalConfig() throws IOException { - File configsRoot = new File(TestConstants.SAMPLE_CONFIG_PATH); + BundleClassLoaders.reset(); + ExtensionManager.reset(); + } + + + protected String readGlobalConfig() throws Exception { + File configsRoot = new File(getGlobalConfigPath()); return new String(Files.readAllBytes(new File(configsRoot, "global.json").toPath())); } protected String readSensorConfig(String sensorType) throws IOException { - File configsRoot = new File(TestConstants.PARSER_CONFIGS_PATH); + File configsRoot = new File(TestConstants.THIS_PARSER_CONFIGS_PATH); File parsersRoot = new File(configsRoot, "parsers"); return new String(Files.readAllBytes(new File(parsersRoot, sensorType + ".json").toPath())); } @Test public void test() throws Exception { - String sensorType = getSensorType(); + final String sensorType = getSensorType(); ParserDriver driver = new ParserDriver(sensorType, readSensorConfig(sensorType), readGlobalConfig()); - inputMessages = TestUtils.readSampleData(SampleDataUtils.getSampleDataPath(sensorType, TestDataType.RAW)); + inputMessages = TestUtils.readSampleData(getSampleDataPath()); ProcessorResult<List<byte[]>> result = driver.run(inputMessages); List<byte[]> outputMessages = result.getResult(); @@ -92,7 +98,15 @@ public abstract class ParserIntegrationTest extends BaseIntegrationTest { } } - abstract String getSensorType(); - abstract List<ParserValidation> getValidations(); + protected String getSampleDataPath() throws Exception{ + return SampleDataUtils.getSampleDataPath(0,getSensorType(), TestDataType.RAW); + } + + abstract public String getSensorType(); + abstract public List<ParserValidation> getValidations(); + + protected String getGlobalConfigPath() throws Exception{ + return TestConstants.SAMPLE_CONFIG_PATH; + } } http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SnortIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SnortIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SnortIntegrationTest.java deleted file mode 100644 index 244dd89..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SnortIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.integration; - -import org.apache.metron.parsers.integration.validation.SampleDataValidation; - -import java.util.ArrayList; -import java.util.List; - -public class SnortIntegrationTest extends ParserIntegrationTest { - @Override - String getSensorType() { - return "snort"; - } - - @Override - List<ParserValidation> getValidations() { - return new ArrayList<ParserValidation>() {{ - add(new SampleDataValidation()); - }}; - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SquidIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SquidIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SquidIntegrationTest.java deleted file mode 100644 index 9c03e81..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/SquidIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.integration; - -import org.apache.metron.parsers.integration.validation.SampleDataValidation; - -import java.util.ArrayList; -import java.util.List; - -public class SquidIntegrationTest extends ParserIntegrationTest { - @Override - String getSensorType() { - return "squid"; - } - - @Override - List<ParserValidation> getValidations() { - return new ArrayList<ParserValidation>() {{ - add(new SampleDataValidation()); - }}; - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/WebSphereIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/WebSphereIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/WebSphereIntegrationTest.java deleted file mode 100644 index 5dc0ac6..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/WebSphereIntegrationTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.metron.parsers.integration; - -import org.apache.metron.parsers.integration.validation.SampleDataValidation; - -import java.util.ArrayList; -import java.util.List; - -public class WebSphereIntegrationTest extends ParserIntegrationTest { - - @Override - public String getSensorType() { - return "websphere"; - } - - @Override - List<ParserValidation> getValidations() { - return new ArrayList<ParserValidation>() {{ - add(new SampleDataValidation()); - }}; - } - -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/YafIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/YafIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/YafIntegrationTest.java deleted file mode 100644 index 9930c2c..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/YafIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.integration; - -import org.apache.metron.parsers.integration.validation.SampleDataValidation; - -import java.util.ArrayList; -import java.util.List; - -public class YafIntegrationTest extends ParserIntegrationTest { - @Override - String getSensorType() { - return "yaf"; - } - - @Override - List<ParserValidation> getValidations() { - return new ArrayList<ParserValidation>() {{ - add(new SampleDataValidation()); - }}; - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/PathedSampleDataValidation.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/PathedSampleDataValidation.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/PathedSampleDataValidation.java new file mode 100644 index 0000000..ff08418 --- /dev/null +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/PathedSampleDataValidation.java @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.metron.parsers.integration.validation; + +import org.apache.metron.integration.utils.TestUtils; +import org.apache.metron.parsers.integration.ParserValidation; +import org.apache.metron.test.TestDataType; +import org.apache.metron.test.utils.SampleDataUtils; +import org.apache.metron.test.utils.ValidationUtils; +import org.junit.Assert; + +import java.util.List; + +public class PathedSampleDataValidation implements ParserValidation { + protected String path; + + public PathedSampleDataValidation(String path){ + this.path = path; + } + + @Override + public String getName() { + return "Pathed Sample Data Validation"; + } + + @Override + public void validate(String sensorType, List<byte[]> actualMessages) throws Exception { + List<byte[]> expectedMessages = TestUtils.readSampleData(getPath(sensorType)); + Assert.assertEquals(expectedMessages.size(), actualMessages.size()); + for (int i = 0; i < actualMessages.size(); i++) { + String expectedMessage = new String(expectedMessages.get(i)); + String actualMessage = new String(actualMessages.get(i)); + try { + ValidationUtils.assertJSONEqual(expectedMessage, actualMessage); + } catch (Throwable t) { + System.out.println("expected: " + expectedMessage); + System.out.println("actual: " + actualMessage); + throw t; + } + } + } + + protected String getPath(String sensorType)throws Exception{ + return path; + } +} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/SampleDataValidation.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/SampleDataValidation.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/SampleDataValidation.java index 9ea9b71..7d6feca 100644 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/SampleDataValidation.java +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/integration/validation/SampleDataValidation.java @@ -17,6 +17,7 @@ */ package org.apache.metron.parsers.integration.validation; +import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; import org.apache.metron.integration.utils.TestUtils; import org.apache.metron.parsers.integration.ParserValidation; import org.apache.metron.test.TestDataType; @@ -26,27 +27,18 @@ import org.junit.Assert; import java.util.List; -public class SampleDataValidation implements ParserValidation { +public class SampleDataValidation extends PathedSampleDataValidation { + public SampleDataValidation(){ + super(""); + } @Override public String getName() { return "Sample Data Validation"; } @Override - public void validate(String sensorType, List<byte[]> actualMessages) throws Exception { - List<byte[]> expectedMessages = TestUtils.readSampleData(SampleDataUtils.getSampleDataPath(sensorType, TestDataType.PARSED)); - Assert.assertEquals(expectedMessages.size(), actualMessages.size()); - for (int i = 0; i < actualMessages.size(); i++) { - String expectedMessage = new String(expectedMessages.get(i)); - String actualMessage = new String(actualMessages.get(i)); - try { - ValidationUtils.assertJSONEqual(expectedMessage, actualMessage); - } catch (Throwable t) { - System.out.println("expected: " + expectedMessage); - System.out.println("actual: " + actualMessage); - throw t; - } - } + protected String getPath(String sensorType) throws Exception{ + return SampleDataUtils.getSampleDataPath(sensorType, TestDataType.PARSED); } } http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/ise/BasicIseParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/ise/BasicIseParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/ise/BasicIseParserTest.java deleted file mode 100644 index 050a2d2..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/ise/BasicIseParserTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.ise; - -import com.github.fge.jsonschema.core.exceptions.ProcessingException; -import java.io.IOException; -import java.net.URL; -import java.util.Map; -import org.apache.metron.parsers.AbstractParserConfigTest; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class BasicIseParserTest extends AbstractParserConfigTest { - - @Before - public void setUp() throws Exception { - inputStrings = super.readTestDataFromFile("src/test/resources/logData/IseParserTest.txt"); - parser = new BasicIseParser(); - - URL schema_url = getClass().getClassLoader().getResource( - "TestSchemas/IseSchema.json"); - super.setSchemaJsonString(super.readSchemaFromFile(schema_url)); - } - - @Test - public void testParse() - throws org.json.simple.parser.ParseException, IOException, ProcessingException { - for (String inputString : inputStrings) { - JSONObject parsed = parser.parse(inputString.getBytes()).get(0); - Assert.assertNotNull(parsed); - - JSONParser parser = new JSONParser(); - - Map<?, ?> json = (Map<?, ?>) parser.parse(parsed.toJSONString()); - Assert.assertTrue(validateJsonData(getSchemaJsonString(), json.toString())); - } - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/lancope/BasicLancopeParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/lancope/BasicLancopeParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/lancope/BasicLancopeParserTest.java deleted file mode 100644 index 50fdcd0..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/lancope/BasicLancopeParserTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.lancope; - -import com.github.fge.jsonschema.core.exceptions.ProcessingException; -import java.io.IOException; -import java.net.URL; -import java.util.Map; -import org.apache.metron.parsers.AbstractParserConfigTest; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class BasicLancopeParserTest extends AbstractParserConfigTest { - - @Before - public void setUp() throws Exception { - inputStrings = super.readTestDataFromFile("src/test/resources/logData/LancopeParserTest.txt"); - parser = new BasicLancopeParser(); - - URL schema_url = getClass().getClassLoader().getResource( - "TestSchemas/LancopeSchema.json"); - super.setSchemaJsonString(super.readSchemaFromFile(schema_url)); - } - - @Test - public void testParse() throws ParseException, IOException, ProcessingException { - for (String inputString : inputStrings) { - JSONObject parsed = parser.parse(inputString.getBytes()).get(0); - Assert.assertNotNull(parsed); - - JSONParser parser = new JSONParser(); - - Map<?, ?> json = (Map<?, ?>) parser.parse(parsed.toJSONString()); - Assert.assertTrue(validateJsonData(getSchemaJsonString(), json.toString())); - } - } -} - http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/paloalto/BasicPaloAltoFirewallParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/paloalto/BasicPaloAltoFirewallParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/paloalto/BasicPaloAltoFirewallParserTest.java deleted file mode 100644 index cf93c92..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/paloalto/BasicPaloAltoFirewallParserTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.paloalto; - -import java.util.Map; -import java.util.Map.Entry; -import org.apache.metron.parsers.AbstractParserConfigTest; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class BasicPaloAltoFirewallParserTest extends AbstractParserConfigTest { - - @Before - public void setUp() throws Exception { - inputStrings = readTestDataFromFile( - "src/test/resources/logData/PaloAltoFirewallParserTest.txt"); - parser = new BasicPaloAltoFirewallParser(); - } - - @SuppressWarnings({"rawtypes"}) - @Test - public void testParse() throws ParseException { - for (String inputString : inputStrings) { - JSONObject parsed = parser.parse(inputString.getBytes()).get(0); - Assert.assertNotNull(parsed); - - JSONParser parser = new JSONParser(); - Map json = (Map) parser.parse(parsed.toJSONString()); - - for (Object o : json.entrySet()) { - Entry entry = (Entry) o; - String key = (String) entry.getKey(); - String value = json.get(key).toString(); - Assert.assertNotNull(value); - } - } - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/sourcefire/BasicSourcefireParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/sourcefire/BasicSourcefireParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/sourcefire/BasicSourcefireParserTest.java deleted file mode 100644 index dedd9db..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/sourcefire/BasicSourcefireParserTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.metron.parsers.sourcefire; - -import java.util.Map; -import java.util.Map.Entry; -import org.apache.metron.parsers.AbstractParserConfigTest; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class BasicSourcefireParserTest extends AbstractParserConfigTest { - - @Before - public void setUp() throws Exception { - inputStrings = super - .readTestDataFromFile("src/test/resources/logData/SourcefireParserTest.txt"); - parser = new BasicSourcefireParser(); - } - - @SuppressWarnings({"rawtypes", "unused"}) - @Test - public void testParse() throws ParseException { - for (String inputString : inputStrings) { - byte[] srcBytes = inputString.getBytes(); - JSONObject parsed = parser.parse(inputString.getBytes()).get(0); - Assert.assertNotNull(parsed); - - JSONParser parser = new JSONParser(); - Map json = (Map) parser.parse(parsed.toJSONString()); - - for (Object o : json.entrySet()) { - Entry entry = (Entry) o; - String key = (String) entry.getKey(); - String value = json.get("original_string").toString(); - Assert.assertNotNull(value); - } - } - } -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/websphere/GrokWebSphereParserTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/websphere/GrokWebSphereParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/websphere/GrokWebSphereParserTest.java deleted file mode 100644 index 230c147..0000000 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/websphere/GrokWebSphereParserTest.java +++ /dev/null @@ -1,260 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.metron.parsers.websphere; - -import static org.junit.Assert.assertEquals; - -import java.time.*; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Level; -import org.apache.metron.parsers.GrokParser; -import org.apache.metron.test.utils.UnitTestHelper; -import org.json.simple.JSONObject; -import org.junit.Before; -import org.junit.Test; - -public class GrokWebSphereParserTest { - - private static final ZoneId UTC = ZoneId.of("UTC"); - private Map<String, Object> parserConfig; - - @Before - public void setup() { - parserConfig = new HashMap<>(); - parserConfig.put("grokPath", "../metron-parsers/src/main/resources/patterns/websphere"); - parserConfig.put("patternLabel", "WEBSPHERE"); - parserConfig.put("timestampField", "timestamp_string"); - parserConfig.put("dateFormat", "yyyy MMM dd HH:mm:ss"); - } - - @Test - public void testParseLoginLine() throws Exception { - - //Set up parser, parse message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<133>Apr 15 17:47:28 ABCXML1413 [rojOut][0x81000033][auth][notice] user(rick007): " - + "[120.43.200.6]: User logged into 'cohlOut'."; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 47, 28, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(133, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("ABCXML1413", parsedJSON.get("hostname")); - assertEquals("rojOut", parsedJSON.get("security_domain")); - assertEquals("0x81000033", parsedJSON.get("event_code")); - assertEquals("auth", parsedJSON.get("event_type")); - assertEquals("notice", parsedJSON.get("severity")); - assertEquals("login", parsedJSON.get("event_subtype")); - assertEquals("rick007", parsedJSON.get("username")); - assertEquals("120.43.200.6", parsedJSON.get("ip_src_addr")); - } - - @Test - public void tetsParseLogoutLine() throws Exception { - - //Set up parser, parse message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<134>Apr 15 18:02:27 PHIXML3RWD [0x81000019][auth][info] [14.122.2.201]: " - + "User 'hjpotter' logged out from 'default'."; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 18, 2, 27, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(134, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("PHIXML3RWD", parsedJSON.get("hostname")); - assertEquals("0x81000019", parsedJSON.get("event_code")); - assertEquals("auth", parsedJSON.get("event_type")); - assertEquals("info", parsedJSON.get("severity")); - assertEquals("14.122.2.201", parsedJSON.get("ip_src_addr")); - assertEquals("hjpotter", parsedJSON.get("username")); - assertEquals("default", parsedJSON.get("security_domain")); - } - - @Test - public void tetsParseRBMLine() throws Exception { - - //Set up parser, parse message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<131>Apr 15 17:36:35 ROBXML3QRS [0x80800018][auth][error] rbm(RBM-Settings): " - + "trans(3502888135)[request] gtid(3502888135): RBM: Resource access denied."; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 36, 35, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(131, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("ROBXML3QRS", parsedJSON.get("hostname")); - assertEquals("0x80800018", parsedJSON.get("event_code")); - assertEquals("auth", parsedJSON.get("event_type")); - assertEquals("error", parsedJSON.get("severity")); - assertEquals("rbm", parsedJSON.get("process")); - assertEquals("trans(3502888135)[request] gtid(3502888135): RBM: Resource access denied.", parsedJSON.get("message")); - } - - @Test - public void tetsParseOtherLine() throws Exception { - - //Set up parser, parse message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<134>Apr 15 17:17:34 SAGPXMLQA333 [0x8240001c][audit][info] trans(191): (admin:default:system:*): " - + "ntp-service 'NTP Service' - Operational state down"; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 17, 34, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(134, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("SAGPXMLQA333", parsedJSON.get("hostname")); - assertEquals("0x8240001c", parsedJSON.get("event_code")); - assertEquals("audit", parsedJSON.get("event_type")); - assertEquals("info", parsedJSON.get("severity")); - assertEquals("trans", parsedJSON.get("process")); - assertEquals("(admin:default:system:*): ntp-service 'NTP Service' - Operational state down", parsedJSON.get("message")); - } - - @Test - public void testParseMalformedLoginLine() throws Exception { - - //Set up parser, attempt to parse malformed message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<133>Apr 15 17:47:28 ABCXML1413 [rojOut][0x81000033][auth][notice] rick007): " - + "[120.43.200. User logged into 'cohlOut'."; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 47, 28, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(133, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("ABCXML1413", parsedJSON.get("hostname")); - assertEquals("rojOut", parsedJSON.get("security_domain")); - assertEquals("0x81000033", parsedJSON.get("event_code")); - assertEquals("auth", parsedJSON.get("event_type")); - assertEquals("notice", parsedJSON.get("severity")); - assertEquals("login", parsedJSON.get("event_subtype")); - assertEquals(null, parsedJSON.get("username")); - assertEquals(null, parsedJSON.get("ip_src_addr")); - } - - @Test - public void tetsParseMalformedLogoutLine() throws Exception { - - //Set up parser, attempt to parse malformed message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<134>Apr 15 18:02:27 PHIXML3RWD [0x81000019][auth][info] [14.122.2.201: " - + "User 'hjpotter' logged out from 'default."; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 18, 2, 27, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(134, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("PHIXML3RWD", parsedJSON.get("hostname")); - assertEquals("0x81000019", parsedJSON.get("event_code")); - assertEquals("auth", parsedJSON.get("event_type")); - assertEquals("info", parsedJSON.get("severity")); - assertEquals(null, parsedJSON.get("ip_src_addr")); - assertEquals(null, parsedJSON.get("username")); - assertEquals(null, parsedJSON.get("security_domain")); - } - - @Test - public void tetsParseMalformedRBMLine() throws Exception { - - //Set up parser, parse message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<131>Apr 15 17:36:35 ROBXML3QRS [0x80800018][auth][error] rbmRBM-Settings): " - + "trans3502888135)[request] gtid3502888135) RBM: Resource access denied."; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 36, 35, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(131, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("ROBXML3QRS", parsedJSON.get("hostname")); - assertEquals("0x80800018", parsedJSON.get("event_code")); - assertEquals("auth", parsedJSON.get("event_type")); - assertEquals("error", parsedJSON.get("severity")); - assertEquals(null, parsedJSON.get("process")); - assertEquals("rbmRBM-Settings): trans3502888135)[request] gtid3502888135) RBM: Resource access denied.", parsedJSON.get("message")); - } - - @Test - public void tetsParseMalformedOtherLine() throws Exception { - - //Set up parser, parse message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = "<134>Apr 15 17:17:34 SAGPXMLQA333 [0x8240001c][audit][info] trans 191) admindefaultsystem*): " - + "ntp-service 'NTP Service' - Operational state down:"; - List<JSONObject> result = parser.parse(testString.getBytes()); - JSONObject parsedJSON = result.get(0); - - long expectedTimestamp = ZonedDateTime.of(Year.now(UTC).getValue(), 4, 15, 17, 17, 34, 0, UTC).toInstant().toEpochMilli(); - - //Compare fields - assertEquals(134, parsedJSON.get("priority")); - assertEquals(expectedTimestamp, parsedJSON.get("timestamp")); - assertEquals("SAGPXMLQA333", parsedJSON.get("hostname")); - assertEquals("0x8240001c", parsedJSON.get("event_code")); - assertEquals("audit", parsedJSON.get("event_type")); - assertEquals("info", parsedJSON.get("severity")); - assertEquals(null, parsedJSON.get("process")); - assertEquals("trans 191) admindefaultsystem*): ntp-service 'NTP Service' - Operational state down:", parsedJSON.get("message")); - } - - - @Test(expected=RuntimeException.class) - public void testParseEmptyLine() throws Exception { - - //Set up parser, attempt to parse malformed message - GrokWebSphereParser parser = new GrokWebSphereParser(); - parser.configure(parserConfig); - String testString = ""; - UnitTestHelper.setLog4jLevel(GrokParser.class, Level.FATAL); - List<JSONObject> result = parser.parse(testString.getBytes()); - UnitTestHelper.setLog4jLevel(GrokParser.class, Level.ERROR); - } - -} http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/SimpleHbaseEnrichmentWriterIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/SimpleHbaseEnrichmentWriterIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/SimpleHbaseEnrichmentWriterIntegrationTest.java index 4f513be..4f6523c 100644 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/SimpleHbaseEnrichmentWriterIntegrationTest.java +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/SimpleHbaseEnrichmentWriterIntegrationTest.java @@ -19,10 +19,20 @@ package org.apache.metron.writers.integration; import com.google.common.collect.ImmutableList; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; import org.adrianwalker.multilinestring.Multiline; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; import org.apache.metron.TestConstants; +import org.apache.metron.bundles.BundleClassLoaders; +import org.apache.metron.bundles.ExtensionManager; import org.apache.metron.common.configuration.SensorParserConfig; import org.apache.metron.common.utils.JSONUtils; import org.apache.metron.enrichment.converter.EnrichmentConverter; @@ -32,16 +42,20 @@ import org.apache.metron.enrichment.integration.components.ConfigUploadComponent import org.apache.metron.enrichment.lookup.LookupKV; import org.apache.metron.hbase.mock.MockHTable; import org.apache.metron.hbase.mock.MockHBaseTableProvider; -import org.apache.metron.integration.*; +import org.apache.metron.integration.BaseIntegrationTest; +import org.apache.metron.integration.ComponentRunner; +import org.apache.metron.integration.Processor; +import org.apache.metron.integration.ProcessorResult; +import org.apache.metron.integration.ReadinessState; +import org.apache.metron.integration.UnableToStartException; import org.apache.metron.integration.components.KafkaComponent; import org.apache.metron.integration.components.ZKServerComponent; import org.apache.metron.parsers.integration.components.ParserTopologyComponent; +import org.junit.AfterClass; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; -import java.io.IOException; -import java.util.*; - public class SimpleHbaseEnrichmentWriterIntegrationTest extends BaseIntegrationTest { /** @@ -67,6 +81,16 @@ public class SimpleHbaseEnrichmentWriterIntegrationTest extends BaseIntegrationT @Multiline public static String parserConfig; + @AfterClass + public static void after(){ + BundleClassLoaders.reset(); + ExtensionManager.reset(); + } + @BeforeClass + public static void before(){ + BundleClassLoaders.reset(); + ExtensionManager.reset(); + } @Test public void test() throws UnableToStartException, IOException { final String sensorType = "dummy"; http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/WriterBoltIntegrationTest.java ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/WriterBoltIntegrationTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/WriterBoltIntegrationTest.java index d4d1c02..952f4fe 100644 --- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/WriterBoltIntegrationTest.java +++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/WriterBoltIntegrationTest.java @@ -20,35 +20,59 @@ package org.apache.metron.writers.integration; import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.base.Function; import com.google.common.collect.Iterables; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import javax.annotation.Nullable; import org.adrianwalker.multilinestring.Multiline; import org.apache.hadoop.hbase.util.Bytes; +import org.apache.metron.TestConstants; +import org.apache.metron.bundles.BundleClassLoaders; +import org.apache.metron.bundles.ExtensionManager; +import org.apache.metron.bundles.util.BundleProperties; import org.apache.metron.common.Constants; import org.apache.metron.common.configuration.SensorParserConfig; -import org.apache.metron.stellar.dsl.Context; import org.apache.metron.common.field.validation.FieldValidation; import org.apache.metron.common.utils.JSONUtils; import org.apache.metron.enrichment.integration.components.ConfigUploadComponent; -import org.apache.metron.integration.*; +import org.apache.metron.integration.BaseIntegrationTest; +import org.apache.metron.integration.ComponentRunner; +import org.apache.metron.integration.ProcessorResult; +import org.apache.metron.integration.UnableToStartException; import org.apache.metron.integration.components.KafkaComponent; -import org.apache.metron.integration.processors.KafkaMessageSet; import org.apache.metron.integration.components.ZKServerComponent; +import org.apache.metron.integration.processors.KafkaMessageSet; import org.apache.metron.integration.processors.KafkaProcessor; import org.apache.metron.parsers.csv.CSVParser; import org.apache.metron.parsers.integration.components.ParserTopologyComponent; +import org.apache.metron.stellar.dsl.Context; import org.apache.metron.test.utils.UnitTestHelper; import org.json.simple.JSONObject; import org.json.simple.parser.ParseException; +import org.junit.AfterClass; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; -import javax.annotation.Nullable; -import java.io.IOException; -import java.util.*; - public class WriterBoltIntegrationTest extends BaseIntegrationTest { private static final String ERROR_TOPIC = "parser_error"; public static class MockValidator implements FieldValidation{ + @AfterClass + public static void after(){ + BundleClassLoaders.reset(); + ExtensionManager.reset(); + } + + @BeforeClass + public static void before(){ + BundleClassLoaders.reset(); + ExtensionManager.reset(); + } @Override public boolean isValid(Map<String, Object> input, Map<String, Object> validationConfig, Map<String, Object> globalConfig, Context context) { @@ -109,10 +133,17 @@ public class WriterBoltIntegrationTest extends BaseIntegrationTest { }}); topologyProperties.setProperty("kafka.broker", kafkaComponent.getBrokerList()); + // we need to patch the properties file + BundleProperties properties = BundleProperties.createBasicBundleProperties(TestConstants.SAMPLE_CONFIG_PATH + "/bundle.properties",new HashMap<>()); + ByteArrayOutputStream fso = new ByteArrayOutputStream(); + properties.storeProperties(fso,"WriteBoltIntegrationTest"); + fso.flush(); + ConfigUploadComponent configUploadComponent = new ConfigUploadComponent() .withTopologyProperties(topologyProperties) .withGlobalConfig(globalConfig) - .withParserSensorConfig(sensorType, JSONUtils.INSTANCE.load(parserConfig, SensorParserConfig.class)); + .withParserSensorConfig(sensorType, JSONUtils.INSTANCE.load(parserConfig, SensorParserConfig.class)) + .withBundleProperties(fso.toByteArray()); ParserTopologyComponent parserTopologyComponent = new ParserTopologyComponent.Builder() .withSensorType(sensorType) http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/TestSchemas/BroSchema.json ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/TestSchemas/BroSchema.json b/metron-platform/metron-parsers/src/test/resources/TestSchemas/BroSchema.json deleted file mode 100644 index 0105c19..0000000 --- a/metron-platform/metron-parsers/src/test/resources/TestSchemas/BroSchema.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Bro Schema", - "type": "object", - "properties": { - "status_code": { - "type": "integer" - }, - "uid": { - "type": "string" - }, - "protocol": { - "type": "string" - }, - "ip_dst_addr": { - "type": "string" - }, - "host": { - "type": "string" - }, - "request_body_len": { - "type": "integer" - }, - "response_body_len": { - "type": "integer" - } - }, - "required": ["status_code", "uid", "protocol","ip_dst_addr","host","request_body_len","response_body_len"] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/TestSchemas/IseSchema.json ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/TestSchemas/IseSchema.json b/metron-platform/metron-parsers/src/test/resources/TestSchemas/IseSchema.json deleted file mode 100644 index 1c3f670..0000000 --- a/metron-platform/metron-parsers/src/test/resources/TestSchemas/IseSchema.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "title": "Pcap Schema", - "type": "object", - "properties": { - "ip_src_addr": { - "type": "string" - }, - "ip_dst_addr": { - "type": "string" - }, - "ip_src_port": { - "type": "string" - }, - "ip_dst_port": { - "type": "string" - }, - "protocol": { - "type": "string" - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/TestSchemas/LancopeSchema.json ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/TestSchemas/LancopeSchema.json b/metron-platform/metron-parsers/src/test/resources/TestSchemas/LancopeSchema.json deleted file mode 100644 index 9118a93..0000000 --- a/metron-platform/metron-parsers/src/test/resources/TestSchemas/LancopeSchema.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Lancope Schema", - "type": "object", - "properties": { - "ip_src_addr": { - "type": "string" - }, - "ip_dst_addr": { - "type": "string" - }, - "original_string": { - "type": "string" - }, - "@version": { - "type": "string" - }, - "timestamp": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "host": { - "type": "string" - } - }, - "required": ["ip_src_addr", "ip_dst_addr", "original_string","@version", "timestamp", "type","host"] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/TestSchemas/PcapSchema.json ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/TestSchemas/PcapSchema.json b/metron-platform/metron-parsers/src/test/resources/TestSchemas/PcapSchema.json deleted file mode 100644 index 761396e..0000000 --- a/metron-platform/metron-parsers/src/test/resources/TestSchemas/PcapSchema.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "title": "Pcap Schema", - "type": "object", - "properties": { - "ip_src_addr": { - "type": "string" - }, - "ip_dst_addr": { - "type": "string" - }, - "ip_src_port": { - "type": "string" - }, - "ip_dst_port": { - "type": "string" - }, - "protocol": { - "type": "string" - } - }, - "required": ["ip_src_addr", "ip_dst_addr", "ip_src_port", "ip_dst_port","protocol"] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/TestSchemas/SourcefireSchema.json ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/TestSchemas/SourcefireSchema.json b/metron-platform/metron-parsers/src/test/resources/TestSchemas/SourcefireSchema.json deleted file mode 100644 index 2711909..0000000 --- a/metron-platform/metron-parsers/src/test/resources/TestSchemas/SourcefireSchema.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "title": "Sourcefire Schema", - "type": "object", - "properties": { - "ip_src_addr": { - "type": "string" - }, - "ip_dst_addr": { - "type": "string" - }, - "timestamp": { - "type": "integer" - }, - "protocol": { - "type": "string" - }, - "original_string": { - "type": "string" - }, - "original_string": { - "type": "string" - }, - "ip_src_port": { - "type": "string" - }, - "ip_dst_port": { - "type": "string" - }, - "key": { - "type": "string" - } - }, - "required": ["ip_src_addr", "ip_dst_addr", "ip_src_port", "ip_dst_port","protocol","original_string","key","timestamp"] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/config/BasicFireEyeParserTest.config ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/config/BasicFireEyeParserTest.config b/metron-platform/metron-parsers/src/test/resources/config/BasicFireEyeParserTest.config deleted file mode 100644 index 4b4c648..0000000 --- a/metron-platform/metron-parsers/src/test/resources/config/BasicFireEyeParserTest.config +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#BasicFireEyeParserTestConfig -logFile=src/test/resources/FireEyeParserTest.log http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/config/BasicIseParserTest.config ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/config/BasicIseParserTest.config b/metron-platform/metron-parsers/src/test/resources/config/BasicIseParserTest.config deleted file mode 100644 index d57dace..0000000 --- a/metron-platform/metron-parsers/src/test/resources/config/BasicIseParserTest.config +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#IseParserTestConfig -logFile=src/test/resources/IseParserTest.log http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/config/BasicLancopeParserTest.config ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/config/BasicLancopeParserTest.config b/metron-platform/metron-parsers/src/test/resources/config/BasicLancopeParserTest.config deleted file mode 100644 index bd32770..0000000 --- a/metron-platform/metron-parsers/src/test/resources/config/BasicLancopeParserTest.config +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#LancopeParserTestConfig -logFile=src/test/resources/LancopeParserTest.log http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/config/BasicPaloAltoFirewallParserTest.config ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/config/BasicPaloAltoFirewallParserTest.config b/metron-platform/metron-parsers/src/test/resources/config/BasicPaloAltoFirewallParserTest.config deleted file mode 100644 index 61b649e..0000000 --- a/metron-platform/metron-parsers/src/test/resources/config/BasicPaloAltoFirewallParserTest.config +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#BasicFireEyeParserTestConfig -logFile=src/test/resources/PaloAltoFirewallParserTest.log http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/config/BasicSourcefireParserTest.config ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/config/BasicSourcefireParserTest.config b/metron-platform/metron-parsers/src/test/resources/config/BasicSourcefireParserTest.config deleted file mode 100644 index 685b0fd..0000000 --- a/metron-platform/metron-parsers/src/test/resources/config/BasicSourcefireParserTest.config +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#BasicSourceFileParserTestConfig -logFile=src/test/resources/SourceFireTest.log http://git-wip-us.apache.org/repos/asf/metron/blob/ffcb91ed/metron-platform/metron-parsers/src/test/resources/config/BroParserTest.config ---------------------------------------------------------------------- diff --git a/metron-platform/metron-parsers/src/test/resources/config/BroParserTest.config b/metron-platform/metron-parsers/src/test/resources/config/BroParserTest.config deleted file mode 100644 index 0dcfc71..0000000 --- a/metron-platform/metron-parsers/src/test/resources/config/BroParserTest.config +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#BroParserTestConfig -logFile=src/test/resources/BroParserTest.log