diff options
author | Gamboa, Gilbert <gilbert.g.gamboa@att.com> | 2019-08-30 13:02:22 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-08-30 13:02:22 -0400 |
commit | baeca07d02b3cd3d22cb4da8973cdd0b71ae0d43 (patch) | |
tree | 96bfda9a5610ede1c0458f5f76d4c82d364cb4fe /bpmn | |
parent | 687cdacb9fd74629e94ebc0914ba8c72bb5015a5 (diff) |
fix create call to A&AI
createIfNotExists should be used rather than create
Issue-ID: SO-2269
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I03af6a83460acbb1d7bde01f108d2a5a03d05adf
Diffstat (limited to 'bpmn')
2 files changed, 4 insertions, 6 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 867d80a4ea..8b939940fa 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -52,7 +52,7 @@ public class AAIConfigurationResources { AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); - injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); + injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration)); } /** diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 68f3d20c82..9855c8587a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -96,14 +96,12 @@ public class AAIConfigurationResourcesTest extends TestDataSetup { public void createConfigurationTest() { doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper) .mapConfiguration(configuration); - doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), - isA(org.onap.aai.domain.yang.Configuration.class)); - + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + any(Optional.class)); aaiConfigurationResources.createConfiguration(configuration); assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); - verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), - isA(org.onap.aai.domain.yang.Configuration.class)); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); } @Test |