summaryrefslogtreecommitdiffstats
path: root/models/src
diff options
context:
space:
mode:
Diffstat (limited to 'models/src')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java47
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java2
6 files changed, 46 insertions, 14 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java
index 659b312d4..94aa07097 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java
@@ -24,5 +24,7 @@ public enum DeployState {
DEPLOYED,
DEPLOYING,
UNDEPLOYED,
- UNDEPLOYING
+ UNDEPLOYING,
+ DELETING,
+ DELETED
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java
index 6c1572d19..f4b57f1d1 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java
@@ -23,5 +23,6 @@ package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
public enum DeployOrder {
NONE,
UNDEPLOY,
- DEPLOY
+ DEPLOY,
+ DELETE
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
index dba64f585..8676b3397 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
@@ -44,6 +44,7 @@ public class AcInstanceStateResolver {
// list of results
public static final String DEPLOY = DeployOrder.DEPLOY.name();
public static final String UNDEPLOY = DeployOrder.UNDEPLOY.name();
+ public static final String DELETE = DeployOrder.DELETE.name();
public static final String LOCK = LockOrder.LOCK.name();
public static final String UNLOCK = LockOrder.UNLOCK.name();
public static final String NONE = "NONE";
@@ -56,6 +57,7 @@ public class AcInstanceStateResolver {
this.graph.put(new String[] {DEPLOY, LOCK_NONE, UNDEPLOYED, STATE_LOCKED_NONE}, DEPLOY);
this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, DEPLOYED, LOCKED}, UNDEPLOY);
+ this.graph.put(new String[] {DELETE, LOCK_NONE, UNDEPLOYED, LOCK_NONE}, DELETE);
this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, LOCKED}, UNLOCK);
this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKED}, LOCK);
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
index 94693fd0b..38add31dd 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
@@ -203,7 +203,7 @@ public class AutomationCompositionProvider {
var jpa = acElementRepository.getReferenceById(element.getAutomationCompositionElementId().toString());
jpa.setUseState(element.getUseState());
jpa.setOperationalState(element.getOperationalState());
- jpa.setProperties(element.getStatusProperties());
+ jpa.setStatusProperties(element.getStatusProperties());
jpaList.add(jpa);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
index 35482b9bb..7de4720ad 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
@@ -284,7 +284,8 @@ public final class AcmUtils {
*/
public static boolean isInTransitionalState(DeployState deployState, LockState lockState) {
return DeployState.DEPLOYING.equals(deployState) || DeployState.UNDEPLOYING.equals(deployState)
- || LockState.LOCKING.equals(lockState) || LockState.UNLOCKING.equals(lockState);
+ || LockState.LOCKING.equals(lockState) || LockState.UNLOCKING.equals(lockState)
+ || DeployState.DELETING.equals(deployState);
}
/**
@@ -294,12 +295,24 @@ public final class AcmUtils {
* @return the DeployOrder
*/
public static DeployOrder stateDeployToOrder(DeployState deployState) {
- if (DeployState.DEPLOYING.equals(deployState)) {
- return DeployOrder.DEPLOY;
- } else if (DeployState.UNDEPLOYING.equals(deployState)) {
- return DeployOrder.UNDEPLOY;
+ DeployOrder result = null;
+ switch (deployState) {
+ case DEPLOYING:
+ result = DeployOrder.DEPLOY;
+ break;
+
+ case UNDEPLOYING:
+ result = DeployOrder.UNDEPLOY;
+ break;
+
+ case DELETING:
+ result = DeployOrder.DELETE;
+ break;
+
+ default:
+ result = DeployOrder.NONE;
}
- return DeployOrder.NONE;
+ return result;
}
/**
@@ -324,12 +337,24 @@ public final class AcmUtils {
* @return the DeployState
*/
public static DeployState deployCompleted(DeployState deployState) {
- if (DeployState.DEPLOYING.equals(deployState)) {
- return DeployState.DEPLOYED;
- } else if (DeployState.UNDEPLOYING.equals(deployState)) {
- return DeployState.UNDEPLOYED;
+ DeployState result = null;
+ switch (deployState) {
+ case DEPLOYING:
+ result = DeployState.DEPLOYED;
+ break;
+
+ case UNDEPLOYING:
+ result = DeployState.UNDEPLOYED;
+ break;
+
+ case DELETING:
+ result = DeployState.DELETED;
+ break;
+
+ default:
+ return deployState;
}
- return deployState;
+ return result;
}
/**
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
index b332d7d44..046d1b848 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
@@ -145,6 +145,7 @@ class AcmUtilsTest {
// from transitional state to order state
assertEquals(DeployOrder.DEPLOY, AcmUtils.stateDeployToOrder(DeployState.DEPLOYING));
assertEquals(DeployOrder.UNDEPLOY, AcmUtils.stateDeployToOrder(DeployState.UNDEPLOYING));
+ assertEquals(DeployOrder.DELETE, AcmUtils.stateDeployToOrder(DeployState.DELETING));
assertEquals(DeployOrder.NONE, AcmUtils.stateDeployToOrder(DeployState.DEPLOYED));
}
@@ -162,6 +163,7 @@ class AcmUtilsTest {
assertEquals(DeployState.DEPLOYED, AcmUtils.deployCompleted(DeployState.DEPLOYING));
assertEquals(DeployState.UNDEPLOYED, AcmUtils.deployCompleted(DeployState.UNDEPLOYING));
assertEquals(DeployState.DEPLOYED, AcmUtils.deployCompleted(DeployState.DEPLOYED));
+ assertEquals(DeployState.DELETED, AcmUtils.deployCompleted(DeployState.DELETING));
}
@Test