diff options
author | Piyush Garg <piyush.garg1@amdocs.com> | 2018-08-29 15:40:53 +0530 |
---|---|---|
committer | Piyush Garg <piyush.garg1@amdocs.com> | 2018-08-31 20:48:21 +0000 |
commit | 0b6288e180c1d33bba88b3df5e03442c57058db9 (patch) | |
tree | 072c9c553f9ac7a4874ce97101be5c6e211d547e /controlloop/common/model-impl/rest/src/test | |
parent | 8279af376b435e1d7dd118a1955c5681edf3b847 (diff) |
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 <piyush.garg1@amdocs.com>
Diffstat (limited to 'controlloop/common/model-impl/rest/src/test')
3 files changed, 49 insertions, 13 deletions
diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java new file mode 100644 index 000000000..0cb5f3aef --- /dev/null +++ b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START======================================================= + * rest + * ================================================================================ + * Copyright (C) 2018 Amdocs. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.rest; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class HttpDeleteWithBodyTest { + + @Test + public void getMethod() { + String url = "http://www.example.org"; + HttpDeleteWithBody deleteWithBody = new HttpDeleteWithBody(url); + assertEquals("DELETE", deleteWithBody.getMethod()); + assertEquals(url, deleteWithBody.getURI().toString()); + } +}
\ No newline at end of file diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java index a8301810c..7e881df51 100755 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java +++ b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java @@ -39,9 +39,9 @@ public class TestGet { RESTManager mgr = new RESTManager(); Pair<Integer, String> result = mgr.get("http://www.example.org", null, null, null); - assertEquals((Integer)200, result.a); - assertTrue(result.b != null); - assertTrue(result.b.length() > 0); + assertEquals((Integer)200, result.first); + assertTrue(result.second != null); + assertTrue(result.second.length() > 0); } @Test @@ -49,9 +49,9 @@ public class TestGet { RESTManager mgr = new RESTManager(); Pair<Integer, String> result = mgr.get("http://www.example.org", "", null, null); - assertEquals((Integer)200, result.a); - assertTrue(result.b != null); - assertTrue(result.b.length() > 0); + assertEquals((Integer)200, result.first); + assertTrue(result.second != null); + assertTrue(result.second.length() > 0); } @Test @@ -59,8 +59,8 @@ public class TestGet { RESTManager mgr = new RESTManager(); Pair<Integer, String> result = mgr.get("http://www.example.org", "user", null, null); - assertEquals((Integer)200, result.a); - assertTrue(result.b != null); - assertTrue(result.b.length() > 0); + assertEquals((Integer)200, result.first); + assertTrue(result.second != null); + assertTrue(result.second.length() > 0); } }
\ No newline at end of file diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPair.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPair.java index aea5a7387..28e9934d1 100755 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPair.java +++ b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPair.java @@ -32,11 +32,11 @@ public class TestPair { RESTManager mgr = new RESTManager(); Pair<Integer, Integer> pii = mgr.new Pair<>(1, 2); - assertEquals((Integer) 1, (Integer) pii.a); - assertEquals((Integer) 2, (Integer) pii.b); + assertEquals((Integer) 1, (Integer) pii.first); + assertEquals((Integer) 2, (Integer) pii.second); Pair<Integer, String> pis = mgr.new Pair<>(1, "test"); - assertEquals((Integer) 1, (Integer) pis.a); - assertEquals("test", pis.b); + assertEquals((Integer) 1, (Integer) pis.first); + assertEquals("test", pis.second); } } |