<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>
<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>
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>
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;
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);
}
}
response = Response.status(Status.OK)
.entity(ErrorLogHelper.getRESTAPIInfoResponse(
- headers.getAcceptableMediaTypes(), exceptionList))
+ new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
.build();
} catch (Exception e) {
response = Response
.status(Status.INTERNAL_SERVER_ERROR)
.entity(ErrorLogHelper.getRESTAPIErrorResponse(
- headers.getAcceptableMediaTypes(), ex,
+ new ArrayList<>(headers.getAcceptableMediaTypes()), ex,
templateVars)).build();
} finally {
import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import org.junit.Before;
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;
/**
* 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})
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;
@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"
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 =
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;
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;
private DataSnapshot4HistInit dataSnapshot4HistInit;
@Rule
- public OutputCapture outputCapture = new OutputCapture();
+ public OutputCaptureRule outputCapture = new OutputCaptureRule();
@Before
public void setup() throws AAIException {
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;
private static final int DELAYSINGLETHREADTEST = 90;
@Rule
- public OutputCapture outputCapture = new OutputCapture();
+ public OutputCaptureRule outputCapture = new OutputCaptureRule();
@Before
public void setup() throws AAIException {
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;
private DataSnapshot4HistInit dataSnapshot4HistInit;
@Rule
- public OutputCapture outputCapture = new OutputCapture();
+ public OutputCaptureRule outputCapture = new OutputCaptureRule();
@Before
public void setup() throws AAIException {
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)
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)
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;
# 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}