diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2020-03-19 17:57:25 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-03-19 17:57:25 -0400 |
commit | 0c6057ea8f21c63af4791107c2440a6ed992f5f0 (patch) | |
tree | 7475d19646f176f30b4f80fcfacd6c68ab18b136 /adapters/mso-openstack-adapters/src/test/java/org/onap | |
parent | c1fcea306877deed8ec05e3608b2a7534b345900 (diff) |
mso to add support for creating the cloud region
mso to add support for creating the cloud region
Updated tag name to msoRequest on deletes.
Issue-ID: SO-2753
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I80e318ce34f5938a42896398eb1a38b5c5f6e831
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java/org/onap')
-rw-r--r-- | adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java index 9c62c286ac..2df56ede10 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java @@ -23,6 +23,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository; @RunWith(MockitoJUnitRunner.class) @@ -38,6 +39,9 @@ public class CloudRegionRestImplTest { @Mock private AAIResourcesClient aaiResClientMock; + @Mock + private NetworkTechnologyReferenceRepository ntRepoMock; + private CloudSite cloudSite = new CloudSite(); private CloudRegion testCloudRegion = new CloudRegion(); @@ -46,30 +50,52 @@ public class CloudRegionRestImplTest { public void setup() { cloudSite.setCloudVersion("1.0"); cloudSite.setRegionId("region1"); + cloudSite.setCloudOwner("bob"); Mockito.doReturn(aaiResClientMock).when(cloudRestImpl).getAaiClient(); testCloudRegion.setCloudOwner("bob"); testCloudRegion.setCloudRegionId("region1"); testCloudRegion.setCloudRegionVersion("1.0"); testCloudRegion.setInMaint(false); testCloudRegion.setOrchestrationDisabled(false); - testCloudRegion.setComplexName("NA"); testCloudRegion.setCloudRegionVersion("1.0"); testCloudRegion.setOwnerDefinedType("cLCP"); testCloudRegion.setCloudType("openstack"); + testCloudRegion.setCloudZone("region1"); } @Test public void mapCloudRegionTest() { - CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite, "bob"); + CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite); assertThat(mappedRegion, sameBeanAs(testCloudRegion)); } + + @Test + public void mapCloudRegionVersionGreaterThan3Test() { + CloudSite cloudSite2 = new CloudSite(); + cloudSite2.setCloudVersion("3.0.1"); + cloudSite2.setRegionId("region1"); + cloudSite2.setCloudOwner("bob"); + + CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite2); + CloudRegion testRegion2 = new CloudRegion(); + testRegion2.setCloudOwner("bob"); + testRegion2.setCloudRegionId("region1"); + testRegion2.setCloudRegionVersion("3.0.1"); + testRegion2.setInMaint(false); + testRegion2.setOrchestrationDisabled(false); + testRegion2.setOwnerDefinedType("cLCP"); + testRegion2.setCloudType("openstack"); + testRegion2.setCloudZone("region"); + assertThat(mappedRegion, sameBeanAs(testRegion2)); + } + @Test public void createCloudRegionTest() { when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null); when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite); AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1"); - cloudRestImpl.createCloudRegion(cloudSite, "bob"); + cloudRestImpl.createCloudRegion(cloudSite); ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class); ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class); verify(catalogDbClientMock, times(1)).getCloudSite("region1"); @@ -82,7 +108,7 @@ public class CloudRegionRestImplTest { @Test public void updateCloudRegionTest() { when(catalogDbClientMock.updateCloudSite(cloudSite)).thenReturn(cloudSite); - cloudRestImpl.updateCloudRegion(cloudSite, "bob"); + cloudRestImpl.updateCloudRegion(cloudSite); verify(catalogDbClientMock, times(1)).updateCloudSite(cloudSite); } |