diff options
author | Jim Hahn <jrh3@att.com> | 2018-08-24 14:00:30 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-08-24 14:36:49 -0400 |
commit | 57ac9eac8ac0f8236ddb52e5226f475368d4de33 (patch) | |
tree | 25bd93e9556becc78742c5bfeeb943de99f20d32 /controlloop/common/simulators/src/test/java | |
parent | 51e88a932274a3ff8a93996332bb4f1d55d4a773 (diff) |
use new vf-walk code in SO request
Methods were added to AaiNqResponseWrapper to extract VF modules
and generate the new VF module name. This step modifies the SO
code to use those methods. It was also determined that the SO
code needs the VF module container object, not just the VF module,
itself. As a result, AaiNqResponseWrapper was modified to return
a list of the containers instead of a list of the VF modules.
Also modified the AAI simulator to return two VF modules in the
response to the vserver named query. As part of that, a method
was added to the simulator so that JSON responses can be read from
files rather than having to convert them to Java Strings.
Modified simulator to work even if vnf-id is null.
Change-Id: I68fdf07ea80ee0daf9e16403e35b11710315a8a8
Issue-ID: POLICY-1037
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/simulators/src/test/java')
-rw-r--r-- | controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
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 606db6cf7..79a484be7 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 @@ -21,6 +21,8 @@ package org.onap.policy.simulators; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.HashMap; @@ -75,6 +77,7 @@ public class AaiSimulatorTest { @Test public void testPost() { + // check vserver named query final AaiNqRequest request = new AaiNqRequest(); final AaiNqQueryParameters tempQueryParameters = new AaiNqQueryParameters(); final AaiNqNamedQuery tempNamedQuery = new AaiNqNamedQuery(); @@ -95,7 +98,17 @@ public class AaiSimulatorTest { "testPass", request, UUID.randomUUID()); assertNotNull(response); assertNotNull(response.getInventoryResponseItems()); + + // check error response for vserver query + tempInnerMap.put("vserver-name", "error"); + response = new AaiManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, + UUID.randomUUID()); + assertNotNull(response); + assertNotNull(response.getRequestError()); + assertTrue(response.getRequestError().getServiceExcept().getVariables()[2].contains("vserver")); + + // check generic-vnf named query tempNamedQuery.setNamedQueryUuid(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087")); tempQueryParameters.setNamedQuery(tempNamedQuery); request.setQueryParameters(tempQueryParameters); @@ -113,5 +126,15 @@ public class AaiSimulatorTest { UUID.randomUUID()); assertNotNull(response); assertNotNull(response.getInventoryResponseItems()); + assertNull(response.getRequestError()); + + // check error response for generic-vnf query + tempInnerMap.put("vnf-id", "error"); + + response = new AaiManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, + UUID.randomUUID()); + assertNotNull(response); + assertNotNull(response.getRequestError()); + assertTrue(response.getRequestError().getServiceExcept().getVariables()[2].contains("generic-vnf")); } } |