diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java index 8c0d27f799..cb5683d9d8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java @@ -22,6 +22,8 @@ package org.onap.so.client.orchestration; import static org.mockito.ArgumentMatchers.eq; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; @@ -40,6 +42,7 @@ import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIEdgeLabel; @@ -131,4 +134,22 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup { verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); } + @Test + public void checkInstanceGroupNameInUseTrueTest() throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + .queryParam("instance-group-name", "instanceGroupName"); + doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri)); + boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName"); + assertTrue(nameInUse); + } + + @Test + public void checkInstanceGroupNameInUseFalseTest() throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + .queryParam("instance-group-name", "instanceGroupName"); + doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri)); + boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName"); + assertFalse(nameInUse); + } + } |