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;
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 {
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();
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();
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();
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();
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();
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();
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(
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()
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")
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
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()
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();
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();
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) {
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();