Update spring-boot to 2.5 in aai-common 84/138784/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 19 Aug 2024 14:17:03 +0000 (16:17 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 19 Aug 2024 14:33:11 +0000 (16:33 +0200)
- update spring-boot (2.4 -> 2.5.15)
- update vulnerable dependencies (spring-jms)
- remove old codehaus.jackson dependency

Issue-ID: AAI-3972
Change-Id: Ie0854c192a3a7bb719e9ac0e080e83a48e1b964a
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
12 files changed:
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafAuthorizationFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertAuthorizationFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/CadiProps.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/GremlinFilter.java
aai-core/pom.xml
aai-core/src/main/java/org/onap/aai/util/PojoUtils.java
aai-core/src/test/java/org/onap/aai/util/PojoUtilsTest.java
aai-parent/pom.xml
aai-schema-abstraction/pom.xml
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/RelationshipSchema.java

index 485fa7e..fb7a58e 100644 (file)
@@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.onap.aai.aaf.auth.ResponseFormatter;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
 import org.springframework.context.annotation.Profile;
@@ -59,7 +58,6 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter {
 
     private List<String> advancedKeywordsList;
 
-    @Autowired
     public AafAuthorizationFilter(GremlinFilter gremlinFilter, @Value("${permission.type}") String type,
             @Value("${permission.instance}") String instance,
             @Value("${advanced.keywords.list:}") String advancedKeys) {
index 56799f1..f19f4b8 100644 (file)
@@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.onap.aai.aaf.auth.AafRequestFilter;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
 import org.springframework.context.annotation.Profile;
@@ -60,7 +59,6 @@ public class AafCertAuthorizationFilter extends OrderedRequestContextFilter {
 
     private List<String> advancedKeywordsList;
 
-    @Autowired
     public AafCertAuthorizationFilter(@Value("${permission.type}") String type,
             @Value("${permission.instance}") String instance, @Value("${advanced.keywords.list:}") String advancedKeys,
             CadiProps cadiProps) {
index e423dc0..a3ce12b 100644 (file)
@@ -32,7 +32,6 @@ import org.onap.aaf.cadi.filter.CadiFilter;
 import org.onap.aai.aaf.auth.AafRequestFilter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
 import org.springframework.context.annotation.Profile;
@@ -57,7 +56,6 @@ public class AafCertFilter extends OrderedRequestContextFilter {
 
     private final CadiProps cadiProps;
 
-    @Autowired
     public AafCertFilter(@Value("${aaf.userchain.pattern}") String aafUserChainPattern, CadiProps cadiProps)
             throws IOException, ServletException {
 
index 5dbc2e7..ae3a6ca 100644 (file)
@@ -32,7 +32,6 @@ import org.onap.aaf.cadi.filter.CadiFilter;
 import org.onap.aai.aaf.auth.ResponseFormatter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
 import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Component;
@@ -49,7 +48,6 @@ public class AafFilter extends OrderedRequestContextFilter {
 
     private final CadiFilter cadiFilter;
 
-    @Autowired
     public AafFilter(CadiProps cadiProps) throws IOException, ServletException {
         cadiFilter = new CadiFilter(new PropAccess((level, element) -> {
             switch (level) {
index 4bf9ea8..01b8914 100644 (file)
@@ -30,7 +30,6 @@ import javax.annotation.PostConstruct;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Component;
@@ -46,7 +45,6 @@ public class CadiProps {
 
     private Properties cadiProperties;
 
-    @Autowired
     public CadiProps(@Value("${aaf.cadi.file:./resources/cadi.properties}") String filename) {
         cadiFileName = filename;
         cadiProperties = new Properties();
index dffa74e..f800097 100644 (file)
@@ -33,7 +33,6 @@ import org.apache.commons.io.IOUtils;
 import org.onap.aai.aaf.auth.ResponseFormatter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Component;
@@ -54,7 +53,6 @@ public class GremlinFilter {
 
     private CadiProps cadiProps;
 
-    @Autowired
     public GremlinFilter(@Value("${permission.type}") String type, @Value("${permission.instance}") String instance,
             CadiProps cadiProps) {
         this.type = type;
index 8e0d23b..d2aed3a 100644 (file)
@@ -151,14 +151,6 @@ limitations under the License.
                        <artifactId>eelf-core</artifactId>
                        <version>2.0.0-oss</version>
                </dependency>
-               <dependency>
-                       <groupId>org.codehaus.jackson</groupId>
-                       <artifactId>jackson-core-asl</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.codehaus.jackson</groupId>
-                       <artifactId>jackson-mapper-asl</artifactId>
-               </dependency>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
@@ -272,6 +264,7 @@ limitations under the License.
                <dependency>
                        <groupId>org.apache.tinkerpop</groupId>
                        <artifactId>gremlin-core</artifactId>
+                       <version>${gremlin.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.tinkerpop</groupId>
index f974ba1..4c2ce94 100644 (file)
@@ -27,6 +27,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
 import com.google.common.base.CaseFormat;
 import com.google.common.collect.Multimap;
@@ -124,12 +125,15 @@ public class PojoUtils {
      */
     public <T> String getJsonFromObject(T clazz, boolean wrapRoot, boolean indent)
             throws JsonGenerationException, JsonMappingException, IOException {
-        ObjectMapper mapper = JsonMapper.builder().serializationInclusion(JsonInclude.Include.NON_NULL)
+        ObjectMapper mapper = JsonMapper.builder()
+                .addModule(new JaxbAnnotationModule())
+                .addModule(new JavaTimeModule())
+                .serializationInclusion(JsonInclude.Include.NON_NULL)
                 .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
                 .configure(SerializationFeature.INDENT_OUTPUT, indent)
                 .configure(SerializationFeature.WRAP_ROOT_VALUE, wrapRoot)
                 .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
-                .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot).addModule(new JaxbAnnotationModule())
+                .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot)
                 .build();
 
         return mapper.writeValueAsString(clazz);
index 68f0196..a6a8c33 100644 (file)
@@ -100,18 +100,8 @@ public class PojoUtilsTest {
         LocalDateTime date = LocalDateTime.of(2017, Month.SEPTEMBER, 18, 10, 55, 0, 300);
 
         String res = pojoUtils.getJsonFromObject(date);
-
+        assertEquals("\"2017-09-18T10:55:00.0000003\"", res);
         assertNotNull(res);
-        assertTrue(res.contains("\"dayOfMonth\" : 18"));
-        assertTrue(res.contains("\"dayOfWeek\" : \"MONDAY\""));
-        assertTrue(res.contains("\"dayOfYear\" : 261"));
-        assertTrue(res.contains("\"hour\" : 10"));
-        assertTrue(res.contains("\"minute\" : 55"));
-        assertTrue(res.contains("\"month\" : \"SEPTEMBER\""));
-        assertTrue(res.contains("\"monthValue\" : 9"));
-        assertTrue(res.contains("\"nano\" : 300"));
-        assertTrue(res.contains("\"second\" : 0"));
-        assertTrue(res.contains("\"year\" : 2017"));
     }
 
     @Test
index b13fb60..717049e 100644 (file)
@@ -47,7 +47,6 @@ limitations under the License.
     <aaf.version>2.1.15</aaf.version>
     <antlr.version>4.11.1</antlr.version>
     <activemq.version>5.16.1</activemq.version>
-    <codehaus.jackson.version>1.9.13</codehaus.jackson.version>
     <commons.beanutils.version>1.9.4</commons.beanutils.version>
     <commons.cli.version>1.5.0</commons.cli.version>
     <commons.compress.version>1.21</commons.compress.version>
@@ -68,7 +67,6 @@ limitations under the License.
     <gson.version>2.9.1</gson.version>
     <hamcrest.junit.version>2.0.0.0</hamcrest.junit.version>
     <hamcrest.core.version>2.2</hamcrest.core.version>
-    <jackson.bom.version>2.11.4</jackson.bom.version>
     <javatuples.version>1.2</javatuples.version>
     <jaxb.version>2.3.1</jaxb.version>
     <old.jaxb.version>2.3.0.1</old.jaxb.version>
@@ -91,8 +89,8 @@ limitations under the License.
         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.4.13</spring.boot.version>
-    <spring.version>5.3.13</spring.version>
+    <spring.boot.version>2.5.15</spring.boot.version>
+    <spring.version>5.3.39</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>
@@ -138,13 +136,6 @@ limitations under the License.
 
   <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>
@@ -175,7 +166,7 @@ limitations under the License.
       <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-jms</artifactId>
-        <version>5.3.31</version>
+        <version>5.3.39</version>
       </dependency>
 
 
@@ -504,12 +495,6 @@ limitations under the License.
         <version>${commons.text.version}</version>
       </dependency>
 
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-core-asl</artifactId>
-        <version>${codehaus.jackson.version}</version>
-      </dependency>
-
       <dependency>
         <groupId>com.sun.jersey</groupId>
         <artifactId>jersey-core</artifactId>
@@ -803,7 +788,7 @@ limitations under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>3.0.0-M4</version>
+          <version>3.1.2</version>
           <configuration>
             <!-- Sets the VM argument line used when unit tests are run. -->
             <argLine>${surefireArgLine}</argLine>
@@ -816,7 +801,7 @@ limitations under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-failsafe-plugin</artifactId>
-          <version>3.0.0-M4</version>
+          <version>3.1.2</version>
           <executions>
             <!-- Ensures that both integration-test and verify goals of the Failsafe
                  Maven plugin are executed. -->
index 00442e4..c89cf6e 100644 (file)
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-access</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-core-asl</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-mapper-asl</artifactId>
-    </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-databind</artifactId>
index 921cff3..3235077 100644 (file)
@@ -23,6 +23,7 @@
 
 package org.onap.aai.schemaif.oxm;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.Multimap;
 
 import java.io.IOException;
@@ -35,7 +36,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import org.codehaus.jackson.map.ObjectMapper;
 import org.onap.aai.cl.eelf.LoggerFactory;
 import org.onap.aai.edges.EdgeRule;
 import org.onap.aai.schemaif.SchemaProviderException;