Update aai-common dependency in schema-service to 1.15.2 99/139399/4
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 14 Nov 2024 07:46:44 +0000 (08:46 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 14 Nov 2024 08:37:26 +0000 (09:37 +0100)
- update aai-common dependency (1.9.4 -> 1.15.2)
- this also updates, among other things, spring boot (2.1.12 -> 2.6.15)
- use lombok to make code more terse

Issue-ID: AAI-4058
Change-Id: Ib4b90d360dc094721eaf82282c6ba0df767d18a9
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
24 files changed:
aai-queries/pom.xml
aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java
aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java
aai-schema-gen/pom.xml
aai-schema-service/pom.xml
aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ConfigTranslator.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java [new file with mode: 0644]
aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeResource.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/healthcheck/EchoResource.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/RequestTransactionLogging.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaResource.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/CheckEverythingStrategy.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/DefaultVersionValidationModule.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/NodeValidator.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/VersionValidator.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryResource.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/versions/VersionResource.java
aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
pom.xml

index a42c60c..18ae75c 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-test</artifactId>
+            <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.vaadin.external.google</groupId>
+                    <artifactId>android-json</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>javax.xml.bind</groupId>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
-            <version>3.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>org.eclipse.persistence.moxy</artifactId>
-            <version>3.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
index d538d21..f0d81a0 100644 (file)
@@ -29,7 +29,6 @@ import java.util.Map;
 
 import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.extension.ExtendWith;
 import org.onap.aai.config.IntrospectionConfig;
 import org.onap.aai.config.RestBeanConfig;
 import org.onap.aai.config.SpringContextAware;
@@ -45,15 +44,13 @@ import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.setup.SchemaVersions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
 
-@ContextConfiguration(
+@SpringJUnitConfig(
     classes = {SchemaLocationsBean.class, SchemaVersions.class, AAIConfigTranslator.class,
         EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
         IntrospectionConfig.class, RestBeanConfig.class, GremlinServerSingleton.class})
-@ExtendWith(SpringExtension.class)
 @TestPropertySource(
     properties = {"schema.uri.base.path = /aai",
         "schema.ingest.file = src/test/resources/application-test.properties"})
index 21a3312..a675331 100644 (file)
@@ -35,7 +35,6 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.onap.aai.config.IntrospectionConfig;
@@ -60,15 +59,13 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
-import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
 
-@ContextConfiguration(
+@SpringJUnitConfig(
     classes = {SchemaLocationsBean.class, SchemaConfigVersions.class, AAIConfigTranslator.class,
         EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
-        GremlinServerSingleton.class, IntrospectionConfig.class})
-@ExtendWith(SpringExtension.class)
+        GremlinServerSingleton.class, IntrospectionConfig.class, LoaderFactory.class})
 @TestPropertySource(
     properties = {"schema.uri.base.path = /aai", "schema.source.name = onap",
         "schema.ingest.file = src/test/resources/application-test.properties"})
index b7723e7..f4ee9af 100644 (file)
     </profiles>
     <dependencies>
         <dependency>
-            <groupId>javax.annotation</groupId>
-            <artifactId>javax.annotation-api</artifactId>
-            <scope>compile</scope>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
         </dependency>
         <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
-            <version>2.3.0</version>
+            <groupId>jakarta.xml.bind</groupId>
+            <artifactId>jakarta.xml.bind-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
-            <version>3.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>org.eclipse.persistence.moxy</artifactId>
-            <version>3.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
-            <version>3.7</version>
+            <!-- <version>3.7</version> -->
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.6</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-text</artifactId>
index eaef1e0..83c9ffe 100644 (file)
             <artifactId>javax.ws.rs-api</artifactId>
             <version>2.1</version>
         </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>
         <dependency>
             <groupId>com.att.eelf</groupId>
             <artifactId>eelf-core</artifactId>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
-            <version>3.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>org.eclipse.persistence.moxy</artifactId>
-            <version>3.0.0</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
                     <groupId>org.onap.aai.aai-common</groupId>
                     <artifactId>aai-schema-ingest</artifactId>
                 </exclusion>
-                <exclusion>
-                    <groupId>org.onap.aai.aai-common</groupId>
-                    <artifactId>aai-aaf-auth</artifactId>
-                </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+                       <groupId>org.projectlombok</groupId>
+                       <artifactId>lombok</artifactId>
+                       <version>1.18.34</version>
+                       <scope>provided</scope>
+               </dependency>
+        <dependency>
+            <groupId>org.reflections</groupId>
+            <artifactId>reflections</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.onap.aai.aai-common</groupId>
             <artifactId>aai-els-onap-logging</artifactId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-junit</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>junit</groupId>
-                    <artifactId>junit</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
index 1cc7a36..5c36ed8 100644 (file)
@@ -37,6 +37,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
 // Component Scan provides a way to look for spring beans
@@ -114,8 +115,8 @@ public class SchemaServiceApp {
         // This is only needed for tomcat keeping this as temporary
         System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
 
-        if (env.acceptsProfiles(Profiles.TWO_WAY_SSL)
-            && env.acceptsProfiles(Profiles.ONE_WAY_SSL)) {
+        if (env.acceptsProfiles(Profiles.of(org.onap.aai.schemaservice.Profiles.TWO_WAY_SSL))
+            && env.acceptsProfiles(Profiles.of(org.onap.aai.schemaservice.Profiles.ONE_WAY_SSL))) {
             logger.warn("You have seriously misconfigured your application");
         }
 
index b86f9fa..a76e4df 100644 (file)
@@ -25,7 +25,6 @@ import java.util.Map;
 
 import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
 import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
-import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * Converts the contents of the schema config file
@@ -37,7 +36,6 @@ public abstract class ConfigTranslator {
     protected SchemaLocationsBean bean;
     protected SchemaVersions schemaVersions;
 
-    @Autowired
     public ConfigTranslator(SchemaLocationsBean schemaLocationbean, SchemaVersions schemaVersions) {
         this.bean = schemaLocationbean;
         this.schemaVersions = schemaVersions;
index 83a1805..f81ca52 100644 (file)
@@ -33,7 +33,6 @@ import javax.ws.rs.core.MediaType;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.logging.ErrorLogHelper;
 import org.onap.aai.logging.ErrorObject;
-import org.onap.aai.logging.ErrorObjectNotFoundException;
 import org.onap.aai.logging.LogFormatTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -108,13 +107,8 @@ public class ErrorHandler extends OncePerRequestFilter {
                 AAIException aaiException = (AAIException) e;
                 String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, aaiException,
                     templateVars);
-                ErrorObject object = null;
-                try {
-                    object = ErrorLogHelper.getErrorObject(aaiException.getCode());
-                    httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
-                } catch (ErrorObjectNotFoundException e1) {
-                    LOGGER.error("getErrorObject exception {}", LogFormatTools.getStackTop(e1));
-                }
+                ErrorObject object = ErrorLogHelper.getErrorObject(aaiException.getCode());
+                httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
                 httpServletResponse.setContentType(mediaTypeList.get(0).toString());
                 httpServletResponse.getWriter().write(message);
                 httpServletResponse.getWriter().close();
@@ -132,13 +126,8 @@ public class ErrorHandler extends OncePerRequestFilter {
                 LOGGER.error("Encountered an internal exception {}", LogFormatTools.getStackTop(e));
                 String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, aaiException,
                     templateVars);
-                ErrorObject object = null;
-                try {
-                    object = ErrorLogHelper.getErrorObject(aaiException.getCode());
-                    httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
-                } catch (ErrorObjectNotFoundException e1) {
-                    LOGGER.error("getErrorObject exception {}", LogFormatTools.getStackTop(e1));
-                }
+                ErrorObject object = ErrorLogHelper.getErrorObject(aaiException.getCode());
+                httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
                 httpServletResponse.setContentType(mediaTypeList.get(0).toString());
                 httpServletResponse.getWriter().write(message);
                 httpServletResponse.getWriter().close();
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java
new file mode 100644 (file)
index 0000000..45e0093
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright Â© 2024 Deutsche Telekom. 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.schemaservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+@Configuration
+public class MappingConfig {
+
+  @Bean
+  public Gson gson() {
+    return new GsonBuilder().create();
+  }
+}
index bae48c3..429fe02 100644 (file)
@@ -23,6 +23,8 @@ package org.onap.aai.schemaservice.edges;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
+import lombok.RequiredArgsConstructor;
+
 import java.util.Optional;
 
 import javax.ws.rs.GET;
@@ -40,23 +42,18 @@ import org.onap.aai.restcore.RESTAPI;
 import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
 import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
 import org.onap.aai.schemaservice.nodeschema.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.RestController;
 
 @Path("/v1")
+@RestController
+@RequiredArgsConstructor
 public class EdgeResource extends RESTAPI {
 
     private final EdgeService edgeService;
     private final SchemaVersions schemaVersions;
     private final Gson gson;
 
-    @Autowired
-    public EdgeResource(EdgeService edgeService, SchemaVersions schemaVersions) {
-        this.edgeService = edgeService;
-        this.schemaVersions = schemaVersions;
-        gson = new GsonBuilder().create();
-    }
-
     @GET
     @Path("/edgerules")
     @Produces({"application/json"})
@@ -66,7 +63,7 @@ public class EdgeResource extends RESTAPI {
 
         try {
 
-            if (StringUtils.isEmpty(version)) {
+            if (ObjectUtils.isEmpty(version)) {
                 throw new AAIException("AAI_3050");
             }
 
index 0b2cc75..af8d6f0 100644 (file)
@@ -41,7 +41,6 @@ import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
 import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
 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.stereotype.Service;
 
@@ -49,28 +48,26 @@ import org.springframework.stereotype.Service;
 public class EdgeService {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(EdgeService.class);
-
     private static final String FILESEP = System.getProperty("file.separator");
 
-    private SchemaVersions schemaVersions;
-    private String edgesLocation;
-
-    private Map<String, EdgeRules> rulesMap;
+    private final SchemaVersions schemaVersions;
+    private final String edgesLocation;
+    private final Map<String, EdgeRules> rulesMap;
+    private final Gson gson;
 
-    @Autowired
     public EdgeService(SchemaVersions schemaVersions,
         @Value("${schema.edges.location}") String edgesLocation) {
         this.schemaVersions = schemaVersions;
         this.edgesLocation = edgesLocation;
         this.rulesMap = new HashMap<>();
+        this.gson = new GsonBuilder()
+            .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
+            .create();
     }
 
     @PostConstruct
     public void initialize() throws IOException {
 
-        Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
-            .create();
-
         for (SchemaVersion schemaVersion : schemaVersions.getVersions()) {
 
             String edgeRuleVersionPath = edgesLocation + FILESEP + schemaVersion.toString();
index b0c8007..97aa2e2 100644 (file)
@@ -33,11 +33,13 @@ 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.web.bind.annotation.RestController;
 
 /**
  * The Class EchoResponse.
  */
 @Path("/util")
+@RestController
 public class EchoResource extends RESTAPI {
 
     /**
@@ -87,7 +89,7 @@ public class EchoResource extends RESTAPI {
 
             response = Response
                 .status(Status.OK).entity(ErrorLogHelper
-                    .getRESTAPIInfoResponse(headers.getAcceptableMediaTypes(), exceptionList))
+                    .getRESTAPIInfoResponse(new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
                 .build();
 
         } catch (Exception e) {
index cfbd364..0820a68 100644 (file)
@@ -39,7 +39,7 @@ import org.glassfish.jersey.message.internal.ReaderWriter;
 import org.glassfish.jersey.server.ContainerException;
 import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
 import org.onap.aai.schemaservice.interceptors.AAIHeaderProperties;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
 import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
@@ -82,7 +82,7 @@ public class RequestTransactionLogging extends AAIContainerFilter
             requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
         }
 
-        if (StringUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) {
+        if (ObjectUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) {
             requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
         }
     }
index ad39e49..6245479 100644 (file)
@@ -24,8 +24,6 @@ import com.google.common.base.CaseFormat;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
 
-import jakarta.xml.bind.JAXBException;
-
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -46,6 +44,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -56,7 +55,6 @@ import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
 import org.onap.aai.schemaservice.config.ConfigTranslator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -78,7 +76,6 @@ public class NodeIngestor {
     private Map<SchemaVersion, Document> schemaPerVersion = new TreeMap<>();
     private ConfigTranslator translator;
 
-    @Autowired
     /**
      * Instantiates the NodeIngestor bean.
      *
index 9c1f894..bab6711 100644 (file)
@@ -35,17 +35,17 @@ import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.restcore.HttpMethod;
 import org.onap.aai.restcore.RESTAPI;
 import org.onap.aai.schemaservice.nodeschema.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.RestController;
 
 @Path("/v1")
+@RestController
 public class NodeSchemaResource extends RESTAPI {
 
     private final NodeSchemaService nodeSchemaService;
 
     private final SchemaVersions schemaVersions;
 
-    @Autowired
     public NodeSchemaResource(NodeSchemaService nodeSchemaService, SchemaVersions schemaVersions) {
         this.nodeSchemaService = nodeSchemaService;
         this.schemaVersions = schemaVersions;
@@ -60,7 +60,7 @@ public class NodeSchemaResource extends RESTAPI {
         Optional<String> optionalSchema = nodeSchemaService.fetch(version);
         try {
 
-            if (StringUtils.isEmpty(version)) {
+            if (ObjectUtils.isEmpty(version)) {
                 throw new AAIException("AAI_3050");
             }
 
index 26214aa..1098989 100644 (file)
@@ -37,21 +37,17 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
+import lombok.RequiredArgsConstructor;
+
 @Service
+@RequiredArgsConstructor
 public class NodeSchemaService {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(NodeSchemaResource.class);
 
-    private SchemaVersions schemaVersions;
-
-    private NodeIngestor nodeIngestor;
-
-    private Map<String, String> versionMap = new HashMap<>();
-
-    public NodeSchemaService(NodeIngestor nodeIngestor, SchemaVersions schemaVersions) {
-        this.nodeIngestor = nodeIngestor;
-        this.schemaVersions = schemaVersions;
-    }
+    private final SchemaVersions schemaVersions;
+    private final NodeIngestor nodeIngestor;
+    private final Map<String, String> versionMap = new HashMap<>();
 
     @PostConstruct
     public void initialize() {
index 40768b6..58079df 100644 (file)
@@ -23,7 +23,7 @@ package org.onap.aai.schemaservice.nodeschema.validation;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 
 /**
  * When an error is found, mark that it is NOT ok to
index aacd66f..bcd69e5 100644 (file)
@@ -25,7 +25,6 @@ import java.util.Map;
 
 import org.onap.aai.schemaservice.config.ConfigTranslator;
 import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
@@ -37,7 +36,6 @@ import org.springframework.stereotype.Component;
 public class DefaultVersionValidationModule implements VersionValidationModule {
     private ConfigTranslator config;
 
-    @Autowired
     public DefaultVersionValidationModule(ConfigTranslator config) {
         this.config = config;
     }
index faeadc5..daec4cc 100644 (file)
@@ -25,7 +25,6 @@ import java.util.Map.Entry;
 
 import org.onap.aai.schemaservice.config.ConfigTranslator;
 import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
@@ -34,7 +33,6 @@ public class NodeValidator {
     private SchemaErrorStrategy strat;
     private DuplicateNodeDefinitionValidationModule dupChecker;
 
-    @Autowired
     public NodeValidator(ConfigTranslator translator, SchemaErrorStrategy strategy,
         DuplicateNodeDefinitionValidationModule dupChecker) {
         this.translator = translator;
index 135bdcc..ccb44bb 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.aai.schemaservice.nodeschema.validation;
 
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
@@ -32,7 +31,6 @@ public class VersionValidator {
     private SchemaErrorStrategy strat;
     private VersionValidationModule verMod;
 
-    @Autowired
     public VersionValidator(SchemaErrorStrategy strategy, VersionValidationModule verMod) {
         this.strat = strategy;
         this.verMod = verMod;
index 69c9998..2f13b5b 100644 (file)
@@ -24,17 +24,16 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
 
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+import lombok.RequiredArgsConstructor;
 
 @Path("/v1")
+@RestController
+@RequiredArgsConstructor
 public class QueryResource {
 
-    private QueryService queryService;
-
-    @Autowired
-    public QueryResource(QueryService queryService) {
-        this.queryService = queryService;
-    }
+    private final QueryService queryService;
 
     @GET
     @Path("/stored-queries")
index 4093769..80ba0db 100644 (file)
@@ -22,29 +22,28 @@ package org.onap.aai.schemaservice.versions;
 
 import com.google.gson.Gson;
 
+import lombok.RequiredArgsConstructor;
+
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
 
 @Path("/v1")
+@RestController
+@RequiredArgsConstructor
 public class VersionResource {
 
-    private VersionService versionService;
-
-    @Autowired
-    public VersionResource(VersionService versionService) {
-        this.versionService = versionService;
-    }
+    private final VersionService versionService;
+    private final Gson gson;
 
     @GET
     @Path("/versions")
     @Produces({MediaType.APPLICATION_JSON})
     public Response getVersions() {
-        Gson gson = new Gson();
         return Response.ok(gson.toJson(versionService.getVersionInfo())).build();
     }
 }
index ad7e546..299c813 100644 (file)
@@ -37,9 +37,9 @@ import org.onap.aai.schemaservice.query.QueryResource;
 import org.onap.aai.schemaservice.versions.VersionResource;
 import org.onap.logging.filter.base.AuditLogContainerFilter;
 import org.reflections.Reflections;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Profile;
 import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
 import org.springframework.stereotype.Component;
 
 @Component
@@ -49,7 +49,6 @@ public class JerseyConfiguration extends ResourceConfig {
 
     private Environment env;
 
-    @Autowired
     public JerseyConfiguration(Environment env) {
 
         this.env = env;
@@ -87,7 +86,7 @@ public class JerseyConfiguration extends ResourceConfig {
         // Turn the set back into a list
         List<Class<? extends T>> filtersList = filters.stream().filter(f -> {
             if (f.isAnnotationPresent(Profile.class)
-                && !env.acceptsProfiles(f.getAnnotation(Profile.class).value())) {
+                && !env.acceptsProfiles(Profiles.of(f.getAnnotation(Profile.class).value()))) {
                 return false;
             }
             return true;
diff --git a/pom.xml b/pom.xml
index 97e9534..5ce4804 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.aai.aai-common</groupId>
         <artifactId>aai-parent</artifactId>
-        <version>1.9.4</version>
+        <version>1.15.2</version>
     </parent>
     <groupId>org.onap.aai.schema-service</groupId>
     <artifactId>schema-service</artifactId>
@@ -45,7 +45,7 @@
             Nexus Proxy Properties and Snapshot Locations
             Ideally this can be overwritten at runtime per internal environment specific values at runtime
         -->
-        <aai.common.version>1.9.4</aai.common.version>
+        <aai.common.version>1.15.2</aai.common.version>
         <nexusproxy>https://nexus.onap.org</nexusproxy>
         <site.path>/content/sites/site/org/onap/aai/resources/${project.artifactId}/${project.version}</site.path>
         <release.path>/content/repositories/releases/</release.path>
         <aai.project.version>${project.version}</aai.project.version>
         <checkstyle.skip>false</checkstyle.skip>
     </properties>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.eclipse.persistence</groupId>
+                <artifactId>eclipselink</artifactId>
+                <version>2.7.15</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.persistence</groupId>
+                <artifactId>org.eclipse.persistence.moxy</artifactId>
+                <version>2.7.15</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <build>
         <pluginManagement>
             <plugins>