This is an automated email from the ASF dual-hosted git repository. leet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/metron.git
The following commit(s) were added to refs/heads/master by this push: new 97d7e46 METRON-2311 Remove JUnit from all our uber jars (justinleet) closes apache/metron#1561 97d7e46 is described below commit 97d7e46f53376303e18540075b0aa53198b0a1cb Author: justinleet <justinjl...@gmail.com> AuthorDate: Tue Nov 19 20:46:38 2019 -0500 METRON-2311 Remove JUnit from all our uber jars (justinleet) closes apache/metron#1561 --- dependencies_with_url.csv | 2 - metron-analytics/metron-maas-service/pom.xml | 3 ++ metron-analytics/metron-profiler-client/pom.xml | 3 ++ metron-analytics/metron-profiler-repl/pom.xml | 7 +++ metron-analytics/metron-profiler-spark/pom.xml | 3 ++ metron-analytics/metron-profiler-storm/pom.xml | 3 ++ metron-analytics/metron-statistics/pom.xml | 3 ++ metron-contrib/metron-performance/pom.xml | 3 ++ metron-interface/metron-rest/pom.xml | 16 +++++++ metron-platform/elasticsearch-shaded/pom.xml | 3 ++ metron-platform/metron-common/pom.xml | 9 ++++ metron-platform/metron-data-management/pom.xml | 4 +- .../metron-elasticsearch-storm/pom.xml | 3 ++ .../metron-enrichment-common/pom.xml | 6 +++ .../metron-enrichment-storm/pom.xml | 6 +++ metron-platform/metron-hbase-client/pom.xml | 6 +++ metron-platform/metron-hbase-server/pom.xml | 3 ++ .../metron-indexing/metron-indexing-common/pom.xml | 3 ++ metron-platform/metron-management/pom.xml | 3 ++ .../metron-parsing/metron-parsers-common/pom.xml | 6 +++ .../metron-parsing/metron-parsers/pom.xml | 6 +++ .../metron-parsing/metron-parsing-storm/pom.xml | 6 +++ metron-platform/metron-pcap-backend/pom.xml | 3 ++ metron-platform/metron-pcap/pom.xml | 6 +++ .../metron-solr/metron-solr-common/pom.xml | 3 ++ .../metron-solr/metron-solr-storm/pom.xml | 3 ++ .../metron-storm-kafka-override/pom.xml | 3 ++ metron-platform/metron-test-utilities/pom.xml | 6 +++ .../metron-writer/metron-writer-common/pom.xml | 3 ++ metron-stellar/stellar-common/pom.xml | 13 +++++- .../common/utils/StellarProcessorUtils.java | 53 ++++++++++++---------- 31 files changed, 172 insertions(+), 28 deletions(-) diff --git a/dependencies_with_url.csv b/dependencies_with_url.csv index 595cf0e..c4fa12d 100644 --- a/dependencies_with_url.csv +++ b/dependencies_with_url.csv @@ -50,8 +50,6 @@ javax.xml.bind:jaxb-api:jar:2.2.2:compile,CDDL,https://jaxb.dev.java.net/ javax.xml.bind:jaxb-api:jar:2.3.0:compile,CDDL,https://jaxb.dev.java.net/ javax.xml.stream:stax-api:jar:1.0-2:compile,COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0,https://docs.oracle.com/javase/7/docs/api/javax/xml/stream/package-summary.html jline:jline:jar:0.9.94:compile,BSD,http://jline.sourceforge.net -junit:junit:jar:4.12:compile,Eclipse Public License 1.0,http://junit.org -junit:junit:jar:4.4:compile,Common Public License Version 1.0,http://junit.org net.razorvine:pyrolite:jar:4.13:compile,MIT,https://github.com/irmen/Pyrolite net.sf.jopt-simple:jopt-simple:jar:3.2:compile,The MIT License,http://jopt-simple.sourceforge.net net.sf.jopt-simple:jopt-simple:jar:4.6:compile,The MIT License,http://jopt-simple.sourceforge.net diff --git a/metron-analytics/metron-maas-service/pom.xml b/metron-analytics/metron-maas-service/pom.xml index a1671b5..d0dde0b 100644 --- a/metron-analytics/metron-maas-service/pom.xml +++ b/metron-analytics/metron-maas-service/pom.xml @@ -240,6 +240,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-analytics/metron-profiler-client/pom.xml b/metron-analytics/metron-profiler-client/pom.xml index 876e1d6..9335742 100644 --- a/metron-analytics/metron-profiler-client/pom.xml +++ b/metron-analytics/metron-profiler-client/pom.xml @@ -155,6 +155,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-analytics/metron-profiler-repl/pom.xml b/metron-analytics/metron-profiler-repl/pom.xml index f3714b8..010d272 100644 --- a/metron-analytics/metron-profiler-repl/pom.xml +++ b/metron-analytics/metron-profiler-repl/pom.xml @@ -105,6 +105,13 @@ <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>uber</shadedClassifierName> <createDependencyReducedPom>true</createDependencyReducedPom> + <artifactSet> + <excludes> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> + </excludes> + </artifactSet> </configuration> <executions> <execution> diff --git a/metron-analytics/metron-profiler-spark/pom.xml b/metron-analytics/metron-profiler-spark/pom.xml index a087663..284c174 100644 --- a/metron-analytics/metron-profiler-spark/pom.xml +++ b/metron-analytics/metron-profiler-spark/pom.xml @@ -192,6 +192,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-analytics/metron-profiler-storm/pom.xml b/metron-analytics/metron-profiler-storm/pom.xml index 2ec108a..a9a6a94 100644 --- a/metron-analytics/metron-profiler-storm/pom.xml +++ b/metron-analytics/metron-profiler-storm/pom.xml @@ -370,6 +370,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-analytics/metron-statistics/pom.xml b/metron-analytics/metron-statistics/pom.xml index 4befad0..9189658 100644 --- a/metron-analytics/metron-statistics/pom.xml +++ b/metron-analytics/metron-statistics/pom.xml @@ -99,6 +99,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-contrib/metron-performance/pom.xml b/metron-contrib/metron-performance/pom.xml index 40992ab..3233d61 100644 --- a/metron-contrib/metron-performance/pom.xml +++ b/metron-contrib/metron-performance/pom.xml @@ -73,6 +73,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-interface/metron-rest/pom.xml b/metron-interface/metron-rest/pom.xml index b4ca507..630130c 100644 --- a/metron-interface/metron-rest/pom.xml +++ b/metron-interface/metron-rest/pom.xml @@ -143,6 +143,12 @@ <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>${global_json_simple_version}</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.antlr</groupId> @@ -558,6 +564,13 @@ <shadedClassifierName>uber</shadedClassifierName> <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope> <createDependencyReducedPom>true</createDependencyReducedPom> + <artifactSet> + <excludes> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> + </excludes> + </artifactSet> <filters> <filter> <artifact>*:*</artifact> @@ -565,6 +578,9 @@ <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> + <!-- Need to exclude by class, because of the shaded hbase jar --> + <exclude>junit/**</exclude> + <exclude>org/junit/**</exclude> </excludes> </filter> </filters> diff --git a/metron-platform/elasticsearch-shaded/pom.xml b/metron-platform/elasticsearch-shaded/pom.xml index 8651e05..0ba4b00 100644 --- a/metron-platform/elasticsearch-shaded/pom.xml +++ b/metron-platform/elasticsearch-shaded/pom.xml @@ -141,6 +141,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-common/pom.xml b/metron-platform/metron-common/pom.xml index 0bcf343..7ecbabb 100644 --- a/metron-platform/metron-common/pom.xml +++ b/metron-platform/metron-common/pom.xml @@ -80,6 +80,12 @@ <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>${global_json_simple_version}</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.antlr</groupId> @@ -359,6 +365,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-platform/metron-data-management/pom.xml b/metron-platform/metron-data-management/pom.xml index d4fae01..ef822a9 100644 --- a/metron-platform/metron-data-management/pom.xml +++ b/metron-platform/metron-data-management/pom.xml @@ -421,7 +421,6 @@ <artifactSet> <excludes> <exclude>classworlds:classworlds</exclude> - <exclude>junit:junit</exclude> <exclude>jmock:*</exclude> <exclude>*:xml-apis</exclude> <exclude>*slf4j*</exclude> @@ -429,6 +428,9 @@ <exclude>log4j:log4j:jar:</exclude> <exclude>*:hbase:*</exclude> <exclude>org.apache.hadoop.yarn.util.package-info*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-platform/metron-elasticsearch/metron-elasticsearch-storm/pom.xml b/metron-platform/metron-elasticsearch/metron-elasticsearch-storm/pom.xml index f25fb5b..dadf511 100644 --- a/metron-platform/metron-elasticsearch/metron-elasticsearch-storm/pom.xml +++ b/metron-platform/metron-elasticsearch/metron-elasticsearch-storm/pom.xml @@ -183,6 +183,9 @@ <excludes> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-enrichment/metron-enrichment-common/pom.xml b/metron-platform/metron-enrichment/metron-enrichment-common/pom.xml index 67938bc..b4058ee 100644 --- a/metron-platform/metron-enrichment/metron-enrichment-common/pom.xml +++ b/metron-platform/metron-enrichment/metron-enrichment-common/pom.xml @@ -139,6 +139,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -178,6 +181,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-enrichment/metron-enrichment-storm/pom.xml b/metron-platform/metron-enrichment/metron-enrichment-storm/pom.xml index 6fe47e4..532ef14 100644 --- a/metron-platform/metron-enrichment/metron-enrichment-storm/pom.xml +++ b/metron-platform/metron-enrichment/metron-enrichment-storm/pom.xml @@ -305,6 +305,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -344,6 +347,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-hbase-client/pom.xml b/metron-platform/metron-hbase-client/pom.xml index fe497df..211b8e5 100644 --- a/metron-platform/metron-hbase-client/pom.xml +++ b/metron-platform/metron-hbase-client/pom.xml @@ -72,6 +72,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -89,6 +92,9 @@ <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> + <!-- Need to exclude by class, because of the shaded hbase jar --> + <exclude>junit/**</exclude> + <exclude>org/junit/**</exclude> </excludes> </filter> </filters> diff --git a/metron-platform/metron-hbase-server/pom.xml b/metron-platform/metron-hbase-server/pom.xml index 171f800..cef7fc4 100644 --- a/metron-platform/metron-hbase-server/pom.xml +++ b/metron-platform/metron-hbase-server/pom.xml @@ -244,6 +244,9 @@ <excludes> <!-- Exclude our SLF4J dependency that's included via the main project pom.xml --> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-platform/metron-indexing/metron-indexing-common/pom.xml b/metron-platform/metron-indexing/metron-indexing-common/pom.xml index abbeb99..c0d234c 100644 --- a/metron-platform/metron-indexing/metron-indexing-common/pom.xml +++ b/metron-platform/metron-indexing/metron-indexing-common/pom.xml @@ -200,6 +200,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-platform/metron-management/pom.xml b/metron-platform/metron-management/pom.xml index e308f8e..c3f8f8f 100644 --- a/metron-platform/metron-management/pom.xml +++ b/metron-platform/metron-management/pom.xml @@ -218,6 +218,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-platform/metron-parsing/metron-parsers-common/pom.xml b/metron-platform/metron-parsing/metron-parsers-common/pom.xml index 407d311..4d0c489 100644 --- a/metron-platform/metron-parsing/metron-parsers-common/pom.xml +++ b/metron-platform/metron-parsing/metron-parsers-common/pom.xml @@ -227,6 +227,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -259,6 +262,9 @@ <excludes> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-parsing/metron-parsers/pom.xml b/metron-platform/metron-parsing/metron-parsers/pom.xml index cbf9c2f..39f4ef9 100644 --- a/metron-platform/metron-parsing/metron-parsers/pom.xml +++ b/metron-platform/metron-parsing/metron-parsers/pom.xml @@ -114,6 +114,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -146,6 +149,9 @@ <excludes> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-parsing/metron-parsing-storm/pom.xml b/metron-platform/metron-parsing/metron-parsing-storm/pom.xml index 9bd898e..7e1bc50 100644 --- a/metron-platform/metron-parsing/metron-parsing-storm/pom.xml +++ b/metron-platform/metron-parsing/metron-parsing-storm/pom.xml @@ -184,6 +184,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -218,6 +221,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-pcap-backend/pom.xml b/metron-platform/metron-pcap-backend/pom.xml index 719292c..0d0948d 100644 --- a/metron-platform/metron-pcap-backend/pom.xml +++ b/metron-platform/metron-pcap-backend/pom.xml @@ -245,6 +245,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-platform/metron-pcap/pom.xml b/metron-platform/metron-pcap/pom.xml index 4fda810..6510dc8 100644 --- a/metron-platform/metron-pcap/pom.xml +++ b/metron-platform/metron-pcap/pom.xml @@ -80,6 +80,12 @@ <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>${global_json_simple_version}</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> diff --git a/metron-platform/metron-solr/metron-solr-common/pom.xml b/metron-platform/metron-solr/metron-solr-common/pom.xml index bcf9366..ec3645d 100644 --- a/metron-platform/metron-solr/metron-solr-common/pom.xml +++ b/metron-platform/metron-solr/metron-solr-common/pom.xml @@ -303,6 +303,9 @@ <excludes> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-solr/metron-solr-storm/pom.xml b/metron-platform/metron-solr/metron-solr-storm/pom.xml index fedf13a..2dabbe5 100644 --- a/metron-platform/metron-solr/metron-solr-storm/pom.xml +++ b/metron-platform/metron-solr/metron-solr-storm/pom.xml @@ -158,6 +158,9 @@ <excludes> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-storm-kafka-override/pom.xml b/metron-platform/metron-storm-kafka-override/pom.xml index f557956..1d69c6b 100644 --- a/metron-platform/metron-storm-kafka-override/pom.xml +++ b/metron-platform/metron-storm-kafka-override/pom.xml @@ -151,6 +151,9 @@ <exclude>storm:storm-lib:*</exclude> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-platform/metron-test-utilities/pom.xml b/metron-platform/metron-test-utilities/pom.xml index 221b13c..572af09 100644 --- a/metron-platform/metron-test-utilities/pom.xml +++ b/metron-platform/metron-test-utilities/pom.xml @@ -41,6 +41,12 @@ <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>${global_json_simple_version}</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.google.guava</groupId> diff --git a/metron-platform/metron-writer/metron-writer-common/pom.xml b/metron-platform/metron-writer/metron-writer-common/pom.xml index 6b902ec..6a75d58 100644 --- a/metron-platform/metron-writer/metron-writer-common/pom.xml +++ b/metron-platform/metron-writer/metron-writer-common/pom.xml @@ -227,6 +227,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> + <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> diff --git a/metron-stellar/stellar-common/pom.xml b/metron-stellar/stellar-common/pom.xml index c98cb32..f6c16b0 100644 --- a/metron-stellar/stellar-common/pom.xml +++ b/metron-stellar/stellar-common/pom.xml @@ -153,6 +153,12 @@ <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>${global_json_simple_version}</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.google.code.findbugs</groupId> @@ -230,11 +236,10 @@ <version>${global_httpclient_version}</version> </dependency> <dependency> - <!-- junit dependency added with default scope to allow inclusion of StellarProcessorUtils in main jar. - It is excluded from the uber-jar. --> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${global_junit_version}</version> + <scope>test</scope> </dependency> <dependency> <groupId>org.mock-server</groupId> @@ -299,7 +304,9 @@ <artifactSet> <excludes> <exclude>*slf4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> </configuration> @@ -362,7 +369,9 @@ <excludes> <exclude>org.slf4j.impl*</exclude> <exclude>org.slf4j:slf4j-log4j*</exclude> + <!-- Exclude all JUnit deps from the uber jar. Exclude both JUnit 4 and 5 --> <exclude>junit</exclude> + <exclude>org.junit*:*</exclude> </excludes> </artifactSet> <transformers> diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/utils/StellarProcessorUtils.java b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/utils/StellarProcessorUtils.java index 51e7aaa..d6ba189 100644 --- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/utils/StellarProcessorUtils.java +++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/utils/StellarProcessorUtils.java @@ -19,16 +19,6 @@ package org.apache.metron.stellar.common.utils; import com.google.common.collect.ImmutableList; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.apache.metron.stellar.common.StellarPredicateProcessor; -import org.apache.metron.stellar.common.StellarProcessor; -import org.apache.metron.stellar.dsl.Context; -import org.apache.metron.stellar.dsl.DefaultVariableResolver; -import org.apache.metron.stellar.dsl.MapVariableResolver; -import org.apache.metron.stellar.dsl.StellarFunctions; -import org.apache.metron.stellar.dsl.VariableResolver; -import org.junit.Assert; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -45,10 +35,14 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.apache.metron.stellar.common.StellarPredicateProcessor; +import org.apache.metron.stellar.common.StellarProcessor; +import org.apache.metron.stellar.dsl.Context; +import org.apache.metron.stellar.dsl.DefaultVariableResolver; +import org.apache.metron.stellar.dsl.MapVariableResolver; +import org.apache.metron.stellar.dsl.StellarFunctions; +import org.apache.metron.stellar.dsl.VariableResolver; /** * Utilities for executing and validating Stellar expressions. @@ -139,7 +133,9 @@ public class StellarProcessorUtils { byte[] raw = SerDeUtils.toBytes(value); Object actual = SerDeUtils.fromBytes(raw, Object.class); - Assert.assertEquals(msg, value, actual); + if((value == null && actual != null) || (value != null && !value.equals(actual))) { + throw new AssertionError(msg); + } } /** @@ -166,21 +162,25 @@ public class StellarProcessorUtils { // the serialized bits byte[] raw = bytes.toByteArray(); - assertTrue(raw.length > 0); + if(!(raw.length > 0)) { + throw new AssertionError("Serialized byte length not greater than 0"); + } // deserialize using java ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(raw)); Object actual = in.readObject(); // ensure that the round-trip was successful - assertEquals(msg, value, actual); + if((value == null && actual != null) || (value != null && !value.equals(actual))) { + throw new AssertionError(msg); + } } catch(IOException | ClassNotFoundException e) { String error = String.format("Expression result is not Java serializable. It is highly recommended for all " + "functions to return a result that is Java serializable to allow for their broadest possible use. " + "expr=%s, value=%s, error=%s", expression, value, ExceptionUtils.getRootCauseMessage(e)); - fail(error); + throw new AssertionError(error); } } @@ -228,8 +228,9 @@ public class StellarProcessorUtils { public static void validate(String expression, Context context) { StellarProcessor processor = new StellarProcessor(); - Assert.assertTrue("Invalid expression; expr=" + expression, - processor.validate(expression, context)); + if(!processor.validate(expression, context)) { + throw new AssertionError("Invalid expression; expr=" + expression); + } } public static void validate(String rule) { @@ -250,7 +251,9 @@ public class StellarProcessorUtils { public static boolean runPredicate(String rule, VariableResolver resolver, Context context) { StellarPredicateProcessor processor = new StellarPredicateProcessor(); - Assert.assertTrue(rule + " not valid.", processor.validate(rule)); + if(!processor.validate(rule)) { + throw new AssertionError(rule + " not valid."); + } return processor.parse(rule, resolver, StellarFunctions.FUNCTION_RESOLVER(), context); } @@ -269,9 +272,13 @@ public class StellarProcessorUtils { String reason = stellarStatement + " != " + expected + " with variables: " + variables; if (expected instanceof Double) { - Assert.assertEquals(reason, (Double) expected, (Double) run(stellarStatement, variables), 1e-6); + if(!(Math.abs((Double) expected - (Double) run(stellarStatement, variables)) < 1e-6)) { + throw new AssertionError(reason); + } } else { - Assert.assertEquals(reason, expected, run(stellarStatement, variables)); + if(!expected.equals(run(stellarStatement, variables))) { + throw new AssertionError(reason); + } } }