From d63391e88b8f87a169e3468669cd6268014b1da8 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 13 Nov 2023 10:59:02 +0100 Subject: Update spring-boot to 2.2 - upgrade spring-boot from 2.1 to 2.2 - change logging level in tests from debug to info - do not version .classpath in git since it's dynamically generated Issue-ID: AAI-3679 Change-Id: I4b0378880a0670d522903d44dbe7e1b144b51177 Signed-off-by: Fiete Ostkamp --- .../src/main/java/org/onap/aai/Profiles.java | 36 --------------------- .../src/main/java/org/onap/aai/TraversalApp.java | 5 +-- .../main/java/org/onap/aai/TraversalProfiles.java | 36 +++++++++++++++++++++ .../java/org/onap/aai/dbgraphmap/SearchGraph.java | 2 -- .../interceptors/pre/OneWaySslAuthorization.java | 4 +-- .../main/java/org/onap/aai/rest/CQ2Gremlin.java | 6 +++- .../java/org/onap/aai/rest/CQ2GremlinTest.java | 20 +++++++++--- .../main/java/org/onap/aai/rest/DslConsumer.java | 37 ++++++++++++++++------ .../main/java/org/onap/aai/rest/QueryConsumer.java | 37 +++++++++++++++------- .../java/org/onap/aai/rest/RecentAPIConsumer.java | 17 +++++++--- .../org/onap/aai/rest/dsl/DslQueryProcessor.java | 2 -- .../java/org/onap/aai/rest/dsl/v1/DslListener.java | 2 -- .../java/org/onap/aai/rest/dsl/v2/DslListener.java | 2 -- .../onap/aai/rest/search/GetCustomQueryConfig.java | 11 +++---- .../aai/rest/search/GremlinServerSingleton.java | 2 -- .../search/ModelAndNamedQueryRestProvider.java | 6 +++- .../org/onap/aai/rest/search/SearchProvider.java | 16 +++++++--- .../onap/aai/rest/security/WebSecurityConfig.java | 2 +- .../java/org/onap/aai/rest/util/EchoResponse.java | 2 ++ .../org/onap/aai/service/AuthorizationService.java | 4 +-- .../java/org/onap/aai/web/JerseyConfiguration.java | 2 -- .../src/main/resources/application.properties | 6 ++-- 22 files changed, 157 insertions(+), 100 deletions(-) delete mode 100644 aai-traversal/src/main/java/org/onap/aai/Profiles.java create mode 100644 aai-traversal/src/main/java/org/onap/aai/TraversalProfiles.java (limited to 'aai-traversal/src/main') diff --git a/aai-traversal/src/main/java/org/onap/aai/Profiles.java b/aai-traversal/src/main/java/org/onap/aai/Profiles.java deleted file mode 100644 index 0a886af..0000000 --- a/aai-traversal/src/main/java/org/onap/aai/Profiles.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.aai; - -public final class Profiles { - - public static final String DMAAP = "dmaap"; - public static final String DME2 = "dme2"; - - public static final String ONE_WAY_SSL = "one-way-ssl"; - // AAF Basic Auth - public static final String AAF_AUTHENTICATION = "aaf-auth"; - // AAF Auth with Client Certs - public static final String AAF_CERT_AUTHENTICATION = "aaf-cert-auth"; - public static final String TWO_WAY_SSL = "two-way-ssl"; - - private Profiles() { - } -} 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 5ac3ff1..14bfca0 100644 --- a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java +++ b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java @@ -45,6 +45,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; @SpringBootApplication( exclude = {DataSourceAutoConfiguration.class, @@ -96,8 +97,8 @@ public class TraversalApp { logger.debug("Starting AAIGraph connections and the NodeInjestor"); - if (env.acceptsProfiles(Profiles.TWO_WAY_SSL) - && env.acceptsProfiles(Profiles.ONE_WAY_SSL)) { + if (env.acceptsProfiles(Profiles.of(TraversalProfiles.TWO_WAY_SSL)) + && env.acceptsProfiles(Profiles.of(TraversalProfiles.ONE_WAY_SSL))) { logger.debug("You have seriously misconfigured your application"); } diff --git a/aai-traversal/src/main/java/org/onap/aai/TraversalProfiles.java b/aai-traversal/src/main/java/org/onap/aai/TraversalProfiles.java new file mode 100644 index 0000000..c1cb6ea --- /dev/null +++ b/aai-traversal/src/main/java/org/onap/aai/TraversalProfiles.java @@ -0,0 +1,36 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.aai; + +public final class TraversalProfiles { + + public static final String DMAAP = "dmaap"; + public static final String DME2 = "dme2"; + + public static final String ONE_WAY_SSL = "one-way-ssl"; + // AAF Basic Auth + public static final String AAF_AUTHENTICATION = "aaf-auth"; + // AAF Auth with Client Certs + public static final String AAF_CERT_AUTHENTICATION = "aaf-cert-auth"; + public static final String TWO_WAY_SSL = "two-way-ssl"; + + private TraversalProfiles() { + } +} diff --git a/aai-traversal/src/main/java/org/onap/aai/dbgraphmap/SearchGraph.java b/aai-traversal/src/main/java/org/onap/aai/dbgraphmap/SearchGraph.java index 1dc8ac1..8e925a5 100644 --- a/aai-traversal/src/main/java/org/onap/aai/dbgraphmap/SearchGraph.java +++ b/aai-traversal/src/main/java/org/onap/aai/dbgraphmap/SearchGraph.java @@ -73,7 +73,6 @@ import org.onap.aai.util.GenericQueryBuilder; import org.onap.aai.util.NodesQueryBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; /** * Database Mapping class which acts as the middle man between the REST interface objects for the @@ -90,7 +89,6 @@ public class SearchGraph { private SchemaVersions schemaVersions; - @Autowired public SearchGraph(LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, SchemaVersions schemaVersions) { this.loaderFactory = loaderFactory; diff --git a/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java b/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java index 78ab1a9..4cd6548 100644 --- a/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java +++ b/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java @@ -31,7 +31,7 @@ import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.aai.Profiles; +import org.onap.aai.TraversalProfiles; import org.onap.aai.exceptions.AAIException; import org.onap.aai.interceptors.AAIContainerFilter; import org.onap.aai.logging.ErrorLogHelper; @@ -39,7 +39,7 @@ import org.onap.aai.service.AuthorizationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; -@Profile(Profiles.ONE_WAY_SSL) +@Profile(TraversalProfiles.ONE_WAY_SSL) @PreMatching @Priority(AAIRequestFilterPriority.AUTHORIZATION) public class OneWaySslAuthorization extends AAIContainerFilter implements ContainerRequestFilter { diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2Gremlin.java b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2Gremlin.java index 6e76c29..c8f1f0b 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2Gremlin.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2Gremlin.java @@ -27,7 +27,11 @@ import javax.ws.rs.Consumes; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import javax.ws.rs.core.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; import org.onap.aai.config.SpringContextAware; import org.onap.aai.introspection.LoaderFactory; diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java index 626c5f3..8c6477f 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java @@ -19,10 +19,13 @@ */ package org.onap.aai.rest; -import com.beust.jcommander.internal.Lists; -import com.beust.jcommander.internal.Maps; - -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -30,7 +33,11 @@ import javax.ws.rs.Consumes; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import javax.ws.rs.core.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; @@ -59,6 +66,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestBody; +import com.beust.jcommander.internal.Lists; +import com.beust.jcommander.internal.Maps; + @Path("/cq2gremlintest") public class CQ2GremlinTest extends RESTAPI { diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/DslConsumer.java b/aai-traversal/src/main/java/org/onap/aai/rest/DslConsumer.java index 2b6bbb9..bbb1aea 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/DslConsumer.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/DslConsumer.java @@ -19,19 +19,30 @@ */ package org.onap.aai.rest; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -import io.micrometer.core.annotation.Timed; - -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.janusgraph.core.SchemaViolationException; @@ -61,6 +72,12 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import io.micrometer.core.annotation.Timed; + @Path("{version: v[1-9][0-9]*|latest}/dsl") @Timed public class DslConsumer extends TraversalConsumer { @@ -147,7 +164,7 @@ public class DslConsumer extends TraversalConsumer { traversalUriHttpEntry.setHttpEntryProperties(version, serverBase); traversalUriHttpEntry.setPaginationParameters(resultIndex, resultSize); dbEngine = traversalUriHttpEntry.getDbEngine(); - JsonObject input = new JsonParser().parse(content).getAsJsonObject(); + JsonObject input = JsonParser.parseString(content).getAsJsonObject(); JsonElement dslElement = input.get("dsl"); String dsl = ""; if (dslElement != null) { diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java b/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java index 460065e..cade20c 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java @@ -19,20 +19,30 @@ */ package org.onap.aai.rest; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -import io.micrometer.core.annotation.Timed; - import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -64,6 +74,12 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import io.micrometer.core.annotation.Timed; + @Path("{version: v[1-9][0-9]*|latest}/query") @Timed public class QueryConsumer extends TraversalConsumer { @@ -134,8 +150,7 @@ public class QueryConsumer extends TraversalConsumer { } SubGraphStyle subGraphStyle = SubGraphStyle.valueOf(subgraph); - JsonParser parser = new JsonParser(); - JsonObject input = parser.parse(content).getAsJsonObject(); + JsonObject input = JsonParser.parseString(content).getAsJsonObject(); JsonElement startElement = input.get("start"); JsonElement queryElement = input.get("query"); JsonElement gremlinElement = input.get("gremlin"); diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/RecentAPIConsumer.java b/aai-traversal/src/main/java/org/onap/aai/rest/RecentAPIConsumer.java index 7f40979..5f2f161 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/RecentAPIConsumer.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/RecentAPIConsumer.java @@ -19,15 +19,22 @@ */ package org.onap.aai.rest; -import io.micrometer.core.annotation.Timed; - import java.util.List; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; import org.onap.aai.concurrent.AaiCallable; import org.onap.aai.exceptions.AAIException; @@ -55,6 +62,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import io.micrometer.core.annotation.Timed; + @Path("/recents/{version: v[1-9][0-9]*|latest}") @Timed public class RecentAPIConsumer extends RESTAPI { diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java b/aai-traversal/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java index a21ca04..ffffaa6 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java @@ -39,7 +39,6 @@ import org.onap.aai.rest.dsl.validation.DslValidator; import org.onap.aai.rest.enums.QueryVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; /** * The Class DslQueryProcessor. @@ -58,7 +57,6 @@ public class DslQueryProcessor { private boolean isAggregate = false; - @Autowired public DslQueryProcessor(Map dslListeners) { this.dslListeners = dslListeners; } diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v1/DslListener.java b/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v1/DslListener.java index ad2899c..1987310 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v1/DslListener.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v1/DslListener.java @@ -39,7 +39,6 @@ import org.onap.aai.rest.dsl.validation.DslValidatorRule; import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; /** * The Class DslListener. @@ -73,7 +72,6 @@ public class DslListener extends AAIDslBaseListener { /** * Instantiates a new DslListener. */ - @Autowired public DslListener(EdgeIngestor edgeIngestor, SchemaVersions schemaVersions, LoaderFactory loaderFactory) { this.loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v2/DslListener.java b/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v2/DslListener.java index 7e46c0b..5395af0 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v2/DslListener.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/dsl/v2/DslListener.java @@ -42,7 +42,6 @@ import org.onap.aai.rest.enums.EdgeDirection; import org.onap.aai.setup.SchemaVersions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; /** * The Class DslListener. @@ -86,7 +85,6 @@ public class DslListener extends AAIDslBaseListener { /** * Instantiates a new DslListener. */ - @Autowired public DslListener(EdgeIngestor edgeIngestor, SchemaVersions schemaVersions, LoaderFactory loaderFactory) { this.loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/GetCustomQueryConfig.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/GetCustomQueryConfig.java index 98eb551..edd882c 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/search/GetCustomQueryConfig.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/GetCustomQueryConfig.java @@ -19,6 +19,10 @@ */ package org.onap.aai.rest.search; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -26,10 +30,6 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; - public class GetCustomQueryConfig { private JsonArray storedQueries = null; @@ -46,8 +46,7 @@ public class GetCustomQueryConfig { } private void init(String customQueryJson) { - JsonParser parser = new JsonParser(); - JsonObject queriesObject = parser.parse(customQueryJson).getAsJsonObject(); + JsonObject queriesObject = JsonParser.parseString(customQueryJson).getAsJsonObject(); if (queriesObject.has(STORED_QUERIES_CONFIG)) { storedQueries = queriesObject.getAsJsonArray(STORED_QUERIES_CONFIG); diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/GremlinServerSingleton.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/GremlinServerSingleton.java index a3bb074..8ddf815 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/search/GremlinServerSingleton.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/GremlinServerSingleton.java @@ -40,7 +40,6 @@ import org.onap.aai.logging.LogFormatTools; import org.onap.aai.util.AAIConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; public class GremlinServerSingleton { @@ -61,7 +60,6 @@ public class GremlinServerSingleton { * the properties object * */ - @Autowired public GremlinServerSingleton(CQConfig customQueryInfo) { this.customQueryInfo = customQueryInfo; } diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/ModelAndNamedQueryRestProvider.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/ModelAndNamedQueryRestProvider.java index 5c8b055..cb31d1a 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/search/ModelAndNamedQueryRestProvider.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/ModelAndNamedQueryRestProvider.java @@ -28,8 +28,12 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; import org.onap.aai.aailog.logs.AaiDBTraversalMetricLog; import org.onap.aai.concurrent.AaiCallable; diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/SearchProvider.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/SearchProvider.java index 17edbc5..27fccb8 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/search/SearchProvider.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/SearchProvider.java @@ -19,17 +19,23 @@ */ package org.onap.aai.rest.search; -import io.micrometer.core.annotation.Timed; - import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.*; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; import org.onap.aai.aailog.logs.AaiDBTraversalMetricLog; import org.onap.aai.concurrent.AaiCallable; @@ -57,6 +63,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import io.micrometer.core.annotation.Timed; + /** * Implements the search subdomain in the REST API. All API calls must include X-FromAppId and * X-TransactionId in the header. diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/security/WebSecurityConfig.java b/aai-traversal/src/main/java/org/onap/aai/rest/security/WebSecurityConfig.java index e24013b..e77c3b3 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/security/WebSecurityConfig.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/security/WebSecurityConfig.java @@ -72,7 +72,7 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter { } @Override - public void configure(WebSecurity web) throws Exception { + public void configure(WebSecurity web) { web.ignoring().regexMatchers("^.*/util/echo$"); } } diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java b/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java index 2e42e4c..c3409f8 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java @@ -36,6 +36,7 @@ import javax.ws.rs.core.Response.Status; import org.onap.aai.exceptions.AAIException; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.restcore.RESTAPI; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** @@ -51,6 +52,7 @@ public class EchoResponse extends RESTAPI { private AaiGraphChecker aaiGraphChecker; + @Autowired public EchoResponse(AaiGraphChecker aaiGraphChecker) { this.aaiGraphChecker = aaiGraphChecker; } diff --git a/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java b/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java index b448bc8..10bee2b 100644 --- a/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java +++ b/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java @@ -31,7 +31,7 @@ import java.util.stream.Stream; import javax.annotation.PostConstruct; import org.eclipse.jetty.util.security.Password; -import org.onap.aai.Profiles; +import org.onap.aai.TraversalProfiles; import org.onap.aai.util.AAIConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +39,7 @@ import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; @Service -@Profile(Profiles.ONE_WAY_SSL) +@Profile(TraversalProfiles.ONE_WAY_SSL) public class AuthorizationService { private static final Logger logger = LoggerFactory.getLogger(AuthorizationService.class); 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 87d6d8f..feb8d1d 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 @@ -38,7 +38,6 @@ import org.onap.aai.rest.search.ModelAndNamedQueryRestProvider; import org.onap.aai.rest.search.SearchProvider; import org.onap.aai.rest.util.EchoResponse; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -56,7 +55,6 @@ public class JerseyConfiguration { private final Environment environment; - @Autowired public JerseyConfiguration(Environment environment) { this.environment = environment; } diff --git a/aai-traversal/src/main/resources/application.properties b/aai-traversal/src/main/resources/application.properties index 6b26c1a..9b374d4 100644 --- a/aai-traversal/src/main/resources/application.properties +++ b/aai-traversal/src/main/resources/application.properties @@ -27,8 +27,8 @@ server.tomcat.max-idle-time=60000 # If you get an application startup failure that the port is already taken # If thats not it, please check if the key-store file path makes sense -server.local.startpath=aai-traversal/src/main/resources/ -server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties +server.local.startpath=aai-traversal/src/main/resources +server.basic.auth.location=${server.local.startpath}/etc/auth/realm.properties server.port=8446 server.ssl.enabled-protocols=TLSv1.1,TLSv1.2 @@ -45,7 +45,7 @@ spring.profiles.active=production,one-way-ssl # Switch to keycloak #spring.profiles.active=production, keycloak ### -server.certs.location=${server.local.startpath}etc/auth/ +server.certs.location=${server.local.startpath}/etc/auth/ server.keystore.name.pkcs12=aai_keystore server.keystore.name=aai_keystore server.truststore.name=aai_keystore -- cgit 1.2.3-korg