diff options
Diffstat (limited to 'controlloop/common/simulators')
5 files changed, 21 insertions, 20 deletions
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java index 2f511f4bc..c6b22cf70 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java @@ -52,9 +52,9 @@ public class AaiSimulatorJaxRs { { AAINQRequest request = Serialization.gsonPretty.fromJson(req, AAINQRequest.class); - if (request.instanceFilters.getInstanceFilter().get(0).containsKey("vserver")) + if (request.getInstanceFilters().getInstanceFilter().get(0).containsKey("vserver")) { - String vserverName = request.instanceFilters.getInstanceFilter().get(0).get("vserver").get("vserver-name"); + String vserverName = request.getInstanceFilters().getInstanceFilter().get(0).get("vserver").get("vserver-name"); if ("error".equals(vserverName)) { return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\"getNamedQueryResponse\",\"Node Not Found:No Node of type vserver found for properties\",\"ERR.5.4.6114\"]}}}"; } @@ -66,7 +66,7 @@ public class AaiSimulatorJaxRs { } else { - String vnfID = request.instanceFilters.getInstanceFilter().get(0).get("generic-vnf").get("vnf-id"); + String vnfID = request.getInstanceFilters().getInstanceFilter().get(0).get("generic-vnf").get("vnf-id"); if ("error".equals(vnfID)) { return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\"getNamedQueryResponse\",\"Node Not Found:No Node of type generic-vnf found for properties\",\"ERR.5.4.6114\"]}}}"; } diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java index 66c65ff82..86168e899 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java @@ -41,6 +41,7 @@ import org.onap.policy.aai.AAINQRequest; import org.onap.policy.aai.AAINQResponse; import org.onap.policy.drools.http.server.HttpServletServer; import org.onap.policy.drools.utils.LoggerUtil; +import org.onap.policy.rest.RESTManager; public class AaiSimulatorTest { @@ -62,11 +63,11 @@ public class AaiSimulatorTest { @Test public void testGet() { - final AAIGETVnfResponse response = AAIManager.getQueryByVnfID( + final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID( "http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass", UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792"); assertNotNull(response); - assertNotNull(response.relationshipList); + assertNotNull(response.getRelationshipList()); } @Test @@ -74,9 +75,9 @@ public class AaiSimulatorTest { final AAINQRequest request = new AAINQRequest(); final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters(); final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery(); - tempNamedQuery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); - tempQueryParameters.namedQuery = tempNamedQuery; - request.queryParameters = tempQueryParameters; + tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469")); + tempQueryParameters.setNamedQuery(tempNamedQuery); + request.setQueryParameters(tempQueryParameters); Map<String, String> tempInnerMap = new HashMap<>(); tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1"); Map<String, Map<String, String>> tempOuterMap = new HashMap<>(); @@ -85,16 +86,16 @@ public class AaiSimulatorTest { tempInstanceFilter.add(tempOuterMap); AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters(); tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.instanceFilters = tempInstanceFilters; + request.setInstanceFilters(tempInstanceFilters); - AAINQResponse response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", + AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID()); assertNotNull(response); assertNotNull(response.getInventoryResponseItems()); - tempNamedQuery.namedQueryUUID = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"); - tempQueryParameters.namedQuery = tempNamedQuery; - request.queryParameters = tempQueryParameters; + tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087")); + tempQueryParameters.setNamedQuery(tempNamedQuery); + request.setQueryParameters(tempQueryParameters); tempInnerMap = new HashMap<>(); tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb"); tempOuterMap = new HashMap<>(); @@ -103,9 +104,9 @@ public class AaiSimulatorTest { tempInstanceFilter.add(tempOuterMap); tempInstanceFilters = new AAINQInstanceFilters(); tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.instanceFilters = tempInstanceFilters; + request.setInstanceFilters(tempInstanceFilters); - response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", request, + response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID()); assertNotNull(response); assertNotNull(response.getInventoryResponseItems()); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java index 86e2c8cf9..ea13ec445 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java @@ -54,14 +54,14 @@ public class GuardSimulatorTest { public void testGuard() { String request = makeRequest("test_actor_id", "test_op_id", "test_target", "test_clName"); String url = "http://localhost:" + Util.GUARDSIM_SERVER_PORT + "/pdp/api/getDecision"; - Pair<Integer, String> response = RESTManager.post(url, "testUname", "testPass", null, "application/json", request); + Pair<Integer, String> response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); assertNotNull(response); assertNotNull(response.a); assertNotNull(response.b); assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.b); request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard"); - response = RESTManager.post(url, "testUname", "testPass", null, "application/json", request); + response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); assertNotNull(response); assertNotNull(response.a); assertNotNull(response.b); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 3aaf1dc55..8054d214a 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -138,7 +138,7 @@ public class SoSimulatorTest { @Test public void testResponse() { final String request = Serialization.gsonPretty.toJson(this.createTestRequest()); - final Pair<Integer, String> httpDetails = RESTManager.post( + final Pair<Integer, String> httpDetails = new RESTManager().post( "http://localhost:6667/serviceInstances/v5/12345/vnfs/12345/vfModules", "username", "password", new HashMap<>(), "application/json", request); assertNotNull(httpDetails); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java index a063277ed..4c29331bf 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java @@ -57,7 +57,7 @@ public class VfcSimulatorTest { @Test public void testPost() { final Pair<Integer, String> httpDetails = - RESTManager.post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", + new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", new HashMap<String, String>(), "application/json", "Some Request Here"); assertNotNull(httpDetails); assertTrue(httpDetails.a == 202); @@ -69,7 +69,7 @@ public class VfcSimulatorTest { @Test public void testGet() { final Pair<Integer, String> httpDetails = - RESTManager.get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", + new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", new HashMap<String, String>()); assertNotNull(httpDetails); final VFCResponse response = |