From 0b6288e180c1d33bba88b3df5e03442c57058db9 Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Wed, 29 Aug 2018 15:40:53 +0530 Subject: Added support for VF Module Delete recipe Enhanced SOActorServiceProvider to support VF Module Delete Recipe. Added SOOperationType enum to map the policy recipe with the SO API that we want to call for a recipe. vf module id from non-base vf module is used to construct the delete request url and same will be deleted. Updated SOManager so that it sends request to SO based on the SOOperationType enum value. Enhanced RESTManager to add support for the http delete using new class HttpDeleteWithBody (to allow pass the payload to the SO delete VF module API). Change-Id: I15b678ed9ebc85dfa7cb62bbf23e41c0fe6e4c69 Issue-ID: POLICY-1079 Signed-off-by: Piyush Garg --- .../java/org/onap/policy/simulators/GuardSimulatorTest.java | 12 ++++++------ .../java/org/onap/policy/simulators/SoSimulatorTest.java | 2 +- .../java/org/onap/policy/simulators/VfcSimulatorTest.java | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'controlloop/common/simulators') 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 cebf5f7fe..3768b1b32 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 @@ -60,16 +60,16 @@ public class GuardSimulatorTest { Pair 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); + assertNotNull(response.first); + assertNotNull(response.second); + assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.second); request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard"); response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); assertNotNull(response); - assertNotNull(response.a); - assertNotNull(response.b); - assertEquals("{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}", response.b); + assertNotNull(response.first); + assertNotNull(response.second); + assertEquals("{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}", response.second); } private static String makeRequest(String actor, String recipe, String target, String clName) { 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 4fce837b9..772dd7f2c 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 @@ -142,7 +142,7 @@ public class SoSimulatorTest { "http://localhost:6667/serviceInstantiation/v7/12345/vnfs/12345/vfModules/scaleOut", "username", "password", new HashMap<>(), "application/json", request); assertNotNull(httpDetails); - final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); + final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, SOResponse.class); assertNotNull(response); } } 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 8a7afb959..0e083bb6c 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 @@ -63,8 +63,8 @@ public class VfcSimulatorTest { new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", new HashMap(), "application/json", "Some Request Here"); assertNotNull(httpDetails); - assertTrue(httpDetails.a == 202); - final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class); + assertTrue(httpDetails.first == 202); + final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VFCResponse.class); assertNotNull(response); } @@ -73,7 +73,7 @@ public class VfcSimulatorTest { final Pair httpDetails = new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", new HashMap()); assertNotNull(httpDetails); - final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class); + final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VFCResponse.class); assertNotNull(response); } } -- cgit 1.2.3-korg