Add restart support in composition and in instance

Add restart support in Automation Composition Definition
and in Automation Composition Instance.

Issue-ID: POLICY-4766
Change-Id: I8d169caf7fe74b6d2fcd40c106e4a1646a89a915
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
index 54c9b61..b92b03f 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
@@ -42,6 +42,8 @@
     @NonNull
     private UUID compositionId;
 
+    private Boolean restarting;
+
     @NonNull
     private DeployState deployState = DeployState.UNDEPLOYED;
 
@@ -61,6 +63,7 @@
         super(otherAutomationComposition);
         this.instanceId = otherAutomationComposition.instanceId;
         this.compositionId = otherAutomationComposition.compositionId;
+        this.restarting = otherAutomationComposition.restarting;
         this.deployState = otherAutomationComposition.deployState;
         this.lockState = otherAutomationComposition.lockState;
         this.elements = PfUtils.mapMap(otherAutomationComposition.elements, AutomationCompositionElement::new);
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java
index eb8a919..548bc45 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionDefinition.java
@@ -41,6 +41,8 @@
     @NonNull
     private ToscaServiceTemplate serviceTemplate;
 
+    private Boolean restarting;
+
     @NonNull
     private AcTypeState state;
 
@@ -58,6 +60,7 @@
     public AutomationCompositionDefinition(final AutomationCompositionDefinition otherAcmDefinition) {
         this.compositionId = otherAcmDefinition.compositionId;
         this.serviceTemplate = new ToscaServiceTemplate(otherAcmDefinition.serviceTemplate);
+        this.restarting = otherAcmDefinition.restarting;
         this.state = otherAcmDefinition.state;
         this.elementStateMap = PfUtils.mapMap(otherAcmDefinition.elementStateMap, NodeTemplateState::new);
         this.stateChangeResult = otherAcmDefinition.stateChangeResult;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
index ea54076..95ee55f 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
@@ -48,6 +48,8 @@
     @NonNull
     private UUID participantId = UUID.randomUUID();
 
+    private Boolean restarting;
+
     @NonNull
     private DeployState deployState = DeployState.UNDEPLOYED;
 
@@ -77,6 +79,7 @@
         this.description = otherElement.description;
         this.properties = PfUtils.mapMap(otherElement.properties, UnaryOperator.identity());
         this.outProperties = PfUtils.mapMap(otherElement.outProperties, UnaryOperator.identity());
+        this.restarting = otherElement.restarting;
         this.deployState = otherElement.deployState;
         this.lockState = otherElement.lockState;
         this.operationalState = otherElement.operationalState;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java
index 62e9208..add4f10 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/NodeTemplateState.java
@@ -38,6 +38,8 @@
 
     private ToscaConceptIdentifier nodeTemplateId;
 
+    private Boolean restarting;
+
     private AcTypeState state;
 
     private String message;
@@ -51,6 +53,7 @@
         this.nodeTemplateStateId = copyConstructor.nodeTemplateStateId;
         this.participantId = copyConstructor.participantId;
         this.nodeTemplateId = new ToscaConceptIdentifier(copyConstructor.nodeTemplateId);
+        this.restarting = copyConstructor.restarting;
         this.state = copyConstructor.state;
         this.message = copyConstructor.message;
     }
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
index 3a448f2..7f2a1e5 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
@@ -81,6 +81,9 @@
     private String compositionId;
 
     @Column
+    private Boolean restarting;
+
+    @Column
     @NotNull
     private DeployState deployState;
 
@@ -140,6 +143,7 @@
         this.name = copyConcept.name;
         this.version = copyConcept.version;
         this.compositionId = copyConcept.compositionId;
+        this.restarting = copyConcept.restarting;
         this.deployState = copyConcept.deployState;
         this.lockState = copyConcept.lockState;
         this.description = copyConcept.description;
@@ -164,6 +168,7 @@
         automationComposition.setName(name);
         automationComposition.setVersion(version);
         automationComposition.setCompositionId(UUID.fromString(compositionId));
+        automationComposition.setRestarting(restarting);
         automationComposition.setDeployState(deployState);
         automationComposition.setLockState(lockState);
         automationComposition.setDescription(description);
@@ -182,6 +187,7 @@
         this.name = automationComposition.getName();
         this.version = automationComposition.getVersion();
         this.compositionId = automationComposition.getCompositionId().toString();
+        this.restarting = automationComposition.getRestarting();
         this.deployState = automationComposition.getDeployState();
         this.lockState = automationComposition.getLockState();
         this.description = automationComposition.getDescription();
@@ -224,6 +230,11 @@
             return result;
         }
 
+        result = ObjectUtils.compare(restarting, other.restarting);
+        if (result != 0) {
+            return result;
+        }
+
         result = ObjectUtils.compare(deployState, other.deployState);
         if (result != 0) {
             return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java
index 50949d7..f82152d 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionDefinition.java
@@ -74,6 +74,9 @@
     private String version;
 
     @Column
+    private Boolean restarting;
+
+    @Column
     @NotNull
     private AcTypeState state;
 
@@ -94,6 +97,7 @@
     public AutomationCompositionDefinition toAuthorative() {
         var acmDefinition = new AutomationCompositionDefinition();
         acmDefinition.setCompositionId(UUID.fromString(this.compositionId));
+        acmDefinition.setRestarting(this.restarting);
         acmDefinition.setState(this.state);
         acmDefinition.setStateChangeResult(this.stateChangeResult);
         acmDefinition.setServiceTemplate(this.serviceTemplate.toAuthorative());
@@ -107,6 +111,7 @@
     @Override
     public void fromAuthorative(final AutomationCompositionDefinition copyConcept) {
         this.compositionId = copyConcept.getCompositionId().toString();
+        this.restarting = copyConcept.getRestarting();
         this.state = copyConcept.getState();
         this.stateChangeResult = copyConcept.getStateChangeResult();
         this.serviceTemplate = new DocToscaServiceTemplate(copyConcept.getServiceTemplate());
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index 60a911b..8c67914 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -81,10 +81,14 @@
     })
     private PfConceptKey definition;
 
+    @Column
     @NotNull
     private String participantId;
 
     @Column
+    private Boolean restarting;
+
+    @Column
     @NotNull
     private DeployState deployState;
 
@@ -168,6 +172,7 @@
         this.outProperties =
                 (copyConcept.outProperties != null ? new LinkedHashMap<>(copyConcept.outProperties)
                         : null);
+        this.restarting = copyConcept.restarting;
         this.deployState = copyConcept.deployState;
         this.lockState = copyConcept.lockState;
         this.operationalState = copyConcept.operationalState;
@@ -194,6 +199,7 @@
         element.setDescription(description);
         element.setProperties(PfUtils.mapMap(properties, UnaryOperator.identity()));
         element.setOutProperties(PfUtils.mapMap(outProperties, UnaryOperator.identity()));
+        element.setRestarting(restarting);
         element.setDeployState(deployState);
         element.setLockState(lockState);
         element.setOperationalState(operationalState);
@@ -210,6 +216,7 @@
         this.description = element.getDescription();
         this.properties = PfUtils.mapMap(element.getProperties(), UnaryOperator.identity());
         this.outProperties = PfUtils.mapMap(element.getOutProperties(), UnaryOperator.identity());
+        this.restarting = element.getRestarting();
         this.deployState = element.getDeployState();
         this.lockState = element.getLockState();
         this.operationalState = element.getOperationalState();
@@ -246,6 +253,11 @@
             return result;
         }
 
+        result = ObjectUtils.compare(restarting, other.restarting);
+        if (result != 0) {
+            return result;
+        }
+
         result = ObjectUtils.compare(deployState, other.deployState);
         if (result != 0) {
             return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java
index 8ee1075..809e139 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaNodeTemplateState.java
@@ -67,6 +67,9 @@
     private PfConceptKey nodeTemplateId;
 
     @Column
+    private Boolean restarting;
+
+    @Column
     @NotNull
     private AcTypeState state;
 
@@ -98,6 +101,7 @@
             this.participantId = copyConcept.getParticipantId().toString();
         }
         this.nodeTemplateId = copyConcept.getNodeTemplateId().asConceptKey();
+        this.restarting = copyConcept.getRestarting();
         this.state = copyConcept.getState();
         this.message = copyConcept.getMessage();
     }
@@ -110,6 +114,7 @@
             nodeTemplateState.setParticipantId(UUID.fromString(this.participantId));
         }
         nodeTemplateState.setNodeTemplateId(new ToscaConceptIdentifier(this.nodeTemplateId));
+        nodeTemplateState.setRestarting(this.restarting);
         nodeTemplateState.setState(this.state);
         nodeTemplateState.setMessage(this.message);
         return nodeTemplateState;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
index 597606e..7e8b353 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
@@ -24,13 +24,13 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.Set;
 import java.util.UUID;
+import java.util.stream.Collectors;
 import javax.ws.rs.core.Response.Status;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-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.NodeTemplateState;
 import org.onap.policy.clamp.models.acm.concepts.Participant;
 import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
@@ -182,4 +182,15 @@
         return ProviderUtils.asEntityList(nodeTemplateStateRepository
             .findByParticipantId(participantId.toString()));
     }
+
+    /**
+     * Get a list of compositionId associated with a participantId from ac definitions.
+     * @param participantId the participant id associated with the automation composition elements
+     * @return the list of compositionId
+     */
+    public Set<UUID> getCompositionIds(@NonNull final UUID participantId) {
+        return nodeTemplateStateRepository.findByParticipantId(participantId.toString()).stream()
+                .map(nodeTemplateState -> UUID.fromString(nodeTemplateState.getCompositionId()))
+                .collect(Collectors.toSet());
+    }
 }
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
index 2a79aee..7cb8f84 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
@@ -193,6 +193,16 @@
         testJpaAcElement.setOperationalState("DEFAULT");
         assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
 
+        testJpaAcElement.setMessage("Message");
+        assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+        testJpaAcElement.setMessage(null);
+        assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+
+        testJpaAcElement.setRestarting(true);
+        assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+        testJpaAcElement.setRestarting(null);
+        assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
+
         testJpaAcElement.setParticipantId(UUID.randomUUID().toString());
         assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
 
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
index bc01e74..04a8744 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
@@ -34,6 +34,7 @@
 import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
 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.StateChangeResult;
 import org.onap.policy.models.base.PfConceptKey;
 
 /**
@@ -172,6 +173,16 @@
         testJpaAutomationComposition.setDescription(null);
         assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
 
+        testJpaAutomationComposition.setRestarting(true);
+        assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+        testJpaAutomationComposition.setRestarting(null);
+        assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+        testJpaAutomationComposition.setStateChangeResult(StateChangeResult.NO_ERROR);
+        assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+        testJpaAutomationComposition.setStateChangeResult(null);
+        assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
         assertEquals(testJpaAutomationComposition, new JpaAutomationComposition(testJpaAutomationComposition));
     }
 
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
index 22523e2..2a5c15a 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
@@ -22,6 +22,7 @@
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
@@ -31,13 +32,10 @@
 import java.util.List;
 import java.util.Optional;
 import java.util.UUID;
-import java.util.stream.Collectors;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-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.NodeTemplateState;
 import org.onap.policy.clamp.models.acm.concepts.Participant;
 import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
@@ -59,9 +57,6 @@
     private static final String AUTOMATION_COMPOSITION_JSON =
         "src/test/resources/providers/TestAutomationCompositions.json";
 
-    private static final String AUTOMATION_COMPOSITION_JSON_DEREGISTER =
-        "src/test/resources/providers/TestAutomationCompositionsDeregister.json";
-
     private static final String NODE_TEMPLATE_STATE_JSON = "src/test/resources/providers/NodeTemplateState.json";
     private static final String LIST_IS_NULL = ".*. is marked .*ull but is null";
     private static final UUID INVALID_ID = UUID.randomUUID();
@@ -72,12 +67,8 @@
 
     private AutomationCompositions inputAutomationCompositions;
     private List<JpaAutomationComposition> inputAutomationCompositionsJpa;
+
     private final String originalAcJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON);
-
-    private AutomationCompositions inputAutomationCompositionsDeregister;
-    private List<JpaAutomationComposition> inputAutomationCompositionsJpaDeregister;
-    private final String deregisterAcJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON_DEREGISTER);
-
     private final String nodeTemplateStatesJson = ResourceUtils.getResourceAsString(NODE_TEMPLATE_STATE_JSON);
 
     private List<NodeTemplateState> nodeTemplateStateList = new ArrayList<>();
@@ -93,11 +84,6 @@
             ProviderUtils.getJpaAndValidateList(inputAutomationCompositions.getAutomationCompositionList(),
                 JpaAutomationComposition::new, "automation compositions");
 
-        inputAutomationCompositionsDeregister = CODER.decode(deregisterAcJson, AutomationCompositions.class);
-        inputAutomationCompositionsJpaDeregister =
-            ProviderUtils.getJpaAndValidateList(inputAutomationCompositionsDeregister.getAutomationCompositionList(),
-                JpaAutomationComposition::new, "automation compositions");
-
         nodeTemplateStateList.add(CODER.decode(nodeTemplateStatesJson, NodeTemplateState.class));
         nodeTemplateStateList.get(0).setState(AcTypeState.COMMISSIONED);
         jpaNodeTemplateStateList = ProviderUtils.getJpaAndValidateList(nodeTemplateStateList,
@@ -132,8 +118,7 @@
         var participantProvider = new ParticipantProvider(participantRepository,
             automationCompositionElementRepository, nodeTemplateStateRepository);
 
-        assertThatThrownBy(() -> participantProvider.updateParticipant(null))
-            .hasMessageMatching(LIST_IS_NULL);
+        assertThatThrownBy(() -> participantProvider.updateParticipant(null)).hasMessageMatching(LIST_IS_NULL);
 
         when(participantRepository.save(any())).thenReturn(jpaParticipantList.get(0));
 
@@ -150,7 +135,6 @@
         var participantProvider = new ParticipantProvider(participantRepository,
             automationCompositionElementRepository, nodeTemplateStateRepository);
 
-
         assertThat(participantProvider.findParticipant(INVALID_ID)).isEmpty();
 
         when(participantRepository.findAll()).thenReturn(jpaParticipantList);
@@ -159,11 +143,9 @@
         assertThatThrownBy(() -> participantProvider.getParticipantById(inputParticipants.get(0).getParticipantId()))
                 .hasMessageMatching("Participant Not Found with ID: " + inputParticipants.get(0).getParticipantId());
 
-        when(participantRepository.findById(any())).thenReturn(
-            Optional.ofNullable(jpaParticipantList.get(0)));
+        when(participantRepository.findById(any())).thenReturn(Optional.ofNullable(jpaParticipantList.get(0)));
 
-        var participant = participantProvider.getParticipantById(inputParticipants.get(0)
-            .getParticipantId());
+        var participant = participantProvider.getParticipantById(inputParticipants.get(0).getParticipantId());
 
         assertThat(inputParticipants.get(0)).usingRecursiveComparison().isEqualTo(participant);
     }
@@ -207,16 +189,16 @@
         var participantProvider = new ParticipantProvider(participantRepository,
             automationCompositionElementRepository, nodeTemplateStateRepository);
 
-        var acElementList = inputAutomationCompositionsJpa
-            .stream().map(c -> c.getElements()).collect(Collectors.toList());
+        var acElementList = inputAutomationCompositionsJpa.get(0).getElements();
 
-        when(automationCompositionElementRepository.findByParticipantId(any())).thenReturn(acElementList.get(0));
+        var participantId = UUID.randomUUID();
+        when(automationCompositionElementRepository.findByParticipantId(participantId.toString()))
+                .thenReturn(acElementList);
 
-        var listOfAcElements = participantProvider.getAutomationCompositionElements(UUID.randomUUID());
+        var listOfAcElements = participantProvider.getAutomationCompositionElements(participantId);
 
-        assertThat(acElementList.get(0).equals(listOfAcElements));
-
-
+        assertThat(listOfAcElements).hasSameSizeAs(acElementList);
+        assertEquals(UUID.fromString(acElementList.get(0).getElementId()), listOfAcElements.get(0).getId());
     }
 
     @Test
@@ -224,16 +206,15 @@
         var participantRepository = mock(ParticipantRepository.class);
         var automationCompositionElementRepository = mock(AutomationCompositionElementRepository.class);
         var nodeTemplateStateRepository = mock(NodeTemplateStateRepository.class);
-        when(nodeTemplateStateRepository.findByParticipantId(any())).thenReturn(jpaNodeTemplateStateList);
+        var participantId = jpaParticipantList.get(0).getParticipantId();
+        when(nodeTemplateStateRepository.findByParticipantId(participantId)).thenReturn(jpaNodeTemplateStateList);
 
         var participantProvider = new ParticipantProvider(participantRepository,
             automationCompositionElementRepository, nodeTemplateStateRepository);
 
-        var listOfNodeTemplateState = participantProvider.getAcNodeTemplateStates(
-            UUID.fromString(jpaParticipantList.get(0).getParticipantId()));
+        var listOfNodeTemplateState = participantProvider.getAcNodeTemplateStates(UUID.fromString(participantId));
 
-        assertThat(listOfNodeTemplateState.equals(nodeTemplateStateList));
-
+        assertEquals(listOfNodeTemplateState, nodeTemplateStateList);
     }
 
     @Test
@@ -268,28 +249,20 @@
     }
 
     @Test
-    void testResetParticipantAcElementState() {
+    void testGetCompositionIds() {
+        var nodeTemplateStateRepository = mock(NodeTemplateStateRepository.class);
+        var participantId = UUID.randomUUID();
+        when(nodeTemplateStateRepository.findByParticipantId(participantId.toString()))
+                .thenReturn(jpaNodeTemplateStateList);
         var participantRepository = mock(ParticipantRepository.class);
         var automationCompositionElementRepository = mock(AutomationCompositionElementRepository.class);
 
-        var acElementList = inputAutomationCompositionsJpaDeregister
-            .stream().map(c -> c.getElements()).collect(Collectors.toList());
-
-        when(automationCompositionElementRepository.findByParticipantId(any())).thenReturn(acElementList.get(0));
-
-        var nodeTemplateStateRepository = mock(NodeTemplateStateRepository.class);
         var participantProvider = new ParticipantProvider(participantRepository,
             automationCompositionElementRepository, nodeTemplateStateRepository);
 
-        acElementList.get(0).stream().forEach(e -> {
-            assertThat(e.getDeployState().equals(DeployState.DEPLOYED));
-            assertThat(e.getLockState().equals(LockState.LOCKED));
-        });
+        assertThatThrownBy(() -> participantProvider.getCompositionIds(null)).hasMessageMatching(LIST_IS_NULL);
 
-        acElementList.get(0).stream().forEach(e -> {
-            assertThat(e.getDeployState().equals(DeployState.UNDEPLOYED));
-            assertThat(e.getLockState().equals(LockState.NONE));
-        });
-
+        var result = participantProvider.getCompositionIds(participantId);
+        assertThat(result).hasSize(1);
     }
 }