diff options
author | Igor Dysko <igor1.dysko@orange.com> | 2020-07-22 14:29:21 +0200 |
---|---|---|
committer | Igor Dysko <igor1.dysko@orange.com> | 2020-07-22 14:29:21 +0200 |
commit | 48b99fe5add8e59789b74d49eca6732813d2ae97 (patch) | |
tree | 0fc8784f6b6166183cb2aecd393a2eeeeaf0281f | |
parent | de4fc52226078ed9276323416c3b5129e6780973 (diff) |
Update to spring boot 2
Update of code and dependencies
Issue-ID: AAI-2530
Signed-off-by: Igor Dysko <igor1.dysko@orange.com>
Change-Id: Iff78a028c237586a285c410a7522744f8a488b58
11 files changed, 77 insertions, 119 deletions
@@ -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> @@ -55,14 +55,14 @@ <!-- 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> @@ -336,19 +334,60 @@ </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> @@ -371,55 +410,7 @@ <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> @@ -486,40 +477,6 @@ <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> </dependency> diff --git a/src/main/java/org/onap/aai/migration/v12/UriMigration.java b/src/main/java/org/onap/aai/migration/v12/UriMigration.java index cc8ba55..ed3b84d 100644 --- a/src/main/java/org/onap/aai/migration/v12/UriMigration.java +++ b/src/main/java/org/onap/aai/migration/v12/UriMigration.java @@ -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 ""; } } diff --git a/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java b/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java index cfc8c74..a3085c9 100644 --- a/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java +++ b/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java @@ -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 ""; } } diff --git a/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java b/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java index 11f7bd5..b2d964b 100644 --- a/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java +++ b/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java @@ -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 ""; } } diff --git a/src/main/java/org/onap/aai/schema/GenTester.java b/src/main/java/org/onap/aai/schema/GenTester.java index 160ec22..defe8bb 100644 --- a/src/main/java/org/onap/aai/schema/GenTester.java +++ b/src/main/java/org/onap/aai/schema/GenTester.java @@ -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"; diff --git a/src/main/java/org/onap/aai/schema/GenTester4Hist.java b/src/main/java/org/onap/aai/schema/GenTester4Hist.java index 05478e2..cbe82e4 100644 --- a/src/main/java/org/onap/aai/schema/GenTester4Hist.java +++ b/src/main/java/org/onap/aai/schema/GenTester4Hist.java @@ -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"; diff --git a/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/src/main/java/org/onap/aai/web/JerseyConfiguration.java index f193b8c..a5c2cb4 100644 --- a/src/main/java/org/onap/aai/web/JerseyConfiguration.java +++ b/src/main/java/org/onap/aai/web/JerseyConfiguration.java @@ -19,17 +19,14 @@ */ 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)); } } diff --git a/src/main/java/org/onap/aai/web/LocalHostAccessLog.java b/src/main/java/org/onap/aai/web/LocalHostAccessLog.java index 4e28562..eaee501 100644 --- a/src/main/java/org/onap/aai/web/LocalHostAccessLog.java +++ b/src/main/java/org/onap/aai/web/LocalHostAccessLog.java @@ -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(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 82780f7..ba59da9 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 diff --git a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java index 3115b87..55506a9 100644 --- a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java +++ b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java @@ -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.*; diff --git a/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java b/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java index 3c68006..c53a0d4 100644 --- a/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java +++ b/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java @@ -81,7 +81,7 @@ public class GraphAdminTestConfiguration { .build(); RestTemplate restTemplate = builder - .requestFactory(new HttpComponentsClientHttpRequestFactory(client)) + .requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client)) .build(); restTemplate.setErrorHandler(new ResponseErrorHandler() { |