From 134ca0a1494ebd664ab2985c1018627624f29f02 Mon Sep 17 00:00:00 2001 From: "Maharajh, Robby (rx2202)" Date: Wed, 9 Sep 2020 19:57:16 -0400 Subject: Update traversal to use spring boot 2 Issue-ID: AAI-2886 Issue-ID: AAI-2527 Change-Id: Id6432ff82b0377ff44115d5b42607d1926431f7b Signed-off-by: Maharajh, Robby (rx2202) --- aai-traversal/pom.xml | 68 +++++++++------------- .../src/main/java/org/onap/aai/TraversalApp.java | 2 - .../aai/config/aaf/AafAuthorizationFilter.java | 2 +- .../java/org/onap/aai/config/aaf/AafFilter.java | 2 +- .../java/org/onap/aai/web/JerseyConfiguration.java | 17 +----- .../java/org/onap/aai/web/LocalHostAccessLog.java | 17 +++--- .../src/main/resources/application.properties | 7 ++- aai-traversal/src/main/resources/logback.xml | 2 + .../java/org/onap/aai/AAIGremlinQueryTest.java | 2 +- .../test/java/org/onap/aai/QueryParameterTest.java | 2 +- .../test/java/org/onap/aai/SubgraphPruneTest.java | 2 +- .../org/onap/aai/TraversalTestConfiguration.java | 3 +- .../org/onap/aai/rest/AbstractSpringRestTest.java | 2 +- .../java/org/onap/aai/rest/BadQueryFormatTest.java | 2 +- .../java/org/onap/aai/rest/QueryConsumerTest.java | 2 +- .../history/AbstractSpringHistoryRestTest.java | 2 +- .../resources/application-onap-test.properties | 6 +- .../src/test/resources/application-test.properties | 4 +- pom.xml | 5 +- 19 files changed, 59 insertions(+), 90 deletions(-) diff --git a/aai-traversal/pom.xml b/aai-traversal/pom.xml index baa56d5..3a74bca 100644 --- a/aai-traversal/pom.xml +++ b/aai-traversal/pom.xml @@ -34,7 +34,6 @@ aai-traversal - 1.7.3 1.10.19 1.8 org.onap.aai.TraversalApp @@ -93,8 +92,8 @@ v11 v12 v12 - v16 - v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20 + v21 + v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21 /aai @@ -301,6 +300,28 @@ spring-boot-starter-parent pom import --> + + javax.jms + javax.jms-api + 2.0.1 + + + javax.ws.rs + javax.ws.rs-api + 2.1 + + + javax.xml.bind + jaxb-api + + + com.sun.xml.bind + jaxb-impl + + + com.sun.xml.bind + jaxb-core + net.sf.jopt-simple jopt-simple @@ -398,30 +419,6 @@ com.google.guava guava - - org.janusgraph - janusgraph-core - - - org.slf4j - slf4j-log4j12 - - - dom4j - dom4j - - - - - org.janusgraph - janusgraph-cassandra - - - org.slf4j - slf4j-log4j12 - - - org.janusgraph janusgraph-cql @@ -432,11 +429,6 @@ - - com.github.jnr jnr-ffi @@ -631,16 +623,6 @@ org.springframework.boot spring-boot-starter-jetty - - org.springframework.boot - spring-boot-starter-jersey - - - org.springframework.boot - spring-boot-starter-tomcat - - - org.onap.aaf.authz aaf-cadi-aaf @@ -957,6 +939,7 @@ aai-schema ${project.basedir}/src/main/resources/schema/ **/oxm/**/*.xml + ${aai.schema.service.version} @@ -975,6 +958,7 @@ aai-schema ${project.basedir}/src/main/resources/schema/ **/dbedgerules/**/*.json + ${aai.schema.service.version} diff --git a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java index 64f99b9..56573bc 100644 --- a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java +++ b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java @@ -116,8 +116,6 @@ public class TraversalApp { @PreDestroy public void cleanup(){ - contextMap = MDC.getCopyOfContextMap(); - MDC.setContextMap (contextMap); logger.debug("Traversal MicroService stopped"); logger.info("Shutting down both realtime and cached connections"); AAIGraph.getInstance().graphShutdown(); diff --git a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java index 9382946..4cfcb91 100644 --- a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java +++ b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java @@ -24,7 +24,7 @@ import com.att.eelf.configuration.EELFManager; import org.apache.commons.io.IOUtils; import org.onap.aai.Profiles; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.filter.OrderedRequestContextFilter; +import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; diff --git a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java index 51e0c17..6ab97ac 100644 --- a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java +++ b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java @@ -25,7 +25,7 @@ import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.aai.Profiles; import org.onap.aai.TraversalApp; -import org.springframework.boot.web.filter.OrderedRequestContextFilter; +import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; diff --git a/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java index e6cf080..39aa31c 100644 --- a/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java +++ b/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java @@ -19,10 +19,8 @@ */ package org.onap.aai.web; -import jersey.repackaged.com.google.common.collect.Sets; -import org.glassfish.jersey.filter.LoggingFilter; +import com.google.common.collect.Sets; import org.glassfish.jersey.server.ResourceConfig; -import org.onap.aai.aailog.logs.AaiDebugLog; import org.onap.aai.rest.*; import org.onap.aai.rest.search.ModelAndNamedQueryRestProvider; import org.onap.aai.rest.search.SearchProvider; @@ -50,11 +48,6 @@ public class JerseyConfiguration { private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName()); private static final org.slf4j.Logger logger = LoggerFactory.getLogger(JerseyConfiguration.class.getName()); - private static AaiDebugLog debugLog = new AaiDebugLog(); - static { - debugLog.setupMDC(); - } - private static final String LOGGING_ENABLED_PROPERTY = "aai.request.logging.enabled"; private static final boolean ENABLE_RESPONSE_LOGGING = false; @@ -80,7 +73,6 @@ public class JerseyConfiguration { CQ2GremlinTest.class ); Set> filterClasses = Sets.newHashSet( - org.onap.aai.aailog.filter.AaiAuditLogContainerFilter.class, org.onap.aai.interceptors.pre.RequestTransactionLogging.class, org.onap.aai.interceptors.pre.HeaderValidation.class, org.onap.aai.interceptors.pre.HttpHeaderInterceptor.class, @@ -94,9 +86,6 @@ public class JerseyConfiguration { org.onap.aai.interceptors.post.ResponseTransactionLogging.class, org.onap.aai.interceptors.post.ResponseHeaderManipulation.class ); - if (isLoggingEnabled()) { - logRequests(resourceConfig); - } resourceConfig.registerClasses(classes); logger.debug("REGISTERED CLASSES " + classes.toString()); @@ -126,10 +115,6 @@ public class JerseyConfiguration { return comparingInt(clazz -> clazz.getAnnotation(Priority.class).value()); } - private void logRequests(ResourceConfig resourceConfig) { - resourceConfig.register(new LoggingFilter(log, ENABLE_RESPONSE_LOGGING)); - } - private boolean isLoggingEnabled() { return parseBoolean(environment.getProperty(LOGGING_ENABLED_PROPERTY)); } diff --git a/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java b/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java index 4bc3300..d2a4e89 100644 --- a/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java +++ b/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java @@ -24,9 +24,8 @@ 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.JettyServletWebServerFactory; +import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -35,14 +34,14 @@ import java.util.Arrays; @Configuration public class LocalHostAccessLog { - @Bean - public EmbeddedServletContainerFactory jettyConfigBean( + @Bean + public AbstractServletWebServerFactory jettyConfigBean( @Value("${jetty.threadPool.maxThreads:200}") final String maxThreads, @Value("${jetty.threadPool.minThreads:8}") final String minThreads ){ - JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory(); - jef.addServerCustomizers((JettyServerCustomizer) server -> { + JettyServletWebServerFactory jef = new JettyServletWebServerFactory(); + jef.addServerCustomizers((org.springframework.boot.web.embedded.jetty.JettyServerCustomizer) server -> { HandlerCollection handlers = new HandlerCollection(); @@ -63,6 +62,6 @@ public class LocalHostAccessLog { threadPool.setMaxThreads(Integer.valueOf(maxThreads)); threadPool.setMinThreads(Integer.valueOf(minThreads)); }); - return jef; - } + return jef; + } } diff --git a/aai-traversal/src/main/resources/application.properties b/aai-traversal/src/main/resources/application.properties index 6e4f3be..a538a58 100644 --- a/aai-traversal/src/main/resources/application.properties +++ b/aai-traversal/src/main/resources/application.properties @@ -6,8 +6,9 @@ info.build.version=1.1.0 spring.application.name=aai-traversal spring.jersey.type=filter +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.jersey.application-path=${schema.uri.base.path} @@ -46,7 +47,7 @@ server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) server.ssl.trust-store=${server.certs.location}${server.truststore.name} server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) -schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20 +schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21 # Specifies which component should the oxm be looking at schema.source.name=onap # End of Internal Specific Properties @@ -83,7 +84,7 @@ schema.version.namespace.change.start=v12 # Specifies from which version should the client start seeing the edge label in payload schema.version.edge.label.start=v12 # Specifies the version that the application should default to -schema.version.api.default=v20 +schema.version.api.default=v21 schema.translator.list=config schema.service.base.url=https://localhost:8452/aai/schema-service/v1/ diff --git a/aai-traversal/src/main/resources/logback.xml b/aai-traversal/src/main/resources/logback.xml index c6fe5c7..877876e 100644 --- a/aai-traversal/src/main/resources/logback.xml +++ b/aai-traversal/src/main/resources/logback.xml @@ -324,6 +324,7 @@ + @@ -360,5 +361,6 @@ + diff --git a/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java index 6d2d5ff..2009389 100644 --- a/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java @@ -32,7 +32,7 @@ import org.onap.aai.util.AAIConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java b/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java index 7703df9..faf0160 100644 --- a/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.config.PropertyPasswordConfiguration; 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/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java b/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java index bc43979..42a4542 100644 --- a/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.config.PropertyPasswordConfiguration; 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/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java b/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java index 32ab70e..516c6b9 100644 --- a/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java +++ b/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java @@ -21,7 +21,6 @@ package org.onap.aai; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.att.eelf.configuration.EELFManager; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; @@ -83,7 +82,7 @@ public class TraversalTestConfiguration { .build(); restTemplate = builder - .requestFactory(new HttpComponentsClientHttpRequestFactory(client)) + .requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client)) .build(); }else { restTemplate = builder.build(); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java index b82d751..de98a8c 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java @@ -33,7 +33,7 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.nodes.NodeIngestor; 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.HttpEntity; diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java index 5edf12d..ea31302 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java @@ -28,7 +28,7 @@ import org.onap.aai.TraversalApp; import org.onap.aai.TraversalTestConfiguration; import org.onap.aai.config.PropertyPasswordConfiguration; 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/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java index cf81b47..2570690 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java @@ -33,7 +33,7 @@ import org.onap.aai.config.PropertyPasswordConfiguration; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; 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/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java index f671135..1d2eac1 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java @@ -32,7 +32,7 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.nodes.NodeIngestor; 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.HttpEntity; diff --git a/aai-traversal/src/test/resources/application-onap-test.properties b/aai-traversal/src/test/resources/application-onap-test.properties index c8e9f6a..132bc6f 100644 --- a/aai-traversal/src/test/resources/application-onap-test.properties +++ b/aai-traversal/src/test/resources/application-onap-test.properties @@ -57,7 +57,7 @@ schema.ingest.file=${server.local.startpath}/application-test.properties # Schema Version Related Attributes schema.uri.base.path=/aai # Lists all of the versions in the schema -schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19 +schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21 # Specifies from which version should the depth parameter to default to zero schema.version.depth.start=v10 # Specifies from which version should the related link be displayed in response payload @@ -70,5 +70,5 @@ schema.version.namespace.change.start=v12 # Specifies from which version should the client start seeing the edge label in payload schema.version.edge.label.start=v12 # Specifies the version that the application should default to -schema.version.api.default=v19 -schema.translator.list=config \ No newline at end of file +schema.version.api.default=v21 +schema.translator.list=config diff --git a/aai-traversal/src/test/resources/application-test.properties b/aai-traversal/src/test/resources/application-test.properties index eae212b..ec45671 100644 --- a/aai-traversal/src/test/resources/application-test.properties +++ b/aai-traversal/src/test/resources/application-test.properties @@ -60,7 +60,7 @@ schema.ingest.file=${server.local.startpath}/application-test.properties # Schema Version Related Attributes schema.uri.base.path=/aai # Lists all of the versions in the schema -schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19 +schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21 # Specifies from which version should the depth parameter to default to zero schema.version.depth.start=v10 # Specifies from which version should the related link be displayed in response payload @@ -73,6 +73,6 @@ schema.version.namespace.change.start=v12 # Specifies from which version should the client start seeing the edge label in payload schema.version.edge.label.start=v12 # Specifies the version that the application should default to -schema.version.api.default=v19 +schema.version.api.default=v21 schema.translator.list=config diff --git a/pom.xml b/pom.xml index 5ccdcec..6f0ad1d 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ org.onap.aai.aai-common aai-parent - 1.6.10 + 1.7.0 org.onap.aai.traversal traversal @@ -41,7 +41,7 @@ Nexus Proxy Properties and Snapshot Locations Ideally this can be overwritten at runtime per internal environment specific values at runtime --> - 1.7.0-SNAPSHOT + 1.7.0 https://nexus.onap.org /content/sites/site/org/onap/aai/traversal/${project.artifactId}/${project.version} /content/repositories/releases/ @@ -49,6 +49,7 @@ /content/repositories/staging/ ${project.version} + 1.7.9 -- cgit 1.2.3-korg