diff options
Diffstat (limited to 'controlloop/common/simulators/src/test/java')
3 files changed, 49 insertions, 8 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 1b12b2527..dc53e267a 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 @@ -23,15 +23,23 @@ package org.onap.policy.simulators; import static org.junit.Assert.assertNotNull; 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.AAIGETResponse; -import org.onap.policy.aai.AAINQF199.AAINQF199Manager; -import org.onap.policy.aai.AAINQF199.AAINQF199Request; -import org.onap.policy.aai.AAINQF199.AAINQF199Response; +import org.onap.policy.aai.AAIGETVnfResponse; +import org.onap.policy.aai.AAINQInstanceFilters; +import org.onap.policy.aai.AAIManager; +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.drools.http.server.HttpServletServer; public class AaiSimulatorTest { @@ -40,7 +48,7 @@ public class AaiSimulatorTest { public static void setUpSimulator() { try { Util.buildAaiSim(); - } catch (InterruptedException e) { + } catch (Exception e) { fail(e.getMessage()); } } @@ -52,14 +60,47 @@ public class AaiSimulatorTest { @Test public void testGet() { - AAIGETResponse response = AAINQF199Manager.getQuery("http://localhost:6666", "testUser", "testPass", UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792"); + AAIGETVnfResponse response = AAIManager.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); } @Test public void testPost() { - AAINQF199Response response = AAINQF199Manager.postQuery("http://localhost:6666", "testUser", "testPass", new AAINQF199Request(), UUID.randomUUID()); + AAINQRequest request = new AAINQRequest(); + AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters(); + AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery(); + tempNamedQuery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); + tempQueryParameters.namedQuery = tempNamedQuery; + request.queryParameters = 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.instanceFilter = tempInstanceFilter; + request.instanceFilters = tempInstanceFilters; + + AAINQResponse response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID()); + assertNotNull(response); + assertNotNull(response.inventoryResponseItems); + + tempNamedQuery.namedQueryUUID = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"); + tempQueryParameters.namedQuery = tempNamedQuery; + request.queryParameters = 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.instanceFilter = tempInstanceFilter; + request.instanceFilters = tempInstanceFilters; + + response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID()); assertNotNull(response); assertNotNull(response.inventoryResponseItems); } 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 0a7cd4168..2cf6b8e0c 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 @@ -48,7 +48,7 @@ public class SoSimulatorTest { public static void setUpSimulator() { try { Util.buildSoSim(); - } catch (InterruptedException e) { + } catch (Exception e) { fail(e.getMessage()); } } 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 db110383c..62c2444aa 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 @@ -40,7 +40,7 @@ public class VfcSimulatorTest { public static void setUpSimulator() { try { Util.buildVfcSim(); - } catch (InterruptedException e) { + } catch (Exception e) { fail(e.getMessage()); } } |