summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-03-14 12:48:45 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-03-15 10:10:01 +0000
commit9cf97c37b6d01142ce5b775dd319dc3d838294ac (patch)
tree0e5fa64627b9cc1cc0f890852c7472eb15a7cdb4 /runtime-acm/src
parent4f15b44c04a6f328f1a3357b859482c147fba0cd (diff)
Upgrade Demo ACM element microservice
Upgrade chart Demo ACM element, upgrade servicetemplate example and fix prime issue Issue-ID: POLICY-4565 Change-Id: Icfc3a32f481840882eb6f20f25ed45b15d4991ff 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.java10
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java5
2 files changed, 11 insertions, 4 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 456e61c20..ca0b5c5ab 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
@@ -22,6 +22,8 @@
package org.onap.policy.clamp.acm.runtime.commissioning;
import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import lombok.RequiredArgsConstructor;
@@ -55,6 +57,8 @@ public class CommissioningProvider {
private final AcTypeStateResolver acTypeStateResolver;
private final ParticipantPrimePublisher participantPrimePublisher;
+ private final ExecutorService executor = Executors.newFixedThreadPool(1);
+
private CommissioningResponse createCommissioningResponse(UUID compositionId,
ToscaServiceTemplate serviceTemplate) {
var response = new CommissioningResponse();
@@ -193,7 +197,9 @@ public class CommissioningProvider {
private void prime(AutomationCompositionDefinition acmDefinition) {
var prearation = participantPrimePublisher.prepareParticipantPriming(acmDefinition);
acDefinitionProvider.updateAcDefinition(acmDefinition);
- participantPrimePublisher.sendPriming(prearation, acmDefinition.getCompositionId(), null);
+
+ executor.execute(
+ () -> participantPrimePublisher.sendPriming(prearation, acmDefinition.getCompositionId(), null));
}
private void deprime(AutomationCompositionDefinition acmDefinition) {
@@ -204,7 +210,7 @@ public class CommissioningProvider {
acmDefinition.setState(AcTypeState.DEPRIMING);
acDefinitionProvider.updateAcDefinition(acmDefinition);
}
- participantPrimePublisher.sendDepriming(acmDefinition.getCompositionId());
+ executor.execute(() -> participantPrimePublisher.sendDepriming(acmDefinition.getCompositionId()));
}
}
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 327d881a1..fbaa4fed5 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
@@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
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;
@@ -162,7 +163,7 @@ class CommissioningProviderTest {
acTypeStateUpdate.setPrimeOrder(PrimeOrder.PRIME);
provider.compositionDefinitionPriming(compositionId, acTypeStateUpdate);
verify(acDefinitionProvider).updateAcDefinition(acmDefinition);
- verify(participantPrimePublisher).sendPriming(any(), any(), any());
+ verify(participantPrimePublisher, timeout(1000).times(1)).sendPriming(any(), any(), any());
}
@Test
@@ -180,6 +181,6 @@ class CommissioningProviderTest {
var acTypeStateUpdate = new AcTypeStateUpdate();
acTypeStateUpdate.setPrimeOrder(PrimeOrder.DEPRIME);
provider.compositionDefinitionPriming(compositionId, acTypeStateUpdate);
- verify(participantPrimePublisher).sendDepriming(compositionId);
+ verify(participantPrimePublisher, timeout(1000).times(1)).sendDepriming(compositionId);
}
}