diff --git a/NOTICE.md b/NOTICE.md
index dbb6410048..b325d93e1b 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -47,7 +47,7 @@ Bean Validation API 2.0.2
* Copyright: 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
* by the @authors tag.
-Hibernate Validator CDI, 6.1.2.Final
+Hibernate Validator CDI, 6.2.4.Final
* License: Apache License, 2.0
* Project: https://beanvalidation.org/
* Repackaged in org.glassfish.jersey.server.validation.internal.hibernate
@@ -65,7 +65,7 @@ javax.inject Version: 1
* License: Apache License, 2.0
* Copyright (C) 2009 The JSR-330 Expert Group
-Javassist Version 3.25.0-GA
+Javassist Version 3.29.0-GA
* License: Apache License, 2.0
* Project: http://www.javassist.org/
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
@@ -95,7 +95,7 @@ KineticJS, v4.7.1
* Project: http://www.kineticjs.com, https://github.com/ericdrowell/KineticJS
* Copyright: Eric Rowell
-org.objectweb.asm Version 9.3
+org.objectweb.asm Version 9.4
* License: Modified BSD (https://asm.ow2.io/license.html)
* Copyright (c) 2000-2011 INRIA, France Telecom. All rights reserved.
diff --git a/examples/NOTICE.md b/examples/NOTICE.md
index 4330b16afd..b47bbbb3f7 100644
--- a/examples/NOTICE.md
+++ b/examples/NOTICE.md
@@ -43,6 +43,11 @@ Bean Validation API 2.0.2
* Copyright: 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
* by the @authors tag.
+Hibernate Validator CDI, 6.2.4.Final
+* License: Apache License, 2.0
+* Project: https://beanvalidation.org/
+* Repackaged in org.glassfish.jersey.server.validation.internal.hibernate
+
Bootstrap v3.3.7
* License: MIT license (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Project: http://getbootstrap.com
@@ -56,12 +61,12 @@ javax.inject Version: 1
* License: Apache License, 2.0
* Copyright (C) 2009 The JSR-330 Expert Group
-Javassist Version 3.25.0-GA
+Javassist Version 3.29.0-GA
* License: Apache License, 2.0
* Project: http://www.javassist.org/
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
-Jackson JAX-RS Providers Version 2.9.9
+Jackson JAX-RS Providers Version 2.14.1
* License: Apache License, 2.0
* Project: https://github.com/FasterXML/jackson-jaxrs-providers
* Copyright: (c) 2009-2011 FasterXML, LLC. All rights reserved unless otherwise indicated.
@@ -86,7 +91,7 @@ KineticJS, v4.7.1
* Project: http://www.kineticjs.com, https://github.com/ericdrowell/KineticJS
* Copyright: Eric Rowell
-org.objectweb.asm Version 7.2
+org.objectweb.asm Version 9.4
* License: Modified BSD (https://asm.ow2.io/license.html)
* Copyright (c) 2000-2011 INRIA, France Telecom. All rights reserved.
diff --git a/ext/bean-validation/src/main/resources/META-INF/NOTICE.markdown b/ext/bean-validation/src/main/resources/META-INF/NOTICE.markdown
index 501db20b72..48e7d2696b 100644
--- a/ext/bean-validation/src/main/resources/META-INF/NOTICE.markdown
+++ b/ext/bean-validation/src/main/resources/META-INF/NOTICE.markdown
@@ -31,7 +31,7 @@ The project maintains the following source code repositories:
## Third-party Content
-Hibernate Validator CDI, 6.1.2.Final
+Hibernate Validator CDI, 6.2.4.Final
* License: Apache License, 2.0
* Project: https://beanvalidation.org/
* Repackaged in org.glassfish.jersey.server.validation.internal.hibernate
\ No newline at end of file
diff --git a/tests/pom.xml b/tests/pom.xml
index 3966d7d5fe..0fd820140c 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -1,7 +1,7 @@
+
+
+
+
+
+
- org.eclipse.ee4j
+ org.glassfish.jersey
project
- 1.0.8
- ../../../pom.xml
+ 2.39-SNAPSHOT
+ ../../pom.xml
org.glassfish.jersey.tests
release-test
- 2.37-SNAPSHOT
jar
jersey-release-test
Jersey post-release validation tests
- ${jersey.version}
11
11
3.8.6
@@ -54,8 +59,7 @@
false
false
- **/DownloadBomPomDependencies.java
- **/*Test.class
+ **/NoticeFilesTest.class
@@ -117,6 +121,60 @@
org.apache.maven.resolver
maven-resolver-transport-http
${maven.resolver.version}
+
+
+ org.apache.httpcomponents
+ httpcore
+
+
+
+
+
+ org.glassfish.jersey.core
+ jersey-common
+
+
+
+ ReleaseTests
+
+
+ jersey.version
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0-M7
+
+ 1
+ false
+ false
+
+ **/DownloadBomPomDependencies.java
+ **/*Test.class
+
+
+
+
+
+
+
+
+ org.glassfish.jersey
+ jersey-bom
+ ${jersey.version}
+ import
+ pom
+
+
+
+
+ ${jersey.version}
+
+
+
diff --git a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/ClassVersionChecker.java b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/ClassVersionChecker.java
index 43e5327356..743d609627 100644
--- a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/ClassVersionChecker.java
+++ b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/ClassVersionChecker.java
@@ -1,13 +1,17 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.jersey.test.artifacts;
diff --git a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyPair.java b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyPair.java
index dd31588bc8..3256d480ae 100644
--- a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyPair.java
+++ b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyPair.java
@@ -1,13 +1,17 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.jersey.test.artifacts;
diff --git a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyResolver.java b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyResolver.java
index 5df3bc1e53..b1a7ee3bba 100644
--- a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyResolver.java
+++ b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/DependencyResolver.java
@@ -1,13 +1,17 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.jersey.test.artifacts;
diff --git a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/MavenUtil.java b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/MavenUtil.java
index 2c5b3a2869..68d0a14159 100644
--- a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/MavenUtil.java
+++ b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/MavenUtil.java
@@ -1,14 +1,19 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
+
package org.glassfish.jersey.test.artifacts;
import org.apache.maven.model.Dependency;
@@ -103,7 +108,7 @@ static Stream streamJerseyJars() throws IOException, XmlPullParserEx
.filter(dep -> dep.getType().equals("jar"));
}
- private static Model getModelFromFile(String fileName) throws IOException, XmlPullParserException {
+ static Model getModelFromFile(String fileName) throws IOException, XmlPullParserException {
File pomFile = new File(fileName);
return getModelFromFile(pomFile);
}
diff --git a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/TestResult.java b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/TestResult.java
index 172c5967b5..5c357fc3ba 100644
--- a/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/TestResult.java
+++ b/tests/release-test/src/main/java/org/glassfish/jersey/test/artifacts/TestResult.java
@@ -1,14 +1,19 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
+
package org.glassfish.jersey.test.artifacts;
import java.io.IOException;
@@ -53,24 +58,24 @@ class MessageBuilder implements Appendable {
}
@Override
- public MessageBuilder append(CharSequence csq) throws IOException {
+ public MessageBuilder append(CharSequence csq) {
builder.append(csq);
return this;
}
- public MessageBuilder append(int i) throws IOException {
+ public MessageBuilder append(int i) {
builder.append(i);
return this;
}
@Override
- public MessageBuilder append(CharSequence csq, int start, int end) throws IOException {
+ public MessageBuilder append(CharSequence csq, int start, int end) {
builder.append(csq, start, end);
return this;
}
@Override
- public MessageBuilder append(char c) throws IOException {
+ public MessageBuilder append(char c) {
builder.append(c);
return this;
}
diff --git a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/DownloadBomPomDependencies.java b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/DownloadBomPomDependencies.java
index ef31d4edf7..01ba01e812 100644
--- a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/DownloadBomPomDependencies.java
+++ b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/DownloadBomPomDependencies.java
@@ -1,14 +1,19 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
+
package org.glassfish.jersey.test.artifacts;
import org.eclipse.aether.DefaultRepositorySystemSession;
diff --git a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/ManifestTest.java b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/ManifestTest.java
index 8da0835edb..0c77d69c3c 100644
--- a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/ManifestTest.java
+++ b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/ManifestTest.java
@@ -1,13 +1,17 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.jersey.test.artifacts;
@@ -28,7 +32,7 @@ public class ManifestTest {
private static final String BUNDLE_NAME_ATTRIBUTE = "Bundle-Name";
private static final String BUNDLE_VERSION_ATTRIBUTE = "Bundle-Version";
- private static final String [] EXCLUDED_JARS = {"test", "rx-client", "oauth", "weld2-se", "spring",
+ private static final String[] EXCLUDED_JARS = {"test", "rx-client", "oauth", "weld2-se", "spring",
"servlet-portability", /* obsolete */
"helidon-connector", /* Helidon does not contain OSGi headers */
"grizzly-connector", /* Limited maintenance */
diff --git a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/MultiReleaseTest.java b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/MultiReleaseTest.java
index deef29ac70..288932a58c 100644
--- a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/MultiReleaseTest.java
+++ b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/MultiReleaseTest.java
@@ -1,13 +1,17 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0,
- * or the Eclipse Distribution License v. 1.0 which is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
*
- * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.jersey.test.artifacts;
diff --git a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/NoticeFilesTest.java b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/NoticeFilesTest.java
new file mode 100644
index 0000000000..d1a4d82ef9
--- /dev/null
+++ b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/NoticeFilesTest.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.test.artifacts;
+
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.glassfish.jersey.message.internal.ReaderWriter;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.ws.rs.core.MediaType;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.regex.Pattern;
+
+public class NoticeFilesTest {
+
+ @Test
+ public void test() throws IOException, XmlPullParserException {
+ Model model = MavenUtil.getModelFromFile("../../pom.xml");
+ List mainExpectedNoticeDeps = mainExpectedDependencies();
+
+ File mainNotice = new File("../../NOTICE.md");
+ List mainNoticeDeps = parseNoticeFileVersions(mainNotice);
+ TestResult testResult = compareDependencies(mainExpectedNoticeDeps, mainNoticeDeps, model, mainNotice.getCanonicalPath());
+
+ // Nothing to check here, yet
+// File commonNotice = new File("../../core-common/src/main/resources/META-INF/NOTICE.markdown");
+// List commonNoticeDeps = parseNoticeFileVersions(mainNotice);
+// testResult.append(compareDependencies(expectedNoticeDeps, commonNoticeDeps, model, commonNotice.getCanonicalPath()));
+
+ File serverNotice = new File("../../core-server/src/main/resources/META-INF/NOTICE.markdown");
+ List serverNoticeDeps = parseNoticeFileVersions(serverNotice);
+ List serverExpectedNoticeDeps = serverExpectedDependencies();
+ testResult.append(
+ compareDependencies(serverExpectedNoticeDeps, serverNoticeDeps, model, serverNotice.getCanonicalPath()));
+
+ File jacksonNotice = new File("../../media/json-jackson/src/main/resources/META-INF/NOTICE.markdown");
+ List jacksonNoticeDeps = parseNoticeFileVersions(jacksonNotice);
+ List jacksonExpectedNoticeDeps = jacksonExpectedDependencies();
+ testResult.append(
+ compareDependencies(jacksonExpectedNoticeDeps, jacksonNoticeDeps, model, jacksonNotice.getCanonicalPath()));
+
+ File bvNotice = new File("../../ext/bean-validation/src/main/resources/META-INF/NOTICE.markdown");
+ List bvNoticeDeps = parseNoticeFileVersions(bvNotice);
+ List bvExpectedNoticeDeps = bvExpectedDependencies();
+ testResult.append(
+ compareDependencies(bvExpectedNoticeDeps, bvNoticeDeps, model, bvNotice.getCanonicalPath()));
+
+ File examplesNotice = new File("../../examples/NOTICE.md");
+ List examplesNoticeDeps = parseNoticeFileVersions(examplesNotice);
+ testResult.append(
+ compareDependencies(mainExpectedNoticeDeps, examplesNoticeDeps, model, examplesNotice.getCanonicalPath()));
+
+ Assert.assertTrue("Some error occurred, see previous messages", testResult.result());
+ }
+
+ private TestResult compareDependencies(List expectedDeps,
+ List actualDeps,
+ Model model, String noticeName) {
+ TestResult testResult = new TestResult();
+ NextExpected:
+ for (NoticeDependencyVersionPair expectedDep : expectedDeps) {
+ for (NoticeDependencyVersionPair actualDep : actualDeps) {
+ if (expectedDep.dependency.equals(actualDep.dependency)) {
+ String expectedVersion = findVersionInModel(expectedDep, model);
+ testResult.ok().append("Expected dependency ").append(expectedDep.dependency).println(" found");
+ if (expectedVersion.equals(actualDep.version)) {
+ testResult.ok().append("Dependency ").append(actualDep.dependency).append(" contains expected version ")
+ .append(expectedVersion).append(" in ").println(noticeName);
+ } else {
+ testResult.exception().append("Dependency ").append(actualDep.dependency).append(" differs version ")
+ .append(expectedVersion).append(" from ").append(noticeName).append(" version ")
+ .println(actualDep.version);
+ }
+ continue NextExpected;
+ }
+ }
+ testResult.exception().append("Expected dependency ").append(expectedDep.dependency).append(" not found in ")
+ .println(noticeName);
+ }
+ return testResult;
+ }
+
+ private static String findVersionInModel(NoticeDependencyVersionPair pair, Model model) {
+ if (pair.version.startsWith("${")) {
+ String version = pair.version.substring(2, pair.version.length() - 1);
+ return model.getProperties().getProperty(version);
+ } else {
+ return pair.version;
+ }
+ }
+
+ private void cat(File path) throws IOException {
+ StringTokenizer tokenizer = tokenizerFromNoticeFile(path);
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ if (token.trim().length() > 1 && !token.trim().startsWith("*")) {
+ System.out.println(token);
+// String filteredToken = removeUnnecessary(token);
+// System.out.println(filteredToken);
+// Pattern versionizer = Pattern.compile("([.*])?([\\d])");
+// System.out.println(versionizer.matcher(filteredToken).replaceFirst("$1:$2"));
+ }
+ }
+ }
+
+ private List parseNoticeFileVersions(File path) throws IOException {
+ List list = new LinkedList<>();
+ StringTokenizer tokenizer = tokenizerFromNoticeFile(path);
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ if (token.trim().length() > 1 && !token.trim().startsWith("*")) {
+ String filteredToken = removeUnnecessary(token);
+ Pattern versionizer = Pattern.compile("([.*])?([\\d])");
+ String[] args = versionizer.matcher(filteredToken).replaceFirst("$1:$2").split(":", 2);
+ NoticeDependencyVersionPair pair = args.length == 2
+ ? new NoticeDependencyVersionPair(args[0], args[1])
+ : new NoticeDependencyVersionPair(args[0], "");
+ list.add(pair);
+ }
+ }
+
+ return list;
+ }
+
+ private StringTokenizer tokenizerFromNoticeFile(File path) throws IOException {
+ StringTokenizer tokenizer = new StringTokenizer(getFile(path), "\n");
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ if (token.trim().startsWith("## Third-party Content")) {
+ break;
+ }
+ }
+ return tokenizer;
+ }
+
+ private String getFile(File path) throws IOException {
+ return ReaderWriter.readFromAsString(new FileInputStream(path), MediaType.TEXT_PLAIN_TYPE);
+ }
+
+ private String removeUnnecessary(String dependency) {
+ String filtered = dependency
+ .replace(" Version ", "").replace(" version ", "")
+ .replace(" API ", "")
+ .replace(" v", "")
+ .replace(", ", "").replace(",", "")
+ .replace(": ", "").replace(": ", "");
+ return filtered;
+ }
+
+ /**
+ * Return pair of Notice file dependency name & pom.xml version property name
+ */
+ private List mainExpectedDependencies() {
+ final List dependencyPairs = new LinkedList<>();
+ dependencyPairs.add(new NoticeDependencyVersionPair("org.objectweb.asm", "${asm.version}"));
+ dependencyPairs.add(new NoticeDependencyVersionPair("org.osgi.core", "${osgi.version}"));
+ dependencyPairs.add(new NoticeDependencyVersionPair("Jackson JAX-RS Providers", "${jackson.version}"));
+ dependencyPairs.add(new NoticeDependencyVersionPair("Javassist", "${javassist.version}"));
+ dependencyPairs.add(new NoticeDependencyVersionPair("Hibernate Validator CDI", "${validation.impl.version}"));
+ dependencyPairs.add(new NoticeDependencyVersionPair("Bean Validation", "${javax.validation.api.version}"));
+ return dependencyPairs;
+ }
+
+ private List serverExpectedDependencies() {
+ final List dependencyPairs = new LinkedList<>();
+ dependencyPairs.add(new NoticeDependencyVersionPair("org.objectweb.asm", "${asm.version}"));
+ return dependencyPairs;
+ }
+
+ private List bvExpectedDependencies() {
+ final List dependencyPairs = new LinkedList<>();
+ dependencyPairs.add(new NoticeDependencyVersionPair("Hibernate Validator CDI", "${validation.impl.version}"));
+ return dependencyPairs;
+ }
+
+ private List jacksonExpectedDependencies() {
+ final List dependencyPairs = new LinkedList<>();
+ dependencyPairs.add(new NoticeDependencyVersionPair("Jackson JAX-RS Providers", "${jackson.version}"));
+ return dependencyPairs;
+ }
+
+ private static class NoticeDependencyVersionPair {
+ private final String dependency;
+ private final String version;
+
+ private NoticeDependencyVersionPair(String dependency, String version) {
+ this.dependency = dependency.trim();
+ this.version = version.trim();
+ }
+ }
+}