summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-11-24 10:41:40 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2022-11-24 14:52:18 +0000
commit933f1325044e6233ca0da1eecf223bc5bbb06b36 (patch)
tree77ab10ee6fa109b53294e328ead2df12aee78a73 /runtime-acm/src
parenta2e99e7df02837d8270228c330bed4915043b996 (diff)
Link the AutomationComposition with AutomationCompositionDefinition
In AutomationComposition replace the link to ToscaNodeTemplate whit a link to AutomationCompositionDefinition using compositionId. Issue-ID: POLICY-4464 Change-Id: I66878f04ef93fb0754d0066e78bd074ce082f891 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java14
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java17
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java61
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java2
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java5
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java9
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java47
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java157
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java12
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java65
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java16
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json100
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json98
14 files changed, 279 insertions, 326 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
index c2564887c..19d4afe11 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
@@ -21,13 +21,11 @@
package org.onap.policy.clamp.acm.runtime.commissioning;
-import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.messages.rest.commissioning.CommissioningResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
@@ -118,7 +116,7 @@ public class CommissioningProvider {
*/
public CommissioningResponse updateCompositionDefinition(UUID compositionId, ToscaServiceTemplate serviceTemplate) {
- var automationCompositions = acProvider.getAutomationCompositions();
+ var automationCompositions = acProvider.getAcInstancesByCompositionId(compositionId);
var result = new BeanValidationResult("AutomationCompositions", automationCompositions);
for (var automationComposition : automationCompositions) {
if (!AutomationCompositionState.UNINITIALISED.equals(automationComposition.getState())) {
@@ -145,11 +143,11 @@ public class CommissioningProvider {
*/
public CommissioningResponse deleteAutomationCompositionDefinition(UUID compositionId) {
- if (verifyIfInstanceExists()) {
+ if (verifyIfInstanceExists(compositionId)) {
throw new PfModelRuntimeException(Status.BAD_REQUEST,
"Delete instances, to commission automation composition definitions");
}
- List<Participant> participantList = participantProvider.getParticipants();
+ var participantList = participantProvider.getParticipants();
if (!participantList.isEmpty()) {
supervisionHandler.handleSendDeCommissionMessage();
}
@@ -190,8 +188,8 @@ public class CommissioningProvider {
*
* @return true if exists instance
*/
- private boolean verifyIfInstanceExists() {
- return !acProvider.getAutomationCompositions().isEmpty();
+ private boolean verifyIfInstanceExists(UUID compositionId) {
+ return !acProvider.getAcInstancesByCompositionId(compositionId).isEmpty();
}
/**
@@ -200,6 +198,6 @@ public class CommissioningProvider {
* @return true if exists instance
*/
private boolean verifyIfDefinitionExists() {
- return !acDefinitionProvider.getAllServiceTemplates().isEmpty();
+ return !acDefinitionProvider.getAllAcDefinitions().isEmpty();
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
index df1f0ead4..2601a233b 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
@@ -126,17 +126,14 @@ public class AutomationCompositionInstantiationProvider {
private BeanValidationResult validateAutomationCompositions(AutomationCompositions automationCompositions) {
var result = new BeanValidationResult("AutomationCompositions", automationCompositions);
- var serviceTemplates = acDefinitionProvider.getAllServiceTemplates();
- if (serviceTemplates.isEmpty()) {
- result.addResult(new ObjectValidationResult("ServiceTemplate", "", ValidationStatus.INVALID,
- "Commissioned automation composition definition not found"));
- return result;
- }
-
- var serviceTemplate = acDefinitionProvider.getAllServiceTemplates().get(0);
-
for (var automationComposition : automationCompositions.getAutomationCompositionList()) {
- result.addResult(AcmUtils.validateAutomationComposition(automationComposition, serviceTemplate));
+ var serviceTemplate = acDefinitionProvider.findAcDefinition(automationComposition.getCompositionId());
+ if (serviceTemplate.isEmpty()) {
+ result.addResult(new ObjectValidationResult("ServiceTemplate", "", ValidationStatus.INVALID,
+ "Commissioned automation composition definition not found"));
+ } else {
+ result.addResult(AcmUtils.validateAutomationComposition(automationComposition, serviceTemplate.get()));
+ }
}
return result;
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
index 479d6cf6a..b01aca5e8 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -445,7 +445,7 @@ public class SupervisionHandler {
}
private int getFirstStartPhase(AutomationComposition automationComposition) {
- var toscaServiceTemplate = acDefinitionProvider.getAllServiceTemplates().get(0);
+ var toscaServiceTemplate = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId());
return ParticipantUtils.getFirstStartPhase(automationComposition, toscaServiceTemplate);
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
index 5f3bfb281..e2f8b6777 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -57,7 +57,7 @@ public class SupervisionScanner {
private final HandleCounter<ToscaConceptIdentifier> automationCompositionCounter = new HandleCounter<>();
private final HandleCounter<ToscaConceptIdentifier> participantStatusCounter = new HandleCounter<>();
private final HandleCounter<Pair<ToscaConceptIdentifier, ToscaConceptIdentifier>> participantUpdateCounter =
- new HandleCounter<>();
+ new HandleCounter<>();
private final Map<ToscaConceptIdentifier, Integer> phaseMap = new HashMap<>();
@@ -82,11 +82,12 @@ public class SupervisionScanner {
* @param acRuntimeParameterGroup the parameters for the automation composition runtime
*/
public SupervisionScanner(final AutomationCompositionProvider automationCompositionProvider,
- AcDefinitionProvider acDefinitionProvider,
- final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
- AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
- ParticipantProvider participantProvider, ParticipantStatusReqPublisher participantStatusReqPublisher,
- ParticipantUpdatePublisher participantUpdatePublisher, final AcRuntimeParameterGroup acRuntimeParameterGroup) {
+ AcDefinitionProvider acDefinitionProvider,
+ final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
+ AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ ParticipantProvider participantProvider, ParticipantStatusReqPublisher participantStatusReqPublisher,
+ ParticipantUpdatePublisher participantUpdatePublisher,
+ final AcRuntimeParameterGroup acRuntimeParameterGroup) {
this.automationCompositionProvider = automationCompositionProvider;
this.acDefinitionProvider = acDefinitionProvider;
this.automationCompositionStateChangePublisher = automationCompositionStateChangePublisher;
@@ -96,17 +97,17 @@ public class SupervisionScanner {
this.participantUpdatePublisher = participantUpdatePublisher;
automationCompositionCounter.setMaxRetryCount(
- acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
automationCompositionCounter
- .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
+ .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
participantUpdateCounter.setMaxRetryCount(
- acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
participantUpdateCounter
- .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxWaitMs());
+ .setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxWaitMs());
participantStatusCounter.setMaxRetryCount(
- acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
+ acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().getMaxRetryCount());
participantStatusCounter.setMaxWaitMs(acRuntimeParameterGroup.getParticipantParameters().getMaxStatusWaitMs());
}
@@ -130,13 +131,12 @@ public class SupervisionScanner {
}
try {
- var list = acDefinitionProvider.getAllServiceTemplates();
- if (list != null && !list.isEmpty()) {
- ToscaServiceTemplate toscaServiceTemplate = list.get(0);
-
- for (AutomationComposition automationComposition : automationCompositionProvider
- .getAutomationCompositions()) {
- scanAutomationComposition(automationComposition, toscaServiceTemplate, counterCheck);
+ var list = acDefinitionProvider.getAllAcDefinitions();
+ for (var acDefinition : list) {
+ var acList =
+ automationCompositionProvider.getAcInstancesByCompositionId(acDefinition.getCompositionId());
+ for (var automationComposition : acList) {
+ scanAutomationComposition(automationComposition, acDefinition.getServiceTemplate(), counterCheck);
}
}
} catch (PfModelException pfme) {
@@ -208,7 +208,7 @@ public class SupervisionScanner {
}
private void scanAutomationComposition(final AutomationComposition automationComposition,
- ToscaServiceTemplate toscaServiceTemplate, boolean counterCheck) throws PfModelException {
+ ToscaServiceTemplate toscaServiceTemplate, boolean counterCheck) throws PfModelException {
LOGGER.debug("scanning automation composition {} . . .", automationComposition.getKey().asIdentifier());
if (automationComposition.getState().equals(automationComposition.getOrderedState().asState())) {
@@ -226,7 +226,7 @@ public class SupervisionScanner {
var defaultMax = 0; // max startPhase
for (AutomationCompositionElement element : automationComposition.getElements().values()) {
ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
- .get(element.getDefinition().getName());
+ .get(element.getDefinition().getName());
int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties());
defaultMin = Math.min(defaultMin, startPhase);
defaultMax = Math.max(defaultMax, startPhase);
@@ -239,7 +239,7 @@ public class SupervisionScanner {
if (completed) {
LOGGER.debug("automation composition scan: transition from state {} to {} completed",
- automationComposition.getState(), automationComposition.getOrderedState());
+ automationComposition.getState(), automationComposition.getOrderedState());
automationComposition.setState(automationComposition.getOrderedState().asState());
automationCompositionProvider.saveAutomationComposition(automationComposition);
@@ -248,21 +248,22 @@ public class SupervisionScanner {
clearFaultAndCounter(automationComposition);
} else {
LOGGER.debug("automation composition scan: transition from state {} to {} not completed",
- automationComposition.getState(), automationComposition.getOrderedState());
+ automationComposition.getState(), automationComposition.getOrderedState());
var nextSpNotCompleted =
- AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
- || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
- ? minSpNotCompleted
- : maxSpNotCompleted;
+ AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
+ ? minSpNotCompleted
+ : maxSpNotCompleted;
var firstStartPhase =
- AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
- || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState()) ? defaultMin
- : defaultMax;
+ AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState())
+ ? defaultMin
+ : defaultMax;
if (nextSpNotCompleted != phaseMap.getOrDefault(automationComposition.getKey().asIdentifier(),
- firstStartPhase)) {
+ firstStartPhase)) {
phaseMap.put(automationComposition.getKey().asIdentifier(), nextSpNotCompleted);
sendAutomationCompositionMsg(automationComposition, nextSpNotCompleted);
} else if (counterCheck) {
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
index 9beef51bb..61ab78fad 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
@@ -73,7 +73,7 @@ public class AutomationCompositionUpdatePublisher extends AbstractParticipantPub
automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
automationCompositionUpdateMsg.setMessageId(UUID.randomUUID());
automationCompositionUpdateMsg.setTimestamp(Instant.now());
- var toscaServiceTemplate = acDefinitionProvider.getAllServiceTemplates().get(0);
+ var toscaServiceTemplate = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId());
List<ParticipantUpdates> participantUpdates = new ArrayList<>();
for (AutomationCompositionElement element : automationComposition.getElements().values()) {
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
index dabb05347..85f21930e 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVICE_TEMPLATE_YAML;
-import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_ST_TEMPLATE_YAML;
import java.util.List;
import java.util.UUID;
@@ -84,7 +83,7 @@ class CommissioningProviderTest {
List<ToscaConceptIdentifier> affectedDefinitions = provider
.createAutomationCompositionDefinitions(serviceTemplate).getAffectedAutomationCompositionDefinitions();
verify(acDefinitionProvider).createAutomationCompositionDefinition(serviceTemplate);
- assertThat(affectedDefinitions).hasSize(13);
+ assertThat(affectedDefinitions).hasSize(7);
}
/**
@@ -100,7 +99,7 @@ class CommissioningProviderTest {
var provider =
new CommissioningProvider(acDefinitionProvider, acProvider, null, participantProvider);
- ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML);
+ ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
when(acDefinitionProvider.getServiceTemplateList(null, null)).thenReturn(List.of(serviceTemplate));
var returnedServiceTemplate = provider.getAutomationCompositionDefinitions(null, null);
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
index 0ded4ec0f..e11ceeeb7 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
@@ -29,7 +29,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVICE_TEMPLATE_YAML;
import java.util.HashMap;
-import java.util.List;
import java.util.UUID;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
@@ -130,7 +129,7 @@ class CommissioningControllerTest extends CommonRestController {
assertNotNull(commissioningResponse);
assertNull(commissioningResponse.getErrorDetails());
// Response should return the number of node templates present in the service template
- assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).hasSize(13);
+ assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).hasSize(7);
for (String nodeTemplateName : serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().keySet()) {
assertTrue(commissioningResponse.getAffectedAutomationCompositionDefinitions().stream()
.anyMatch(ac -> ac.getName().equals(nodeTemplateName)));
@@ -162,7 +161,7 @@ class CommissioningControllerTest extends CommonRestController {
assertNotNull(commissioningResponse);
assertNull(commissioningResponse.getErrorDetails());
// Response should return the number of node templates present in the service template
- assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).hasSize(13);
+ assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).hasSize(7);
for (String nodeTemplateName : serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().keySet()) {
assertTrue(commissioningResponse.getAffectedAutomationCompositionDefinitions().stream()
.anyMatch(ac -> ac.getName().equals(nodeTemplateName)));
@@ -216,7 +215,7 @@ class CommissioningControllerTest extends CommonRestController {
Response resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- List<ToscaServiceTemplate> templatesInDB = acDefinitionProvider.getAllServiceTemplates();
+ var templatesInDB = acDefinitionProvider.getAllAcDefinitions();
assertThat(templatesInDB).isEmpty();
}
@@ -228,7 +227,7 @@ class CommissioningControllerTest extends CommonRestController {
// Delete entries from the DB after relevant tests
private synchronized void deleteEntryInDB() throws Exception {
- var list = acDefinitionProvider.getAllServiceTemplates();
+ var list = acDefinitionProvider.getAllAcDefinitions();
if (!list.isEmpty()) {
acDefinitionProvider.deleteAcDefintion(compositionId);
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
index 040fabe27..cebabdb0f 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
@@ -30,6 +30,7 @@ import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVIC
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -40,7 +41,6 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
-import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
@@ -67,16 +67,22 @@ class AutomationCompositionInstantiationProviderTest {
private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command";
private static final String AC_ELEMENT_NAME_NOT_FOUND =
"\"AutomationCompositions\" INVALID, item has status INVALID\n"
- + " {2}\"entry org.onap.domain.pmsh.PMSHAutomationCompositionDefinition\" "
- + "INVALID, item has status INVALID\n"
- + " {4}\"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n"
- + " {2}\"entry org.onap.domain.pmsh.PMSHAutomationCompositionDefinition\" "
- + "INVALID, item has status INVALID\n"
- + " {4}\"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n";
+ + " \"entry PMSHInstance0AcElementNotFound\" INVALID, item has status INVALID\n"
+ + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n"
+ + " \"entry org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement\""
+ + " INVALID, Not found\n"
+ + " \"entry org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement\" INVALID, Not found\n"
+ + " \"entry PMSHInstance1AcElementNotFound\" INVALID, item has status INVALID\n"
+ + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n"
+ + " \"entry org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement\""
+ + " INVALID, Not found\n"
+ + " \"entry org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement\" INVALID, Not found\n";
private static final String AC_DEFINITION_NOT_FOUND =
"\"AutomationCompositions\" INVALID, item has status INVALID\n"
+ " item \"ServiceTemplate\" value \"\" INVALID,"
+ + " Commissioned automation composition definition not found\n"
+ + " item \"ServiceTemplate\" value \"\" INVALID,"
+ " Commissioned automation composition definition not found\n";
private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
@@ -96,13 +102,17 @@ class AutomationCompositionInstantiationProviderTest {
when(participantProvider.getParticipants()).thenReturn(participants);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- when(acDefinitionProvider.getAllServiceTemplates()).thenReturn(List.of(serviceTemplate));
+ var compositionId = UUID.randomUUID();
+ when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(serviceTemplate));
var supervisionHandler = mock(SupervisionHandler.class);
var acProvider = mock(AutomationCompositionProvider.class);
var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
participantProvider, acDefinitionProvider);
var automationCompositionsCreate =
InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
+ for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
var instantiationResponse = instantiationProvider.createAutomationCompositions(automationCompositionsCreate);
InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsCreate);
@@ -121,6 +131,9 @@ class AutomationCompositionInstantiationProviderTest {
var automationCompositionsUpdate =
InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
+ for (var automationComposition : automationCompositionsUpdate.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
instantiationResponse = instantiationProvider.updateAutomationCompositions(automationCompositionsUpdate);
InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsUpdate);
@@ -217,10 +230,14 @@ class AutomationCompositionInstantiationProviderTest {
@Test
void testCreateAutomationCompositions_NoDuplicates() throws Exception {
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- when(acDefinitionProvider.getAllServiceTemplates()).thenReturn(List.of(serviceTemplate));
+ var compositionId = UUID.randomUUID();
+ when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(serviceTemplate));
- AutomationCompositions automationCompositionsCreate =
+ var automationCompositionsCreate =
InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "NoDuplicates");
+ for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = Mockito.mock(ParticipantProvider.class);
@@ -229,7 +246,7 @@ class AutomationCompositionInstantiationProviderTest {
var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
participantProvider, acDefinitionProvider);
- InstantiationResponse instantiationResponse =
+ var instantiationResponse =
instantiationProvider.createAutomationCompositions(automationCompositionsCreate);
InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsCreate);
@@ -246,9 +263,13 @@ class AutomationCompositionInstantiationProviderTest {
@Test
void testCreateAutomationCompositions_CommissionedAcElementNotFound() throws Exception {
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- when(acDefinitionProvider.getAllServiceTemplates()).thenReturn(List.of(serviceTemplate));
- AutomationCompositions automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(
+ var compositionId = UUID.randomUUID();
+ when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(serviceTemplate));
+ var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(
AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON, "AcElementNotFound");
+ for (var automationComposition : automationCompositions.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
var acProvider = mock(AutomationCompositionProvider.class);
var participantProvider = mock(ParticipantProvider.class);
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
index 228412133..732b76a81 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
@@ -41,14 +41,12 @@ import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
import org.onap.policy.clamp.acm.runtime.main.rest.InstantiationController;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
-import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -67,10 +65,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
class InstantiationControllerTest extends CommonRestController {
private static final String AC_INSTANTIATION_CREATE_JSON =
- "src/test/resources/rest/acm/AutomationCompositions.json";
+ "src/test/resources/rest/acm/AutomationCompositions.json";
private static final String AC_INSTANTIATION_UPDATE_JSON =
- "src/test/resources/rest/acm/AutomationCompositionsUpdate.json";
+ "src/test/resources/rest/acm/AutomationCompositionsUpdate.json";
private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json";
@@ -123,7 +121,7 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCreate_Unauthorized() throws Exception {
AutomationCompositions automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized");
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized");
assertUnauthorizedPost(INSTANTIATION_ENDPOINT, Entity.json(automationCompositions));
}
@@ -136,7 +134,7 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testUpdate_Unauthorized() throws Exception {
AutomationCompositions automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized");
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized");
assertUnauthorizedPut(INSTANTIATION_ENDPOINT, Entity.json(automationCompositions));
}
@@ -148,8 +146,8 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCommand_Unauthorized() throws Exception {
- InstantiationCommand instantiationCommand =
- InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Unauthorized");
+ InstantiationCommand instantiationCommand = InstantiationUtils
+ .getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Unauthorized");
assertUnauthorizedPut(INSTANTIATION_COMMAND_ENDPOINT, Entity.json(instantiationCommand));
}
@@ -157,35 +155,40 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCreate() throws Exception {
- AutomationCompositions automationCompositionsFromRsc =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Create");
+ var automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Create");
+ for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
- Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
- Response resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
+ var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
+ var resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionsFromRsc);
- for (AutomationComposition automationCompositionFromRsc : automationCompositionsFromRsc
- .getAutomationCompositionList()) {
- AutomationCompositions automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
- automationCompositionFromRsc.getKey().getName(), automationCompositionFromRsc.getKey().getVersion());
+ for (var automationCompositionFromRsc : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ var automationCompositionsFromDb =
+ instantiationProvider.getAutomationCompositions(automationCompositionFromRsc.getKey().getName(),
+ automationCompositionFromRsc.getKey().getVersion());
assertNotNull(automationCompositionsFromDb);
assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1);
assertEquals(automationCompositionFromRsc,
- automationCompositionsFromDb.getAutomationCompositionList().get(0));
+ automationCompositionsFromDb.getAutomationCompositionList().get(0));
}
}
@Test
void testCreateBadRequest() throws Exception {
+ var automationCompositionsFromRsc = InstantiationUtils
+ .getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest");
+ for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
- AutomationCompositions automationCompositionsFromRsc =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest");
-
- Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
- Response resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
+ var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
+ var resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
// testing Bad Request: AC already defined
@@ -209,89 +212,100 @@ class InstantiationControllerTest extends CommonRestController {
void testQuery() throws Exception {
var automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Query");
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Query");
+ for (var acFromRsc : automationCompositions.getAutomationCompositionList()) {
+ acFromRsc.setCompositionId(compositionId);
+ }
instantiationProvider.createAutomationCompositions(automationCompositions);
- for (AutomationComposition automationCompositionFromRsc : automationCompositions
- .getAutomationCompositionList()) {
- Invocation.Builder invocationBuilder =
- super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName());
+ for (var automationCompositionFromRsc : automationCompositions.getAutomationCompositionList()) {
+ var invocationBuilder = super.sendRequest(
+ INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName());
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
AutomationCompositions automationCompositionsQuery = rawresp.readEntity(AutomationCompositions.class);
assertNotNull(automationCompositionsQuery);
assertThat(automationCompositionsQuery.getAutomationCompositionList()).hasSize(1);
assertEquals(automationCompositionFromRsc,
- automationCompositionsQuery.getAutomationCompositionList().get(0));
+ automationCompositionsQuery.getAutomationCompositionList().get(0));
}
}
@Test
void testUpdate() throws Exception {
- AutomationCompositions automationCompositionsCreate =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Update");
+ var automationCompositionsCreate =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Update");
+ for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
- var automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update");
instantiationProvider.createAutomationCompositions(automationCompositionsCreate);
- Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
- Response resp = invocationBuilder.put(Entity.json(automationCompositions));
+ var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT);
+ var automationCompositions =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update");
+ for (var automationComposition : automationCompositions.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
+ var resp = invocationBuilder.put(Entity.json(automationCompositions));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
+ var instResponse = resp.readEntity(InstantiationResponse.class);
InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositions);
- for (AutomationComposition automationCompositionUpdate : automationCompositions
- .getAutomationCompositionList()) {
- AutomationCompositions automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
- automationCompositionUpdate.getKey().getName(), automationCompositionUpdate.getKey().getVersion());
+ for (var automationCompositionUpdate : automationCompositions.getAutomationCompositionList()) {
+ var automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
+ automationCompositionUpdate.getKey().getName(), automationCompositionUpdate.getKey().getVersion());
assertNotNull(automationCompositionsFromDb);
assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1);
assertEquals(automationCompositionUpdate,
- automationCompositionsFromDb.getAutomationCompositionList().get(0));
+ automationCompositionsFromDb.getAutomationCompositionList().get(0));
}
}
@Test
void testDelete() throws Exception {
- AutomationCompositions automationCompositionsFromRsc =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
+ var automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
+ for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
instantiationProvider.createAutomationCompositions(automationCompositionsFromRsc);
- for (AutomationComposition automationCompositionFromRsc : automationCompositionsFromRsc
- .getAutomationCompositionList()) {
- Invocation.Builder invocationBuilder =
- super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName()
- + "&version=" + automationCompositionFromRsc.getKey().getVersion());
- Response resp = invocationBuilder.delete();
+ for (var automationCompositionFromRsc : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ var invocationBuilder = super.sendRequest(
+ INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName() + "&version="
+ + automationCompositionFromRsc.getKey().getVersion());
+ var resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
+ var instResponse = resp.readEntity(InstantiationResponse.class);
InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc);
- AutomationCompositions automationCompositionsFromDb = instantiationProvider.getAutomationCompositions(
- automationCompositionFromRsc.getKey().getName(), automationCompositionFromRsc.getKey().getVersion());
+ var automationCompositionsFromDb =
+ instantiationProvider.getAutomationCompositions(automationCompositionFromRsc.getKey().getName(),
+ automationCompositionFromRsc.getKey().getVersion());
assertThat(automationCompositionsFromDb.getAutomationCompositionList()).isEmpty();
}
}
@Test
void testDeleteBadRequest() throws Exception {
-
- AutomationCompositions automationCompositionsFromRsc =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "DelBadRequest");
+ var automationCompositionsFromRsc =
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "DelBadRequest");
+ for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
instantiationProvider.createAutomationCompositions(automationCompositionsFromRsc);
- for (AutomationComposition automationCompositionFromRsc : automationCompositionsFromRsc
- .getAutomationCompositionList()) {
- Invocation.Builder invocationBuilder =
- super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName());
- Response resp = invocationBuilder.delete();
+ for (var automationCompositionFromRsc : automationCompositionsFromRsc.getAutomationCompositionList()) {
+ var invocationBuilder = super.sendRequest(
+ INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName());
+ var resp = invocationBuilder.delete();
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
}
}
@@ -306,7 +320,7 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCommand_NotFound2() throws Exception {
InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
command.setOrderedState(null);
Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
@@ -317,7 +331,10 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testCommand() throws Exception {
var automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Command");
+ InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Command");
+ for (var automationComposition : automationCompositions.getAutomationCompositionList()) {
+ automationComposition.setCompositionId(compositionId);
+ }
instantiationProvider.createAutomationCompositions(automationCompositions);
var participants = CommonTestData.createParticipants();
@@ -325,28 +342,28 @@ class InstantiationControllerTest extends CommonRestController {
participantProvider.saveParticipant(participant);
}
- InstantiationCommand command =
- InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
+ var command =
+ InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command");
- Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
- Response resp = invocationBuilder.put(Entity.json(command));
+ var invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT);
+ var resp = invocationBuilder.put(Entity.json(command));
assertEquals(Response.Status.ACCEPTED.getStatusCode(), resp.getStatus());
InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class);
InstantiationUtils.assertInstantiationResponse(instResponse, command);
// check passive state on DB
- for (ToscaConceptIdentifier toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) {
- AutomationCompositions automationCompositionsGet = instantiationProvider
- .getAutomationCompositions(toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion());
+ for (var toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) {
+ var automationCompositionsGet = instantiationProvider
+ .getAutomationCompositions(toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion());
assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
assertEquals(command.getOrderedState(),
- automationCompositionsGet.getAutomationCompositionList().get(0).getOrderedState());
+ automationCompositionsGet.getAutomationCompositionList().get(0).getOrderedState());
}
}
private synchronized void deleteEntryInDB() throws Exception {
automationCompositionRepository.deleteAll();
- var list = acDefinitionProvider.getAllServiceTemplates();
+ var list = acDefinitionProvider.getAllAcDefinitions();
if (!list.isEmpty()) {
acDefinitionProvider.deleteAcDefintion(compositionId);
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
index e4d382133..47e3d516c 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
@@ -113,6 +113,7 @@ class SupervisionHandlerTest {
var automationComposition = automationCompositionsCreate.getAutomationCompositionList().get(0);
automationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
automationComposition.setState(AutomationCompositionState.PASSIVE);
+ automationComposition.setCompositionId(UUID.randomUUID());
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.findAutomationComposition(identifier))
@@ -120,9 +121,9 @@ class SupervisionHandlerTest {
when(automationCompositionProvider.getAutomationComposition(identifier)).thenReturn(automationComposition);
var acDefinitionProvider = Mockito.mock(AcDefinitionProvider.class);
- when(acDefinitionProvider.getAllServiceTemplates())
- .thenReturn(List.of(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate(
- TOSCA_SERVICE_TEMPLATE_YAML))));
+ when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId()))
+ .thenReturn(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate(
+ TOSCA_SERVICE_TEMPLATE_YAML)));
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
@@ -133,7 +134,7 @@ class SupervisionHandlerTest {
handler.triggerAutomationCompositionSupervision(List.of(identifier));
- verify(automationCompositionStateChangePublisher).send(any(AutomationComposition.class), eq(0));
+ verify(automationCompositionStateChangePublisher).send(any(AutomationComposition.class), eq(1));
}
@Test
@@ -359,9 +360,6 @@ class SupervisionHandlerTest {
when(acDefinitionProvider.getServiceTemplateList(any(), any()))
.thenReturn(List.of(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate(
TOSCA_SERVICE_TEMPLATE_YAML))));
- when(acDefinitionProvider.getAllServiceTemplates())
- .thenReturn(List.of(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate(
- TOSCA_SERVICE_TEMPLATE_YAML))));
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
index 50d5246b0..6d3e5b5a0 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
@@ -26,10 +26,11 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_ST_TEMPLATE_YAML;
+import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVICE_TEMPLATE_YAML;
import java.util.List;
import java.util.Objects;
+import java.util.UUID;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -40,6 +41,7 @@ import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPu
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.Participant;
@@ -51,7 +53,6 @@ import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
class SupervisionScannerTest {
@@ -62,14 +63,19 @@ class SupervisionScannerTest {
private static final String PARTICIPANT_NAME = "Participant0";
private static final String PARTICIPANT_VERSION = "1.0.0";
+ private static UUID compositionId;
+
private static final ToscaConceptIdentifier PARTICIPANT_TYPE =
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", PARTICIPANT_VERSION);
@BeforeAll
public static void setUpBeforeAll() throws Exception {
- ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML);
- when(acDefinitionProvider.getAllServiceTemplates())
- .thenReturn(List.of(Objects.requireNonNull(serviceTemplate)));
+ var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
+ var acDefinition = new AutomationCompositionDefinition();
+ compositionId = UUID.randomUUID();
+ acDefinition.setCompositionId(compositionId);
+ acDefinition.setServiceTemplate(serviceTemplate);
+ when(acDefinitionProvider.getAllAcDefinitions()).thenReturn(List.of(Objects.requireNonNull(acDefinition)));
}
@Test
@@ -82,13 +88,14 @@ class SupervisionScannerTest {
var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
- var automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud").getAutomationCompositionList();
- when(automationCompositionProvider.getAutomationCompositions()).thenReturn(automationCompositions);
+ var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud")
+ .getAutomationCompositionList();
+ when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
+ .thenReturn(automationCompositions);
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
supervisionScanner.run(false);
verify(automationCompositionProvider, times(0)).saveAutomationComposition(any(AutomationComposition.class));
@@ -96,12 +103,13 @@ class SupervisionScannerTest {
@Test
void testScannerOrderedStateDifferentToState() throws PfModelException, CoderException {
- var automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud").getAutomationCompositionList();
+ var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud")
+ .getAutomationCompositionList();
automationCompositions.get(0).setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
automationCompositions.get(0).setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
- when(automationCompositionProvider.getAutomationCompositions()).thenReturn(automationCompositions);
+ when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
+ .thenReturn(automationCompositions);
var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
@@ -111,8 +119,8 @@ class SupervisionScannerTest {
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
supervisionScanner.run(false);
verify(automationCompositionProvider, times(1)).saveAutomationComposition(any(AutomationComposition.class));
@@ -122,7 +130,8 @@ class SupervisionScannerTest {
void testScanner() throws PfModelException {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var automationComposition = new AutomationComposition();
- when(automationCompositionProvider.getAutomationCompositions()).thenReturn(List.of(automationComposition));
+ when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
+ .thenReturn(List.of(automationComposition));
var participantProvider = mock(ParticipantProvider.class);
var participant = new Participant();
@@ -137,8 +146,8 @@ class SupervisionScannerTest {
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
supervisionScanner.run(true);
@@ -148,13 +157,13 @@ class SupervisionScannerTest {
@Test
void testSendAutomationCompositionMsgUpdate() throws PfModelException, CoderException {
- var automationCompositions =
- InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud").getAutomationCompositionList();
+ var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud")
+ .getAutomationCompositionList();
automationCompositions.get(0).setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
automationCompositions.get(0).setOrderedState(AutomationCompositionOrderedState.PASSIVE);
for (var element : automationCompositions.get(0).getElements().values()) {
if ("org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement"
- .equals(element.getDefinition().getName())) {
+ .equals(element.getDefinition().getName())) {
element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
element.setState(AutomationCompositionState.UNINITIALISED);
} else {
@@ -164,7 +173,8 @@ class SupervisionScannerTest {
}
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
- when(automationCompositionProvider.getAutomationCompositions()).thenReturn(automationCompositions);
+ when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
+ .thenReturn(automationCompositions);
var participantProvider = mock(ParticipantProvider.class);
var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
@@ -174,8 +184,8 @@ class SupervisionScannerTest {
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
supervisionScanner.run(false);
@@ -186,7 +196,8 @@ class SupervisionScannerTest {
void testScanParticipant() throws PfModelException {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var automationComposition = new AutomationComposition();
- when(automationCompositionProvider.getAutomationCompositions()).thenReturn(List.of(automationComposition));
+ when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
+ .thenReturn(List.of(automationComposition));
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanParticipant");
acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1);
@@ -208,8 +219,8 @@ class SupervisionScannerTest {
var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
- participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ participantStatusReqPublisher, participantUpdatePublisher, acRuntimeParameterGroup);
supervisionScanner
.handleParticipantRegister(new ImmutablePair<>(participant.getKey().asIdentifier(), PARTICIPANT_TYPE));
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
index 3d5370b21..ad8243bed 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
@@ -38,8 +38,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
private static final Coder CODER = new StandardCoder();
public static final String TOSCA_SERVICE_TEMPLATE_YAML =
- "clamp/acm/test/pmsh_multiple_ac_tosca.yaml";
- public static final String TOSCA_ST_TEMPLATE_YAML =
"clamp/acm/pmsh/funtional-pmsh-usecase.yaml";
/**
@@ -77,16 +75,14 @@ public class CommonTestData {
*/
public static List<Participant> createParticipants() {
var participant1 = createParticipant(
- new ToscaConceptIdentifier("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "2.3.4"),
- new ToscaConceptIdentifier("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "2.3.4"));
+ new ToscaConceptIdentifier("org.onap.policy.clamp.acm.KubernetesParticipant", "2.3.4"),
+ new ToscaConceptIdentifier("K8sParticipant0", "1.0.0"));
var participant2 = createParticipant(
- new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"),
- new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"));
+ new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpParticipant", "2.3.4"),
+ new ToscaConceptIdentifier("HttpParticipant0", "1.0.0"));
var participant3 = createParticipant(
- new ToscaConceptIdentifier("org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", "2.2.1"),
- new ToscaConceptIdentifier("org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", "2.2.1"));
+ new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", "2.3.1"),
+ new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0"));
return List.of(participant1, participant2, participant3);
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json
index f368cd69d..33ebd1706 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json
@@ -3,10 +3,7 @@
{
"name": "PMSHInstance0",
"version": "1.0.1",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
- "version": "1.2.3"
- },
+ "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "PMSH automation composition instance 0",
@@ -14,38 +11,38 @@
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
+ "name": "K8sParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
+ "description": "Automation composition element for the K8S microservice for PMSH"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "HttpParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.policy.clamp.acm.HttpParticipant",
+ "version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
+ "description": "Automation composition element for the http requests of PMSH microservice"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
@@ -54,44 +51,23 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c23": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
- "version": "1.2.3"
- },
- "participantId": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
+ "description": "Automation composition element for the operational policy for Performance Management Subscription Handling"
}
}
},
{
"name": "PMSHInstance1",
"version": "1.0.1",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
- "version": "1.2.3"
- },
+ "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "PMSH automation composition instance 1",
@@ -99,15 +75,15 @@
"709c62b3-8918-41b9-a747-d21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
+ "name": "K8sParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
@@ -117,16 +93,16 @@
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "HttpParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.policy.clamp.acm.HttpParticipant",
+ "version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
@@ -139,34 +115,16 @@
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c27": {
- "id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
- "version": "1.2.3"
- },
- "participantId": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json
index f0c45b5b2..dc1f7056b 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json
@@ -3,10 +3,7 @@
{
"name": "PMSHInstance0",
"version": "1.0.1",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
- "version": "1.2.3"
- },
+ "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "PMSH automation composition instance 1",
@@ -14,15 +11,15 @@
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
+ "name": "K8sParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
@@ -32,16 +29,16 @@
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "HttpParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.policy.clamp.acm.HttpParticipant",
+ "version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
@@ -50,48 +47,27 @@
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c24": {
- "id": "709c62b3-8918-41b9-a747-d21eb79c6c24",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
- "version": "1.2.3"
- },
- "participantId": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
},
{
"name": "PMSHInstance1",
"version": "1.0.1",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
- "version": "1.2.3"
- },
+ "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "PMSH automation composition instance 1",
@@ -99,15 +75,15 @@
"709c62b3-8918-41b9-a747-d21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
+ "name": "K8sParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
@@ -117,16 +93,16 @@
"709c62b3-8918-41b9-a747-d21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "HttpParticipant0",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.policy.clamp.acm.HttpParticipant",
+ "version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
@@ -135,38 +111,20 @@
"709c62b3-8918-41b9-a747-d21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantId": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
},
"participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
+ "name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition"
- },
- "709c62b3-8918-41b9-a747-d21eb79c6c28": {
- "id": "709c62b3-8918-41b9-a747-e21eb79c6c28",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
- "version": "1.2.3"
- },
- "participantId": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
- "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition"
}
}
}