diff options
author | Gamboa, Gilbert <gilbert.g.gamboa@att.com> | 2019-12-11 13:35:47 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-12-11 13:35:47 -0500 |
commit | 5671fed30c9bcc74f0884893538e4aacabbc1b2f (patch) | |
tree | 87c1f4276453944bc94980a490ec33d47a35ea65 /bpmn/so-bpmn-tasks/src/test/java | |
parent | 02c068ce771ee4522936f2d15f41c2b631e965a8 (diff) |
Need to globally check object name duplicates in
Need to globally check object name duplicates in AAI for vf-module,
volumegroup and configuration.
Issue-ID: SO-2563
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I88a89a4a3ba02d5d9d586593d259580bf4546c96
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 6c959703e4..a894706357 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -1702,7 +1702,24 @@ public class WorkflowActionTest extends BaseTaskTest { "vfModule with name (vFModName222), same parent and different customization id (1234567) already exists. The name must be unique.")); workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName222", reqDetails, workflowResourceIds); + } + @Test + public void validateVfModuleResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("id111"); + + GenericVnf vnf1 = new GenericVnf(); + workflowResourceIds.setVnfId("id111"); + when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf1); + + when(bbSetupUtils.existsAAIVfModuleGloballyByName("vFModName333")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("vfModule with name vFModName333 already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName333", reqDetails, + workflowResourceIds); } @Test @@ -1725,6 +1742,7 @@ public class WorkflowActionTest extends BaseTaskTest { VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); volumeGroup.setVolumeGroupName("name123"); + volumeGroup.setVfModuleModelCustomizationId("1234567"); workflowResourceIds.setVnfId("id123"); Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); @@ -1747,6 +1765,24 @@ public class WorkflowActionTest extends BaseTaskTest { } @Test + public void validateVolumeGroupResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("id123"); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "testVolumeGroup")).thenReturn(Optional.empty()); + + when(bbSetupUtils.existsAAIVolumeGroupGloballyByName("testVolumeGroup")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("volumeGroup with name testVolumeGroup already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "testVolumeGroup", + reqDetails, workflowResourceIds); + } + + @Test public void validateConfigurationResourceIdInAAITest() throws Exception { RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); @@ -1789,6 +1825,22 @@ public class WorkflowActionTest extends BaseTaskTest { } @Test + public void validateConfigurationResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "testConfig")) + .thenReturn(Optional.empty()); + when(bbSetupUtils.existsAAIConfigurationGloballyByName("testConfig")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("configuration with name testConfig already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "testConfig", reqDetails, + workflowResourceIds); + } + + @Test public void validateServiceInstanceResourceIdInAAITest() throws Exception { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setServiceInstanceId("siId123"); |