Update aai-common version to 1.13.4 in graphadmin 37/137337/8
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 21 Feb 2024 14:15:39 +0000 (15:15 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 22 Feb 2024 15:59:47 +0000 (16:59 +0100)
- update to 1.13.4
- bump activemq dep to fix security vulnerability
- update mockito from 1.X to 3.4
- bump graphadmin version to 1.13.4 to be in sync with aai-common

Issue-ID: AAI-3784
Change-Id: Idcaf9b18ce6cb100b5db88ce0fc6d62157b6c387
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
12 files changed:
pom.xml
src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java
src/main/java/org/onap/aai/rest/util/EchoResponse.java
src/test/java/org/onap/aai/MetricsConfigurationTest.java
src/test/java/org/onap/aai/audit/AuditGraphson2SqlTest.java
src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java
src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java
src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java
src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java
src/test/java/org/onap/aai/migration/v20/MigrateL2DefaultToFalseTest.java
version.properties

diff --git a/pom.xml b/pom.xml
index b15ee5a..59fcddd 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
     <parent>
         <groupId>org.onap.aai.aai-common</groupId>
         <artifactId>aai-parent</artifactId>
-        <version>1.9.4</version>
+        <version>1.13.4</version>
     </parent>
     <groupId>org.onap.aai.graphadmin</groupId>
     <artifactId>aai-graphadmin</artifactId>
-    <version>1.12.3-SNAPSHOT</version>
+    <version>1.13.4-SNAPSHOT</version>
 
     <properties>
 
         <!-- Start of Compiler Related Properties -->
-             <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>
@@ -56,7 +55,7 @@
         <docker.push.registry>localhost:5000</docker.push.registry>
         <aai.docker.version>1.0.0</aai.docker.version>
         <aai.schema.service.version>1.12.3</aai.schema.service.version>
-        <aai.common.version>1.9.4</aai.common.version>
+        <aai.common.version>1.13.4</aai.common.version>
         <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/
         </aai.build.directory>
         <aai.docker.namespace>onap</aai.docker.namespace>
@@ -72,7 +71,7 @@
             Nexus Proxy Properties and Snapshot Locations
             Ideally this can be overwritten at runtime per internal environment specific values at runtime
         -->
-        <nexusproxy>https://nexus.onap.org</nexusproxy>
+        <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
         <site.path>/content/sites/site/org/onap/aai/graphadmin/${project.artifactId}/${project.version}</site.path>
         <release.path>/content/repositories/releases/</release.path>
         <snapshot.path>/content/repositories/snapshots/</snapshot.path>
         <micrometer.core.version>1.8.1</micrometer.core.version>
         <micrometer.registry.prometheus.version>1.8.1</micrometer.registry.prometheus.version>
         <micrometer.jersey2.version>1.8.1</micrometer.jersey2.version>
-        <spring.boot.starter.actuator.version>2.1.12.RELEASE</spring.boot.starter.actuator.version>
+        <activemq.version>5.16.7</activemq.version>
+        <antlr.version>4.9.3</antlr.version>
         <!-- End of graphadmin metric collection Properties -->
     </properties>
 
         </profile>
     </profiles>
 
+    <dependencyManagement>
+        <dependencies>
+            <!-- Keeping guava at 19 is necessary here, since the janusgraph-cql driver in version
+                 2.3 has a dependency on it. Remove this override, once we are using janusgraph > 0.2.3/tinkerpop > 3.2.3
+            -->
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava</artifactId>
+                <version>19.0</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <!-- Start of graphadmin metric collection dependencies -->
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>
             <artifactId>tinkergraph-gremlin</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.antlr</groupId>
-            <artifactId>antlr4-runtime</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>
             <artifactId>gremlin-core</artifactId>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
         </dependency>
-        <!-- Start of JAXB Dependencies -->
-        <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
-        </dependency>
-        <!-- End of JAXB Dependencies -->
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
         <dependency>
             <groupId>org.apache.activemq</groupId>
             <artifactId>activemq-broker</artifactId>
+            <version>${activemq.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.activemq</groupId>
             <artifactId>activemq-client</artifactId>
+            <version>${activemq.version}</version>
         </dependency>
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-jetty</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-jersey</artifactId>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
-            <version>${spring.boot.starter.actuator.version}</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.springframework.boot</groupId>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
+            <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
             <artifactId>jsonassert</artifactId>
             <scope>test</scope>
         </dependency>
-        <!-- End of Junit Test Dependencies -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+          </dependency>
+        <!-- TODO: Migrate tests to junit 5 and remove this dependency -->
+        <dependency>
+            <groupId>org.junit.vintage</groupId>
+            <artifactId>junit-vintage-engine</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                    <exclusion>
+                            <groupId>org.hamcrest</groupId>
+                            <artifactId>hamcrest-core</artifactId>
+                    </exclusion>
+            </exclusions>
+        </dependency>
     </dependencies>
 
     <build>
             <plugin>
                 <groupId>org.antlr</groupId>
                 <artifactId>antlr4-maven-plugin</artifactId>
-                <version>4.7</version>
+                <version>${antlr.version}</version>
                 <executions>
                     <execution>
                         <goals>
index 6aa180b..ecaff91 100644 (file)
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.annotation.Priority;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.HttpMethod;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.PreMatching;
@@ -86,11 +87,13 @@ public class RequestTransactionLogging extends AAIContainerFilter implements Con
                String contentType = headersMap.getFirst(CONTENT_TYPE);
                String acceptType  = headersMap.getFirst(ACCEPT);
 
-               if(contentType == null || contentType.contains(TEXT_PLAIN)){
+               if(contentType == null && !requestContext.getMethod().equals(HttpMethod.GET.toString())){
+                       LOGGER.debug("Content Type header missing in the request, adding one of [{}]", DEFAULT_CONTENT_TYPE);
                        requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
                }
 
-               if(acceptType == null || acceptType.contains(TEXT_PLAIN)){
+               if(acceptType == null){
+                       LOGGER.debug("Accept header missing in the request, adding one of [{}]", DEFAULT_RESPONSE_TYPE);
                        requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
                }
        }
index 05ff38e..91841df 100644 (file)
@@ -94,7 +94,7 @@ public class EchoResponse extends RESTAPI {
                                
                        response = Response.status(Status.OK)
                                        .entity(ErrorLogHelper.getRESTAPIInfoResponse(
-                                                       headers.getAcceptableMediaTypes(), exceptionList))
+                                                       new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
                                                        .build();
                        
                } catch (Exception e) {
@@ -106,7 +106,7 @@ public class EchoResponse extends RESTAPI {
                        response = Response
                                        .status(Status.INTERNAL_SERVER_ERROR)
                                        .entity(ErrorLogHelper.getRESTAPIErrorResponse(
-                                                       headers.getAcceptableMediaTypes(), ex,
+                                                       new ArrayList<>(headers.getAcceptableMediaTypes()), ex,
                                                        templateVars)).build();
 
                } finally {
index d0c0ce4..68b2ca8 100644 (file)
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
 
 
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 import java.util.Base64;
 import java.util.Collections;
 import org.junit.Before;
@@ -37,6 +38,7 @@ import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort;
+import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
 import org.springframework.boot.web.server.LocalServerPort;
@@ -51,6 +53,7 @@ import org.springframework.web.client.RestTemplate;
 /**
  * Test management endpoints against configuration resource.
  */
+@AutoConfigureMetrics
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
     classes = {SpringContextAware.class, GraphAdminApp.class})
 @ContextConfiguration(initializers = PropertyPasswordConfiguration.class, classes = {SpringContextAware.class})
@@ -91,14 +94,12 @@ public class MetricsConfigurationTest {
 
         headers = new HttpHeaders();
 
-        headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
-        headers.setContentType(MediaType.APPLICATION_JSON);
+        headers.setAccept(Arrays.asList(MediaType.TEXT_PLAIN));
         headers.add("Real-Time", "true");
         headers.add("X-FromAppId", "JUNIT");
         headers.add("X-TransactionId", "JUNIT");
 
-        String authorization = Base64.getEncoder().encodeToString("AAI:AAI".getBytes("UTF-8"));
-        headers.add("Authorization", "Basic " + authorization);
+        headers.setBasicAuth("AAI","AAI");
 
         httpEntity = new HttpEntity<String>(headers);
         baseUrl = "http://localhost:" + randomPort;
@@ -108,15 +109,16 @@ public class MetricsConfigurationTest {
 
     @Test
     public void testManagementEndpointConfiguration() {
-        ResponseEntity responseEntity = null;
+        ResponseEntity<String> responseEntity = null;
         String responseBody = null;
 
         //set Accept as text/plain in order to get access of endpoint "/actuator/prometheus"
         headers.set("Accept", "text/plain");
+        headers.setAccept(Arrays.asList(MediaType.TEXT_PLAIN));
         httpEntity = new HttpEntity<String>(headers);
         responseEntity =
             restTemplate.exchange(actuatorUrl + "/actuator/prometheus", HttpMethod.GET, httpEntity, String.class);
-        responseBody = (String) responseEntity.getBody();
+        responseBody = responseEntity.getBody();
         assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
 
         //Set Accept as MediaType.APPLICATION_JSON in order to get access of endpoint "/actuator/info" and "/actuator/health"
@@ -124,7 +126,7 @@ public class MetricsConfigurationTest {
         httpEntity = new HttpEntity<String>(headers);
         responseEntity =
             restTemplate.exchange(actuatorUrl + "/actuator/info", HttpMethod.GET, httpEntity, String.class);
-        responseBody = (String) responseEntity.getBody();
+        responseBody = responseEntity.getBody();
         assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
 
         responseEntity =
index 2bc6250..aa8236e 100644 (file)
@@ -22,22 +22,18 @@ package org.onap.aai.audit;
 
 import com.google.gson.JsonObject;
 import org.junit.Before;
-import org.junit.FixMethodOrder;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.junit.runners.MethodSorters;
 import org.mockito.Mock;
 
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.mock;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.when;
 import org.onap.aai.AAISetup;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
-import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.rest.client.ApertureService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.TestPropertySource;
 
 import java.io.IOException;
 import java.util.HashMap;
index c297f78..d3fbec7 100644 (file)
@@ -35,7 +35,8 @@ import org.junit.Test;
 import org.onap.aai.AAISetup;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
-import org.springframework.boot.test.rule.OutputCapture;
+import org.springframework.boot.test.system.OutputCaptureRule;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -66,7 +67,7 @@ public class DataSnapshot4HistInitTest extends AAISetup {
     private DataSnapshot4HistInit dataSnapshot4HistInit;
 
     @Rule
-    public OutputCapture outputCapture = new OutputCapture();
+    public OutputCaptureRule outputCapture = new OutputCaptureRule();
 
     @Before
     public void setup() throws AAIException {
index 7f511e6..9d74651 100644 (file)
@@ -33,14 +33,8 @@ import org.junit.Test;
 import org.onap.aai.AAISetup;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.util.AAIConstants;
-import org.onap.aai.util.FormatDate;
-import org.onap.aai.util.GraphAdminDBUtils;
-import org.springframework.boot.test.rule.OutputCapture;
+import org.springframework.boot.test.system.OutputCaptureRule;
 
-import com.beust.jcommander.ParameterException;
-
-import java.lang.NumberFormatException;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -66,7 +60,7 @@ public class DataSnapshotTest extends AAISetup {
     private static final int DELAYSINGLETHREADTEST = 90;
 
     @Rule
-    public OutputCapture outputCapture = new OutputCapture();
+    public OutputCaptureRule outputCapture = new OutputCaptureRule();
 
     @Before
     public void setup() throws AAIException {
index adcde4e..893a197 100644 (file)
@@ -37,13 +37,8 @@ import org.onap.aai.datagrooming.DataGrooming;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 
-import org.onap.aai.logging.LogFormatTools;
-import org.onap.aai.util.AAISystemExitUtil;
-import org.springframework.boot.test.rule.OutputCapture;
+import org.springframework.boot.test.system.OutputCaptureRule;
 
-import com.beust.jcommander.ParameterException;
-
-import java.lang.NumberFormatException;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -73,7 +68,7 @@ public class DataSnapshotTest4HistInit extends AAISetup {
     private DataSnapshot4HistInit dataSnapshot4HistInit;
 
     @Rule
-    public OutputCapture outputCapture = new OutputCapture();
+    public OutputCaptureRule outputCapture = new OutputCaptureRule();
 
     @Before
     public void setup() throws AAIException {
index 8c79cc1..b6d12cd 100644 (file)
@@ -23,32 +23,15 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.janusgraph.core.JanusGraphTransaction;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
-import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.onap.aai.AAISetup;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.setup.SchemaVersions;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import static org.mockito.Mockito.when;
 
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.*;
 
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index caccccf..e66cca3 100644 (file)
@@ -23,32 +23,15 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.janusgraph.core.JanusGraphTransaction;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
-import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.onap.aai.AAISetup;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.setup.SchemaVersions;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import static org.mockito.Mockito.when;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.*;
 
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index cba5c45..94413f8 100644 (file)
@@ -33,7 +33,7 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersions;
 
-import edu.emory.mathcs.backport.java.util.Arrays;
+import java.util.Arrays;
 
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.spy;
index 60c0073..c5bbf54 100644 (file)
@@ -4,8 +4,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major_version=1
-minor_version=12
-patch_version=3
+minor_version=13
+patch_version=4
 
 base_version=${major_version}.${minor_version}.${patch_version}