Update to spring boot 2 47/110447/1
authorIgor Dysko <igor1.dysko@orange.com>
Wed, 22 Jul 2020 12:29:21 +0000 (14:29 +0200)
committerIgor Dysko <igor1.dysko@orange.com>
Wed, 22 Jul 2020 12:29:21 +0000 (14:29 +0200)
Update of code and dependencies

Issue-ID: AAI-2530
Signed-off-by: Igor Dysko <igor1.dysko@orange.com>
Change-Id: Iff78a028c237586a285c410a7522744f8a488b58

pom.xml
src/main/java/org/onap/aai/migration/v12/UriMigration.java
src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java
src/main/java/org/onap/aai/schema/GenTester.java
src/main/java/org/onap/aai/schema/GenTester4Hist.java
src/main/java/org/onap/aai/web/JerseyConfiguration.java
src/main/java/org/onap/aai/web/LocalHostAccessLog.java
src/main/resources/application.properties
src/test/java/org/onap/aai/AAIGremlinQueryTest.java
src/test/java/org/onap/aai/GraphAdminTestConfiguration.java

diff --git a/pom.xml b/pom.xml
index fa58349..5c39095 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.aai.aai-common</groupId>
         <artifactId>aai-parent</artifactId>
-        <version>1.6.10</version>
+        <version>1.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.aai.graphadmin</groupId>
     <artifactId>aai-graphadmin</artifactId>
@@ -35,7 +35,7 @@
     <properties>
 
         <!-- Start of Compiler Related Properties -->
-       <mockito.core.version>1.10.19</mockito.core.version>
+             <mockito.core.version>1.10.19</mockito.core.version>
         <java.version>1.8</java.version>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <!-- This value should be overwritten at runtime to wherever need to be pushed to -->
         <docker.push.registry>localhost:5000</docker.push.registry>
         <aai.docker.version>1.0.0</aai.docker.version>
-       <aai.schema.version>1.6.6</aai.schema.version>
+             <aai.schema.version>1.6.6</aai.schema.version>
         <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/
         </aai.build.directory>
         <aai.docker.namespace>onap</aai.docker.namespace>
         <!-- base image for aai-common -->
         <aai.base.image>alpine</aai.base.image>
         <!-- aai-common image version -->
-        <aai.base.image.version>1.6.0</aai.base.image.version>
+        <aai.base.image.version>1.7.0-SNAPSHOT</aai.base.image.version>
         <!-- End of Docker Related Properties -->
 
         <license.goal.type>check</license.goal.type>
@@ -87,8 +87,6 @@
         <snapshot.file>${project.basedir}/snapshots/int1-data.graphson</snapshot.file>
         <jacoco.line.coverage.limit>0.46</jacoco.line.coverage.limit>
         
-        <aai.common.version>1.6.10</aai.common.version>
-
         <!-- Start of Default ONAP Schema Properties -->
         <schema.source.name>onap</schema.source.name>
         <schema.configuration.location>N/A</schema.configuration.location>
         </profile>
     </profiles>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-parent</artifactId>
-                <version>${spring.boot.version}</version>
-                <scope>import</scope>
-                <type>pom</type>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
+        <dependency>
+            <groupId>javax.jms</groupId>
+            <artifactId>javax.jms-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.aai.aai-common</groupId>
+            <artifactId>aai-core</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.sun.jersey</groupId>
+                    <artifactId>jersey-core</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.cxf</groupId>
+                    <artifactId>cxf-core</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-http</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-server</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-web</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-core</artifactId>
+        </dependency>
+
         <!-- Start of Logback Dependencies -->
         <dependency>
             <groupId>com.att.eelf</groupId>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <!-- Start of Janus Graph Dependencies -->
-        <dependency>
-            <groupId>org.janusgraph</groupId>
-            <artifactId>janusgraph-core</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>dom4j</groupId>
-                    <artifactId>dom4j</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.janusgraph</groupId>
-            <artifactId>janusgraph-cassandra</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>dom4j</groupId>
-                    <artifactId>dom4j</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <!--
-            indirect janusgraph-cassandra dependency
-            need to be newer than default one
-            in order to support multiple cpu archs
-        -->
-        <dependency>
-            <groupId>com.github.jnr</groupId>
-            <artifactId>jnr-ffi</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.janusgraph</groupId>
-            <artifactId>janusgraph-cql</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <!-- End of Janus Graph Dependencies -->
+
         <!-- Start of Tinkerpop Dependencies -->
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>
             <groupId>org.apache.activemq</groupId>
             <artifactId>activemq-client</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.onap.aai.aai-common</groupId>
-            <artifactId>aai-core</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.sun.jersey</groupId>
-                    <artifactId>jersey-core</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.cxf</groupId>
-                    <artifactId>cxf-core</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.eclipse.jetty</groupId>
-                    <artifactId>jetty-http</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.eclipse.jetty</groupId>
-                    <artifactId>jetty-server</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.springframework</groupId>
-                    <artifactId>spring-web</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.codehaus.jackson</groupId>
-                    <artifactId>jackson-mapper-asl</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-client</artifactId>
index cc8ba55..ed3b84d 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.onap.aai.migration.v12;
 
+import java.nio.charset.UnsupportedCharsetException;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -158,7 +159,7 @@ public class UriMigration extends Migrator {
        private static String encodeProp(String s) {
                try {
                        return UriUtils.encode(s, "UTF-8");
-               } catch (UnsupportedEncodingException e) {
+               } catch (UnsupportedCharsetException e) {
                        return "";
                }
        }
index cfc8c74..a3085c9 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.onap.aai.migration.v14;
 
+import java.nio.charset.UnsupportedCharsetException;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.*;
@@ -568,7 +569,7 @@ public class MigrateSameSourcedRCTROPserverData extends EdgeSwingMigrator {
     private static String encodeProp(String s) {
         try {
             return UriUtils.encode(s, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
+        } catch (UnsupportedCharsetException e) {
             return "";
         }
     }
index 11f7bd5..b2d964b 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.onap.aai.migration.v14;
 
+import java.nio.charset.UnsupportedCharsetException;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -350,7 +351,7 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
     private static String encodeProp(String s) {
         try {
             return UriUtils.encode(s, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
+        } catch (UnsupportedCharsetException e) {
             return "";
         }
     }
index 160ec22..defe8bb 100644 (file)
@@ -145,7 +145,7 @@ public class GenTester {
                imsg = "-- Loading new schema elements into JanusGraph --";
                        System.out.println(imsg);
                        LOGGER.debug(imsg);
-                       SchemaGenerator.loadSchemaIntoJanusGraph(graph, graphMgt, null);
+                       SchemaGenerator.loadSchemaIntoJanusGraph(graphMgt, null);
 
             if( graph != null ){
                 imsg = "-- graph commit";
index 05478e2..cbe82e4 100644 (file)
@@ -147,7 +147,7 @@ public class GenTester4Hist {
                imsg = "-- Loading new schema elements into JanusGraph --";
                        System.out.println(imsg);
                        LOGGER.debug(imsg);                                             
-                       SchemaGenerator4Hist.loadSchemaIntoJanusGraph(graph, graphMgt, null);
+                       SchemaGenerator4Hist.loadSchemaIntoJanusGraph(graphMgt, null);
 
             if( graph != null ){
                 imsg = "-- graph commit";
index f193b8c..a5c2cb4 100644 (file)
  */
 package org.onap.aai.web;
 
+import com.sun.jersey.api.client.filter.LoggingFilter;
 import java.util.List;
 import java.util.Set;
 import java.util.logging.Logger;
 import java.util.stream.Collectors;
-
 import javax.annotation.Priority;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.ContainerResponseFilter;
-
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.glassfish.jersey.filter.LoggingFilter;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.servlet.ServletProperties;
 import org.onap.aai.rest.AuditSqlDbConsumer;
@@ -68,7 +65,7 @@ public class JerseyConfiguration extends ResourceConfig {
         // Following registers the request headers and response headers
         // If the LoggingFilter second argument is set to true, it will print response value as well
         if ("true".equalsIgnoreCase(env.getProperty("aai.request.logging.enabled"))) {
-            register(new LoggingFilter(log, false));
+            register(new LoggingFilter(log, 0));
         }
     }
 
index 4e28562..eaee501 100644 (file)
@@ -24,9 +24,9 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.server.handler.RequestLogHandler;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
-import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
-import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
+import org.springframework.boot.web.embedded.jetty.JettyServerCustomizer;
+import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
+import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -36,11 +36,11 @@ import java.util.Arrays;
 public class LocalHostAccessLog {
 
     @Bean
-    public EmbeddedServletContainerFactory jettyConfigBean(
+    public AbstractServletWebServerFactory jettyConfigBean(
             @Value("${jetty.threadPool.maxThreads:200}") final String maxThreads,
             @Value("${jetty.threadPool.minThreads:8}") final String minThreads
     ){
-               JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory();
+    JettyServletWebServerFactory jef = new JettyServletWebServerFactory();
                jef.addServerCustomizers((JettyServerCustomizer) server -> {
 
             HandlerCollection handlers = new HandlerCollection();
index 82780f7..ba59da9 100644 (file)
@@ -1,7 +1,8 @@
 
 spring.application.name=GraphAdmin
+spring.main.allow-bean-definition-overriding=true
 
-server.contextPath=/
+server.servlet.context-path=/
 spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
 
 spring.profiles.active=production,one-way-ssl
index 3115b87..55506a9 100644 (file)
@@ -28,7 +28,7 @@ import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.util.AAIConfig;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.web.server.LocalServerPort;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Import;
 import org.springframework.http.*;
index 3c68006..c53a0d4 100644 (file)
@@ -81,7 +81,7 @@ public class GraphAdminTestConfiguration {
                 .build();
 
         RestTemplate restTemplate =  builder
-                .requestFactory(new HttpComponentsClientHttpRequestFactory(client))
+                .requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client))
                 .build();
 
         restTemplate.setErrorHandler(new ResponseErrorHandler() {