summaryrefslogtreecommitdiffstats
path: root/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2019-09-19 10:21:21 +0100
committerMichaelMorris <michael.morris@est.tech>2019-09-19 10:24:01 +0100
commit5c869b76bc052104f6720a304344e9c0a4494f1d (patch)
tree15b5280dffd2b1618ab183ffc176b49bb9a5c01f /adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java
parenta1f8a0c1ce64e90653397c5ce8d4949fe0244d07 (diff)
VNFM adapter relationship handling improvements
Change-Id: I8fd7af559448b9cdd6fab4bedd8ec001f196a200 Issue-ID: SO-2352 Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java')
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java21
2 files changed, 18 insertions, 19 deletions
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index 89a2c102f4..f83e9c94d2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -212,12 +212,16 @@ public class Sol003LcnControllerTest {
final Vserver vserver = (Vserver) bodyArgument2.getAllValues().get(0);
assertEquals("myVnfc1", vserver.getVserverId());
- final Relationship relationship = vserver.getRelationshipList().getRelationship().get(0);
- assertEquals("generic-vnf", relationship.getRelatedTo());
- assertEquals("tosca.relationships.HostedOn", relationship.getRelationshipLabel());
- assertEquals("/aai/v15/network/generic-vnfs/generic-vnf/myTestVnfId", relationship.getRelatedLink());
- assertEquals("generic-vnf.vnf-id", relationship.getRelationshipData().get(0).getRelationshipKey());
- assertEquals("myTestVnfId", relationship.getRelationshipData().get(0).getRelationshipValue());
+
+ final ArgumentCaptor<AAIResourceUri> uriArgument1Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).connect(uriArgument1Connect.capture(), uriArgument2Connect.capture());
+ assertEquals(
+ "/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/" + REGION + "/tenants/tenant/"
+ + TENANT_ID + "/vservers/vserver/myVnfc1",
+ uriArgument1Connect.getAllValues().get(0).build().toString());
+ assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
+ uriArgument2Connect.getAllValues().get(0).build().toString());
}
@Test
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index fe55907420..297f74433e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
@@ -175,20 +176,14 @@ public class VnfmAdapterControllerTest {
assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId", uriArgument.getValue().build().toString());
assertEquals("myTestVnfId", genericVnfArgument.getValue().getVnfId());
- assertEquals(2, genericVnfArgument.getValue().getRelationshipList().getRelationship().size());
- final Relationship vnfmRelationship =
- genericVnfArgument.getValue().getRelationshipList().getRelationship().get(0);
- assertEquals("esr-vnfm", vnfmRelationship.getRelatedTo());
- assertEquals("tosca.relationships.DependsOn", vnfmRelationship.getRelationshipLabel());
- assertEquals("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfm2", vnfmRelationship.getRelatedLink());
-
- final Relationship tenantRelationship =
- genericVnfArgument.getValue().getRelationshipList().getRelationship().get(1);
- assertEquals("tenant", tenantRelationship.getRelatedTo());
- assertEquals(
- "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/myTestCloudOwner/myTestRegion/tenants/tenant/myTestTenantId",
- tenantRelationship.getRelatedLink());
+ final ArgumentCaptor<AAIResourceUri> uriArgument1Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).connect(uriArgument1Connect.capture(), uriArgument2Connect.capture());
+ assertEquals("/external-system/esr-vnfm-list/esr-vnfm/vnfm2",
+ uriArgument1Connect.getAllValues().get(0).build().toString());
+ assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
+ uriArgument2Connect.getAllValues().get(0).build().toString());
// check the job status