Update spring boot to 2.2 12/136912/2
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Tue, 2 Jan 2024 12:02:39 +0000 (13:02 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 10 Jan 2024 10:37:13 +0000 (11:37 +0100)
- update spring dependency to 2.2.13
- remove profile based switch between spring versions 1.5.22 and 2.1.12
- migrate testng based tests in aai-els-onap-logging to junit 4
- rely more on boms for dependencyManagement by removing separate declarations (of spring and jackson)
- resolve some build warnings by adding dependency + plugin versions
- resolve some build warnings by removing duplicate declarations of dependencies
- resolve build warning about ambiguous reference to JsonObject.addProperty()

Issue-ID: AAI-3711
Change-Id: I7559e90ffb65199ee46bc5b7cdf5d9e73b7d87bc
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
12 files changed:
aai-core/pom.xml
aai-core/src/main/java/org/onap/aai/serialization/queryformats/StateFormat.java
aai-els-onap-logging/pom.xml
aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java
aai-parent/pom.xml
aai-schema-abstraction/pom.xml
aai-schema-ingest/src/test/resources/edgerequests.json
aai-schema-ingest/src/test/resources/mockrequests.json
aai-utils/pom.xml
pom.xml
version.properties

index 3b65392..79f8aad 100644 (file)
@@ -256,22 +256,10 @@ limitations under the License.
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                </dependency>
-               <dependency>
-                       <groupId>com.fasterxml.jackson.core</groupId>
-                       <artifactId>jackson-annotations</artifactId>
-
-               </dependency>
-               <dependency>
-                       <groupId>com.fasterxml.jackson.dataformat</groupId>
-                       <artifactId>jackson-dataformat-yaml</artifactId>
-               </dependency>
                <dependency>
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>commons-cli</groupId>
-                       <artifactId>commons-cli</artifactId>
+                       <version>1.4.01</version>
                </dependency>
                <dependency>
                        <groupId>com.beust</groupId>
@@ -280,7 +268,6 @@ limitations under the License.
                <dependency>
                        <groupId>org.json</groupId>
                        <artifactId>json</artifactId>
-
                </dependency>
                <dependency>
                        <groupId>com.bazaarvoice.jolt</groupId>
@@ -394,12 +381,16 @@ limitations under the License.
                        <groupId>com.fasterxml.jackson.core</groupId>
                        <artifactId>jackson-annotations</artifactId>
                </dependency>
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>${log4j.version}</version>
-            <type>pom</type>
-        </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.dataformat</groupId>
+                       <artifactId>jackson-dataformat-yaml</artifactId>
+               </dependency>
+               <dependency>
+                               <groupId>org.apache.logging.log4j</groupId>
+                               <artifactId>log4j</artifactId>
+                               <version>${log4j.version}</version>
+                               <type>pom</type>
+               </dependency>
        </dependencies>
 
        <!-- Plugins and repositories -->
index 2440595..b010b19 100644 (file)
@@ -104,7 +104,7 @@ public class StateFormat extends HistoryFormat {
             json.addProperty("uri", "NA");
         }
         json.addProperty(TIMESTAMP,
-                e.property(AAIProperties.START_TS).isPresent() ? e.value(AAIProperties.START_TS) : 0);
+                e.property(AAIProperties.START_TS).isPresent() ? (String) e.value(AAIProperties.START_TS) : String.valueOf(0));
         json.addProperty(SOT,
                 e.property(AAIProperties.SOURCE_OF_TRUTH).isPresent() ? e.value(AAIProperties.SOURCE_OF_TRUTH) : "");
         json.addProperty(TX_ID,
index 38b3e05..9ae986f 100644 (file)
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <version>6.8.5</version>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>junit</groupId>
-                    <artifactId>junit</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
     </dependencies>
+
+    <!-- <build>
+        <plugins>
+          <plugin>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+          </plugin>
+        </plugins>
+    </build> -->
 </project>
index f6ed961..f055360 100644 (file)
@@ -36,14 +36,13 @@ import java.util.UUID;
 
 import javax.xml.bind.DatatypeConverter;
 
+import org.junit.After;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 import org.slf4j.event.Level;
 import org.springframework.mock.web.MockHttpServletRequest;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
 
 /**
  * Tests for {@link ONAPLogAdapter}.
@@ -53,7 +52,7 @@ public class ONAPLogAdapterTest {
     /**
      * Ensure that MDCs are cleared after each testcase.
      */
-    @AfterMethod
+    @After
     public void resetMDCs() {
         MDC.clear();
     }
@@ -61,17 +60,10 @@ public class ONAPLogAdapterTest {
     /**
      * Test nullcheck.
      */
-    @Test
+    @Test(expected = NullPointerException.class)
     public void testCheckNotNull() {
 
-        ONAPLogAdapter.checkNotNull("");
-
-        try {
-            ONAPLogAdapter.checkNotNull(null);
-            Assert.fail("Should throw NullPointerException");
-        } catch (final NullPointerException e) {
-
-        }
+        ONAPLogAdapter.checkNotNull(null);
     }
 
     /**
index 6dc5e59..dee07a4 100644 (file)
@@ -28,14 +28,18 @@ import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 /**
  * Tests for {@link ONAPLogConstants}.
  */
 public class ONAPLogConstantsTest {
 
+    @Rule
+    public ExpectedException exceptionRule = ExpectedException.none();
+
     @Test
     public void testConstructors() throws Exception {
         assertInaccessibleConstructor(ONAPLogConstants.class);
@@ -46,14 +50,11 @@ public class ONAPLogConstantsTest {
 
     @Test
     public void testConstructorUnsupported() throws Exception {
-        try {
-            Constructor<?> c = ONAPLogConstants.class.getDeclaredConstructors()[0];
-            c.setAccessible(true);
-            c.newInstance();
-            Assert.fail("Should fail for hidden constructor.");
-        } catch (final InvocationTargetException e) {
-            assertThat(e.getCause(), instanceOf(UnsupportedOperationException.class));
-        }
+        exceptionRule.expect(InvocationTargetException.class);
+        exceptionRule.expectCause(instanceOf(UnsupportedOperationException.class));
+        Constructor<?> c = ONAPLogConstants.class.getDeclaredConstructors()[0];
+        c.setAccessible(true);
+        c.newInstance();
     }
 
     @Test
@@ -108,21 +109,17 @@ public class ONAPLogConstantsTest {
 
     }
 
-    static void assertInaccessibleConstructor(final Class<?> c) throws Exception {
-        try {
-            c.getDeclaredConstructors()[0].newInstance();
-            Assert.fail("Should fail for hidden constructor.");
-        } catch (final IllegalAccessException e) {
-
-        }
-
-        try {
-            final Constructor<?> constructor = c.getDeclaredConstructors()[0];
-            constructor.setAccessible(true);
-            constructor.newInstance();
-            Assert.fail("Should fail even when invoked.");
-        } catch (final InvocationTargetException e) {
-            assertThat(e.getCause(), instanceOf(UnsupportedOperationException.class));
-        }
+    
+    void assertInaccessibleConstructor(final Class<?> c) throws Exception {
+        exceptionRule.expect(IllegalAccessException.class);
+        // Should fail for hidden constructor.
+        c.getDeclaredConstructors()[0].newInstance();
+
+
+        exceptionRule.expect(InvocationTargetException.class);
+        exceptionRule.expectCause(instanceOf(UnsupportedOperationException.class));
+        final Constructor<?> constructor = c.getDeclaredConstructors()[0];
+        constructor.setAccessible(true);
+        constructor.newInstance();
     }
 }
index 0a49685..4c04789 100644 (file)
@@ -91,7 +91,11 @@ limitations under the License.
         and would take some time to refactor
         Please don't upgrade to 2.3.0 or above for nexus iq or security scans
         as it could potentially break our code
-    -->
+      -->
+    <spring.boot.version>2.2.13.RELEASE</spring.boot.version>
+    <spring.version>5.2.12.RELEASE</spring.version>
+    <spring.jms.version>5.2.25.RELEASE</spring.jms.version>
+    <spring.test.version>${spring.version}</spring.test.version>
     <json.path.version>2.2.0</json.path.version>
     <json.version>20190722</json.version>
     <junit.version>4.12</junit.version>
@@ -110,7 +114,6 @@ limitations under the License.
     <reflections.version>0.9.10</reflections.version>
     <snakeyaml.version>1.29</snakeyaml.version>
 
-    <spring.boot.version>2.1.12.RELEASE</spring.boot.version>
     <javax.servlet.version>3.1.0</javax.servlet.version>
     <javax.annotation.version>1.2</javax.annotation.version>
 
@@ -129,9 +132,6 @@ limitations under the License.
 
     <sonar.scanner.version>3.7.0.1746</sonar.scanner.version>
 
-    <spring.version>5.1.13.RELEASE</spring.version>
-    <spring.jms.version>5.1.13.RELEASE</spring.jms.version>
-    <spring.test.version>5.1.13.RELEASE</spring.test.version>
     <spring.security.rsa.version>1.0.8.RELEASE</spring.security.rsa.version>
     <json.simple.version>1.1.1</json.simple.version>
     <powermock.api.mockito2.version>2.0.4</powermock.api.mockito2.version>
@@ -139,23 +139,49 @@ limitations under the License.
     <logging.analytics.version>1.5.1</logging.analytics.version>
   </properties>
 
-  <profiles>
-    <profile>
-      <id>spring-boot-2-1</id>
-      <properties>
-        <spring.boot.version>2.1.12.RELEASE</spring.boot.version>
-      </properties>
-    </profile>
-    <profile>
-      <id>spring-boot-1-5</id>
-      <properties>
-        <spring.boot.version>1.5.22.RELEASE</spring.boot.version>
-      </properties>
-    </profile>
-  </profiles>
-
   <dependencyManagement>
     <dependencies>
+      <dependency>
+        <groupId>com.fasterxml.jackson</groupId>
+        <artifactId>jackson-bom</artifactId>
+        <version>${jackson.bom.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring.boot.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-framework-bom</artifactId>
+        <version>${spring.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>${spring.boot.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <!-- TODO: check if this can be updated to something > 1.0.8 -->
+      <dependency>
+        <groupId>org.springframework.security</groupId>
+        <artifactId>spring-security-rsa</artifactId>
+        <version>${spring.security.rsa.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-jms</artifactId>
+        <version>${spring.jms.version}</version>
+      </dependency>
+
+
 
       <dependency>
         <groupId>com.googlecode.json-simple</groupId>
@@ -199,49 +225,6 @@ limitations under the License.
         <version>${aai.release.version}</version>
       </dependency>
 
-      <dependency>
-        <groupId>com.fasterxml.jackson</groupId>
-        <artifactId>jackson-bom</artifactId>
-        <version>${jackson.bom.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-web</artifactId>
-        <version>${spring.boot.version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>${spring.boot.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-dependencies</artifactId>
-        <version>${spring.boot.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-test</artifactId>
-        <scope>test</scope>
-        <version>${spring.boot.version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-test</artifactId>
-        <version>${spring.test.version}</version>
-      </dependency>
-
       <dependency>
         <groupId>commons-configuration</groupId>
         <artifactId>commons-configuration</artifactId>
@@ -618,59 +601,7 @@ limitations under the License.
         <version>${commons.io.version}</version>
       </dependency>
 
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-web</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-context</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-core</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-orm</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-oxm</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-aspects</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-tx</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-webmvc</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework.security</groupId>
-        <artifactId>spring-security-rsa</artifactId>
-        <version>${spring.security.rsa.version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-jms</artifactId>
-        <version>${spring.jms.version}</version>
-      </dependency>
-
+      
       <dependency>
         <groupId>org.onap.aai.logging-service</groupId>
         <artifactId>common-logging</artifactId>
index 8d332f1..4474475 100644 (file)
       <plugin>
         <groupId>org.sonatype.plugins</groupId>
         <artifactId>nexus-staging-maven-plugin</artifactId>
+        <version>1.6.13</version>
       </plugin>
     </plugins>
   </build>
index 0878686..28f5da7 100644 (file)
@@ -4,47 +4,47 @@
         {
             "aai-uri": "/versions",
             "response-file": "payload/versions.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v8",
             "response-file": "edgeRules/test_v8.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v9",
             "response-file": "edgeRules/test_v9.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v10",
             "response-file": "edgeRules/test_v10.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v11",
             "response-file": "edgeRules/test_v11.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v12",
             "response-file": "edgeRules/test_v12.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v13",
             "response-file": "edgeRules/test_v13.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v14",
             "response-file": "edgeRules/test_v14.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/edgerules?version=v15",
             "response-file": "edgeRules/test_v15.json",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         }
     ]
 }
index 7d66900..db7c6e6 100644 (file)
@@ -4,47 +4,47 @@
     {
         "aai-uri": "/versions",
         "response-file": "payload/versions.json",
-        "content": "application/json;charset=UTF-8"
+        "content": "application/json"
     },
     {
         "aai-uri": "/nodes?version=v8",
         "response-file": "oxm/test_combined_network_business_v8.xml",
-        "content": "application/json;charset=UTF-8"
+        "content": "application/json"
     },
         {
             "aai-uri": "/nodes?version=v9",
             "response-file": "oxm/test_combined_network_business_v9.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/nodes?version=v10",
             "response-file": "oxm/test_combined_network_business_v10.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/nodes?version=v11",
             "response-file": "oxm/test_combined_network_business_v11.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/nodes?version=v12",
             "response-file": "oxm/test_combined_network_business_v12.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/nodes?version=v13",
             "response-file": "oxm/test_combined_v13.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/nodes?version=v14",
             "response-file": "oxm/test_combined_network_business_v14.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         },
         {
             "aai-uri": "/nodes?version=v15",
             "response-file": "oxm/test_combined_network_business_v15.xml",
-            "content": "application/json;charset=UTF-8"
+            "content": "application/json"
         }
     ]
 
index 7126e14..2b60528 100644 (file)
             <artifactId>eelf-core</artifactId>
             <version>1.0.1-oss</version>
         </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
diff --git a/pom.xml b/pom.xml
index 4f84bcf..3e0d59e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
 
     <groupId>org.onap.aai.aai-common</groupId>
     <artifactId>aai-common</artifactId>
-    <version>1.13.0-SNAPSHOT</version>
+    <version>1.13.1-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>aai-aai-common</name>
     <description>Contains all of the common code for resources and traversal repos</description>
index 39cb3bf..0c0fa8e 100644 (file)
@@ -5,7 +5,7 @@
 
 major_version=1
 minor_version=13
-patch_version=0
+patch_version=1
 
 base_version=${major_version}.${minor_version}.${patch_version}