aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/logging_analytics
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2019-03-01 14:15:33 -0500
committerTait,Trevor(rt0435) <rtait@amdocs.com>2019-03-06 11:59:32 -0500
commit2ecb0d9cfcb4fab803da12787b6e75f68fdff280 (patch)
tree6182903d796d08c0cb779569b1caabdae3a586fb /src/test/java/org/onap/logging_analytics
parentf0c44b14013d7418c19ba4cd7f9a5a3043648d5c (diff)
X-ONAP-RequestId and X-ONAP-PartnerName support
Also cleaned up a few hundred ONAP code audit issues related to: - white space - long lines - naming conventions Issue-ID: LOG-551 Change-Id: Ic2af0093e1b4d14c42b95fffe013247afbbadd52 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/test/java/org/onap/logging_analytics')
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java55
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java40
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java34
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JsonReaderTest.java47
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java54
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java51
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java59
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java55
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java59
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java58
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java55
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java58
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java88
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java76
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java378
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java96
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java22
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java100
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java56
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java139
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java87
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java89
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java38
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java526
24 files changed, 0 insertions, 2320 deletions
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java
deleted file mode 100644
index cb631cc..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/AppTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testApp()
- {
- assertTrue( true );
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java
deleted file mode 100644
index ce11d61..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/GenericResponseTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.model.GenericResponse;
-
-public class GenericResponseTest {
-
- @Test
- public void testGenericResponse() {
- GenericResponse response = new GenericResponse();
-
- response.setFailureReason("failureReason");
- response.setResponseObj(new Object());
- response.setStatus("status");
-
- assertEquals("failureReason", response.getFailureReason());
- assertEquals("status", response.getStatus());
- assertTrue(response.getResponseObj() != null);
-
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java
deleted file mode 100644
index a0570c3..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JerseyConfigurationTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.ws.rs.client.Client;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.JerseyConfiguration;
-
-public class JerseyConfigurationTest {
- @Test
- public void testJerseyConfiguration() {
- JerseyConfiguration jerseyConfiguration = new JerseyConfiguration();
- Client client = jerseyConfiguration.jerseyClient();
- String protocol = client.getSslContext().getProtocol();
- assertEquals("TLS", protocol);
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JsonReaderTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JsonReaderTest.java
deleted file mode 100644
index b827fbc..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/JsonReaderTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.exception.AuditException;
-import org.onap.pomba.contextbuilder.aai.reader.JsonReader;
-
-public class JsonReaderTest {
-
- @Test
- public void testJsonReader() {
- JsonReader reader = new JsonReader();
- try {
- reader.parse("{test:test}");
- } catch(AuditException e) {
- fail("This should not throw an exception.");
- }
- }
-
- @Test
- public void testJsonReaderWithException() {
- JsonReader reader = new JsonReader();
- try {
- reader.parse("{test}");
- fail("This should throw an exception.");
- } catch(AuditException e) {
- //Just a test, no need to log the exception here.
- }
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java
deleted file mode 100644
index d08d696..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/L3networkInstanceTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
-
-public class L3networkInstanceTest {
- @Test
- public void testL3networkInstanceEquals() {
- L3networkInstance l3networkInstance1 = new L3networkInstance
- ( "networkId1", "networkName1", "networkType1",
- "networkRole1", "networkTechnology1", "resourceVersion1",
- "modelInvariantId1", "modelVersionId1", "physicalNetworkName1", "true",
- null);
-
- L3networkInstance l3networkInstance2 = new L3networkInstance ();
- l3networkInstance2.setNetworkId("networkId1");
- l3networkInstance2.setNetworkName("networkName1");
- l3networkInstance2.setNetworkType("networkType1");
- l3networkInstance2.setNetworkRole("networkRole1");
- l3networkInstance2.setNetworkTechnology("networkTechnology1");
- l3networkInstance2.setResourceVersion("resourceVersion1");
- l3networkInstance2.setModelInvariantId("modelInvariantId1");
- l3networkInstance2.setModelVersionId("modelVersionId1");
- l3networkInstance2.setPhysicalNetworkName("physicalNetworkName1");
- l3networkInstance2.setSharedNetworkBoolean("true");
- l3networkInstance2.setRelationshipList(null);
-
- l3networkInstance1.toJson();
- l3networkInstance1.toString();
- assertEquals("physicalNetworkName1", l3networkInstance2.getPhysicalNetworkName());
- assertTrue(l3networkInstance1.equals(l3networkInstance1));
- assertTrue(l3networkInstance1.equals(l3networkInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java
deleted file mode 100644
index 1dde19d..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LInterfaceInstanceTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstance;
-
-public class LInterfaceInstanceTest {
- @Test
- public void testLInterfaceInstanceEquals() {
- LInterfaceInstance lInterfaceInstance1 = new LInterfaceInstance
- ( "interfaceId1", "interfaceName1", "interfaceRole1",
- "isPortMirrored1", "adminStatus1", "networkName1",
- "macAddr1", "inMaint1", null);
-
- LInterfaceInstance lInterfaceInstance2 = new LInterfaceInstance ();
- lInterfaceInstance2.setInterfaceId("interfaceId1");
- lInterfaceInstance2.setInterfaceName("interfaceName1");
- lInterfaceInstance2.setInterfaceRole("interfaceRole1");
- lInterfaceInstance2.setIsPortMirrored("isPortMirrored1");
- lInterfaceInstance2.setAdminStatus("adminStatus1");
- lInterfaceInstance2.setNetworkName("networkName1");
- lInterfaceInstance2.setMacAddr("macAddr1");
- lInterfaceInstance2.setInMaint("inMaint1");
-
- lInterfaceInstance1.toJson();
- lInterfaceInstance1.toString();
- assertEquals("interfaceName1", lInterfaceInstance2.getInterfaceName());
- assertTrue(lInterfaceInstance1.equals(lInterfaceInstance1));
- assertTrue(lInterfaceInstance1.equals(lInterfaceInstance2));
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java
deleted file mode 100644
index b0c4ea8..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/LogicalLinkInstanceTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance;
-
-public class LogicalLinkInstanceTest {
- @Test
- public void testLogicalLinkInstanceEquals() {
- LogicalLinkInstance logicalLinkInstance1 = new LogicalLinkInstance
- ( "linkName1", "linkId1", "modelVersionId1",
- "modelInvariantId1", "linkType1", "routingProtocol1",
- "speedValue1", "speedUnits1", "provStatus1",
- "inMaint1", "linkRole1", "ipVersion1",
- "linkName21","circuitId1","purpose1");
-
- LogicalLinkInstance logicalLinkInstance2 = new LogicalLinkInstance ();
- logicalLinkInstance2.setLinkName("linkName1");
- logicalLinkInstance2.setLinkId("linkId1");
- logicalLinkInstance2.setModelVersionId("modelVersionId1");
- logicalLinkInstance2.setModelInvariantId("modelInvariantId1");
- logicalLinkInstance2.setLinkType("linkType1");
- logicalLinkInstance2.setRoutingProtocol("routingProtocol1");
- logicalLinkInstance2.setSpeedValue("speedValue1");
- logicalLinkInstance2.setSpeedUnits("speedUnits1");
- logicalLinkInstance2.setProvStatus("provStatus1");
- logicalLinkInstance2.setInMaint("inMaint1");
- logicalLinkInstance2.setLinkRole("linkRole1");
- logicalLinkInstance2.setIpVersion("ipVersion1");
- logicalLinkInstance2.setLinkName2("linkName21");
- logicalLinkInstance2.setCircuitId("circuitId1");
- logicalLinkInstance2.setPurpose("purpose1");
-
- logicalLinkInstance1.toJson();
- logicalLinkInstance1.toString();
- assertEquals("linkName1", logicalLinkInstance2.getLinkName());
- assertTrue(logicalLinkInstance1.equals(logicalLinkInstance1));
- assertTrue(logicalLinkInstance1.equals(logicalLinkInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java
deleted file mode 100644
index 33bba56..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PInterfaceInstanceTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
-
-public class PInterfaceInstanceTest {
-
- @Test
- public void testPInterfaceInstanceEquals() {
- PInterfaceInstance pInterfaceInstance1 = new PInterfaceInstance
- ( "interfaceName1", "speedValue1", "speedUnits1",
- "portDescription1", "equipmentIdentifier1", "interfaceRole1", "interfaceType1",
- "provStatus1", "resourceVersion1", "inMaint1", "invStatus1" , new LInterfaceInstanceList(), null);
-
- PInterfaceInstance pInterfaceInstance2 = new PInterfaceInstance ();
- pInterfaceInstance2.setInterfaceName("interfaceName1");
- pInterfaceInstance2.setSpeedValue("speedValue1");
- pInterfaceInstance2.setSpeedUnits("speedUnits1");
- pInterfaceInstance2.setPortDescription("portDescription1");
- pInterfaceInstance2.setEquipmentIdentifier("equipmentIdentifier1");
- pInterfaceInstance2.setInterfaceRole("interfaceRole1");
- pInterfaceInstance2.setInterfaceType("interfaceType1");
- pInterfaceInstance2.setProvStatus("provStatus1");
- pInterfaceInstance2.setResourceVersion("resourceVersion1");
- pInterfaceInstance2.setInMaint("inMaint1");
- pInterfaceInstance2.setInvStatus("invStatus1");
-
- pInterfaceInstance1.toJson();
- pInterfaceInstance1.toString();
- assertEquals("interfaceName1", pInterfaceInstance2.getInterfaceName());
- assertTrue(pInterfaceInstance1.equals(pInterfaceInstance1));
- assertTrue(pInterfaceInstance1.equals(pInterfaceInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java
deleted file mode 100644
index e7748c5..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PnfInstanceTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.PnfInstance;
-
-public class PnfInstanceTest {
- @Test
- public void testPnfInstanceEquals() {
- PnfInstance pnfInstance1 = new PnfInstance
- ( "uuid1", "name1", "networkRole1",
- "name21", "name2Source1", "equipmentType1",
- "equipmentVendor1", "equipmentModel1", "managementOptions1",
- "swVersion1", "frameId1", "serialNumber1",
- "modelInvariantId1", "modelVersionId1", null);
-
- PnfInstance pnfInstance2 = new PnfInstance ();
- pnfInstance2.setPnfId("uuid1");
- pnfInstance2.setPnfName("name1");
- pnfInstance2.setNfRole("networkRole1");
- pnfInstance2.setPnfName2("name21");
- pnfInstance2.setPnfName2Source("name2Source1");
- pnfInstance2.setEquipmentType("equipmentType1");
- pnfInstance2.setEquipmentVendor("equipmentVendor1");
- pnfInstance2.setEquipmentModel("equipmentModel1");
- pnfInstance2.setManagementOptions("managementOptions1");
- pnfInstance2.setSwVersion("swVersion1");
- pnfInstance2.setFrameId("frameId1");
- pnfInstance2.setSerialNumber("serialNumber1");
- pnfInstance2.setModelInvariantId("modelInvariantId1");
- pnfInstance2.setModelVersionId("modelVersionId1");
- pnfInstance2.setPInterfaceInstanceList(null);
-
- pnfInstance1.toJson();
- pnfInstance1.toString();
- assertEquals("name1", pnfInstance2.getPnfName());
- assertTrue(pnfInstance1.equals(pnfInstance1));
- assertTrue(pnfInstance1.equals(pnfInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java
deleted file mode 100644
index 93afb91..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/PserverInstanceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.PserverInstance;
-
-public class PserverInstanceTest {
- @Test
- public void testPserverInstanceEquals() {
- PserverInstance pserverInstance1 = new PserverInstance
- ( "pserverId1", "hostname1", "pserverName2a",
- "ptniiEquipName1", "equipType1", "equipVendor1",
- "equipModel1", "fqdn1", "internetTopology1",
- "inMaint1", "resourceVersion1", "serialNumber1",
- "purpose1",null);
-
- PserverInstance pserverInstance2 = new PserverInstance ();
- pserverInstance2.setPserverId("pserverId1");
- pserverInstance2.setHostname("hostname1");
- pserverInstance2.setPserverName2("pserverName2a");
- pserverInstance2.setPtniiEquipName("ptniiEquipName1");
- pserverInstance2.setEquipType("equipType1");
- pserverInstance2.setEquipVendor("equipVendor1");
- pserverInstance2.setEquipModel("equipModel1");
- pserverInstance2.setFqdn("fqdn1");
- pserverInstance2.setInternetTopology("internetTopology1");
- pserverInstance2.setInMaint("inMaint1");
- pserverInstance2.setResourceVersion("resourceVersion1");
- pserverInstance2.setSerialNumber("serialNumber1");
- pserverInstance2.setPurpose("purpose1");
- pserverInstance2.setPInterfaceInstanceList(null);
-
- pserverInstance1.toJson();
- pserverInstance1.toString();
- assertEquals("hostname1", pserverInstance2.getHostname());
- assertTrue(pserverInstance1.equals(pserverInstance1));
- assertTrue(pserverInstance1.equals(pserverInstance2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java
deleted file mode 100644
index 6a3c0ac..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelatedToPropertyTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
-
-public class RelatedToPropertyTest {
-
- @Test
- public void testRelatedToPropertyWithParameters() {
- RelatedToProperty relatedToProperty = new RelatedToProperty("propertyKey", "propertyValue");
- assertEquals("propertyKey", relatedToProperty.getPropertyKey());
- assertEquals("propertyValue", relatedToProperty.getPropertyValue());
- }
-
- @Test
- public void testRelatedToProperty() {
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- relatedToProperty.setPropertyKey("propertyKey");
- relatedToProperty.setPropertyValue("propertyValue");
- assertEquals("propertyKey", relatedToProperty.getPropertyKey());
- assertEquals("propertyValue", relatedToProperty.getPropertyValue());
- String relatedToPropertyString = relatedToProperty.toString();
- assertTrue(relatedToPropertyString.contains("[propertyKey=propertyKey,propertyValue=propertyValue]"));
- }
-
- @Test
- public void testRelatedToPropertyIsEqual() {
- RelatedToProperty relatedToProperty1 = new RelatedToProperty("propertyKey1", "propertyValue1");
- RelatedToProperty relatedToProperty2 = new RelatedToProperty("propertyKey2", "propertyValue2");
- RelatedToProperty relatedToProperty3 = new RelatedToProperty("propertyKey1", "propertyValue1");
- assertTrue(relatedToProperty1.equals(relatedToProperty1));
- assertTrue(!relatedToProperty1.equals(relatedToProperty2));
- assertTrue(relatedToProperty1.equals(relatedToProperty3));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java
deleted file mode 100644
index 490e3d3..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipDatumTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
-
-public class RelationshipDatumTest {
- @Test
- public void testRelationshipDatum() {
- RelationshipDatum relationshipDatum = new RelationshipDatum();
-
- relationshipDatum.setRelationshipKey("relationshipKey");
- relationshipDatum.setRelationshipValue("relationshipValue");
-
- assertEquals("relationshipKey", relationshipDatum.getRelationshipKey());
- assertEquals("relationshipValue", relationshipDatum.getRelationshipValue());
- }
-
- @Test
- public void testRelationshipDatumWithParameters() {
- RelationshipDatum relationshipDatum = new RelationshipDatum("relationshipKey", "relationshipValue");
-
- assertEquals("relationshipKey", relationshipDatum.getRelationshipKey());
- assertEquals("relationshipValue", relationshipDatum.getRelationshipValue());
- String relationshipDatumString = relationshipDatum.toString();
- assertTrue(relationshipDatumString.contains("[relationshipKey=relationshipKey,relationshipValue=relationshipValue]"));
- }
-
- @Test
- public void testRelationshipDatumEqual() {
- RelationshipDatum relationshipDatum1 = new RelationshipDatum("relationshipKey1", "relationshipValue1");
- RelationshipDatum relationshipDatum2 = new RelationshipDatum("relationshipKey2", "relationshipValue2");
- RelationshipDatum relationshipDatum3 = new RelationshipDatum("relationshipKey1", "relationshipValue1");
-
- assertTrue(relationshipDatum1.equals(relationshipDatum1));
- assertTrue(!relationshipDatum1.equals(relationshipDatum2));
- assertTrue(relationshipDatum1.equals(relationshipDatum3));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java
deleted file mode 100644
index f904f25..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipListTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
-import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
-
-public class RelationshipListTest {
- @Test
- public void testRelationshipList() {
- RelationshipList relationshipList = new RelationshipList();
- Relationship relationship = new Relationship();
- List<Relationship> list = new ArrayList<Relationship>();
- list.add(relationship);
- relationshipList.setRelationship(list);
-
- assertTrue(relationshipList.getRelationship().size() == 1);
-
- relationship.setRelatedLink("relatedLink");
- relationship.setRelatedTo("relatedTo");
-
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- List<RelatedToProperty> relatedToPropertyList = new ArrayList<RelatedToProperty>();
- relatedToPropertyList.add(relatedToProperty);
- relationship.setRelatedToProperty(relatedToPropertyList);
- list.add(relationship);
- relationshipList.setRelationship(list);
-
- String relationshipListString = relationshipList.toString();
- assertTrue(relationshipListString.contains("[relationship="));
-
- }
-
- @Test
- public void testRelationshipListWithParameters() {
- Relationship relationship = new Relationship("relatedTo", "relatedLink", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
- List<Relationship> listOfRelationship = new ArrayList<Relationship>();
- listOfRelationship.add(relationship);
- RelationshipList relationshipList = new RelationshipList(listOfRelationship);
-
- assertTrue(relationshipList.getRelationship().size() == 1);
- }
-
- @Test
- public void testRelationshipListEquals() {
-
- Relationship relationship1 = new Relationship("relatedTo1", "relatedLink1", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
- List<Relationship> listOfRelationship = new ArrayList<Relationship>();
- listOfRelationship.add(relationship1);
- RelationshipList relationshipList1 = new RelationshipList(listOfRelationship);
-
- Relationship relationship2 = new Relationship("relatedTo2", "relatedLink2", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
- List<Relationship> listOfRelationship2 = new ArrayList<Relationship>();
- listOfRelationship.add(relationship2);
- RelationshipList relationshipList2 = new RelationshipList(listOfRelationship2);
-
- Relationship relationship3 = new Relationship("relatedTo1", "relatedLink1", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
- List<Relationship> listOfRelationship3 = new ArrayList<Relationship>();
- listOfRelationship.add(relationship3);
- RelationshipList relationshipList3 = new RelationshipList(listOfRelationship3);
-
- assertTrue(relationshipList1.equals(relationshipList1));
- assertTrue(!relationshipList1.equals(relationshipList2));
- assertTrue(!relationshipList1.equals(relationshipList3));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java
deleted file mode 100644
index 786ea13..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RelationshipTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
-import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
-
-public class RelationshipTest {
-
- @Test
- public void testRelationshipWithParameters() {
- List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
- List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
- Relationship relationship = new Relationship("relatedTo", "relatedLink", relationshipDatum, relatedToProperty);
-
- assertEquals("relatedTo", relationship.getRelatedTo());
- assertEquals("relatedLink", relationship.getRelatedLink());
- assertTrue(relationship.getRelationshipData().isEmpty());
- assertTrue(relationship.getRelatedToProperty().isEmpty());
- }
-
- @Test
- public void testRelationship() {
- Relationship relationship = new Relationship();
- List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
- List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
-
- relationship.setRelatedLink("relatedLink");
- relationship.setRelatedTo("relatedTo");
- relationship.setRelatedToProperty(relatedToProperty);
- relationship.setRelationshipData(relationshipDatum);
-
- assertEquals("relatedTo", relationship.getRelatedTo());
- assertEquals("relatedLink", relationship.getRelatedLink());
- assertTrue(relationship.getRelationshipData().isEmpty());
- assertTrue(relationship.getRelatedToProperty().isEmpty());
-
- String relationshipString = relationship.toString();
- assertTrue(relationshipString.contains("[relatedTo=relatedTo,relatedLink=relatedLink,relationshipData=[],relatedToProperty=[]]"));
- }
-
- @Test
- public void testRelationshipEquals() {
- List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
- List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
- Relationship relationship1 = new Relationship("relatedTo1", "relatedLink1", relationshipDatum, relatedToProperty);
- Relationship relationship2 = new Relationship("relatedTo2", "relatedLink2", relationshipDatum, relatedToProperty);
- Relationship relationship3 = new Relationship("relatedTo1", "relatedLink1", relationshipDatum, relatedToProperty);
- assertTrue(relationship1.equals(relationship1));
- assertTrue(!relationship1.equals(relationship2));
- assertTrue(relationship1.equals(relationship3));
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
deleted file mode 100644
index 8c445c1..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.UUID;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.aai.restclient.client.RestClient;
-import org.onap.pomba.contextbuilder.aai.Application;
-import org.onap.pomba.contextbuilder.aai.exception.AuditException;
-import org.onap.pomba.contextbuilder.aai.util.RestUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.web.WebAppConfiguration;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import org.onap.pomba.common.datatypes.ModelContext;
-import org.onap.pomba.common.datatypes.VNF;
-import org.onap.pomba.common.datatypes.VFModule;
-import org.onap.pomba.common.datatypes.VM;
-import org.onap.pomba.common.datatypes.Network;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
-@WebAppConfiguration
-@SpringBootTest(classes = Application.class)
-@TestPropertySource(properties = { "aai.serviceName=localhost","aai.servicePort=9808", "aai.httpProtocol=http" })
-public class RestUtilTest {
- @Autowired
- private RestClient aaiClient;
- @Autowired
- private String aaiBaseUrl;
- @Autowired
- private String aaiPathToSearchNodeQuery;
- @Autowired
- private String aaiBasicAuthorization;
-
- private static final String DEPTH = "?depth=2";
-
- @Rule
- public WireMockRule aaiEnricherRule = new WireMockRule(wireMockConfig().port(9808));
-
- @Test
- public void testValidateServiceInstanceId() {
- // Missing ServiceInstanceId or it is null
- try {
- RestUtil.validateServiceInstanceId("");
- } catch (AuditException e) {
- assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId"));
- }
-
- try {
- RestUtil.validateServiceInstanceId(null);
- } catch (AuditException e) {
- assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId"));
- }
-
- }
-
- @Test
- public void testIsEmptyJson() {
- assertTrue(RestUtil.isEmptyJson("{}"));
- assertTrue(!RestUtil.isEmptyJson("{Not Empty}"));
- }
-
- private void addResponse(String path, String classpathResource, WireMockRule thisMock) throws IOException {
- String payload = readFully(ClassLoader.getSystemResourceAsStream(classpathResource));
- thisMock.stubFor(get(path).willReturn(okJson(payload)));
- }
-
- private String readFully(InputStream in) throws IOException {
- char[] cbuf = new char[1024];
- StringBuilder content = new StringBuilder();
- try (InputStreamReader reader = new InputStreamReader(in, "UTF-8")) {
- int count;
- while ((count = reader.read(cbuf)) >= 0) {
- content.append(cbuf, 0, count);
- }
- }
- return content.toString();
- }
-
- private static String generateGetCustomerInfoUrl (String baseURL, String aaiPathToSearchNodeQuery,String serviceInstanceId) {
- return baseURL + MessageFormat.format(aaiPathToSearchNodeQuery, serviceInstanceId);
- }
-
- ////
- @Test
- public void testretrieveAAIModelDataFromAAI_PNF() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
-
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput.json", aaiEnricherRule);
-
- // 4. simulate the response of PNF based on the resourceLink in (2)
- //note: match pnf_id in junit/aai-service-instance.json
- addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH,
- "junit/pnfSampleInput.json", aaiEnricherRule);
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- assertEquals(modelCtx.getVnfs().size(), 1);
- assertEquals(modelCtx.getPnfs().size(), 1);
-
- }
- ///Verify the relationship serviceInstanceId -> vnf -> vserver
- @Test
- public void testretrieveAAIModelDataFromAAI_VSERVER_PSERVER() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
-
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set2.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver.json", aaiEnricherRule);
-
- // 5. simulate the rsp of pserver
- // note: match pserver hostname to the path of "pserver" in (4)
- addResponse(
- "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
- "junit/pserverInput_set2.json", aaiEnricherRule);
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id
- assertEquals(vmList.get(0).getPServer().getName(), "mtn96compute.cci.att.com"); //pserver-name
- }
-
- ////
- @Test
- public void testretrieveAAIModelDataFromAAI_PInterface_LInterface_with_PNF() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
- // 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput.json", aaiEnricherRule);
-
- // 4. simulate the response of PNF based on the resourceLink in (2)
- //note: match pnf_id in junit/aai-service-instance.json
- addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH,
- "junit/pnfInput_w_pInterface_LInterface.json", aaiEnricherRule);
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- assertEquals(modelCtx.getVnfs().size(), 1);
- assertEquals(modelCtx.getPnfs().size(), 1);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().size(), 1);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().size(), 2);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name5"); //l-interface-name
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name6"); //l-interface-name
- }
-
- @Test
- public void testretrieveAAIModelDataFromAAI_PInterface_LInterface_with_PSERVER() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set2.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver.json", aaiEnricherRule);
-
- // 5. simulate the rsp of pserver with P-interface which also contains L-interface.
- // note: match pserver hostname to the path of "pserver" in (4)
- addResponse(
- "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
- "junit/pserverInput_with_pInterface_LInterface.json", aaiEnricherRule);
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(), "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().size(), 2);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name7"); //l-interface-name
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name8"); //l-interface-name
- }
-
- ///Verify the relationship serviceInstanceId -> l3network
- @Test
- public void testretrieveAAIModelDataFromAAI_L3_network_in_service_level () throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set3.json", aaiEnricherRule);
-
- // 3. simulate the rsp of l3-network
- // note: match to network-id to the path of "l3network" in (2: aai-service-instance_set3)
- addResponse(
- "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
- "junit/l3-network-1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-2" + DEPTH,
- "junit/l3-network-2.json", aaiEnricherRule);
-
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- // verify results
- List<Network> networkList = modelCtx.getNetworkList();
- assertEquals(networkList.size(), 2);
- assertEquals(networkList.get(0).getUuid(), "01e8d84a-l3-network-1");
- assertEquals(networkList.get(1).getUuid(), "01e8d84a-l3-network-2");
- }
-
- ///Verify the relationship serviceInstanceId -> vnf -> l3network
- @Test
- public void testretrieveAAIModelDataFromAAI_L3_network_in_VNF_level() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set3.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set2.json", aaiEnricherRule);
-
- // 5. simulate the rsp of l3-network
- // note: match to network-id to the path of "l3network" in (3: genericVnfInput_set3)
- addResponse(
- "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
- "junit/l3-network-1.json", aaiEnricherRule);
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<Network> networkList = vnfList.get(0).getNetworks();
- assertEquals(networkList.size(), 1);
- assertEquals(networkList.get(0).getUuid(), "01e8d84a-l3-network-1");
- }
-
- @Test
- public void testretrieveAAIModelDataFromAAI_L3_network_in_vModule_level() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set4.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set2.json", aaiEnricherRule);
-
- // 5. simulate the rsp of l3-network
- // note: match to network-id to the path of "l3network" in (3: genericVnfInput_set4)
- addResponse(
- "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-1" + DEPTH,
- "junit/l3-network-1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/l3-networks/l3-network/01e8d84a-l3-network-2" + DEPTH,
- "junit/l3-network-2.json", aaiEnricherRule);
-
-
- ModelContext modelCtx = RestUtil.retrieveAAIModelData(aaiClient, aaiBaseUrl, aaiPathToSearchNodeQuery, transactionId , serviceInstanceId, aaiBasicAuthorization);
-
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
-
- List<Network> networkList = vfModuleList.get(0).getNetworks();
- assertEquals(networkList.size(), 2);
- assertEquals(networkList.get(0).getUuid(), "01e8d84a-l3-network-1");
- assertEquals(networkList.get(1).getUuid(), "01e8d84a-l3-network-2");
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java
deleted file mode 100644
index 74e5994..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/ServiceInstanceTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
-import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
-import org.onap.pomba.contextbuilder.aai.datatype.ServiceInstance;
-
-public class ServiceInstanceTest {
- @Test
- public void testServiceInstance() {
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
- serviceInstance.setServiceInstanceName("serviceInstanceName");
- serviceInstance.setServiceType("serviceType");
- serviceInstance.setServiceRole("serviceRole");
- serviceInstance.setEnvironmentContext("environmentContext");
- serviceInstance.setWorkloadContext("workloadContext");
- serviceInstance.setModelInvariantId("modelInvariantId");
- serviceInstance.setModelVersionId("modelVersionId");
- serviceInstance.setResourceVersion("resourceVersion");
- serviceInstance.setOrchestrationStatus("orchestrationStatus");
- RelationshipList relationshipList = new RelationshipList();
- List<Relationship> listOfRelationship = new ArrayList<Relationship>();
- Relationship relationship = new Relationship("relatedTo", "relatedLink", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
- listOfRelationship.add(relationship);
- relationshipList.setRelationship(listOfRelationship);
-
- serviceInstance.setRelationshipList(relationshipList);
-
- assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId());
- assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName());
- assertEquals("serviceType", serviceInstance.getServiceType());
- assertEquals("serviceRole", serviceInstance.getServiceRole());
- assertEquals("environmentContext", serviceInstance.getEnvironmentContext());
- assertEquals("workloadContext", serviceInstance.getWorkloadContext());
- assertEquals("modelInvariantId", serviceInstance.getModelInvariantId());
- assertEquals("modelVersionId", serviceInstance.getModelVersionId());
- assertEquals("resourceVersion", serviceInstance.getResourceVersion());
- assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus());
- assertEquals("relatedTo", serviceInstance.getRelationshipList().getRelationship().get(0).getRelatedTo());
- }
-
- @Test
- public void testServiceInstanceWithParameters() {
- ServiceInstance serviceInstance = new ServiceInstance("serviceInstanceId", "serviceInstanceName", "serviceType", "serviceRole", "environmentContext", "workloadContext", "modelInvariantId", "modelVersionId", "resourceVersion", "orchestrationStatus", new RelationshipList());
-
- assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId());
- assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName());
- assertEquals("serviceType", serviceInstance.getServiceType());
- assertEquals("serviceRole", serviceInstance.getServiceRole());
- assertEquals("environmentContext", serviceInstance.getEnvironmentContext());
- assertEquals("workloadContext", serviceInstance.getWorkloadContext());
- assertEquals("modelInvariantId", serviceInstance.getModelInvariantId());
- assertEquals("modelVersionId", serviceInstance.getModelVersionId());
- assertEquals("resourceVersion", serviceInstance.getResourceVersion());
- assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus());
-
- String serviceInstanceString = serviceInstance.toString();
- assertTrue(serviceInstanceString.contains("[serviceInstanceId=serviceInstanceId,serviceInstanceName=serviceInstanceName,serviceType=serviceType,serviceRole=serviceRole,environmentContext=environmentContext,workloadContext=workloadContext,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,resourceVersion=resourceVersion,orchestrationStatus=orchestrationStatus,"));
- }
-
- @Test
- public void testServiceInstanceEquals() {
- ServiceInstance serviceInstance1 = new ServiceInstance("serviceInstanceId1", "serviceInstanceName1", "serviceType1", "serviceRole1", "environmentContext1", "workloadContext1", "modelInvariantId1", "modelVersionId1", "resourceVersion1", "orchestrationStatus1", new RelationshipList());
- ServiceInstance serviceInstance2 = new ServiceInstance("serviceInstanceId2", "serviceInstanceName2", "serviceType2", "serviceRole2", "environmentContext2", "workloadContext2", "modelInvariantId2", "modelVersionId2", "resourceVersion2", "orchestrationStatus2", new RelationshipList());
- ServiceInstance serviceInstance3 = new ServiceInstance("serviceInstanceId1", "serviceInstanceName1", "serviceType1", "serviceRole1", "environmentContext1", "workloadContext1", "modelInvariantId1", "modelVersionId1", "resourceVersion1", "orchestrationStatus1", new RelationshipList());
-
- assertTrue(serviceInstance1.equals(serviceInstance1));
- assertTrue(!serviceInstance1.equals(serviceInstance2));
- assertTrue(serviceInstance1.equals(serviceInstance3));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java
deleted file mode 100644
index 13d52f9..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/TestSrpingServiceImpl.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-public class TestSrpingServiceImpl {
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
deleted file mode 100644
index 77da591..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModuleTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty;
-import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
-import org.onap.pomba.contextbuilder.aai.datatype.VfModule;
-
-public class VfModuleTest {
- @Test
- public void testVfModule() {
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("vfModuleId");
- vfModule.setVfModuleName("vfModuleName");
- vfModule.setHeatStackId("heatStackId");
- vfModule.setOrchestrationStatus("orchestrationStatus");
- vfModule.setIsBaseVfModule(true);
- vfModule.setResourceVersion("resourceVersion");
- vfModule.setModelInvariantId("modelInvariantId");
- vfModule.setModelVersionId("modelVersionId");
- vfModule.setModelCustomizationId("modelCustomizationId");
- vfModule.setModuleIndex(1);
-
- RelationshipList relationshipList = new RelationshipList();
- List<Relationship> listOfRelationship = new ArrayList<Relationship>();
- Relationship relationship = new Relationship("relatedTo", "relatedLink", new ArrayList<RelationshipDatum>(), new ArrayList<RelatedToProperty>());
- listOfRelationship.add(relationship);
- relationshipList.setRelationship(listOfRelationship);
-
- vfModule.setRelationshipList(relationshipList);
-
- assertEquals("vfModuleId", vfModule.getVfModuleId());
- assertEquals("vfModuleName", vfModule.getVfModuleName());
- assertEquals("heatStackId", vfModule.getHeatStackId());
- assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
- assertTrue(vfModule.getIsBaseVfModule());
- assertEquals("resourceVersion", vfModule.getResourceVersion());
- assertEquals("modelInvariantId", vfModule.getModelInvariantId());
- assertEquals("modelVersionId", vfModule.getModelVersionId());
- assertEquals("modelCustomizationId", vfModule.getModelCustomizationId());
- assertEquals(new Integer(1), vfModule.getModuleIndex());
- assertEquals("relatedTo", vfModule.getRelationshipList().getRelationship().get(0).getRelatedTo());
- }
-
- @Test
- public void testVfModuleWithParameters() {
- VfModule vfModule = new VfModule("vfModuleId", "vfModuleName", "heatStackId", "orchestrationStatus", true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
-
- assertEquals("vfModuleId", vfModule.getVfModuleId());
- assertEquals("vfModuleName", vfModule.getVfModuleName());
- assertEquals("heatStackId", vfModule.getHeatStackId());
- assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
- assertTrue(vfModule.getIsBaseVfModule());
- assertEquals("resourceVersion", vfModule.getResourceVersion());
- assertEquals("modelInvariantId", vfModule.getModelInvariantId());
- assertEquals("modelVersionId", vfModule.getModelVersionId());
- assertEquals("modelCustomizationId", vfModule.getModelCustomizationId());
- assertEquals(new Integer(1), vfModule.getModuleIndex());
-
- String vfModuleString = vfModule.toString();
- assertTrue(vfModuleString.contains("[vfModuleId=vfModuleId,vfModuleName=vfModuleName,heatStackId=heatStackId,orchestrationStatus=orchestrationStatus,isBaseVfModule=true,resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId,moduleIndex=1"));
-
- }
-
- @Test
- public void testVfModuleEquals() {
- VfModule vfModule1 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
- VfModule vfModule2 = new VfModule("vfModuleId2", "vfModuleName2", "heatStackId2", "orchestrationStatus2", true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
- VfModule vfModule3 = new VfModule("vfModuleId1", "vfModuleName1", "heatStackId1", "orchestrationStatus1", true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", 1, new RelationshipList() , new ArrayList<L3networkInstance>());
-
- assertTrue(vfModule1.equals(vfModule1));
- assertTrue(!vfModule1.equals(vfModule2));
- assertTrue(vfModule1.equals(vfModule3));
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java
deleted file mode 100644
index 3e1588c..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VfModulesTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.VfModule;
-import org.onap.pomba.contextbuilder.aai.datatype.VfModules;
-
-public class VfModulesTest {
- @Test
- public void testVfModules() {
- VfModules vfModules = new VfModules();
-
- List<VfModule> vfModuleList = new ArrayList<VfModule>();
- vfModuleList.add(new VfModule());
- vfModules.setVfModule(vfModuleList);
-
- assertTrue(vfModules.getVfModule().get(0) instanceof VfModule);
- }
-
- @Test
- public void testVfModulesWithParameters() {
- VfModules vfModules = new VfModules(new ArrayList<VfModule>());
-
- String vfModulesString = vfModules.toString();
- assertTrue(vfModulesString.contains("[vfModule="));
- }
-
- @Test
- public void testVfModulesEquals() {
- VfModules vfModules1 = new VfModules(new ArrayList<VfModule>());
- VfModules vfModules2 = new VfModules(new ArrayList<VfModule>());
-
- assertTrue(vfModules1.equals(vfModules1));
- assertTrue(vfModules1.equals(vfModules2));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java
deleted file mode 100644
index b9d9329..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfInstanceTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
-import org.onap.pomba.contextbuilder.aai.datatype.VfModules;
-import org.onap.pomba.contextbuilder.aai.datatype.VnfInstance;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
-
-public class VnfInstanceTest {
- @Test
- public void testVnfInstance() {
- VnfInstance vnfInstance = new VnfInstance();
-
- vnfInstance.setServiceId("serviceId");
- vnfInstance.setModelCustomizationId("modelCustomizationId");
- vnfInstance.setVnfType("vnfType");
- vnfInstance.setIpv4Loopback0Address("ipv4Loopback0Address");
- vnfInstance.setNfFunction("nfFunction");
- vnfInstance.setModelInvariantId("modelInvariantId");
- vnfInstance.setResourceVersion("resourceVersion");
- vnfInstance.setVnfName2("vnfName2");
- vnfInstance.setRelationshipList(new RelationshipList());
- vnfInstance.setNmLanV6Address("nmLanV6Address");
- vnfInstance.setNfRole("nfRole");
- vnfInstance.setNfType("nfType");
- vnfInstance.setModelVersionId("modelVersionId");
- vnfInstance.setIpv4OamAddress("ipv4OamAddress");
- vnfInstance.setVnfName("vnfName");
- vnfInstance.setInMaintenance(true);
- vnfInstance.setMsoCatalogKey("msoCatalogKey");
- vnfInstance.setProvisionStatus("provisionStatus");
- vnfInstance.setVfModules(new VfModules());
- vnfInstance.setEquipmentRole("equipmentRole");
- vnfInstance.setVnfId("vnfId");
- vnfInstance.setOrchestrationStatus("orchestrationStatus");
- vnfInstance.setNfNamingCode("nfNamingCode");
- vnfInstance.setHeatStackId("heatStackId");
- vnfInstance.setIsClosedLoopDisabled(true);
- vnfInstance.setLicenseKey("licenseKey");
- vnfInstance.setManagementV6Address("managementV6Address");
-
- assertEquals("serviceId", vnfInstance.getServiceId());
- assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId());
- assertEquals("vnfType", vnfInstance.getVnfType());
- assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address());
- assertEquals("nfFunction", vnfInstance.getNfFunction());
- assertEquals("modelInvariantId", vnfInstance.getModelInvariantId());
- assertEquals("resourceVersion", vnfInstance.getResourceVersion());
- assertEquals("vnfName2", vnfInstance.getVnfName2());
- assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList);
- assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address());
- assertEquals("nfRole", vnfInstance.getNfRole());
- assertEquals("nfType", vnfInstance.getNfType());
- assertEquals("modelVersionId", vnfInstance.getModelVersionId());
- assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress());
- assertEquals("vnfName", vnfInstance.getVnfName());
- assertTrue(vnfInstance.getInMaintenance());
- assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey());
- assertEquals("provisionStatus", vnfInstance.getProvisionStatus());
- assertTrue(vnfInstance.getVfModules() instanceof VfModules);
- assertEquals("equipmentRole", vnfInstance.getEquipmentRole());
- assertEquals("vnfId", vnfInstance.getVnfId());
- assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus());
- assertEquals("nfNamingCode", vnfInstance.getNfNamingCode());
- assertEquals("heatStackId", vnfInstance.getHeatStackId());
- assertTrue(vnfInstance.getIsClosedLoopDisabled());
- assertEquals("licenseKey", vnfInstance.getLicenseKey());
- assertEquals("managementV6Address", vnfInstance.getManagementV6Address());
-
- }
-
- @Test
- public void testVnfInstanceWithParameters() {
- VnfInstance vnfInstance = new VnfInstance("vnfId", "vnfName", "vnfName2", "vnfType", "serviceId", "provisionStatus", "licenseKey", "equipmentRole", "orchestrationStatus", "heatStackId", "msoCatalogKey", "ipv4OamAddress", "ipv4Loopback0Address", "nmLanV6Address", "managementV6Address", true, true, "resourceVersion", "modelInvariantId", "modelVersionId", "modelCustomizationId", "nfType", "nfFunction", "nfRole", "nfNamingCode", new RelationshipList(), new VfModules(), new LInterfaceInstanceList());
-
- assertEquals("serviceId", vnfInstance.getServiceId());
- assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId());
- assertEquals("vnfType", vnfInstance.getVnfType());
- assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address());
- assertEquals("nfFunction", vnfInstance.getNfFunction());
- assertEquals("modelInvariantId", vnfInstance.getModelInvariantId());
- assertEquals("resourceVersion", vnfInstance.getResourceVersion());
- assertEquals("vnfName2", vnfInstance.getVnfName2());
- assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList);
- assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address());
- assertEquals("nfRole", vnfInstance.getNfRole());
- assertEquals("nfType", vnfInstance.getNfType());
- assertEquals("modelVersionId", vnfInstance.getModelVersionId());
- assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress());
- assertEquals("vnfName", vnfInstance.getVnfName());
- assertTrue(vnfInstance.getInMaintenance());
- assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey());
- assertEquals("provisionStatus", vnfInstance.getProvisionStatus());
- assertTrue(vnfInstance.getVfModules() instanceof VfModules);
- assertEquals("equipmentRole", vnfInstance.getEquipmentRole());
- assertEquals("vnfId", vnfInstance.getVnfId());
- assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus());
- assertEquals("nfNamingCode", vnfInstance.getNfNamingCode());
- assertEquals("heatStackId", vnfInstance.getHeatStackId());
- assertTrue(vnfInstance.getIsClosedLoopDisabled());
- assertEquals("licenseKey", vnfInstance.getLicenseKey());
- assertEquals("managementV6Address", vnfInstance.getManagementV6Address());
-
- String vnfInstanceString = vnfInstance.toString();
- assertTrue(vnfInstanceString.contains("[vnfId=vnfId,vnfName=vnfName,vnfName2=vnfName2,vnfType=vnfType,serviceId=serviceId,provisionStatus=provisionStatus,licenseKey=licenseKey,equipmentRole=equipmentRole,orchestrationStatus=orchestrationStatus,heatStackId=heatStackId,msoCatalogKey=msoCatalogKey,ipv4OamAddress=ipv4OamAddress,ipv4Loopback0Address=ipv4Loopback0Address,nmLanV6Address=nmLanV6Address,managementV6Address=managementV6Address,inMaintenance=true,isClosedLoopDisabled=true,resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId,nfType=nfType,nfFunction=nfFunction,nfRole=nfRole,nfNamingCode=nfNamingCode,"));
- }
-
- @Test
- public void testVnfInstanceEquals() {
- VnfInstance vnfInstance1 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules(), new LInterfaceInstanceList());
- VnfInstance vnfInstance2 = new VnfInstance("vnfId2", "vnfName2", "vnfName2-2", "vnfType2", "serviceId2", "provisionStatus2", "licenseKey2", "equipmentRole2", "orchestrationStatus2", "heatStackId2", "msoCatalogKey2", "ipv4OamAddress2", "ipv4Loopback0Address2", "nmLanV6Address2", "managementV6Address2", true, true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", "modelCustomizationId2", "nfType2", "nfFunction2", "nfRole2", "nfNamingCode2", new RelationshipList(), new VfModules(), new LInterfaceInstanceList());
- VnfInstance vnfInstance3 = new VnfInstance("vnfId1", "vnfName1", "vnfName2-1", "vnfType1", "serviceId1", "provisionStatus1", "licenseKey1", "equipmentRole1", "orchestrationStatus1", "heatStackId1", "msoCatalogKey1", "ipv4OamAddress1", "ipv4Loopback0Address1", "nmLanV6Address1", "managementV6Address1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", "modelCustomizationId1", "nfType1", "nfFunction1", "nfRole1", "nfNamingCode1", new RelationshipList(), new VfModules(), new LInterfaceInstanceList());
-
- assertTrue(vnfInstance1.equals(vnfInstance1));
- assertTrue(!vnfInstance1.equals(vnfInstance2));
- assertTrue(vnfInstance1.equals(vnfInstance3));
-
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java
deleted file mode 100644
index 29c55a9..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VnfcInstanceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
-import org.onap.pomba.contextbuilder.aai.datatype.VnfcInstance;
-
-public class VnfcInstanceTest {
- @Test
- public void testVnfcInstance() {
- VnfcInstance vnfcInstance = new VnfcInstance();
- vnfcInstance.setVnfcName("vnfcName");
- vnfcInstance.setNfcNamingCode("nfcNamingCode");
- vnfcInstance.setNfcFunction("nfcFunction");
- vnfcInstance.setProvisionStatus("provisionStatus");
- vnfcInstance.setOrchestrationStatus("orchestrationStatus");
- vnfcInstance.setInMaintenance(true);
- vnfcInstance.setIsClosedLoopDisabled(true);
- vnfcInstance.setResourceVersion("resourceVersion");
- vnfcInstance.setModelInvariantId("modelInvariantId");
- vnfcInstance.setModelVersionId("modelVersionId");
- vnfcInstance.setRelationshipList(new RelationshipList());
-
- assertEquals("vnfcName", vnfcInstance.getVnfcName());
- assertEquals("nfcNamingCode", vnfcInstance.getNfcNamingCode());
- assertEquals("nfcFunction", vnfcInstance.getNfcFunction());
- assertEquals("provisionStatus", vnfcInstance.getProvisionStatus());
- assertEquals("orchestrationStatus", vnfcInstance.getOrchestrationStatus());
- assertTrue(vnfcInstance.getInMaintenance());
- assertTrue(vnfcInstance.getIsClosedLoopDisabled());
- assertEquals("resourceVersion", vnfcInstance.getResourceVersion());
- assertEquals("modelInvariantId", vnfcInstance.getModelInvariantId());
- assertEquals("modelVersionId", vnfcInstance.getModelVersionId());
- assertTrue(vnfcInstance.getRelationshipList() instanceof RelationshipList);
-
- }
-
- @Test
- public void testVnfcInstanceWithParameters() {
- VnfcInstance vnfcInstance = new VnfcInstance("vnfcName", "nfcNamingCode", "nfcFunction", "provisionStatus", "orchestrationStatus", true, true, "resourceVersion", "modelInvariantId", "modelVersionId", new RelationshipList());
-
- assertEquals("vnfcName", vnfcInstance.getVnfcName());
- assertEquals("nfcNamingCode", vnfcInstance.getNfcNamingCode());
- assertEquals("nfcFunction", vnfcInstance.getNfcFunction());
- assertEquals("provisionStatus", vnfcInstance.getProvisionStatus());
- assertEquals("orchestrationStatus", vnfcInstance.getOrchestrationStatus());
- assertTrue(vnfcInstance.getInMaintenance());
- assertTrue(vnfcInstance.getIsClosedLoopDisabled());
- assertEquals("resourceVersion", vnfcInstance.getResourceVersion());
- assertEquals("modelInvariantId", vnfcInstance.getModelInvariantId());
- assertEquals("modelVersionId", vnfcInstance.getModelVersionId());
- assertTrue(vnfcInstance.getRelationshipList() instanceof RelationshipList);
-
- String vnfcInstanceString = vnfcInstance.toString();
- assertTrue(vnfcInstanceString.contains("[vnfcName=vnfcName,nfcNamingCode=nfcNamingCode,nfcFunction=nfcFunction,provisionStatus=provisionStatus,orchestration_status=orchestrationStatus,inMaintenance=true,isClosedLoopDisabled=true,resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,"));
- }
-
- @Test
- public void testVnfcInstanceEquals() {
- VnfcInstance vnfcInstance1 = new VnfcInstance("vnfcName1", "nfcNamingCode1", "nfcFunction1", "provisionStatus1", "orchestrationStatus1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", new RelationshipList());
- VnfcInstance vnfcInstance2 = new VnfcInstance("vnfcName2", "nfcNamingCode2", "nfcFunction2", "provisionStatus2", "orchestrationStatus2", true, true, "resourceVersion2", "modelInvariantId2", "modelVersionId2", new RelationshipList());
- VnfcInstance vnfcInstance3 = new VnfcInstance("vnfcName1", "nfcNamingCode1", "nfcFunction1", "provisionStatus1", "orchestrationStatus1", true, true, "resourceVersion1", "modelInvariantId1", "modelVersionId1", new RelationshipList());
-
- assertTrue(vnfcInstance1.equals(vnfcInstance1));
- assertTrue(!vnfcInstance1.equals(vnfcInstance2));
- assertTrue(vnfcInstance1.equals(vnfcInstance3));
- }
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java
deleted file mode 100644
index 509db34..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/VserverTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.datatype.Relationship;
-import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList;
-import org.onap.pomba.contextbuilder.aai.datatype.Vserver;
-import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList;
-
-public class VserverTest {
-
- @Test
- public void testVserver() {
- Vserver aVServer = new Vserver();
- aVServer.setVserverId("vserverId");
- aVServer.setVserverName("vserverName");
- aVServer.setVserverName2("vserverName2");
- aVServer.setVserverSelflink("vserverSelflink");
- aVServer.setInMaint(true);
- aVServer.setIsClosedLoopDisabled(true);
- aVServer.setProvStatus("provStatus");
- Relationship relationship = new Relationship();
- List<Relationship> list = new ArrayList<Relationship>();
- list.add(relationship);
- RelationshipList relationshipList = new RelationshipList(list);
- aVServer.setRelationshipList(relationshipList);
- aVServer.setResourceVersion("resourceVersion");
-
- assertEquals("vserverId", aVServer.getVserverId());
- assertEquals("vserverName", aVServer.getVserverName());
- assertEquals("vserverName2", aVServer.getVserverName2());
- assertEquals("vserverSelflink", aVServer.getVserverSelflink());
- assertEquals(true, aVServer.getInMaint());
- assertEquals(true, aVServer.getIsClosedLoopDisabled());
- assertEquals("provStatus", aVServer.getProvStatus());
- assertTrue(aVServer.getRelationshipList().getRelationship().size() == 1);
- assertEquals("resourceVersion", aVServer.getResourceVersion());
-
- String vserverToString = aVServer.toString();
- assertTrue(vserverToString.contains("[vserverId=vserverId,vserverName=vserverName,vserverName2=vserverName2,provStatus=provStatus,vserverSelflink=vserverSelflink,inMaint=true,isClosedLoopDisabled=true,resourceVersion=resourceVersion"));
- }
-
- @Test
- public void testVserverWithParameters() {
- Vserver aVServer = new Vserver("vserverId", "vserverName", "vserverName2", "provStatus", "vserverSelflink", true, true, "resourceVersion", new RelationshipList(), new LInterfaceInstanceList());
-
- assertEquals("vserverId", aVServer.getVserverId());
- assertEquals("vserverName", aVServer.getVserverName());
- assertEquals("vserverName2", aVServer.getVserverName2());
- assertEquals("vserverSelflink", aVServer.getVserverSelflink());
- assertEquals(true, aVServer.getInMaint());
- assertEquals(true, aVServer.getIsClosedLoopDisabled());
- assertEquals("provStatus", aVServer.getProvStatus());
- assertEquals("resourceVersion", aVServer.getResourceVersion());
- }
-
- @Test
- public void testVserverEquals() {
- Vserver aVServer1 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList(), new LInterfaceInstanceList());
- Vserver aVServer2 = new Vserver("vserverId2", "vserverName2", "vserverName2", "provStatus2", "vserverSelflink2", false, false, "resourceVersion2", new RelationshipList(), new LInterfaceInstanceList());
- Vserver aVServer3 = new Vserver("vserverId1", "vserverName1", "vserverName2", "provStatus1", "vserverSelflink1", true, true, "resourceVersion1", new RelationshipList(), new LInterfaceInstanceList());
-
- assertTrue(aVServer1.equals(aVServer1));
- assertFalse(aVServer1.equals(aVServer2));
- assertTrue(aVServer1.equals(aVServer3));
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java
deleted file mode 100644
index a07524d..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/WebConfigurationTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-
-import org.junit.Test;
-import org.onap.pomba.contextbuilder.aai.WebConfiguration;
-import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-public class WebConfigurationTest {
- @Test
- public void runTest() {
- WebConfiguration webConfiguration = new WebConfiguration();
- WebMvcConfigurerAdapter webMvConfigurationAdapter = webConfiguration.forwardToIndex();
- ViewResolverRegistry registry = mock(ViewResolverRegistry.class);
- webMvConfigurationAdapter.configureViewResolvers(registry);
- assertEquals(false, registry.hasRegistrations());
- }
-
-}
diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java
deleted file mode 100644
index c97ea1a..0000000
--- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/test/RestServiceTest.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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.logging_analytics.pomba.pomba_aai_context_builder.test;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.pomba.contextbuilder.aai.Application;
-import org.onap.pomba.contextbuilder.aai.service.rs.RestService;
-import org.onap.pomba.contextbuilder.aai.util.RestUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.web.WebAppConfiguration;
-import org.onap.pomba.common.datatypes.ModelContext;
-import org.onap.pomba.common.datatypes.VFModule;
-import org.onap.pomba.common.datatypes.VM;
-import org.onap.pomba.common.datatypes.VNF;
-import org.onap.pomba.common.datatypes.VNFC;
-import org.json.JSONObject;
-import com.google.gson.Gson;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
-@WebAppConfiguration
-@SpringBootTest (classes = Application.class)
-@TestPropertySource(properties = { "aai.serviceName=localhost",
- "aai.servicePort=9806", "aai.httpProtocol=http",
- "http.userId=admin", "http.password=OBF:1u2a1toa1w8v1tok1u30"})
-public class RestServiceTest {
- @Autowired
- private String aaiPathToSearchNodeQuery;
-
- @Autowired
- private String httpBasicAuthorization;
-
- @Autowired
- private RestService dummyRestSvc;
-
- private String testRestHeaders = "aai-context-builder";
-
- HttpHeaders mockHttpHeaders = mock(HttpHeaders.class);
-
- private static final String DEPTH = "?depth=2";
-
- @Rule
- public WireMockRule aaiEnricherRule = new WireMockRule(wireMockConfig().port(9806));
-
- private void addResponse(String path, String classpathResource, WireMockRule thisMock) throws IOException {
- String payload = readFully(ClassLoader.getSystemResourceAsStream(classpathResource));
- thisMock.stubFor(get(path).willReturn(okJson(payload)));
- }
-
- private String readFully(InputStream in) throws IOException {
- char[] cbuf = new char[1024];
- StringBuilder content = new StringBuilder();
- try (InputStreamReader reader = new InputStreamReader(in, "UTF-8")) {
- int count;
- while ((count = reader.read(cbuf)) >= 0) {
- content.append(cbuf, 0, count);
- }
- }
- return content.toString();
- }
-
- private static MultivaluedMap<String, String> buildHeaders(
- String partnerName, String transactionId, String authorization) {
-
- MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
- headers.put(RestUtil.FROM_APP_ID, Collections.singletonList(partnerName));
- headers.put(RestUtil.TRANSACTION_ID, Collections.singletonList(transactionId));
- if (null != authorization) {
- headers.put(RestUtil.AUTHORIZATION, Collections.singletonList(authorization));
- }
- return headers;
- }
-
- private static String generateGetCustomerInfoUrl (String baseURL, String aaiPathToSearchNodeQuery,String serviceInstanceId) {
- return baseURL + MessageFormat.format(aaiPathToSearchNodeQuery, serviceInstanceId);
- }
-
- ///Verify the relationship serviceInstanceId -> vnf -> vserver -> pserver
- @Test
- public void testGetContext_VSERVER_PSERVER() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf)
- // note: match serviceInstanceId in (1)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set2.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver.json", aaiEnricherRule);
-
- // 5. simulate the rsp of pserver
- // note: match pserver hostname to the path of "pserver" in (4)
- addResponse(
- "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
- "junit/pserverInput_set2.json", aaiEnricherRule);
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
-
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id
- assertEquals(vmList.get(0).getPServer().getName(), "mtn96compute.cci.att.com"); //pserver-name
-
- }
-
- ///Verify the relationship serviceInstanceId -> vnf (containing L-Interface) -> vserver (containing - LInterfaceList)
-
- @Test
- public void testGetContext_VSERVER_L_interface_And_Logical_link() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set6.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set3.json", aaiEnricherRule);
- // 5. simulate the rsp of logical-link
- // note: match to link-name to the path of "relationship-list" in (3: genericVnfInput_set6)
- // and match the link-name to (4 aai-vserver-set3.json)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3",
- "junit/logical-link-input3.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4",
- "junit/logical-link-input4.json", aaiEnricherRule);
-
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
-
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- assertEquals(vnfList.get(0).getLInterfaceList().size(), 2);
- assertEquals(vnfList.get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name3"); //l-interface-name
- assertEquals(vnfList.get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name4"); //l-interface-name
- assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1);
- assertEquals(vnfList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-3"); //Logical-link at vnf->l-interface -> Logical-link
- assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1);
- assertEquals(vnfList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-4");
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id
- assertEquals(vmList.get(0).getLInterfaceList().size(), 2);
- assertEquals(vmList.get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name1"); //l-interface-name
- assertEquals(vmList.get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name2"); //l-interface-name
- assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); //Logical-link at vserver->l-interface -> Logical-link
- assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-2");
-
- }
-
- ///Verify the relationship serviceInstanceId -> vnf + vnfc
- @Test
- public void testGetContext_VNFC() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set5.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set2.json", aaiEnricherRule);
-
- // 5. simulate the rsp of vnfc
- // note: match to vnfc-name to the path of "vnfc" in (3)
- addResponse(
- "/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212",
- "junit/vnfc-input1.json", aaiEnricherRule);
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
-
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id
-
- List<VNFC> vnfcList = vnfList.get(0).getVnfcs();
- assertEquals(vnfcList.size(), 1);
- assertEquals(vnfcList.get(0).getName(), "junit-vnfc-name1212"); //vnfc-name
- }
-
- ///Verify the relationship serviceInstanceId -> vnf + vnfc
- @Test
- public void testGetContext_VNFC2() throws Exception {
-
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set5.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver-set2.json", aaiEnricherRule);
-
- // 5. simulate the rsp of vnfc
- // note: match to vnfc-name to the path of "vnfc" in (3)
- addResponse(
- "/aai/v13/network/vnfcs/vnfc/junit-vnfc-name1212",
- "junit/vnfc-input1.json", aaiEnricherRule);
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
-
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
- // verify results
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getUuid(), "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"); //vserver-id
-
- List<VNFC> vnfcList = vnfList.get(0).getVnfcs();
- assertEquals(vnfcList.size(), 1);
- assertEquals(vnfcList.get(0).getName(), "junit-vnfc-name1212"); //vnfc-name
- }
-
- ///Verify the relationship serviceInstanceId -> vnf + vnfc
- @Test
- public void testGetContext_LogicalLink_in_service_level() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set4.json", aaiEnricherRule);
-
- // 3. simulate the rsp of logical-link
- // note: match to link-name to the path of "relationship-list" in (2: aai-service-instance_set4)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
- assertEquals(modelCtx.getLogicalLinkList().size(), 2);
- assertEquals(modelCtx.getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1");
- assertEquals(modelCtx.getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2");
- }
-
- ///Verify the relationship P-interface, L-interaface, Logical-link
- @Test
- public void testGetContext_LogicalLink_in_PInterface_level_with_PNF() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf and 1 pnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput.json", aaiEnricherRule);
-
- // 4. simulate the response of PNF based on the resourceLink in (2)
- //note: match pnf_id in junit/aai-service-instance.json
- addResponse( "/aai/v13/network/pnfs/pnf/amdocsPnfName" + DEPTH,
- "junit/pnfInput_w_pInterface_LInterface_set2.json", aaiEnricherRule);
-
- // 5. simulate the rsp of logical-link
- // note: match to link-name to the path of "relationship-list" in (4: pnfInput_w_pInterface_LInterface_set2)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
- assertEquals(modelCtx.getVnfs().size(), 1);
- assertEquals(modelCtx.getPnfs().size(), 1);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().size(), 1);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().size(), 2);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name5"); //l-interface-name
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name6"); //l-interface-name
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().size(), 2);
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1");
- assertEquals(modelCtx.getPnfs().get(0).getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2");
- }
-
- ///Verify the relationship P-interface, L-interaface, Logical-link
- @Test
- public void testGetContext_LogicalLink_in_PInterface_level_with_PSERVER() throws Exception {
- String transactionId = UUID.randomUUID().toString();
- String serviceInstanceId = "adc3cc2a-c73e-414f-8ddb-367de81300cb"; //match to the test data in junit/queryNodeData-1.json
- String queryNodeUrl = generateGetCustomerInfoUrl("", aaiPathToSearchNodeQuery, serviceInstanceId);
-
- // Test with No Partner Name
- final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
- transactionId, testRestHeaders, httpBasicAuthorization);
-
- // 2. simulate the response of AAI (1 vnf)
- addResponse( queryNodeUrl,
- "junit/aai-service-instance_set2.json", aaiEnricherRule);
-
- // 3. simulate the rsp of VNF (with 1 vserver)
- // note: match vnf_id in (2)
- addResponse( "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39" + DEPTH,
- "junit/genericVnfInput_set2.json", aaiEnricherRule);
-
- // 4. simulate the rsp of vserer
- // note: match to vserver-id to the path of "vserver" in (3)
- addResponse(
- "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant"
- + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + DEPTH,
- "junit/aai-vserver.json", aaiEnricherRule);
-
- // 5. simulate the rsp of pserver with P-interface which also contains L-interface.
- // note: match pserver hostname to the path of "pserver" in (4)
- addResponse(
- "/aai/v13/cloud-infrastructure/pservers/pserver/mtn96compute.cci.att.com" + DEPTH,
- "junit/pserverInput_with_pInterface_LInterface_set2.json", aaiEnricherRule);
-
- // 6. simulate the rsp of logical-link
- // note: match to link-name to the path of "relationship-list" in (5: pserverInput_with_pInterface_LInterface_set2)
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-1",
- "junit/logical-link-input1.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-2",
- "junit/logical-link-input2.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-3",
- "junit/logical-link-input3.json", aaiEnricherRule);
- addResponse(
- "/aai/v13/network/logical-links/logical-link/01e8d84a-logical-link-4",
- "junit/logical-link-input4.json", aaiEnricherRule);
-
- when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = this.dummyRestSvc.getContext(mockHttpHeaders, httpBasicAuthorization, testRestHeaders, transactionId,
- serviceInstanceId);
-
- assertEquals(Status.OK.getStatusCode(), response.getStatus());
- Gson gson = new Gson();
- ModelContext modelCtx = gson.fromJson((String) response.getEntity(), ModelContext.class);
-
- List<VNF> vnfList = modelCtx.getVnfs();
- assertEquals(vnfList.size(), 1);
- List<VFModule> vfModuleList = vnfList.get(0).getVfModules();
- assertEquals(vfModuleList.size(), 1);
- List<VM> vmList = vfModuleList.get(0).getVms();
- assertEquals(vmList.size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getName(), "bdc3cc2a-c73e-414f-7ddb-367de92801cb"); //interface-name
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().size(), 2);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getName(), "junit-l-interface-name7"); //Vserver-> Pserver-> P-interface -> l-interface
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getName(), "junit-l-interface-name8");
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-3"); //Vserver-> Pserver-> P-interface -> l-interface -> logical-link
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getLogicalLinkList().size(), 1);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLInterfaceList().get(1).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-4");
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().size(), 2);
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(0).getName(), "01e8d84a-logical-link-1"); //Vserver-> Pserver-> P-interface -> Logical-link
- assertEquals(vmList.get(0).getPServer().getPInterfaceList().get(0).getLogicalLinkList().get(1).getName(), "01e8d84a-logical-link-2");
- }
-}