diff options
Diffstat (limited to 'models-interactions/model-simulators/src/test/java')
-rw-r--r-- | models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java | 88 |
1 files changed, 2 insertions, 86 deletions
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java index a03010a00..1d60af0e1 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java @@ -23,26 +23,14 @@ package org.onap.policy.simulators; import static org.junit.Assert.assertEquals; 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; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; import java.util.UUID; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.aai.AaiCqResponse; -import org.onap.policy.aai.AaiGetVnfResponse; import org.onap.policy.aai.AaiManager; -import org.onap.policy.aai.AaiNqInstanceFilters; -import org.onap.policy.aai.AaiNqNamedQuery; -import org.onap.policy.aai.AaiNqQueryParameters; -import org.onap.policy.aai.AaiNqRequest; -import org.onap.policy.aai.AaiNqResponse; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.rest.RestManager; @@ -66,82 +54,10 @@ public class AaiSimulatorTest { } @Test - public void testGet() { - 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.getRelationshipList()); - } - - @Test public void testCqGet() { final AaiCqResponse response = new AaiManager(new RestManager()).getCustomQueryResponse("http://localhost:6666", - "testUser", "testPass", UUID.randomUUID(), "Ete_vFWCLvFWSNK_7ba1fbde_0"); - assertNotNull(response); - assertEquals(response.getVserver().getVserverName(), "Ete_vFWCLvFWSNK_7ba1fbde_0"); - } - - @Test - public void testPost() { - // check vserver named query - final AaiNqRequest request = new AaiNqRequest(); - final AaiNqQueryParameters tempQueryParameters = new AaiNqQueryParameters(); - final AaiNqNamedQuery tempNamedQuery = new AaiNqNamedQuery(); - 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<>(); - tempOuterMap.put("vserver", tempInnerMap); - List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>(); - tempInstanceFilter.add(tempOuterMap); - AaiNqInstanceFilters tempInstanceFilters = new AaiNqInstanceFilters(); - tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.setInstanceFilters(tempInstanceFilters); - - AaiNqResponse response = new AaiManager(new RestManager()).postQuery("http://localhost:6666", "testUser", - "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); - tempInnerMap = new HashMap<>(); - tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb"); - tempOuterMap = new HashMap<>(); - tempOuterMap.put("generic-vnf", tempInnerMap); - tempInstanceFilter = new LinkedList<>(); - tempInstanceFilter.add(tempOuterMap); - tempInstanceFilters = new AaiNqInstanceFilters(); - tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.setInstanceFilters(tempInstanceFilters); - - response = new AaiManager(new RestManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, - 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()); + "testUser", "testPass", UUID.randomUUID(), "f953c499-4b1e-426b-8c6d-e9e9f1fc730f"); assertNotNull(response); - assertNotNull(response.getRequestError()); - assertTrue(response.getRequestError().getServiceExcept().getVariables()[2].contains("generic-vnf")); + assertEquals(response.getVserver().getVserverId(), "f953c499-4b1e-426b-8c6d-e9e9f1fc730f"); } } |