aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2024-01-04 10:28:13 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2024-01-04 10:32:05 +0000
commitd8ecbcfb5461ad13f72a6def9224a600d29f1090 (patch)
tree63e54f6001d4185249f96d002634589a9aa41443
parent664af40d4c073404d6c067731e25fc44dab3f2c2 (diff)
Add OutProperties instance support for restart scenario in acm-model
Add support for OutProperties instance, operationalState and useState in restart scenario. Issue-ID: POLICY-4909 Change-Id: I2106bc3bd60ba9ca568acfa64c09a2984ad8a337 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementRestart.java10
-rwxr-xr-xmodels/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java5
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java11
-rwxr-xr-xmodels/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java6
-rw-r--r--models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json13
5 files changed, 34 insertions, 11 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementRestart.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementRestart.java
index 3815989f7..3f0dff2bb 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementRestart.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementRestart.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,12 +50,17 @@ public class AcElementRestart {
// State of the AutomationCompositionElement
private LockState lockState;
+ private String operationalState;
+ private String useState;
+
private ToscaServiceTemplate toscaServiceTemplateFragment;
// A map indexed by the property name. Each map entry is the serialized value of the property,
// which can be deserialized into an instance of the type of the property.
private Map<String, Object> properties = new LinkedHashMap<>();
+ private Map<String, Object> outProperties = new LinkedHashMap<>();
+
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
@@ -66,8 +71,11 @@ public class AcElementRestart {
this.definition = new ToscaConceptIdentifier(otherElement.definition);
this.deployState = otherElement.deployState;
this.lockState = otherElement.lockState;
+ this.operationalState = otherElement.operationalState;
+ this.useState = otherElement.useState;
this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment;
this.properties = PfUtils.mapMap(otherElement.properties, UnaryOperator.identity());
+ this.outProperties = PfUtils.mapMap(otherElement.outProperties, UnaryOperator.identity());
}
}
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 0fd7ab95c..504d3ef06 100755
--- 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -437,7 +437,10 @@ public final class AcmUtils {
acElementRestart.setDefinition(new ToscaConceptIdentifier(element.getDefinition()));
acElementRestart.setDeployState(element.getDeployState());
acElementRestart.setLockState(element.getLockState());
+ acElementRestart.setOperationalState(element.getOperationalState());
+ acElementRestart.setUseState(element.getUseState());
acElementRestart.setProperties(PfUtils.mapMap(element.getProperties(), UnaryOperator.identity()));
+ acElementRestart.setOutProperties(PfUtils.mapMap(element.getOutProperties(), UnaryOperator.identity()));
return acElementRestart;
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java
index ba84ac76f..4a2a958d6 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,9 +27,12 @@ import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.Partic
import java.time.Instant;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AcElementRestart;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
@@ -62,6 +65,12 @@ class ParticipantRestartTest {
acElement.setId(UUID.randomUUID());
var id = new ToscaConceptIdentifier("id", "1.2.3");
acElement.setDefinition(id);
+ acElement.setDeployState(DeployState.DEPLOYED);
+ acElement.setLockState(LockState.LOCKED);
+ acElement.setOperationalState("OperationalState");
+ acElement.setUseState("UseState");
+ acElement.setProperties(Map.of("key", "value"));
+ acElement.setOutProperties(Map.of("keyOut", "valueOut"));
var acRestart = new ParticipantRestartAc();
acRestart.setAcElementList(List.of(acElement));
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 8e10e81ad..bc8741e65 100755
--- 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -226,6 +226,10 @@ class AcmUtilsTest {
assertEquals(element.getDefinition(), result.getDefinition());
assertEquals(element.getDeployState(), result.getDeployState());
assertEquals(element.getLockState(), result.getLockState());
+ assertEquals(element.getOperationalState(), result.getOperationalState());
+ assertEquals(element.getUseState(), result.getUseState());
+ assertEquals(element.getProperties(), result.getProperties());
+ assertEquals(element.getOutProperties(), result.getOutProperties());
}
private AutomationComposition getDummyAutomationComposition() {
diff --git a/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
index 934535a05..abb821536 100644
--- a/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
+++ b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
@@ -4,11 +4,10 @@
"name": "aceDef",
"version": "0.0.1"
},
- "participantType": {
- "name": "participantType",
- "version": "0.0.1"
- },
- "state": "UNINITIALISED",
- "orderedState": null,
- "properties":{"key":"{}"}
+ "deployState": "DEPLOYED",
+ "lockState": "LOCKED",
+ "operationalState": "operationalState",
+ "useState": "useState",
+ "properties":{"key":"{}"},
+ "outProperties":{"key":"{}"}
}