diff options
Diffstat (limited to 'models')
7 files changed, 5 insertions, 40 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantReplica.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantReplica.java index 23f72191a..73dfad564 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantReplica.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantReplica.java @@ -37,6 +37,7 @@ public class ParticipantReplica { @NonNull private ParticipantState participantState = ParticipantState.ON_LINE; + // last time ACM-R has received a status message from participant replica @NonNull private String lastMsg; 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 b3437c06f..85c9e67cb 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 @@ -116,20 +116,6 @@ public class ParticipantProvider { } /** - * Updates an existing participant. - * - * @param participant participant to update - * @return the participant updated - */ - public Participant updateParticipant(@NonNull final Participant participant) { - var result = participantRepository - .save(ProviderUtils.getJpaAndValidate(participant, JpaParticipant::new, "participant")); - - // Return the saved participant - return result.toAuthorative(); - } - - /** * Delete a participant. * * @param participantId the Id of the participant to delete diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSyncTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSyncTest.java index 970b94824..2fee9c55a 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSyncTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantSyncTest.java @@ -40,7 +40,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -public class ParticipantSyncTest { +class ParticipantSyncTest { @Test void testCopyConstructor() throws CoderException { diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantReplicaTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantReplicaTest.java index d77760860..8cc9580cb 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantReplicaTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantReplicaTest.java @@ -28,9 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.UUID; import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.ParticipantReplica; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.utils.TimestampHelper; class JpaParticipantReplicaTest { 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 9ceeef640..ac3aa87c5 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 @@ -114,25 +114,6 @@ class ParticipantProviderTest { } @Test - void testParticipantUpdate() { - var participantRepository = mock(ParticipantRepository.class); - var automationCompositionElementRepository = mock(AutomationCompositionElementRepository.class); - var nodeTemplateStateRepository = mock(NodeTemplateStateRepository.class); - - var participantProvider = new ParticipantProvider(participantRepository, - automationCompositionElementRepository, nodeTemplateStateRepository, - mock(ParticipantReplicaRepository.class)); - - assertThatThrownBy(() -> participantProvider.updateParticipant(null)).hasMessageMatching(LIST_IS_NULL); - - when(participantRepository.save(any())).thenReturn(jpaParticipantList.get(0)); - - var updatedParticipant = participantProvider.updateParticipant(inputParticipants.get(0)); - updatedParticipant.setParticipantId(inputParticipants.get(0).getParticipantId()); - assertThat(updatedParticipant).usingRecursiveComparison().isEqualTo(inputParticipants.get(0)); - } - - @Test void testGetAutomationCompositions() { var participantRepository = mock(ParticipantRepository.class); var automationCompositionElementRepository = mock(AutomationCompositionElementRepository.class); @@ -240,7 +221,6 @@ class ParticipantProviderTest { assertThrows(NullPointerException.class, () -> participantProvider.getParticipantById(null)); assertThrows(NullPointerException.class, () -> participantProvider.findParticipant(null)); assertThrows(NullPointerException.class, () -> participantProvider.saveParticipant(null)); - assertThrows(NullPointerException.class, () -> participantProvider.updateParticipant(null)); assertThrows(NullPointerException.class, () -> participantProvider.deleteParticipant(null)); assertThrows(NullPointerException.class, () -> participantProvider.getAutomationCompositionElements(null)); assertThrows(NullPointerException.class, () -> participantProvider.getAcNodeTemplateStates(null)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java index e6135fe5b..91f26f7c1 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 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. @@ -47,7 +47,7 @@ class RestUtilsTest { var response = RestUtils.toSimpleResponse(ex); - assertThat(response.getStatusCodeValue()).isEqualTo(STATUS_ERROR.getStatusCode()); + assertThat(response.getStatusCode().value()).isEqualTo(STATUS_ERROR.getStatusCode()); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getErrorDetails()).isEqualTo(MESSAGE_ERROR); } diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/TimestampHelperTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/TimestampHelperTest.java index aaba0bcc8..d87b8bcd2 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/TimestampHelperTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/TimestampHelperTest.java @@ -30,7 +30,7 @@ class TimestampHelperTest { void testNow() { assertThat(TimestampHelper.nowTimestamp()).isNotNull(); assertThat(TimestampHelper.now()).isNotNull(); - assertThat(TimestampHelper.nowEpochMilli()).isNotNull(); + assertThat(TimestampHelper.nowEpochMilli()).isNotZero(); } @Test |