summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/test
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-11-13 10:59:02 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-11-13 12:00:27 +0100
commitd63391e88b8f87a169e3468669cd6268014b1da8 (patch)
tree0fa14fdd79213f22ef3424d643d0ee3ca1b5de32 /aai-traversal/src/test
parent818806ec5b3810da0599aa0a7538583cdcc0bfca (diff)
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 <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-traversal/src/test')
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java27
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java8
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java12
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java72
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/CQAllChildernFromPnfStateTest.java18
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleEdgeTest.java27
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleNodeDeletedThenRecreatedTest.java21
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleSingleNodeTest.java21
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateEdgeTest.java29
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateTest.java25
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java8
-rw-r--r--aai-traversal/src/test/resources/application-onap-test.properties10
-rw-r--r--aai-traversal/src/test/resources/application-test.properties6
-rw-r--r--aai-traversal/src/test/resources/logback.xml7
14 files changed, 175 insertions, 116 deletions
diff --git a/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
index 266cb60..652c2f3 100644
--- a/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
@@ -25,14 +25,20 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.fail;
-import com.jayway.jsonpath.JsonPath;
-
-import java.util.*;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraphTransaction;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
import org.onap.aai.config.PropertyPasswordConfiguration;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
@@ -44,13 +50,20 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.web.client.RestTemplate;
+import com.jayway.jsonpath.JsonPath;
+
/**
* A sample junit test using spring boot that provides the ability to spin
* up the application from the junit layer and run rest requests against
@@ -92,8 +105,8 @@ public class AAIGremlinQueryTest {
@BeforeClass
public static void setupConfig() throws AAIException {
- System.setProperty("AJSC_HOME", "./");
- System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
AAIConfig.init();
}
diff --git a/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
index 8c6364d..e3351ae 100644
--- a/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
@@ -25,9 +25,6 @@ import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -57,6 +54,9 @@ import org.onap.aai.exceptions.AAIException;
import org.onap.aai.rest.util.AAIExtensionMap;
import org.onap.aai.util.AAIConstants;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
public class SearchGraphNamedQueryTest extends AAISetup {
protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
@@ -83,7 +83,7 @@ public class SearchGraphNamedQueryTest extends AAISetup {
private HttpTestUtil httpTestUtil;
private String getJsonValue(String json, String key) {
- JsonObject jsonObj = new JsonParser().parse(json).getAsJsonObject();
+ JsonObject jsonObj = JsonParser.parseString(json).getAsJsonObject();
String strValue = "";
if (jsonObj.isJsonObject()) {
strValue = jsonObj.get(key).getAsString();
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
index ac71b57..21a7862 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
@@ -29,10 +29,13 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphTransaction;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
import org.onap.aai.TraversalApp;
import org.onap.aai.TraversalTestConfiguration;
-import org.onap.aai.config.PropertyPasswordConfiguration;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.nodes.NodeIngestor;
@@ -44,7 +47,6 @@ import org.springframework.context.annotation.Import;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
@@ -79,8 +81,8 @@ public abstract class AbstractSpringRestTest {
@BeforeClass
public static void setupConfig() throws AAIException {
- System.setProperty("AJSC_HOME", "./");
- System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
}
@Before
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java
index b72107f..b02911a 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java
@@ -22,14 +22,16 @@ package org.onap.aai.rest;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -42,7 +44,16 @@ import org.onap.aai.util.AAIConfig;
import org.onap.aai.util.TraversalConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
public class DslConsumerTest extends AbstractSpringRestTest {
@@ -330,8 +341,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
JsonObject properties = resultsValue.get("properties").getAsJsonObject();
@@ -358,8 +368,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
JsonObject properties = resultsValue.get("properties").getAsJsonObject();
@@ -387,8 +396,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
JsonObject properties = resultsValue.get("pserver").getAsJsonObject();
@@ -416,8 +424,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
JsonObject properties = resultsValue.get("pserver").getAsJsonObject();
@@ -446,8 +453,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
JsonObject properties = resultsValue.get("pserver").getAsJsonObject();
@@ -475,8 +481,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
JsonObject properties = resultsValue.get("pserver").getAsJsonObject();
@@ -502,8 +507,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
assertNull(
@@ -546,8 +550,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonArray resultsValue = resultsArray.get(0).getAsJsonArray();
assertNotNull(resultsValue.get(1).getAsJsonObject()
@@ -592,8 +595,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject properties = resultsArray.get(0).getAsJsonObject()
.get("/aai/v16/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
@@ -626,8 +628,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
assertEquals(1, resultsArray.size()); // Returns only test-pserver-dsl, does not return
// test-pserver-dsl-03 since it does not have an edge
@@ -654,8 +655,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
assertEquals(1, resultsArray.size()); // Returns only test-pserver-dsl-02
assertEquals(null, resultsArray.get(0).getAsJsonObject()
@@ -698,8 +698,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultValue = resultsArray.get(0).getAsJsonObject();
JsonObject complex = resultValue.get("complex").getAsJsonObject();
@@ -721,8 +720,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
String responseString = responseEntity.getBody().toString();
// Extract the properties array from the response and compare in assert statements
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
for (JsonElement je : resultsArray) {
JsonObject jo = je.getAsJsonObject();
@@ -752,8 +750,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString(); // pnf should have no results
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
boolean hasPserver1 = false, hasPserver2 = false;
for (JsonElement je : resultsArray) {
@@ -791,8 +788,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
String responseString = responseEntity.getBody().toString();
- JsonParser jsonParser = new JsonParser();
- JsonObject results = jsonParser.parse(responseString).getAsJsonObject();
+ JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
for (JsonElement je : resultsArray) {
JsonObject jo = je.getAsJsonObject();
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/CQAllChildernFromPnfStateTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/CQAllChildernFromPnfStateTest.java
index 472cffb..7442386 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/CQAllChildernFromPnfStateTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/CQAllChildernFromPnfStateTest.java
@@ -20,12 +20,9 @@
package org.onap.aai.rest.history;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.HashSet;
@@ -45,6 +42,11 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
@Ignore("The state format requires the history schema to be loaded. "
+ "Because aaigraph is a singleton its very complicated to have 2 different schemas loaded for testing. "
+ "This needs to be addressed.")
@@ -146,7 +148,7 @@ public class CQAllChildernFromPnfStateTest extends AbstractSpringHistoryRestTest
httpEntity = new HttpEntity(payload.toString(), headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
@@ -162,7 +164,7 @@ public class CQAllChildernFromPnfStateTest extends AbstractSpringHistoryRestTest
httpEntity = new HttpEntity(payload.toString(), headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleEdgeTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleEdgeTest.java
index d26eff2..3411c2a 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleEdgeTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleEdgeTest.java
@@ -20,14 +20,18 @@
package org.onap.aai.rest.history;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import java.util.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -44,6 +48,11 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
@Ignore("The lifecycle format requires the history schema to be loaded. "
+ "Because aaigraph is a singleton its very complicated to have 2 different schemas loaded for testing. "
+ "This needs to be addressed.")
@@ -148,7 +157,7 @@ public class DslConsumerHistoryLifecycleEdgeTest extends AbstractSpringHistoryRe
httpEntity = new HttpEntity(payload, headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleNodeDeletedThenRecreatedTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleNodeDeletedThenRecreatedTest.java
index dc794b8..4a94504 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleNodeDeletedThenRecreatedTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleNodeDeletedThenRecreatedTest.java
@@ -20,13 +20,16 @@
package org.onap.aai.rest.history;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.janusgraph.core.JanusGraphTransaction;
@@ -42,6 +45,10 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
@Ignore("The lifecycle format requires the history schema to be loaded. "
+ "Because aaigraph is a singleton its very complicated to have 2 different schemas loaded for testing. "
+ "This needs to be addressed.")
@@ -200,7 +207,7 @@ public class DslConsumerHistoryLifecycleNodeDeletedThenRecreatedTest
httpEntity = new HttpEntity(payload, headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleSingleNodeTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleSingleNodeTest.java
index 6d1a36c..88cc91c 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleSingleNodeTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryLifecycleSingleNodeTest.java
@@ -20,13 +20,16 @@
package org.onap.aai.rest.history;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.janusgraph.core.JanusGraphTransaction;
@@ -42,6 +45,10 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
@Ignore("The lifecycle format requires the history schema to be loaded. "
+ "Because aaigraph is a singleton its very complicated to have 2 different schemas loaded for testing. "
+ "This needs to be addressed.")
@@ -141,7 +148,7 @@ public class DslConsumerHistoryLifecycleSingleNodeTest extends AbstractSpringHis
httpEntity = new HttpEntity(payload, headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateEdgeTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateEdgeTest.java
index 6b9815c..1a88c8b 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateEdgeTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateEdgeTest.java
@@ -20,14 +20,20 @@
package org.onap.aai.rest.history;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import java.util.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -44,6 +50,11 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
@Ignore("The state format requires the history schema to be loaded. "
+ "Because aaigraph is a singleton its very complicated to have 2 different schemas loaded for testing. "
+ "This needs to be addressed.")
@@ -148,7 +159,7 @@ public class DslConsumerHistoryStateEdgeTest extends AbstractSpringHistoryRestTe
httpEntity = new HttpEntity(payload, headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateTest.java
index 5b08d83..1596fd4 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/DslConsumerHistoryStateTest.java
@@ -20,13 +20,18 @@
package org.onap.aai.rest.history;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.util.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.janusgraph.core.JanusGraphTransaction;
@@ -42,6 +47,10 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
@Ignore("The state format requires the history schema to be loaded. "
+ "Because aaigraph is a singleton its very complicated to have 2 different schemas loaded for testing. "
+ "This needs to be addressed.")
@@ -179,7 +188,7 @@ public class DslConsumerHistoryStateTest extends AbstractSpringHistoryRestTest {
httpEntity = new HttpEntity(payload, headers);
ResponseEntity responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- JsonArray results = new JsonParser().parse(responseEntity.getBody().toString())
+ JsonArray results = JsonParser.parseString(responseEntity.getBody().toString())
.getAsJsonObject().getAsJsonArray("results");
LOGGER.debug("Response for PUT request with uri {} : {}", baseUrl + endpoint,
responseEntity.getBody());
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java
index 08136c2..bdd52ee 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java
@@ -157,9 +157,9 @@ public abstract class QueryTest {
addParam(params);
when(dbEngine.getQueryBuilder(any(QueryStyle.class)))
.thenReturn(new GremlinTraversal<>(loader, graph.traversal()));
- logger.info("Stored query in abstraction form {}", query);
+ logger.debug("Stored query in abstraction form {}", query);
query = new GroovyQueryBuilder().executeTraversal(dbEngine, query, params);
- logger.info("After converting to gremlin query {}", query);
+ logger.debug("After converting to gremlin query {}", query);
query = "g" + query;
GraphTraversal<Vertex, Vertex> g = graph.traversal().V();
addStartNode(g);
@@ -173,8 +173,8 @@ public abstract class QueryTest {
List<Vertex> vertices = result.toList();
- logger.info("Expected result set of vertexes [{}]", convert(expectedResult));
- logger.info("Actual Result set of vertexes [{}]", convert(vertices));
+ logger.debug("Expected result set of vertexes [{}]", convert(expectedResult));
+ logger.debug("Actual Result set of vertexes [{}]", convert(vertices));
List<Vertex> nonDuplicateExpectedResult = new ArrayList<>(new HashSet<>(expectedResult));
vertices = new ArrayList<>(new HashSet<>(vertices));
diff --git a/aai-traversal/src/test/resources/application-onap-test.properties b/aai-traversal/src/test/resources/application-onap-test.properties
index 7d70fac..24bff05 100644
--- a/aai-traversal/src/test/resources/application-onap-test.properties
+++ b/aai-traversal/src/test/resources/application-onap-test.properties
@@ -7,7 +7,7 @@ info.build.version=1.1.0
spring.application.name=aai-traversal
spring.jersey.type=filter
-server.contextPath=/
+server.servlet.context-path=/
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
spring.jersey.application-path=${schema.uri.base.path}
@@ -25,14 +25,14 @@ server.context_parameters.p-name=value #context parameter with p-name as key and
# 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=src/main/resources/
-server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties
+server.local.startpath=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
-server.ssl.key-store=${server.local.startpath}etc/auth/aai-client-cert.p12
+server.ssl.key-store=${server.local.startpath}/etc/auth/aai-client-cert.p12
server.ssl.key-store-password=password(1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o)
-server.ssl.trust-store=${server.local.startpath}etc/auth/tomcat_keystore
+server.ssl.trust-store=${server.local.startpath}/etc/auth/tomcat_keystore
server.ssl.trust-store-password=password(1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o)
server.ssl.client-auth=want
server.ssl.key-store-type=JKS
diff --git a/aai-traversal/src/test/resources/application-test.properties b/aai-traversal/src/test/resources/application-test.properties
index 72f28b7..d2ad6a6 100644
--- a/aai-traversal/src/test/resources/application-test.properties
+++ b/aai-traversal/src/test/resources/application-test.properties
@@ -30,14 +30,14 @@ server.context_parameters.p-name=value #context parameter with p-name as key and
# 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=src/main/resources/
-server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties
+server.local.startpath=src/main/resources
+server.basic.auth.location=${server.local.startpath}/etc/auth/realm.properties
server.port=8446
security.require-ssl=false
server.ssl.enabled=false
#server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
-#server.ssl.key-store=${server.local.startpath}etc/auth/aai_keystore
+#server.ssl.key-store=${server.local.startpath}/etc/auth/aai_keystore
#server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
#server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
#server.ssl.client-auth=want
diff --git a/aai-traversal/src/test/resources/logback.xml b/aai-traversal/src/test/resources/logback.xml
index 4b969b1..fc275dd 100644
--- a/aai-traversal/src/test/resources/logback.xml
+++ b/aai-traversal/src/test/resources/logback.xml
@@ -299,7 +299,7 @@
<logger name="org.zookeeper" level="OFF" />
- <logger name="org.onap.aai" level="DEBUG" additivity="false">
+ <logger name="org.onap.aai" level="INFO" additivity="false">
<appender-ref ref="asyncDEBUG" />
<appender-ref ref="asyncSANE" />
<appender-ref ref="STDOUT" />
@@ -338,6 +338,9 @@
<appender-ref ref="dmaapAAIEventConsumerInfo" />
</logger>
+ <logger name="org.onap.aai.dbgen" level="WARN"/>
+ <logger name="org.onap.aai.aailog" level="WARN"/>
+
<!-- ============================================================================ -->
<!-- General EELF logger -->
<!-- ============================================================================ -->
@@ -347,7 +350,7 @@
<appender-ref ref="asyncMETRIC" />
</logger>
- <root level="DEBUG">
+ <root level="INFO">
<appender-ref ref="external" />
<appender-ref ref="STDOUT" />
</root>