aboutsummaryrefslogtreecommitdiffstats
path: root/models/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-01-25 19:55:43 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-18 15:54:40 +0000
commit43098043c4ef31d9d5dead66568d7d9482a6b165 (patch)
tree6f6ea4812ff93d65e7c64e12a3ec6ab4462a64e2 /models/src
parentf401b5099bcb64f3e21de608d0207dd69d8043cd (diff)
Rename TOSCA Control Loop to ACM
This commit renames the TOSCA Control Loop functionality in CLAMP to Automation Composition Management. This review is a direct renaming review and, as everything is renamed together it is large. Issue-ID: POLICY-3939 Change-Id: I28f0a6dd889bf3570a4c1365ae9e71fc58db6d6c Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models/src')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java63
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java279
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java104
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsList.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsList.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java)51
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java)16
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java)26
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java)18
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionOrderedState.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopOrderedState.java)25
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java67
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoops.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantDefinition.java)11
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantHealthStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantState.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantState.java)23
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatistics.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsList.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsList.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUpdates.java)10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtils.java)40
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotification.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotification.java)16
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatus.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java)29
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java)24
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java)24
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregister.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAck.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java104
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAck.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantResponseStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseStatus.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java)25
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAck.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/GenericNameVersion.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/SimpleResponse.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/TypedSimpleResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/TypedSimpleResponse.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/commissioning/CommissioningResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/commissioning/CommissioningResponse.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionOrderStateResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopOrderStateResponse.java)14
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimed.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimedResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java)10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstancePropertiesResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstancePropertiesResponse.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommand.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommand.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationOrderStateResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationResponse.java)6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java)74
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java)115
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java)52
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatistics.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatistics.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java)84
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java287
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProvider.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java)10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ProviderUtils.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProvider.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProvider.java)12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AcElementStatisticsRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ClElementStatisticsRepository.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ControlLoopRepository.java)8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImpl.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantRepository.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantStatisticsRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantStatisticsRepository.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplateRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplateRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplatesRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplatesRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaServiceTemplateRepository.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaServiceTemplateRepository.java)2
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/rest/RestUtils.java (renamed from models/src/main/java/org/onap/policy/clamp/controlloop/models/rest/RestUtils.java)4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java152
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java103
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java160
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java189
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java300
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java301
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java116
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java290
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java83
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsTest.java)44
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionConceptPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopConceptPojosTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java103
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java160
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtilsTest.java)47
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java83
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatusTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatusTest.java)24
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/NotificationPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/NotificationPojosTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java)34
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java)28
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java)46
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java)4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java)4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantPojosTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java)92
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java)28
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/MessagesRestPojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/MessagesRestPojosTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommandTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommandTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAcElementStatisticsChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopChild.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopElementChild.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionElementChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaClElementStatisticsChild.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantChild.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantStatisticsChild.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantStatisticsChild.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java189
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java315
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java310
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatisticsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatisticsTest.java)28
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantTest.java)8
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/PojosTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/PojosTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java116
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java305
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java)12
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProviderTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java)12
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProviderTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProviderTest.java)6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImplTest.java)35
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java (renamed from models/src/test/java/org/onap/policy/clamp/controlloop/models/rest/RestUtilsTest.java)2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java149
-rw-r--r--models/src/test/resources/META-INF/persistence.xml10
-rw-r--r--models/src/test/resources/examples/acm/PMSubscriptionHandling.yaml (renamed from models/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml)90
-rw-r--r--models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json (renamed from models/src/test/resources/json/ControlLoopElementNoOrderedState.json)2
-rw-r--r--models/src/test/resources/json/AutomationCompositionNoOrderedState.json (renamed from models/src/test/resources/json/ControlLoopNoOrderedState.json)4
-rw-r--r--models/src/test/resources/providers/TestAcElementStatistics.json (renamed from models/src/test/resources/providers/TestClElementStatistics.json)10
-rw-r--r--models/src/test/resources/providers/TestAutomationCompositions.json (renamed from models/src/test/resources/providers/TestControlLoops.json)54
-rw-r--r--models/src/test/resources/providers/TestParticipant.json4
-rw-r--r--models/src/test/resources/providers/UpdateAutomationCompositions.json (renamed from models/src/test/resources/providers/UpdateControlLoops.json)28
134 files changed, 3196 insertions, 2817 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java
deleted file mode 100644
index ff0d553af..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopState.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-
-public enum ControlLoopState {
- /**
- * The control loop or control loop element is not initialised on participants, it does not exist on participants.
- */
- UNINITIALISED,
- /**
- * The control loop or control loop element is changing from unitialised to passive, it is being initialised onto
- * participants.
- */
- UNINITIALISED2PASSIVE,
- /**
- * The control loop or control loop element is initialised on the participants but is passive, that is, it is not
- * handling control loop messages yet.
- */
- PASSIVE,
- /**
- * The control loop or control loop element is changing from passive to running, the participants are preparing to
- * execute control loops.
- */
- PASSIVE2RUNNING,
- /** The control loop or control loop element is running and is executing control loops. */
- RUNNING,
- /**
- * The control loop or control loop element is completing execution of current control loops but will not start
- * running any more control loops and will become passive.
- */
- RUNNING2PASSIVE,
- /**
- * The control loop or control loop element is changing from passive to unitialised, the control loop is being
- * removed from participants.
- */
- PASSIVE2UNINITIALISED;
-
- public boolean equalsControlLoopOrderedState(final ControlLoopOrderedState controlLoopOrderedState) {
- return this.name().equals(controlLoopOrderedState.name());
- }
-
- public ControlLoopOrderedState asOrderedState() {
- return ControlLoopOrderedState.valueOf(this.name());
- }
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
deleted file mode 100644
index a1b1045eb..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import javax.persistence.EntityNotFoundException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import lombok.AllArgsConstructor;
-import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ControlLoopRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplateRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplatesRepository;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
-import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
-import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * This class provides information on control loop concepts in the database to callers.
- */
-@Service
-@Transactional
-@AllArgsConstructor
-public class ControlLoopProvider {
-
- private final ControlLoopRepository controlLoopRepository;
- private final ToscaNodeTemplateRepository toscaNodeTemplateRepository;
- private final ToscaNodeTemplatesRepository toscaNodeTemplatesRepository;
-
- /**
- * Get Control Loop.
- *
- * @param controlLoopId the ID of the control loop to get
- * @return the control loop found
- * @throws PfModelException on errors getting the control loop
- */
- @Transactional(readOnly = true)
- public ControlLoop getControlLoop(final ToscaConceptIdentifier controlLoopId) throws PfModelException {
- try {
- return controlLoopRepository.getById(controlLoopId.asConceptKey()).toAuthorative();
- } catch (EntityNotFoundException e) {
- throw new PfModelException(Status.NOT_FOUND, "ControlLoop not found", e);
- }
- }
-
- /**
- * Find Control Loop by controlLoopId.
- *
- * @param name the name of the control loop to get, null to get all control loops
- * @param version the version of the control loop to get, null to get all control loops
- * @return the control loop found
- * @throws PfModelException on errors getting the control loop
- */
- @Transactional(readOnly = true)
- public Optional<ControlLoop> findControlLoop(@NonNull final String name, @NonNull final String version)
- throws PfModelException {
- return findControlLoop(new PfConceptKey(name, version));
- }
-
- /**
- * Find Control Loop by controlLoopId.
- *
- * @param controlLoopId the ID of the control loop to get
- * @return the control loop found
- * @throws PfModelException on errors getting the control loop
- */
- @Transactional(readOnly = true)
- public Optional<ControlLoop> findControlLoop(final ToscaConceptIdentifier controlLoopId) throws PfModelException {
- return findControlLoop(controlLoopId.asConceptKey());
- }
-
- private Optional<ControlLoop> findControlLoop(@NonNull final PfConceptKey key) throws PfModelException {
- try {
- return controlLoopRepository.findById(key).map(JpaControlLoop::toAuthorative);
- } catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Not valid parameter", e);
- }
- }
-
- /**
- * Save Control Loop.
- *
- * @param controlLoop the control loop to update
- * @return the updated control loop
- * @throws PfModelException on errors updating the control loop
- */
- public ControlLoop saveControlLoop(final ControlLoop controlLoop) throws PfModelException {
- try {
- var result = controlLoopRepository
- .save(ProviderUtils.getJpaAndValidate(controlLoop, JpaControlLoop::new, "control loop"));
-
- // Return the saved participant
- return result.toAuthorative();
- } catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Error in save controlLoop", e);
- }
- }
-
- /**
- * Get All Control Loops.
- *
- * @return all control loops found
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public List<ControlLoop> getControlLoops() throws PfModelException {
-
- return ProviderUtils.asEntityList(controlLoopRepository.findAll());
- }
-
- /**
- * Get Control Loops.
- *
- * @param name the name of the control loop to get, null to get all control loops
- * @param version the version of the control loop to get, null to get all control loops
- * @return the control loops found
- * @throws PfModelException on errors getting control loops
- */
- @Transactional(readOnly = true)
- public List<ControlLoop> getControlLoops(final String name, final String version) throws PfModelException {
-
- return ProviderUtils.asEntityList(controlLoopRepository.getFiltered(JpaControlLoop.class, name, version));
- }
-
- /**
- * Saves control loops.
- *
- * @param controlLoops a specification of the control loops to create
- * @return the control loops created
- * @throws PfModelException on errors creating control loops
- */
- public List<ControlLoop> saveControlLoops(@NonNull final List<ControlLoop> controlLoops) throws PfModelException {
- try {
- var result = controlLoopRepository
- .saveAll(ProviderUtils.getJpaAndValidateList(controlLoops, JpaControlLoop::new, "control loops"));
-
- // Return the saved participant
- return ProviderUtils.asEntityList(result);
- } catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Error in save ControlLoops", e);
- }
- }
-
- /**
- * Saves Instance Properties to the database.
- *
- * @param serviceTemplate the service template
- * @return a Map of tosca node templates
- */
- public Map<String, ToscaNodeTemplate> saveInstanceProperties(ToscaServiceTemplate serviceTemplate) {
- Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
-
- var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
- jpaToscaNodeTemplates.fromAuthorative(List.of(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()));
-
- toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
- serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach(savedNodeTemplates::put);
-
- return savedNodeTemplates;
- }
-
- /**
- * Delete a control loop.
- *
- * @param name the name of the control loop to delete
- * @param version the version of the control loop to delete
- * @return the control loop deleted
- * @throws PfModelException on errors deleting the control loop
- */
- public ControlLoop deleteControlLoop(@NonNull final String name, @NonNull final String version)
- throws PfModelException {
-
- var controlLoopKey = new PfConceptKey(name, version);
- var jpaDeleteControlLoop = controlLoopRepository.findById(controlLoopKey);
-
- if (jpaDeleteControlLoop.isEmpty()) {
- String errorMessage =
- "delete of control loop \"" + controlLoopKey.getId() + "\" failed, control loop does not exist";
- throw new PfModelException(Response.Status.BAD_REQUEST, errorMessage);
- }
-
- controlLoopRepository.deleteById(controlLoopKey);
-
- return jpaDeleteControlLoop.get().toAuthorative();
- }
-
- /**
- * Deletes Instance Properties on the database.
- *
- * @param filteredToscaNodeTemplateMap filtered node templates map to delete
- * @param filteredToscaNodeTemplateList filtered node template list to delete
- */
- public void deleteInstanceProperties(Map<String, ToscaNodeTemplate> filteredToscaNodeTemplateMap,
- List<ToscaNodeTemplate> filteredToscaNodeTemplateList) {
-
- var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
- jpaToscaNodeTemplates.fromAuthorative(List.of(filteredToscaNodeTemplateMap));
-
- toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
-
- filteredToscaNodeTemplateList.forEach(template -> {
- var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
-
- toscaNodeTemplateRepository.delete(jpaToscaNodeTemplate);
- });
- }
-
- /**
- * Get All Node Templates.
- *
- * @return the list of node templates found
- * @throws PfModelException on errors getting node templates
- */
- @Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getAllNodeTemplates() {
- return ProviderUtils.asEntityList(toscaNodeTemplateRepository.findAll());
- }
-
- /**
- * Get Node Templates.
- *
- * @param name the name of the node template to get, null to get all node templates
- * @param version the version of the node template to get, null to get all node templates
- * @return the node templates found
- * @throws PfModelException on errors getting node templates
- */
- @Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getNodeTemplates(final String name, final String version) {
- return ProviderUtils
- .asEntityList(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version));
- }
-
- /**
- * Get filtered node templates.
- *
- * @param filter the filter for the node templates to get
- * @return the node templates found
- * @throws PfModelException on errors getting node templates
- */
- @Transactional(readOnly = true)
- public List<ToscaNodeTemplate> getFilteredNodeTemplates(
- @NonNull final ToscaTypedEntityFilter<ToscaNodeTemplate> filter) {
-
- return filter.filter(ProviderUtils.asEntityList(toscaNodeTemplateRepository
- .getFiltered(JpaToscaNodeTemplate.class, filter.getName(), filter.getVersion())));
- }
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
deleted file mode 100644
index 62b8d20b0..000000000
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageType.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
-
-/**
- * Class to hold the possible values for the type of participant messages.
- */
-public enum ParticipantMessageType {
-
- /**
- * Used by participants to report status to the control loop runtime.
- */
- PARTICIPANT_STATUS,
-
- /**
- * Used by the controlloop runtime to change the state of participants, triggers a
- * PARTICIPANT_STATUS message with the result of the PARTICIPANT_STATE_CHANGE operation.
- */
- PARTICIPANT_STATE_CHANGE,
-
- /**
- * Used by controlloop runtime to update the controlloops running on participants, triggers a
- * PARTICIPANT_STATUS message with the result of the CONTROL_LOOP_UPDATE operation.
- */
- CONTROL_LOOP_UPDATE,
-
- /**
- * Used by controlloop runtime to change the state of controlloops in participants, triggers a
- * PARTICIPANT_STATUS message with result of CONTROL_LOOP_STATE_CHANGE operation.
- */
- CONTROL_LOOP_STATE_CHANGE,
-
- /**
- * Used by the control loop runtime to order a health check on participants, triggers a
- * PARTICIPANT_STATUS message with the result of the PARTICIPANT_HEALTH_CHECK operation.
- */
- PARTICIPANT_HEALTH_CHECK,
-
- /**
- * Used by participant to register itself with control loop runtime.
- */
- PARTICIPANT_REGISTER,
-
- /**
- * Used by control loop runtime to respond to participant registration.
- */
- PARTICIPANT_REGISTER_ACK,
-
- /**
- * Used by participant to deregister itself with control loop runtime.
- */
- PARTICIPANT_DEREGISTER,
-
- /**
- * Used by control loop runtime to respond to participant deregistration.
- */
- PARTICIPANT_DEREGISTER_ACK,
-
- /**
- * Used by control loop runtime to send ToscaServiceTemplate to participant.
- */
- PARTICIPANT_UPDATE,
-
- /**
- * Used by participant to acknowledge the receipt of Participant_Update message
- * from control loop runtime.
- */
- PARTICIPANT_UPDATE_ACK,
-
- /**
- * Used by participant to acknowledge the receipt of ControlLoop_Update message
- * from control loop runtime.
- */
- CONTROLLOOP_UPDATE_ACK,
-
- /**
- * Used by participant to acknowledge the receipt of ControlLoop_StateChange message
- * from control loop runtime.
- */
- CONTROLLOOP_STATECHANGE_ACK,
-
- /**
- * Used by control loop runtime to request for ParticipantStatus message immediately.
- */
- PARTICIPANT_STATUS_REQ
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatistics.java
index 4ef9bdcd9..d1b1e31e8 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatistics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.io.Serializable;
import java.time.Instant;
@@ -32,7 +32,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@NoArgsConstructor
@Data
@ToString
-public class ClElementStatistics implements Serializable {
+public class AcElementStatistics implements Serializable {
private static final long serialVersionUID = 3284285693112271055L;
@@ -46,8 +46,8 @@ public class ClElementStatistics implements Serializable {
private Instant timeStamp;
@NonNull
- private ControlLoopState controlLoopState;
+ private AutomationCompositionState state;
- private long clElementUptime;
+ private long acElementUptime;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsList.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsList.java
index 166f1e48f..3b8feb5f6 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsList.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsList.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.List;
import lombok.Getter;
@@ -28,6 +28,6 @@ import lombok.ToString;
@Getter
@Setter
@ToString
-public class ClElementStatisticsList {
- private List<ClElementStatistics> clElementStatistics;
+public class AcElementStatisticsList {
+ private List<AcElementStatistics> acElementStatistics;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
index cf22b7228..f6134782b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.List;
import java.util.Map;
@@ -35,22 +35,22 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
- * Class to represent a control loop instance.
+ * Class to represent an automation composition instance.
*/
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
-public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop> {
+public class AutomationComposition extends ToscaEntity implements Comparable<AutomationComposition> {
@NonNull
private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
@NonNull
- private ControlLoopState state = ControlLoopState.UNINITIALISED;
+ private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
@NonNull
- private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED;
+ private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
- private Map<UUID, ControlLoopElement> elements;
+ private Map<UUID, AutomationCompositionElement> elements;
@NonNull
private Boolean primed = false;
@@ -68,28 +68,28 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop>
/**
* Copy contructor, does a deep copy.
*
- * @param otherControlLoop the other element to copy from
+ * @param otherAutomationComposition the other element to copy from
*/
- public ControlLoop(final ControlLoop otherControlLoop) {
- super(otherControlLoop);
- this.definition = new ToscaConceptIdentifier(otherControlLoop.definition);
- this.state = otherControlLoop.state;
- this.orderedState = otherControlLoop.orderedState;
- this.elements = PfUtils.mapMap(otherControlLoop.elements, ControlLoopElement::new);
- this.primed = otherControlLoop.primed;
+ public AutomationComposition(final AutomationComposition otherAutomationComposition) {
+ super(otherAutomationComposition);
+ this.definition = new ToscaConceptIdentifier(otherAutomationComposition.definition);
+ this.state = otherAutomationComposition.state;
+ this.orderedState = otherAutomationComposition.orderedState;
+ this.elements = PfUtils.mapMap(otherAutomationComposition.elements, AutomationCompositionElement::new);
+ this.primed = otherAutomationComposition.primed;
}
@Override
- public int compareTo(final ControlLoop other) {
+ public int compareTo(final AutomationComposition other) {
return compareNameVersion(this, other);
}
/**
- * Set the ordered state on the control loop and on all its control loop elements.
+ * Set the ordered state on the automation composition and on all its automation composition elements.
*
- * @param orderedState the state we want the control loop to transition to
+ * @param orderedState the state we want the automation composition to transition to
*/
- public void setCascadedOrderedState(final ControlLoopOrderedState orderedState) {
+ public void setCascadedOrderedState(final AutomationCompositionOrderedState orderedState) {
this.orderedState = orderedState;
if (MapUtils.isEmpty(elements)) {
@@ -100,17 +100,18 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop>
}
/**
- * Get a list of control loop element statistics.
+ * Get a list of automation composition element statistics.
*
- * @param controlLoop the control loop
- * @return List of ClElementStatistics
+ * @param automationComposition the automation composition
+ * @return List of AcElementStatistics
*/
- public List<ClElementStatistics> getControlLoopElementStatisticsList(final ControlLoop controlLoop) {
- if (MapUtils.isEmpty(controlLoop.elements)) {
+ public List<AcElementStatistics> getAutomationCompositionElementStatisticsList(
+ final AutomationComposition automationComposition) {
+ if (MapUtils.isEmpty(automationComposition.elements)) {
return List.of();
}
- return controlLoop.elements.values().stream().map(ControlLoopElement::getClElementStatistics)
- .collect(Collectors.toList());
+ return automationComposition.elements.values().stream()
+ .map(AutomationCompositionElement::getAcElementStatistics).collect(Collectors.toList());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
index c7d85e4b6..046b77f76 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -35,12 +35,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
- * Class to represent a control loop instance.
+ * Class to represent a automation composition instance.
*/
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopElement {
+public class AutomationCompositionElement {
@NonNull
private UUID id = UUID.randomUUID();
@@ -54,16 +54,16 @@ public class ControlLoopElement {
private ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
@NonNull
- private ControlLoopState state = ControlLoopState.UNINITIALISED;
+ private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
@NonNull
- private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED;
+ private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
private ToscaServiceTemplate toscaServiceTemplateFragment;
private String description;
- private ClElementStatistics clElementStatistics;
+ private AcElementStatistics acElementStatistics;
// 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.
@@ -74,7 +74,7 @@ public class ControlLoopElement {
*
* @param otherElement the other element to copy from
*/
- public ControlLoopElement(final ControlLoopElement otherElement) {
+ public AutomationCompositionElement(final AutomationCompositionElement otherElement) {
this.id = otherElement.id;
this.definition = new ToscaConceptIdentifier(otherElement.definition);
this.participantType = new ToscaConceptIdentifier(otherElement.participantType);
@@ -83,7 +83,7 @@ public class ControlLoopElement {
this.orderedState = otherElement.orderedState;
this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment;
this.description = otherElement.description;
- this.clElementStatistics = otherElement.clElementStatistics;
+ this.acElementStatistics = otherElement.acElementStatistics;
this.propertiesMap = PfUtils.mapMap(otherElement.propertiesMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java
index 61b90c9e9..b100f28c0 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -29,10 +29,10 @@ import lombok.ToString;
@Setter
@AllArgsConstructor
@ToString
-public class ControlLoopElementAck {
+public class AutomationCompositionElementAck {
- // State of the controlLoopElement
- private ControlLoopState state;
+ // State of the AutomationCompositionElement
+ private AutomationCompositionState state;
// Result: Success/Fail.
private Boolean result;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
index ae50b40ce..aebee0e2c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementDefinition.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -33,18 +33,18 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
- * Class to represent a control loop element definition instance.
+ * Class to represent an automation composition element definition instance.
*/
@Getter
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopElementDefinition {
+public class AutomationCompositionElementDefinition {
- private ToscaConceptIdentifier clElementDefinitionId;
+ private ToscaConceptIdentifier acElementDefinitionId;
- // The definition of the Control Loop Element in TOSCA
- private ToscaNodeTemplate controlLoopElementToscaNodeTemplate;
+ // The definition of the Automation Composition Element in TOSCA
+ private ToscaNodeTemplate automationCompositionElementToscaNodeTemplate;
// 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.
@@ -53,12 +53,12 @@ public class ControlLoopElementDefinition {
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
- * @param clElementDefinition the controlloop element definition to copy from
+ * @param acElementDefinition the automation composition element definition to copy from
*/
- public ControlLoopElementDefinition(final ControlLoopElementDefinition clElementDefinition) {
- this.clElementDefinitionId = clElementDefinition.clElementDefinitionId;
- this.controlLoopElementToscaNodeTemplate =
- new ToscaNodeTemplate(clElementDefinition.controlLoopElementToscaNodeTemplate);
- this.commonPropertiesMap = PfUtils.mapMap(clElementDefinition.commonPropertiesMap, UnaryOperator.identity());
+ public AutomationCompositionElementDefinition(final AutomationCompositionElementDefinition acElementDefinition) {
+ this.acElementDefinitionId = acElementDefinition.acElementDefinitionId;
+ this.automationCompositionElementToscaNodeTemplate =
+ new ToscaNodeTemplate(acElementDefinition.automationCompositionElementToscaNodeTemplate);
+ this.commonPropertiesMap = PfUtils.mapMap(acElementDefinition.commonPropertiesMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
index 0c33606db..dba8f553c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopInfo.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -26,27 +26,27 @@ import lombok.ToString;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a control loop info instance.
+ * Class to represent a automation composition info instance.
*/
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopInfo {
+public class AutomationCompositionInfo {
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
- private ControlLoopState state = ControlLoopState.UNINITIALISED;
+ private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
- private ControlLoopStatistics controlLoopStatistics;
+ private AutomationCompositionStatistics automationCompositionStatistics;
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
* @param otherElement the other element to copy from
*/
- public ControlLoopInfo(final ControlLoopInfo otherElement) {
- this.controlLoopId = otherElement.controlLoopId;
+ public AutomationCompositionInfo(final AutomationCompositionInfo otherElement) {
+ this.automationCompositionId = otherElement.automationCompositionId;
this.state = otherElement.state;
- this.controlLoopStatistics = otherElement.controlLoopStatistics;
+ this.automationCompositionStatistics = otherElement.automationCompositionStatistics;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopOrderedState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionOrderedState.java
index 91f90275e..3be5ffa2f 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopOrderedState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionOrderedState.java
@@ -18,27 +18,30 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
-public enum ControlLoopOrderedState {
+public enum AutomationCompositionOrderedState {
/**
- * The control loop or control loop element should become uninitialised on participants, it should not exist on
- * participants.
+ * The automation composition or automation composition element should become uninitialised on participants, it
+ * should not exist on participants.
*/
UNINITIALISED,
/**
- * The control loop or control loop element should initialised on the participants and be passive, that is, it is
- * not handling control loop messages yet.
+ * The automation composition or automation composition element should initialised on the participants and be
+ * passive, that is, it is not handling automation composition messages yet.
*/
PASSIVE,
- /** The control loop or control loop element should running and is executing control loops. */
+ /**
+ * The automation composition or automation composition element should running and is executing automation
+ * compositions.
+ */
RUNNING;
- public boolean equalsControlLoopState(final ControlLoopState controlLoopState) {
- return this.name().equals(controlLoopState.name());
+ public boolean equalsAutomationCompositionState(final AutomationCompositionState automationCompositionState) {
+ return this.name().equals(automationCompositionState.name());
}
- public ControlLoopState asState() {
- return ControlLoopState.valueOf(this.name());
+ public AutomationCompositionState asState() {
+ return AutomationCompositionState.valueOf(this.name());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java
new file mode 100644
index 000000000..aa6fcfd1d
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionState.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+public enum AutomationCompositionState {
+ /**
+ * The automation composition or automation composition element is not initialised on participants, it does not
+ * exist on participants.
+ */
+ UNINITIALISED,
+ /**
+ * The automation composition or automation composition element is changing from unitialised to passive, it is being
+ * initialised onto participants.
+ */
+ UNINITIALISED2PASSIVE,
+ /**
+ * The automation composition or automation composition element is initialised on the participants but is passive,
+ * that is, it is not handling automation composition messages yet.
+ */
+ PASSIVE,
+ /**
+ * The automation composition or automation composition element is changing from passive to running, the
+ * participants are preparing to execute automation compositions.
+ */
+ PASSIVE2RUNNING,
+ /**
+ * The automation composition or automation composition element is running and is executing automation compositions.
+ */
+ RUNNING,
+ /**
+ * The automation composition or automation composition element is completing execution of current automation
+ * compositions but will not start running any more automation compositions and will become passive.
+ */
+ RUNNING2PASSIVE,
+ /**
+ * The automation composition or automation composition element is changing from passive to unitialised, the
+ * automation composition is being removed from participants.
+ */
+ PASSIVE2UNINITIALISED;
+
+ public boolean equalsAutomationCompositionOrderedState(
+ final AutomationCompositionOrderedState automationCompositionOrderedState) {
+ return this.name().equals(automationCompositionOrderedState.name());
+ }
+
+ public AutomationCompositionOrderedState asOrderedState() {
+ return AutomationCompositionOrderedState.valueOf(this.name());
+ }
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionStatistics.java
index 685947b13..8f73328ad 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionStatistics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.time.Instant;
import lombok.Data;
@@ -30,16 +30,16 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@NoArgsConstructor
@Data
@ToString
-public class ControlLoopStatistics {
+public class AutomationCompositionStatistics {
@NonNull
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
@NonNull
private Instant timeStamp;
@NonNull
- private ClElementStatisticsList clElementStatisticsList;
+ private AcElementStatisticsList acElementStatisticsList;
private long eventCount;
private long lastExecutionTime;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoops.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java
index 4ab406f3b..1802f814c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoops.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -34,15 +34,15 @@ import org.onap.policy.models.base.PfUtils;
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
-public class ControlLoops {
- private List<ControlLoop> controlLoopList = new ArrayList<>();
+public class AutomationCompositions {
+ private List<AutomationComposition> automationCompositionList = new ArrayList<>();
/**
* Copy constructor, does a deep copy.
*
- * @param otherControlLoops the other element to copy from
+ * @param otherAutomationCompositions the other element to copy from
*/
- public ControlLoops(final ControlLoops otherControlLoops) {
- this.controlLoopList = PfUtils.mapList(controlLoopList, ControlLoop::new);
+ public AutomationCompositions(final AutomationCompositions otherAutomationCompositions) {
+ this.automationCompositionList = PfUtils.mapList(automationCompositionList, AutomationComposition::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java
index 198cf1a16..1a8fbc409 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java
index 336b309ce..949a7c47d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantDefinition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -42,8 +42,8 @@ public class ParticipantDefinition {
private ToscaConceptIdentifier participantType;
- // List of ControlLoopElementDefinition values for a particular participant
- private List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>();
+ // List of AutomationCompositionElementDefinition values for a particular participant
+ private List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList = new ArrayList<>();
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
@@ -53,7 +53,8 @@ public class ParticipantDefinition {
public ParticipantDefinition(final ParticipantDefinition participantDefinition) {
this.participantId = participantDefinition.participantId;
this.participantType = participantDefinition.participantType;
- this.controlLoopElementDefinitionList = PfUtils.mapList(
- participantDefinition.controlLoopElementDefinitionList, ControlLoopElementDefinition::new);
+ this.automationCompositionElementDefinitionList =
+ PfUtils.mapList(participantDefinition.automationCompositionElementDefinitionList,
+ AutomationCompositionElementDefinition::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantHealthStatus.java
index e7c5fecda..f8cc0a852 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantHealthStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantHealthStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
/**
* Class to hold the possible values for health status of Participant.
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantState.java
index 1af32660d..4ab42c697 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantState.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantState.java
@@ -18,44 +18,43 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
/**
* Class to hold the possible values for mode of participant.
*/
public enum ParticipantState {
-
/**
- * Control Loop execution is unknown.
+ * Participant state is unknown.
*/
UNKNOWN,
/**
- * Control Loop execution is always rejected.
+ * Participant is passive, automation composition element execution is always rejected.
*/
PASSIVE,
/**
- * Control Loop execution execution proceeds, but changes to domain state or context are not carried out. The
- * participant returns an indication that it is running in SAFE mode together with the action it would have
- * performed if it was operating in ACTIVE mode.
+ * Automation composition element execution execution proceeds, but changes to domain state or context are not
+ * carried out. The participant returns an indication that it is running in SAFE mode together with the action it
+ * would have performed if it was operating in ACTIVE mode.
*/
SAFE,
/**
- * Control Loop execution execution proceeds and changes to domain and state are carried out in a test environment.
- * The participant returns an indication that it is running in TEST mode together with the action it has performed
- * on the test environment.
+ * Automation composition element execution execution proceeds and changes to domain and state are carried out in a
+ * test environment. The participant returns an indication that it is running in TEST mode together with the action
+ * it has performed on the test environment.
*/
TEST,
/**
- * Control Loop execution execution is executed in the live environment by the participant.
+ * Automation composition element execution is executed in the live environment by the participant.
*/
ACTIVE,
/**
- * Control Loop execution execution is terminated and not available.
+ * Automation composition element execution has been terminated.
*/
TERMINATED
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatistics.java
index 3a7b21fa1..4d3b96db7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatistics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.io.Serializable;
import java.time.Instant;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsList.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsList.java
index a69f96f85..4abdf4a63 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsList.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsList.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.List;
import lombok.Getter;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUpdates.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
index ea851b8c5..1872a6144 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUpdates.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -40,8 +40,8 @@ public class ParticipantUpdates {
private ToscaConceptIdentifier participantId;
- // List of ControlLoopElement values for a particular participant
- private List<ControlLoopElement> controlLoopElementList = new ArrayList<>();
+ // List of AutomationCompositionElement values for a particular participant
+ private List<AutomationCompositionElement> automationCompositionElementList = new ArrayList<>();
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
@@ -50,7 +50,7 @@ public class ParticipantUpdates {
*/
public ParticipantUpdates(final ParticipantUpdates participantUpdates) {
this.participantId = participantUpdates.participantId;
- this.controlLoopElementList = PfUtils.mapList(
- participantUpdates.controlLoopElementList, ControlLoopElement::new);
+ this.automationCompositionElementList = PfUtils.mapList(
+ participantUpdates.automationCompositionElementList, AutomationCompositionElement::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
index c05311892..9d26ce406 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import java.util.Map;
import javax.ws.rs.core.Response;
@@ -36,7 +36,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
public final class ParticipantUtils {
private static final Coder CODER = new StandardCoder();
- private static final String CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.ControlLoopElement";
+ private static final String AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.policy.clamp.acm.AutomationCompositionElement";
/**
* Finds participantType from a map of properties.
@@ -57,27 +58,30 @@ public final class ParticipantUtils {
}
/**
- * Get the First StartPhase
- * it depend of the state of the Control Loop
- * and also from the all startPhase defined into the ToscaServiceTemplate.
- * @param controlLoop the ControlLoop
+ * Get the First StartPhase.
+ *
+ * <p>This depends on the state of the automation composition and also on all start phases defined in the
+ * ToscaServiceTemplate.
+ *
+ * @param automationComposition the automation composition
* @param toscaServiceTemplate the ToscaServiceTemplate
* @return the First StartPhase
*/
- public static int getFirstStartPhase(ControlLoop controlLoop, ToscaServiceTemplate toscaServiceTemplate) {
+ public static int getFirstStartPhase(
+ AutomationComposition automationComposition, ToscaServiceTemplate toscaServiceTemplate) {
var minStartPhase = 1000;
var maxStartPhase = 0;
- for (var element : controlLoop.getElements().values()) {
+ for (var element : automationComposition.getElements().values()) {
ToscaNodeTemplate toscaNodeTemplate = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()
- .get(element.getDefinition().getName());
+ .get(element.getDefinition().getName());
int startPhase = ParticipantUtils.findStartPhase(toscaNodeTemplate.getProperties());
minStartPhase = Math.min(minStartPhase, startPhase);
maxStartPhase = Math.max(maxStartPhase, startPhase);
}
- return ControlLoopState.UNINITIALISED2PASSIVE.equals(controlLoop.getState())
- || ControlLoopState.PASSIVE2RUNNING.equals(controlLoop.getState()) ? minStartPhase
- : maxStartPhase;
+ return AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())
+ || AutomationCompositionState.PASSIVE2RUNNING.equals(automationComposition.getState()) ? minStartPhase
+ : maxStartPhase;
}
/**
@@ -95,22 +99,22 @@ public final class ParticipantUtils {
}
/**
- * Checks If NodeTemplate Is ControlLoopElement.
+ * Checks if a NodeTemplate is an AutomationCompositionElement.
*
* @param nodeTemplate the ToscaNodeTemplate
* @param toscaServiceTemplate the ToscaServiceTemplate
- * @return true if NodeTemplate Is ControlLoopElement
+ * @return true if the NodeTemplate is an AutomationCompositionElement
*/
- public static boolean checkIfNodeTemplateIsControlLoopElement(ToscaNodeTemplate nodeTemplate,
- ToscaServiceTemplate toscaServiceTemplate) {
- if (nodeTemplate.getType().contains(CONTROL_LOOP_ELEMENT)) {
+ public static boolean checkIfNodeTemplateIsAutomationCompositionElement(ToscaNodeTemplate nodeTemplate,
+ ToscaServiceTemplate toscaServiceTemplate) {
+ if (nodeTemplate.getType().contains(AUTOMATION_COMPOSITION_ELEMENT)) {
return true;
} else {
var nodeType = toscaServiceTemplate.getNodeTypes().get(nodeTemplate.getType());
if (nodeType != null) {
var derivedFrom = nodeType.getDerivedFrom();
if (derivedFrom != null) {
- return derivedFrom.contains(CONTROL_LOOP_ELEMENT);
+ return derivedFrom.contains(AUTOMATION_COMPOSITION_ELEMENT);
}
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotification.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotification.java
index c6bbd81d6..4b898633a 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotification.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotification.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
@@ -29,23 +29,23 @@ import org.apache.commons.collections4.CollectionUtils;
@Data
@NoArgsConstructor
@AllArgsConstructor
-public class ControlLoopNotification {
+public class AutomationCompositionNotification {
/**
- * Status of control loops that are being added to participants.
+ * Status of automation compositions that are being added to participants.
*/
- @SerializedName("deployed-control-loops")
- private List<ControlLoopStatus> added = new ArrayList<>();
+ @SerializedName("deployed-automation-compositions")
+ private List<AutomationCompositionStatus> added = new ArrayList<>();
/**
* Status of policies that are being deleted from PDPs.
*/
- @SerializedName("undeployed-control-loops")
- private List<ControlLoopStatus> deleted = new ArrayList<>();
+ @SerializedName("undeployed-automation-compositions")
+ private List<AutomationCompositionStatus> deleted = new ArrayList<>();
/**
- * Determines if the notification is empty (i.e., has no added or delete control loop
+ * Determines if the notification is empty (i.e., has no added or delete automation composition
* notifications).
*
* @return {@code true} if the notification is empty, {@code false} otherwise
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatus.java
index 033843e75..f65c6217b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatus.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import com.google.gson.annotations.SerializedName;
import java.util.UUID;
@@ -28,8 +28,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Data
@NoArgsConstructor
@AllArgsConstructor
-public class ControlLoopStatus {
- @SerializedName("control-loop-id")
+public class AutomationCompositionStatus {
+ @SerializedName("automation-composition-id")
private UUID id;
private ToscaConceptIdentifier definition;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
index cdbfea4e2..c0a21d61a 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -27,32 +27,32 @@ import java.util.function.UnaryOperator;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent the CONTROLLOOP_ACK message that a participant sends
- * to control loop runtime as an acknowledgement to either ControlLoopUpdate
- * or ControlLoopStateChange message.
+ * Class to represent the AUTOMATION_COMPOSITION_ACK message that a participant sends
+ * to automation composition runtime as an acknowledgement to either AUTOMATION_COMPOSITION_UPDATE
+ * or AUTOMATION_COMPOSITION_STATE_CHANGE message.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopAck extends ParticipantAckMessage {
+public class AutomationCompositionAck extends ParticipantAckMessage {
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
private Integer startPhase;
- // A map with ControlLoopElementID as its key, and a pair of result and message as value per
- // ControlLoopElement.
- private Map<UUID, ControlLoopElementAck> controlLoopResultMap = new LinkedHashMap<>();
+ // A map with AutomationCompositionElementID as its key, and a pair of result and message as value per
+ // AutomationCompositionElement.
+ private Map<UUID, AutomationCompositionElementAck> automationCompositionResultMap = new LinkedHashMap<>();
/**
* Constructor for instantiating ParticipantRegisterAck class with message name.
*
*/
- public ControlLoopAck(final ParticipantMessageType messageType) {
+ public AutomationCompositionAck(final ParticipantMessageType messageType) {
super(messageType);
}
@@ -61,9 +61,10 @@ public class ControlLoopAck extends ParticipantAckMessage {
*
* @param source source from which to copy
*/
- public ControlLoopAck(final ControlLoopAck source) {
+ public AutomationCompositionAck(final AutomationCompositionAck source) {
super(source);
- this.controlLoopId = source.controlLoopId;
- this.controlLoopResultMap = PfUtils.mapMap(source.controlLoopResultMap, UnaryOperator.identity());
+ this.automationCompositionId = source.automationCompositionId;
+ this.automationCompositionResultMap =
+ PfUtils.mapMap(source.automationCompositionResultMap, UnaryOperator.identity());
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
index e3b7049e1..f8daa36a9 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChange.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
@@ -18,32 +18,32 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
/**
- * Class to represent the CONTROL_LOOP_STATE_CHANGE message that the control loop runtime will send to
- * participants to change the state of a control loop they are running.
+ * Class to represent the AUTOMATION_COMPOSITION_STATE_CHANGE message that the automation composition runtime will send
+ * to participants to change the state of an automation composition they are running.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopStateChange extends ParticipantMessage {
- private ControlLoopOrderedState orderedState;
- private ControlLoopState currentState;
+public class AutomationCompositionStateChange extends ParticipantMessage {
+ private AutomationCompositionOrderedState orderedState;
+ private AutomationCompositionState currentState;
private Integer startPhase;
/**
- * Constructor for instantiating ControlLoopStateChange class with message name.
+ * Constructor for instantiating class with message name.
*
*/
- public ControlLoopStateChange() {
- super(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ public AutomationCompositionStateChange() {
+ super(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
}
/**
@@ -51,7 +51,7 @@ public class ControlLoopStateChange extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ControlLoopStateChange(ControlLoopStateChange source) {
+ public AutomationCompositionStateChange(AutomationCompositionStateChange source) {
super(source);
this.orderedState = source.orderedState;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java
index f8a47c7c9..55fcc7462 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java
@@ -18,36 +18,37 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the CONTROL_LOOP_UPDATE message that the control loop runtime sends to a participant.
- * When a participant receives this message, it creates the control loop elements contained in the message and sets them
- * to state PASSIVE. subsequent CONTROL_LOOP_STATE_CHANGE messages are used to activate the control loops.
+ * Class to represent the AUTOMATION_COMPOSITION_UPDATE message that the automation composition runtime sends to a
+ * participant. When a participant receives this message, it creates the automation composition elements contained in
+ * the message and sets them to state PASSIVE. subsequent AUTOMATION_COMPOSITION_STATE_CHANGE messages are used to
+ * activate the automation compositions.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopUpdate extends ParticipantMessage {
+public class AutomationCompositionUpdate extends ParticipantMessage {
// A list of ParticipantUpdates instances which carries details of an updated participant.
private List<ParticipantUpdates> participantUpdatesList = new ArrayList<>();
private Integer startPhase = 0;
/**
- * Constructor for instantiating ControlLoopUpdate class with message name.
+ * Constructor for instantiating class with message name.
*
*/
- public ControlLoopUpdate() {
- super(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ public AutomationCompositionUpdate() {
+ super(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
}
/**
@@ -55,10 +56,9 @@ public class ControlLoopUpdate extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ControlLoopUpdate(ControlLoopUpdate source) {
+ public AutomationCompositionUpdate(AutomationCompositionUpdate source) {
super(source);
- this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList,
- ParticipantUpdates::new);
+ this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantUpdates::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java
index 8a1be69bd..8b33d3172 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessage.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.UUID;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -104,7 +104,7 @@ public class ParticipantAckMessage {
return false;
}
- // Broadcast message to all control loop elements on this participant
+ // Broadcast message to all automation composition elements on this participant
if (this.participantId == null) {
return true;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java
index 7705e3d0c..2e7ed8c52 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregister.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_DEREGISTER message that all the participants send to control loop runtime.
+ * Class to represent the PARTICIPANT_DEREGISTER message that all the participants send to the ACM runtime.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java
index 69406beb7..afa987d65 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_DEREGISTER_ACK message that control loop runtime sends to the participant.
+ * Class to represent the PARTICIPANT_DEREGISTER_ACK message that the ACM runtime sends to the participant.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
index f98a88c3b..c358376b2 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.time.Instant;
import java.util.UUID;
@@ -30,7 +30,7 @@ import lombok.ToString;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent the base class for various messages that will be exchanged between the control loop runtime and
+ * Class to represent the base class for various messages that will be exchanged between the ACM runtime and
* participants.
*/
@Getter
@@ -58,9 +58,9 @@ public class ParticipantMessage {
private ToscaConceptIdentifier participantId;
/**
- * Control loop ID, or {@code null} for messages to participants.
+ * Automation Composition ID, or {@code null} for messages to participants.
*/
- private ToscaConceptIdentifier controlLoopId;
+ private ToscaConceptIdentifier automationCompositionId;
/**
* Constructor for instantiating a participant message class.
@@ -80,7 +80,7 @@ public class ParticipantMessage {
this.messageType = source.messageType;
this.participantType = source.participantType;
this.participantId = source.participantId;
- this.controlLoopId = source.controlLoopId;
+ this.automationCompositionId = source.automationCompositionId;
}
/**
@@ -101,7 +101,7 @@ public class ParticipantMessage {
return false;
}
- // Broadcast message to all control loop elements on this participant
+ // Broadcast message to all automation composition elements on this participant
if (this.participantId == null) {
return true;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
new file mode 100644
index 000000000..4f6bcdbf3
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
+
+/**
+ * Class to hold the possible values for the type of participant messages.
+ */
+public enum ParticipantMessageType {
+
+ /**
+ * Used by participants to report status to the automation composition runtime.
+ */
+ PARTICIPANT_STATUS,
+
+ /**
+ * Used by the acm runtime to change the state of participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the PARTICIPANT_STATE_CHANGE operation.
+ */
+ PARTICIPANT_STATE_CHANGE,
+
+ /**
+ * Used by acm runtime to update the automation compositions running on participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the AUTOMATION_COMPOSITION_UPDATE operation.
+ */
+ AUTOMATION_COMPOSITION_UPDATE,
+
+ /**
+ * Used by acm runtime to change the state of automation compositions in participants, triggers a
+ * PARTICIPANT_STATUS message with result of AUTOMATION_COMPOSITION_STATE_CHANGE operation.
+ */
+ AUTOMATION_COMPOSITION_STATE_CHANGE,
+
+ /**
+ * Used by the automation composition runtime to order a health check on participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the PARTICIPANT_HEALTH_CHECK operation.
+ */
+ PARTICIPANT_HEALTH_CHECK,
+
+ /**
+ * Used by participant to register itself with automation composition runtime.
+ */
+ PARTICIPANT_REGISTER,
+
+ /**
+ * Used by automation composition runtime to respond to participant registration.
+ */
+ PARTICIPANT_REGISTER_ACK,
+
+ /**
+ * Used by participant to deregister itself with automation composition runtime.
+ */
+ PARTICIPANT_DEREGISTER,
+
+ /**
+ * Used by automation composition runtime to respond to participant deregistration.
+ */
+ PARTICIPANT_DEREGISTER_ACK,
+
+ /**
+ * Used by automation composition runtime to send ToscaServiceTemplate to participant.
+ */
+ PARTICIPANT_UPDATE,
+
+ /**
+ * Used by participant to acknowledge the receipt of PARTICIPANT_UPDATE message
+ * from automation composition runtime.
+ */
+ PARTICIPANT_UPDATE_ACK,
+
+ /**
+ * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_UPDATE message
+ * from automation composition runtime.
+ */
+ AUTOMATION_COMPOSITION_UPDATE_ACK,
+
+ /**
+ * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_STATE_CHANGE message
+ * from automation composition runtime.
+ */
+ AUTOMATION_COMPOSITION_STATECHANGE_ACK,
+
+ /**
+ * Used by automation composition runtime to request for PARTICIPANT_STATUS message immediately.
+ */
+ PARTICIPANT_STATUS_REQ
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java
index af0149189..7b315dbe0 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegister.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_REGISTER message that all the participants send to control loop runtime.
+ * Class to represent the PARTICIPANT_REGISTER message that all the participants send to the ACM runtime.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java
index 28d51be93..60858be4c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_REGISTER_ACK message that control loop runtime sends to registered participant.
+ * Class to represent the PARTICIPANT_REGISTER_ACK message that the ACM runtime sends to a registered participant.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantResponseStatus.java
index f014529b3..cb0307742 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantResponseStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantResponseStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
/**
* Class to hold the possible values for participant response status.
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java
index 8600b4b5b..32b95e11b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the PARTICIPANT_STATUS message that all the participants send to the control loop runtime.
+ * Class to represent the PARTICIPANT_STATUS message that all the participants send to the ACM runtime.
*/
@Getter
@Setter
@@ -49,8 +49,8 @@ public class ParticipantStatus extends ParticipantMessage {
// A list of ParticipantDefinition updates, returned in response to ParticipantStatusReq only
private List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- // List of ControlLoopInfo types with ControlLoopId, its state and statistics
- private List<ControlLoopInfo> controlLoopInfoList = new ArrayList<>();
+ // List of AutomationCompositionInfo types with AutomationCompositionId, its state and statistics
+ private List<AutomationCompositionInfo> automationCompositionInfoList = new ArrayList<>();
/**
* Constructor for instantiating ParticipantStatus class with message name.
@@ -71,8 +71,9 @@ public class ParticipantStatus extends ParticipantMessage {
this.state = source.state;
this.healthStatus = source.healthStatus;
this.participantStatistics = (source.participantStatistics == null ? null : new ParticipantStatistics());
- this.participantDefinitionUpdates = PfUtils.mapList(source.participantDefinitionUpdates,
- ParticipantDefinition::new);
- this.controlLoopInfoList = PfUtils.mapList(source.controlLoopInfoList, ControlLoopInfo::new);
+ this.participantDefinitionUpdates =
+ PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new);
+ this.automationCompositionInfoList =
+ PfUtils.mapList(source.automationCompositionInfoList, AutomationCompositionInfo::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java
index 9242cea02..82260ee67 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReq.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_STATUS_REQ message that controlloop runtime
+ * Class to represent the PARTICIPANT_STATUS_REQ message that the ACM runtime
* sends to participants for an immediate ParticipantStatus from participants.
*/
@Getter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java
index 72db7d97e..36842a8cf 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java
@@ -19,19 +19,19 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the PARTICIPANT_UPDATE message that the control loop runtime sends to a participant.
- * ControlLoop Runtime sends Control Loop Element Definitions and Common Parameter Values to Participants.
+ * Class to represent the PARTICIPANT_UPDATE message that the ACM runtime sends to a participant.
+ * the ACM Runtime sends automation composition element Definitions and Common Parameter Values to Participants.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java
index d38fa4bb2..2c3a68e22 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java
@@ -20,14 +20,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_UPDATE_ACK message that registered participant sends to controlloop runtime.
+ * Class to represent the PARTICIPANT_UPDATE_ACK message that registered participant sends to the ACM runtime.
*/
@Getter
@Setter
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/GenericNameVersion.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
index a48af9223..3e39e970d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/GenericNameVersion.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
@@ -17,7 +17,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import lombok.Data;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/SimpleResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java
index 2bd09c632..1668652b7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/SimpleResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java
@@ -16,7 +16,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import lombok.Getter;
import lombok.Setter;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/TypedSimpleResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/TypedSimpleResponse.java
index 199ac8ee1..871eb3bc2 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/TypedSimpleResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/TypedSimpleResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import lombok.Getter;
import lombok.Setter;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/commissioning/CommissioningResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/commissioning/CommissioningResponse.java
index 6363db8d2..42ce79843 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/commissioning/CommissioningResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/commissioning/CommissioningResponse.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.commissioning;
+package org.onap.policy.clamp.models.acm.messages.rest.commissioning;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -34,5 +34,5 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Setter
@ToString(callSuper = true)
public class CommissioningResponse extends SimpleResponse {
- private List<ToscaConceptIdentifier> affectedControlLoopDefinitions;
+ private List<ToscaConceptIdentifier> affectedAutomationCompositionDefinitions;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopOrderStateResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionOrderStateResponse.java
index dcc63a538..a87433d4c 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopOrderStateResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionOrderStateResponse.java
@@ -17,16 +17,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.messages.rest.GenericNameVersion;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.messages.rest.GenericNameVersion;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
/**
@@ -35,9 +35,9 @@ import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopOrderStateResponse extends SimpleResponse {
+public class AutomationCompositionOrderStateResponse extends SimpleResponse {
- private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED;
+ private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
- private List<GenericNameVersion> controlLoopIdentifierList = new ArrayList<>();
+ private List<GenericNameVersion> automationCompositionIdentifierList = new ArrayList<>();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimed.java
index d6e670060..34556653b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimed.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimed.java
@@ -17,12 +17,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import lombok.Data;
@Data
-public class ControlLoopPrimed {
+public class AutomationCompositionPrimed {
private String name;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimedResponse.java
index 4d2dfaf01..fa3e8fad7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/ControlLoopPrimedResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/AutomationCompositionPrimedResponse.java
@@ -17,23 +17,23 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
/**
- * Response to provide all primed controlLoops.
+ * Response to provide all primed automation compositions.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ControlLoopPrimedResponse extends SimpleResponse {
+public class AutomationCompositionPrimedResponse extends SimpleResponse {
- private List<ControlLoopPrimed> primedControlLoopsList = new ArrayList<>();
+ private List<AutomationCompositionPrimed> primedAutomationCompositionsList = new ArrayList<>();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstancePropertiesResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstancePropertiesResponse.java
index d8974d6e3..0341d5dae 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstancePropertiesResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstancePropertiesResponse.java
@@ -17,14 +17,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommand.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommand.java
index 71b7ab92c..a3fb70e15 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommand.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommand.java
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.List;
import lombok.Data;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Data
public class InstantiationCommand {
- // The state to which the control loops are to be set
- private ControlLoopOrderedState orderedState;
+ // The state to which the automation compositions are to be set
+ private AutomationCompositionOrderedState orderedState;
- // The list of control loops on which the command is to be issued
- private List<ToscaConceptIdentifier> controlLoopIdentifierList;
+ // The list of automation compositions on which the command is to be issued
+ private List<ToscaConceptIdentifier> automationCompositionIdentifierList;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationOrderStateResponse.java
index 1ddce7840..e6bdaee9d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationOrderStateResponse.java
@@ -19,13 +19,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
/**
* Response to instantiation OrderState.
@@ -35,5 +35,5 @@ import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
@ToString(callSuper = true)
public class InstantiationOrderStateResponse extends SimpleResponse {
- private ControlLoopOrderedState orderedState;
+ private AutomationCompositionOrderedState orderedState;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationResponse.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java
index d932f29ac..e7c346498 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -34,5 +34,5 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Setter
@ToString(callSuper = true)
public class InstantiationResponse extends SimpleResponse {
- private List<ToscaConceptIdentifier> affectedControlLoops;
+ private List<ToscaConceptIdentifier> affectedAutomationCompositions;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatistics.java
index 956f1db02..4a046052e 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatistics.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.io.Serializable;
import java.util.List;
@@ -37,8 +37,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.builder.CompareToBuilder;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -49,17 +49,17 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a controlloop element statistics in the database.
+ * Class to represent automation composition element statistics in the database.
*
* @author Ramesh Murugan Iyer (ramesh.murugan.iyer@est.tech)
*/
@Entity
-@Table(name = "ClElementStatistics")
+@Table(name = "AcElementStatistics")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
-public class JpaClElementStatistics extends PfConcept implements PfAuthorative<ClElementStatistics>, Serializable {
+public class JpaAcElementStatistics extends PfConcept implements PfAuthorative<AcElementStatistics>, Serializable {
private static final long serialVersionUID = 621426717868738629L;
@@ -79,36 +79,36 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
@Column
@NotNull
- private ControlLoopState state;
+ private AutomationCompositionState state;
@Column
- private long clElementUptime;
+ private long acElementUptime;
/**
- * The Default Constructor creates a {@link JpaClElementStatistics} object with a null key.
+ * The Default Constructor creates a {@link JpaAcElementStatistics} object with a null key.
*/
- public JpaClElementStatistics() {
+ public JpaAcElementStatistics() {
this(new PfReferenceTimestampKey());
}
/**
- * The Key Constructor creates a {@link JpaClElementStatistics} object with the given Reference Timestamp key.
+ * The Key Constructor creates a {@link JpaAcElementStatistics} object with the given Reference Timestamp key.
*
* @param key the key
*/
- public JpaClElementStatistics(@NonNull final PfReferenceTimestampKey key) {
- this(key, new PfConceptKey(), ControlLoopState.PASSIVE, 0L);
+ public JpaAcElementStatistics(@NonNull final PfReferenceTimestampKey key) {
+ this(key, new PfConceptKey(), AutomationCompositionState.PASSIVE, 0L);
}
/**
- * The Key Constructor creates a {@link JpaClElementStatistics} object with all mandatory fields.
+ * The Key Constructor creates a {@link JpaAcElementStatistics} object with all mandatory fields.
*
* @param key the key
- * @param participantId the TOSCA definition of the control loop element
+ * @param participantId the TOSCA definition of the automation composition element
*/
- public JpaClElementStatistics(@NonNull final PfReferenceTimestampKey key,
+ public JpaAcElementStatistics(@NonNull final PfReferenceTimestampKey key,
@NonNull final PfConceptKey participantId) {
this.key = key;
this.participantId = participantId;
@@ -119,12 +119,12 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
*
* @param copyConcept the concept to copy from
*/
- public JpaClElementStatistics(@NonNull final JpaClElementStatistics copyConcept) {
+ public JpaAcElementStatistics(@NonNull final JpaAcElementStatistics copyConcept) {
super(copyConcept);
this.key = new PfReferenceTimestampKey(copyConcept.key);
this.participantId = new PfConceptKey(copyConcept.participantId);
this.state = copyConcept.state;
- this.clElementUptime = copyConcept.clElementUptime;
+ this.acElementUptime = copyConcept.acElementUptime;
}
@@ -133,36 +133,36 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
*
* @param authorativeConcept the authorative concept to copy from
*/
- public JpaClElementStatistics(@NonNull final ClElementStatistics authorativeConcept) {
+ public JpaAcElementStatistics(@NonNull final AcElementStatistics authorativeConcept) {
this.fromAuthorative(authorativeConcept);
}
@Override
- public ClElementStatistics toAuthorative() {
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setId(UUID.fromString(getKey().getReferenceKey().getLocalName()));
- clElementStatistics.setTimeStamp(key.getInstant());
- clElementStatistics.setParticipantId(new ToscaConceptIdentifier(participantId));
- clElementStatistics.setControlLoopState(state);
- clElementStatistics.setClElementUptime(clElementUptime);
-
- return clElementStatistics;
+ public AcElementStatistics toAuthorative() {
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setId(UUID.fromString(getKey().getReferenceKey().getLocalName()));
+ acElementStatistics.setTimeStamp(key.getInstant());
+ acElementStatistics.setParticipantId(new ToscaConceptIdentifier(participantId));
+ acElementStatistics.setState(state);
+ acElementStatistics.setAcElementUptime(acElementUptime);
+
+ return acElementStatistics;
}
@Override
- public void fromAuthorative(@NonNull ClElementStatistics clElementStatistics) {
+ public void fromAuthorative(@NonNull AcElementStatistics acElementStatistics) {
// @formatter:off
if (this.key == null || this.getKey().isNullKey()) {
- this.setKey(new PfReferenceTimestampKey(clElementStatistics.getParticipantId().getName(),
- clElementStatistics.getParticipantId().getVersion(), clElementStatistics.getId().toString(),
- clElementStatistics.getTimeStamp()));
+ this.setKey(new PfReferenceTimestampKey(acElementStatistics.getParticipantId().getName(),
+ acElementStatistics.getParticipantId().getVersion(), acElementStatistics.getId().toString(),
+ acElementStatistics.getTimeStamp()));
}
// @formatter:on
- this.setParticipantId(clElementStatistics.getParticipantId().asConceptKey());
- this.setState(clElementStatistics.getControlLoopState());
- this.setClElementUptime(clElementStatistics.getClElementUptime());
+ this.setParticipantId(acElementStatistics.getParticipantId().asConceptKey());
+ this.setState(acElementStatistics.getState());
+ this.setAcElementUptime(acElementStatistics.getAcElementUptime());
}
@Override
@@ -189,8 +189,8 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C
return getClass().getName().compareTo(otherConcept.getClass().getName());
}
- final JpaClElementStatistics other = (JpaClElementStatistics) otherConcept;
+ final JpaAcElementStatistics other = (JpaAcElementStatistics) otherConcept;
return new CompareToBuilder().append(this.key, other.key).append(this.state, other.state)
- .append(this.clElementUptime, other.clElementUptime).toComparison();
+ .append(this.acElementUptime, other.acElementUptime).toComparison();
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
index adc300607..e5c44d0a2 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.util.LinkedHashMap;
import java.util.List;
@@ -39,10 +39,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -55,16 +55,16 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a control loop in the database.
+ * Class to represent a automation composition in the database.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
@Entity
-@Table(name = "ControlLoop")
+@Table(name = "AutomationComposition")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLoop> {
+public class JpaAutomationComposition extends PfConcept implements PfAuthorative<AutomationComposition> {
private static final long serialVersionUID = -4725410933242154805L;
@EmbeddedId
@@ -82,11 +82,11 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
@Column
@NotNull
- private ControlLoopState state;
+ private AutomationCompositionState state;
@Column
@NotNull
- private ControlLoopOrderedState orderedState;
+ private AutomationCompositionOrderedState orderedState;
@Column
private String description;
@@ -96,34 +96,36 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@NotNull
- private Map<@NotNull UUID, @NotNull @Valid JpaControlLoopElement> elements;
+ private Map<@NotNull UUID, @NotNull @Valid JpaAutomationCompositionElement> elements;
+ // @formatter:on
/**
- * The Default Constructor creates a {@link JpaControlLoop} object with a null key.
+ * The Default Constructor creates a {@link JpaAutomationComposition} object with a null key.
*/
- public JpaControlLoop() {
+ public JpaAutomationComposition() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link JpaControlLoop} object with the given concept key.
+ * The Key Constructor creates a {@link JpaAutomationComposition} object with the given concept key.
*
* @param key the key
*/
- public JpaControlLoop(@NonNull final PfConceptKey key) {
- this(key, new PfConceptKey(), ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
+ public JpaAutomationComposition(@NonNull final PfConceptKey key) {
+ this(key, new PfConceptKey(), AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>());
}
/**
- * The Key Constructor creates a {@link JpaControlLoop} object with all mandatory fields.
+ * The Key Constructor creates a {@link JpaAutomationComposition} object with all mandatory fields.
*
* @param key the key
- * @param definition the TOSCA definition of the control loop
- * @param state the state of the control loop
- * @param elements the elements of the control looop in participants
+ * @param definition the TOSCA definition of the automation composition
+ * @param state the state of the automation composition
+ * @param elements the elements of the automation composition in participants
*/
- public JpaControlLoop(@NonNull final PfConceptKey key, @NonNull final PfConceptKey definition,
- @NonNull final ControlLoopState state, @NonNull final Map<UUID, JpaControlLoopElement> elements) {
+ public JpaAutomationComposition(@NonNull final PfConceptKey key, @NonNull final PfConceptKey definition,
+ @NonNull final AutomationCompositionState state,
+ @NonNull final Map<UUID, JpaAutomationCompositionElement> elements) {
this.key = key;
this.definition = definition;
this.state = state;
@@ -135,14 +137,15 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
*
* @param copyConcept the concept to copy from
*/
- public JpaControlLoop(@NonNull final JpaControlLoop copyConcept) {
+ public JpaAutomationComposition(@NonNull final JpaAutomationComposition copyConcept) {
super(copyConcept);
this.key = new PfConceptKey(copyConcept.key);
this.definition = new PfConceptKey(copyConcept.definition);
this.state = copyConcept.state;
this.orderedState = copyConcept.orderedState;
this.description = copyConcept.description;
- this.elements = PfUtils.mapMap(copyConcept.elements, JpaControlLoopElement::new, new LinkedHashMap<>(0));
+ this.elements =
+ PfUtils.mapMap(copyConcept.elements, JpaAutomationCompositionElement::new, new LinkedHashMap<>(0));
this.primed = copyConcept.primed;
}
@@ -151,44 +154,46 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
*
* @param authorativeConcept the authorative concept to copy from
*/
- public JpaControlLoop(@NonNull final ControlLoop authorativeConcept) {
+ public JpaAutomationComposition(@NonNull final AutomationComposition authorativeConcept) {
this.fromAuthorative(authorativeConcept);
}
@Override
- public ControlLoop toAuthorative() {
- var controlLoop = new ControlLoop();
-
- controlLoop.setName(getKey().getName());
- controlLoop.setVersion(getKey().getVersion());
- controlLoop.setDefinition(new ToscaConceptIdentifier(definition));
- controlLoop.setState(state);
- controlLoop.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
- controlLoop.setDescription(description);
- controlLoop.setElements(PfUtils.mapMap(elements, JpaControlLoopElement::toAuthorative, new LinkedHashMap<>(0)));
- controlLoop.setPrimed(primed);
-
- return controlLoop;
+ public AutomationComposition toAuthorative() {
+ var automationComposition = new AutomationComposition();
+
+ automationComposition.setName(getKey().getName());
+ automationComposition.setVersion(getKey().getVersion());
+ automationComposition.setDefinition(new ToscaConceptIdentifier(definition));
+ automationComposition.setState(state);
+ automationComposition.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
+ automationComposition.setDescription(description);
+ automationComposition.setElements(
+ PfUtils.mapMap(elements, JpaAutomationCompositionElement::toAuthorative, new LinkedHashMap<>(0)));
+ automationComposition.setPrimed(primed);
+
+ return automationComposition;
}
@Override
- public void fromAuthorative(@NonNull final ControlLoop controlLoop) {
+ public void fromAuthorative(@NonNull final AutomationComposition automationComposition) {
if (this.key == null || this.getKey().isNullKey()) {
- this.setKey(new PfConceptKey(controlLoop.getName(), controlLoop.getVersion()));
+ this.setKey(new PfConceptKey(automationComposition.getName(), automationComposition.getVersion()));
}
- this.definition = controlLoop.getDefinition().asConceptKey();
- this.state = controlLoop.getState();
- this.orderedState = controlLoop.getOrderedState();
- this.description = controlLoop.getDescription();
- this.primed = controlLoop.getPrimed();
-
- this.elements = new LinkedHashMap<>(controlLoop.getElements().size());
- for (Entry<UUID, ControlLoopElement> elementEntry : controlLoop.getElements().entrySet()) {
- var jpaControlLoopElement = new JpaControlLoopElement();
- jpaControlLoopElement.setKey(new PfReferenceKey(getKey(), elementEntry.getValue().getId().toString()));
- jpaControlLoopElement.fromAuthorative(elementEntry.getValue());
- this.elements.put(elementEntry.getKey(), jpaControlLoopElement);
+ this.definition = automationComposition.getDefinition().asConceptKey();
+ this.state = automationComposition.getState();
+ this.orderedState = automationComposition.getOrderedState();
+ this.description = automationComposition.getDescription();
+ this.primed = automationComposition.getPrimed();
+
+ this.elements = new LinkedHashMap<>(automationComposition.getElements().size());
+ for (Entry<UUID, AutomationCompositionElement> elementEntry : automationComposition.getElements().entrySet()) {
+ var jpaAutomationCompositionElement = new JpaAutomationCompositionElement();
+ jpaAutomationCompositionElement
+ .setKey(new PfReferenceKey(getKey(), elementEntry.getValue().getId().toString()));
+ jpaAutomationCompositionElement.fromAuthorative(elementEntry.getValue());
+ this.elements.put(elementEntry.getKey(), jpaAutomationCompositionElement);
}
}
@@ -198,7 +203,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
keyList.add(definition);
- for (JpaControlLoopElement element : elements.values()) {
+ for (JpaAutomationCompositionElement element : elements.values()) {
keyList.addAll(element.getKeys());
}
@@ -211,7 +216,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
definition.clean();
description = (description == null ? null : description.trim());
- for (JpaControlLoopElement element : elements.values()) {
+ for (JpaAutomationCompositionElement element : elements.values()) {
element.clean();
}
}
@@ -228,7 +233,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo
return this.getClass().getName().compareTo(otherConcept.getClass().getName());
}
- final JpaControlLoop other = (JpaControlLoop) otherConcept;
+ final JpaAutomationComposition other = (JpaAutomationComposition) otherConcept;
int result = key.compareTo(other.key);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index 22773e064..08d8ee06b 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.util.List;
import java.util.UUID;
@@ -35,9 +35,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -48,16 +48,16 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a participant control loop element in the database.
+ * Class to represent a participant automation composition element in the database.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
@Entity
-@Table(name = "ControlLoopElement")
+@Table(name = "AutomationCompositionElement")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class JpaControlLoopElement extends PfConcept implements PfAuthorative<ControlLoopElement> {
+public class JpaAutomationCompositionElement extends PfConcept implements PfAuthorative<AutomationCompositionElement> {
private static final long serialVersionUID = -1791732273187890213L;
@EmbeddedId
@@ -86,41 +86,41 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
@Column
@NotNull
- private ControlLoopState state;
+ private AutomationCompositionState state;
@Column
@NotNull
- private ControlLoopOrderedState orderedState;
+ private AutomationCompositionOrderedState orderedState;
@Column
private String description;
/**
- * The Default Constructor creates a {@link JpaControlLoopElement} object with a null key.
+ * The Default Constructor creates a {@link JpaAutomationCompositionElement} object with a null key.
*/
- public JpaControlLoopElement() {
+ public JpaAutomationCompositionElement() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link JpaControlLoopElement} object with the given concept key.
+ * The Key Constructor creates a {@link JpaAutomationCompositionElement} object with the given concept key.
*
* @param key the key
*/
- public JpaControlLoopElement(@NonNull final PfReferenceKey key) {
- this(key, new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED);
+ public JpaAutomationCompositionElement(@NonNull final PfReferenceKey key) {
+ this(key, new PfConceptKey(), new PfConceptKey(), AutomationCompositionState.UNINITIALISED);
}
/**
- * The Key Constructor creates a {@link JpaControlLoopElement} object with all mandatory fields.
+ * The Key Constructor creates a {@link JpaAutomationCompositionElement} object with all mandatory fields.
*
* @param key the key
- * @param definition the TOSCA definition of the control loop element
- * @param participantType the TOSCA definition of the participant running the control loop element
- * @param state the state of the control loop
+ * @param definition the TOSCA definition of the automation composition element
+ * @param participantType the TOSCA definition of the participant running the automation composition element
+ * @param state the state of the automation composition
*/
- public JpaControlLoopElement(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey definition,
- @NonNull final PfConceptKey participantType, @NonNull final ControlLoopState state) {
+ public JpaAutomationCompositionElement(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey definition,
+ @NonNull final PfConceptKey participantType, @NonNull final AutomationCompositionState state) {
this.key = key;
this.definition = definition;
this.participantType = participantType;
@@ -132,7 +132,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
*
* @param copyConcept the concept to copy from
*/
- public JpaControlLoopElement(@NonNull final JpaControlLoopElement copyConcept) {
+ public JpaAutomationCompositionElement(@NonNull final JpaAutomationCompositionElement copyConcept) {
super(copyConcept);
this.key = new PfReferenceKey(copyConcept.key);
this.definition = new PfConceptKey(copyConcept.definition);
@@ -148,13 +148,13 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
*
* @param authorativeConcept the authorative concept to copy from
*/
- public JpaControlLoopElement(@NonNull final ControlLoopElement authorativeConcept) {
+ public JpaAutomationCompositionElement(@NonNull final AutomationCompositionElement authorativeConcept) {
this.fromAuthorative(authorativeConcept);
}
@Override
- public ControlLoopElement toAuthorative() {
- var element = new ControlLoopElement();
+ public AutomationCompositionElement toAuthorative() {
+ var element = new AutomationCompositionElement();
element.setId(UUID.fromString(getKey().getLocalName()));
element.setDefinition(new ToscaConceptIdentifier(definition));
@@ -168,7 +168,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
}
@Override
- public void fromAuthorative(@NonNull final ControlLoopElement element) {
+ public void fromAuthorative(@NonNull final AutomationCompositionElement element) {
if (this.key == null || this.getKey().isNullKey()) {
this.setKey(new PfReferenceKey());
getKey().setLocalName(element.getId().toString());
@@ -217,7 +217,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co
return this.getClass().getName().compareTo(otherConcept.getClass().getName());
}
- final JpaControlLoopElement other = (JpaControlLoopElement) otherConcept;
+ final JpaAutomationCompositionElement other = (JpaAutomationCompositionElement) otherConcept;
int result = key.compareTo(other.key);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java
index c8c26a8de..143499c0d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipant.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.io.Serializable;
import java.util.List;
@@ -33,9 +33,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatistics.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatistics.java
index 2e5188abe..a076433bb 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatistics.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatistics.java
@@ -21,7 +21,7 @@
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import java.io.Serializable;
import java.util.List;
@@ -37,9 +37,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.builder.CompareToBuilder;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -50,7 +50,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
- * Class to represent a control loop statistics in the database.
+ * Class to represent a participant statistics in the database.
*
* @author Ramesh Murugan Iyer (ramesh.murugan.iyer@est.tech)
*/
@@ -124,7 +124,7 @@ public class JpaParticipantStatistics extends PfConcept implements PfAuthorative
* The Key Constructor creates a {@link JpaParticipantStatistics} object with all mandatory fields.
*
* @param key the key
- * @param participantId the TOSCA definition of the control loop participant
+ * @param participantId the TOSCA definition of the participant
*/
public JpaParticipantStatistics(@NonNull final PfTimestampKey key, @NonNull final PfConceptKey participantId) {
this.key = key;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProvider.java
index 3a7fa9c87..59ddcc2ea 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.time.Instant;
import java.util.List;
@@ -27,9 +27,9 @@ import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ClElementStatisticsRepository;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAcElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.AcElementStatisticsRepository;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfReferenceTimestampKey;
import org.onap.policy.models.dao.PfFilterParameters;
@@ -37,87 +37,89 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
- * This class provides the provision of information on control loop element statistics in the database to callers.
+ * This class provides the provision of information on automation composition element statistics in the database to
+ * callers.
*
* @author Ramesh Murugan Iyer (ramesh.murugan.iyer@est.tech)
*/
@Service
@Transactional
@AllArgsConstructor
-public class ClElementStatisticsProvider {
+public class AcElementStatisticsProvider {
- private ClElementStatisticsRepository clElementStatisticsRepository;
+ private AcElementStatisticsRepository acElementStatisticsRepository;
/**
- * Creates control loop element statistics.
+ * Creates automation composition element statistics.
*
- * @param clElementStatisticsList a specification of the CL element statistics to create
- * @return the clElement statistics created
+ * @param acElementStatisticsList a specification of the statistics to create
+ * @return the Element statistics created
* @throws PfModelException on initiation errors
*/
- public List<ClElementStatistics> createClElementStatistics(
- @NonNull final List<ClElementStatistics> clElementStatisticsList) throws PfModelException {
+ public List<AcElementStatistics> createAcElementStatistics(
+ @NonNull final List<AcElementStatistics> acElementStatisticsList) throws PfModelException {
try {
- var jpaClElementStatisticsList = ProviderUtils.getJpaAndValidateList(clElementStatisticsList,
- JpaClElementStatistics::new, "control loop element statistics");
+ var jpaAcElementStatisticsList = ProviderUtils.getJpaAndValidateList(acElementStatisticsList,
+ JpaAcElementStatistics::new, "automation composition element statistics");
- var jpaClElementStatisticsSaved = clElementStatisticsRepository.saveAll(jpaClElementStatisticsList);
+ var jpaAcElementStatisticsSaved = acElementStatisticsRepository.saveAll(jpaAcElementStatisticsList);
- // Return the saved control loop element statistics
- return asClElementStatisticsList(jpaClElementStatisticsSaved);
+ // Return the saved automation composition element statistics
+ return asAcElementStatisticsList(jpaAcElementStatisticsSaved);
} catch (IllegalArgumentException e) {
- throw new PfModelException(Status.BAD_REQUEST, "Error in save control loop element statistics", e);
+ throw new PfModelException(Status.BAD_REQUEST, "Error in save automation composition element statistics",
+ e);
}
}
/**
- * Convert JPA clElement statistics list to clElement statistics list.
+ * Convert JPA acElement statistics list to acElement statistics list.
*
- * @param jpaClElementStatistics the list to convert
- * @return the clElement statistics list
+ * @param jpaAcElementStatistics the list to convert
+ * @return the acElement statistics list
*/
- private List<ClElementStatistics> asClElementStatisticsList(List<JpaClElementStatistics> jpaClElementStatistics) {
- return jpaClElementStatistics.stream().map(JpaClElementStatistics::toAuthorative).collect(Collectors.toList());
+ private List<AcElementStatistics> asAcElementStatisticsList(List<JpaAcElementStatistics> jpaAcElementStatistics) {
+ return jpaAcElementStatistics.stream().map(JpaAcElementStatistics::toAuthorative).collect(Collectors.toList());
}
/**
- * Get clElement statistics.
+ * Get acElement statistics.
*
* @param name the name of the participant
* @param version version of the participant
- * @param id of the control loop element
+ * @param id of the automation composition element
* @param timestamp timestamp of the statistics
- * @return the clElement statistics found
+ * @return the acElement statistics found
*/
@Transactional(readOnly = true)
- public List<ClElementStatistics> getClElementStatistics(final String name, final String version, final String id,
- final Instant timestamp) {
+ public List<AcElementStatistics> getAcElementStatistics(final String name, final String version, final String id,
+ final Instant timestamp) {
if (name != null && version != null && timestamp != null && id != null) {
- return asClElementStatisticsList(clElementStatisticsRepository
- .findAllById(List.of(new PfReferenceTimestampKey(name, version, id, timestamp))));
+ return asAcElementStatisticsList(acElementStatisticsRepository
+ .findAllById(List.of(new PfReferenceTimestampKey(name, version, id, timestamp))));
} else if (name != null) {
- return getFilteredClElementStatistics(name, version, null, null, null, "DESC", 0);
+ return getFilteredAcElementStatistics(name, version, null, null, null, "DESC", 0);
}
- return asClElementStatisticsList(clElementStatisticsRepository.findAll());
+ return asAcElementStatisticsList(acElementStatisticsRepository.findAll());
}
/**
- * Get filtered clElement statistics.
+ * Get filtered acElement statistics.
*
- * @param name the clElement name for the statistics to get
- * @param version the clElement version for the statistics to get
+ * @param name the acElement name for the statistics to get
+ * @param version the acElement version for the statistics to get
* @param startTimeStamp startTimeStamp to filter statistics
* @param endTimeStamp endTimeStamp to filter statistics
* @param sortOrder sortOrder to query database
* @param getRecordNum Total query count from database
* @param filterMap the filters to apply to the get operation
- * @return the clElement statistics found
+ * @return the acElement statistics found
*/
@Transactional(readOnly = true)
- public List<ClElementStatistics> getFilteredClElementStatistics(final String name, final String version,
- final Instant startTimeStamp, final Instant endTimeStamp, Map<String, Object> filterMap,
- final String sortOrder, final int getRecordNum) {
+ public List<AcElementStatistics> getFilteredAcElementStatistics(final String name, final String version,
+ final Instant startTimeStamp, final Instant endTimeStamp, Map<String, Object> filterMap, final String sortOrder,
+ final int getRecordNum) {
// @formatter:off
PfFilterParameters filterParams = PfFilterParameters
@@ -131,7 +133,7 @@ public class ClElementStatisticsProvider {
.recordNum(getRecordNum)
.build();
// @formatter:on
- return asClElementStatisticsList(
- clElementStatisticsRepository.getFiltered(JpaClElementStatistics.class, filterParams));
+ return asAcElementStatisticsList(
+ acElementStatisticsRepository.getFiltered(JpaAcElementStatistics.class, filterParams));
}
}
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
new file mode 100644
index 000000000..760613026
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
@@ -0,0 +1,287 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.persistence.EntityNotFoundException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import lombok.AllArgsConstructor;
+import lombok.NonNull;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplatesRepository;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * This class provides information on automation composition concepts in the database to callers.
+ */
+@Service
+@Transactional
+@AllArgsConstructor
+public class AutomationCompositionProvider {
+
+ private final AutomationCompositionRepository automationCompositionRepository;
+ private final ToscaNodeTemplateRepository toscaNodeTemplateRepository;
+ private final ToscaNodeTemplatesRepository toscaNodeTemplatesRepository;
+
+ /**
+ * Get automation composition.
+ *
+ * @param automationCompositionId the ID of the automation composition to get
+ * @return the automation composition found
+ * @throws PfModelException on errors getting the automation composition
+ */
+ @Transactional(readOnly = true)
+ public AutomationComposition getAutomationComposition(final ToscaConceptIdentifier automationCompositionId)
+ throws PfModelException {
+ try {
+ return automationCompositionRepository.getById(automationCompositionId.asConceptKey()).toAuthorative();
+ } catch (EntityNotFoundException e) {
+ throw new PfModelException(Status.NOT_FOUND, "AutomationComposition not found", e);
+ }
+ }
+
+ /**
+ * Find automation composition by automationCompositionId.
+ *
+ * @param name the name of the automation composition to get, null to get all automation compositions
+ * @param version the version of the automation composition to get, null to get all automation compositions
+ * @return the automation composition found
+ * @throws PfModelException on errors getting the automation composition
+ */
+ @Transactional(readOnly = true)
+ public Optional<AutomationComposition> findAutomationComposition(@NonNull final String name,
+ @NonNull final String version) throws PfModelException {
+ return findAutomationComposition(new PfConceptKey(name, version));
+ }
+
+ /**
+ * Find automation composition by automationCompositionId.
+ *
+ * @param automationCompositionId the ID of the automation composition to get
+ * @return the automation composition found
+ * @throws PfModelException on errors getting the automation composition
+ */
+ @Transactional(readOnly = true)
+ public Optional<AutomationComposition> findAutomationComposition(
+ final ToscaConceptIdentifier automationCompositionId) throws PfModelException {
+ return findAutomationComposition(automationCompositionId.asConceptKey());
+ }
+
+ private Optional<AutomationComposition> findAutomationComposition(@NonNull final PfConceptKey key)
+ throws PfModelException {
+ try {
+ return automationCompositionRepository.findById(key).map(JpaAutomationComposition::toAuthorative);
+ } catch (IllegalArgumentException e) {
+ throw new PfModelException(Status.BAD_REQUEST, "Not valid parameter", e);
+ }
+ }
+
+ /**
+ * Save automation composition.
+ *
+ * @param automationComposition the automation composition to update
+ * @return the updated automation composition
+ * @throws PfModelException on errors updating the automation composition
+ */
+ public AutomationComposition saveAutomationComposition(final AutomationComposition automationComposition)
+ throws PfModelException {
+ try {
+ var result = automationCompositionRepository.save(ProviderUtils.getJpaAndValidate(automationComposition,
+ JpaAutomationComposition::new, "automation composition"));
+
+ // Return the saved participant
+ return result.toAuthorative();
+ } catch (IllegalArgumentException e) {
+ throw new PfModelException(Status.BAD_REQUEST, "Error in save automationComposition", e);
+ }
+ }
+
+ /**
+ * Get all automation compositions.
+ *
+ * @return all automation compositions found
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public List<AutomationComposition> getAutomationCompositions() throws PfModelException {
+
+ return ProviderUtils.asEntityList(automationCompositionRepository.findAll());
+ }
+
+ /**
+ * Get automation compositions.
+ *
+ * @param name the name of the automation composition to get, null to get all automation compositions
+ * @param version the version of the automation composition to get, null to get all automation compositions
+ * @return the automation compositions found
+ * @throws PfModelException on errors getting automation compositions
+ */
+ @Transactional(readOnly = true)
+ public List<AutomationComposition> getAutomationCompositions(final String name, final String version)
+ throws PfModelException {
+
+ return ProviderUtils
+ .asEntityList(automationCompositionRepository.getFiltered(JpaAutomationComposition.class, name, version));
+ }
+
+ /**
+ * Saves automation compositions.
+ *
+ * @param automationCompositions a specification of the automation compositions to create
+ * @return the automation compositions created
+ * @throws PfModelException on errors creating automation compositions
+ */
+ public List<AutomationComposition> saveAutomationCompositions(
+ @NonNull final List<AutomationComposition> automationCompositions) throws PfModelException {
+ try {
+ var result =
+ automationCompositionRepository.saveAll(ProviderUtils.getJpaAndValidateList(automationCompositions,
+ JpaAutomationComposition::new, "automation compositions"));
+
+ // Return the saved participant
+ return ProviderUtils.asEntityList(result);
+ } catch (IllegalArgumentException e) {
+ throw new PfModelException(Status.BAD_REQUEST, "Error in save AutomationCompositions", e);
+ }
+ }
+
+ /**
+ * Saves Instance Properties to the database.
+ *
+ * @param serviceTemplate the service template
+ * @return a Map of tosca node templates
+ */
+ public Map<String, ToscaNodeTemplate> saveInstanceProperties(ToscaServiceTemplate serviceTemplate) {
+ Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
+
+ var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
+ jpaToscaNodeTemplates.fromAuthorative(List.of(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()));
+
+ toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
+ serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach(savedNodeTemplates::put);
+
+ return savedNodeTemplates;
+ }
+
+ /**
+ * Delete a automation composition.
+ *
+ * @param name the name of the automation composition to delete
+ * @param version the version of the automation composition to delete
+ * @return the automation composition deleted
+ * @throws PfModelException on errors deleting the automation composition
+ */
+ public AutomationComposition deleteAutomationComposition(@NonNull final String name, @NonNull final String version)
+ throws PfModelException {
+
+ var automationCompositionKey = new PfConceptKey(name, version);
+ var jpaDeleteAutomationComposition = automationCompositionRepository.findById(automationCompositionKey);
+
+ if (jpaDeleteAutomationComposition.isEmpty()) {
+ String errorMessage = "delete of automation composition \"" + automationCompositionKey.getId()
+ + "\" failed, automation composition does not exist";
+ throw new PfModelException(Response.Status.BAD_REQUEST, errorMessage);
+ }
+
+ automationCompositionRepository.deleteById(automationCompositionKey);
+
+ return jpaDeleteAutomationComposition.get().toAuthorative();
+ }
+
+ /**
+ * Deletes Instance Properties on the database.
+ *
+ * @param filteredToscaNodeTemplateMap filtered node templates map to delete
+ * @param filteredToscaNodeTemplateList filtered node template list to delete
+ */
+ public void deleteInstanceProperties(Map<String, ToscaNodeTemplate> filteredToscaNodeTemplateMap,
+ List<ToscaNodeTemplate> filteredToscaNodeTemplateList) {
+
+ var jpaToscaNodeTemplates = new JpaToscaNodeTemplates();
+ jpaToscaNodeTemplates.fromAuthorative(List.of(filteredToscaNodeTemplateMap));
+
+ toscaNodeTemplatesRepository.save(jpaToscaNodeTemplates);
+
+ filteredToscaNodeTemplateList.forEach(template -> {
+ var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
+
+ toscaNodeTemplateRepository.delete(jpaToscaNodeTemplate);
+ });
+ }
+
+ /**
+ * Get All Node Templates.
+ *
+ * @return the list of node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaNodeTemplate> getAllNodeTemplates() {
+ return ProviderUtils.asEntityList(toscaNodeTemplateRepository.findAll());
+ }
+
+ /**
+ * Get Node Templates.
+ *
+ * @param name the name of the node template to get, null to get all node templates
+ * @param version the version of the node template to get, null to get all node templates
+ * @return the node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaNodeTemplate> getNodeTemplates(final String name, final String version) {
+ return ProviderUtils
+ .asEntityList(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version));
+ }
+
+ /**
+ * Get filtered node templates.
+ *
+ * @param filter the filter for the node templates to get
+ * @return the node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ @Transactional(readOnly = true)
+ public List<ToscaNodeTemplate> getFilteredNodeTemplates(
+ @NonNull final ToscaTypedEntityFilter<ToscaNodeTemplate> filter) {
+
+ return filter.filter(ProviderUtils.asEntityList(toscaNodeTemplateRepository
+ .getFiltered(JpaToscaNodeTemplate.class, filter.getName(), filter.getVersion())));
+ }
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
index 0c001c11c..1f9e07f8e 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.util.List;
import java.util.Optional;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantRepository;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantRepository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProvider.java
index bb4f3a5dd..a5a0ce176 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.time.Instant;
import java.util.List;
@@ -27,9 +27,9 @@ import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantStatisticsRepository;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantStatisticsRepository;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfTimestampKey;
import org.onap.policy.models.dao.PfFilterParameters;
@@ -103,7 +103,7 @@ public class ParticipantStatisticsProvider {
/**
* Creates Participant statistics.
*
- * @param participantStatisticsList a specification of the CL statistics to create
+ * @param participantStatisticsList a specification of the statistics to create
* @return the participant statistics created
* @throws PfModelException on errors creating participant statistics
*/
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ProviderUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
index 3b0400b4f..9510e5919 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ProviderUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.util.ArrayList;
import java.util.List;
@@ -80,7 +80,7 @@ public final class ProviderUtils {
}
/**
- * Convert JPA control loop list to an authorative control loop list.
+ * Convert JPA automation composition list to an authorative automation composition list.
*
* @param <T> the type of TOSCA entity
* @param <J> the type of JPA TOSCA entity
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProvider.java
index 8ff0dd102..0de5f480a 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import java.util.HashMap;
import java.util.List;
@@ -26,7 +26,7 @@ import java.util.Map;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaServiceTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaServiceTemplateRepository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -83,19 +83,19 @@ public class ServiceTemplateProvider {
}
/**
- * Get the requested control loop definitions.
+ * Get the requested automation composition definitions.
*
* @param name the name of the definition to get, null for all definitions
* @param version the version of the definition to get, null for all definitions
- * @return the control loop definitions
- * @throws PfModelException on errors getting control loop definitions
+ * @return the automation composition definitions
+ * @throws PfModelException on errors getting automation composition definitions
*/
@Transactional(readOnly = true)
public ToscaServiceTemplate getToscaServiceTemplate(String name, String version) throws PfModelException {
var serviceTemplateKey = new PfConceptKey(name, version);
var jpaServiceTemplates = serviceTemplateRepository.findById(serviceTemplateKey);
if (jpaServiceTemplates.isEmpty()) {
- throw new PfModelException(Status.NOT_FOUND, "Control Loop definitions not found");
+ throw new PfModelException(Status.NOT_FOUND, "Automation composition definitions not found");
}
return jpaServiceTemplates.get().toAuthorative();
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ClElementStatisticsRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AcElementStatisticsRepository.java
index 1e07a4fe6..13001114f 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ClElementStatisticsRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AcElementStatisticsRepository.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAcElementStatistics;
import org.onap.policy.models.base.PfReferenceTimestampKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ClElementStatisticsRepository
- extends JpaRepository<JpaClElementStatistics, PfReferenceTimestampKey>, FilterRepository {
+public interface AcElementStatisticsRepository
+ extends JpaRepository<JpaAcElementStatistics, PfReferenceTimestampKey>, FilterRepository {
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ControlLoopRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
index 1a5fd5a56..8eeb77e0d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ControlLoopRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
import org.onap.policy.models.base.PfConceptKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ControlLoopRepository extends JpaRepository<JpaControlLoop, PfConceptKey>, FilterRepository {
-
+public interface AutomationCompositionRepository
+ extends JpaRepository<JpaAutomationComposition, PfConceptKey>, FilterRepository {
}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java
index ce1f3d8c3..cdedc5eb5 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import java.util.List;
import org.onap.policy.models.base.PfConcept;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImpl.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java
index 0dc8fc373..d7e81d4da 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImpl.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import java.util.List;
import javax.persistence.EntityManager;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
index 671d23bbe..2279a75cc 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
import org.onap.policy.models.base.PfConceptKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantStatisticsRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantStatisticsRepository.java
index 6fecd6143..9cba62a70 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ParticipantStatisticsRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantStatisticsRepository.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics;
import org.onap.policy.models.base.PfTimestampKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplateRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplateRepository.java
index a8f830fed..20d0f0f7e 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplateRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplateRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplatesRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplatesRepository.java
index 7bd7d1013..f0ab40bf7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaNodeTemplatesRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaNodeTemplatesRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaServiceTemplateRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaServiceTemplateRepository.java
index a5d5fe766..b9190d0a7 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/ToscaServiceTemplateRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ToscaServiceTemplateRepository.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/rest/RestUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/rest/RestUtils.java
index 6c12c2de7..ac19d2a27 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/rest/RestUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/rest/RestUtils.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.rest;
+package org.onap.policy.clamp.models.acm.rest;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse;
+import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
import org.springframework.http.ResponseEntity;
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
new file mode 100644
index 000000000..394579aa6
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
+
+/**
+ * Utility functions used in acm-runtime and participants.
+ *
+ */
+public class AcmUtils {
+
+ private AcmUtils() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ /**
+ * Prepare participant updates map.
+ *
+ * @param acElement automation composition element
+ * @param participantUpdates list of participantUpdates
+ */
+ public static void prepareParticipantUpdate(AutomationCompositionElement acElement,
+ List<ParticipantUpdates> participantUpdates) {
+ if (participantUpdates.isEmpty()) {
+ participantUpdates.add(getAutomationCompositionElementList(acElement));
+ return;
+ }
+
+ var participantExists = false;
+ for (ParticipantUpdates participantUpdate : participantUpdates) {
+ if (participantUpdate.getParticipantId().equals(acElement.getParticipantId())) {
+ participantUpdate.setAutomationCompositionElementList(List.of(acElement));
+ participantExists = true;
+ }
+ }
+ if (!participantExists) {
+ participantUpdates.add(getAutomationCompositionElementList(acElement));
+ }
+ }
+
+ private static ParticipantUpdates getAutomationCompositionElementList(AutomationCompositionElement acElement) {
+ var participantUpdate = new ParticipantUpdates();
+ participantUpdate.setParticipantId(acElement.getParticipantId());
+ participantUpdate.setAutomationCompositionElementList(List.of(acElement));
+ return participantUpdate;
+ }
+
+ /**
+ * Set the Policy information in the service template for the automation composition element.
+ *
+ * @param acElement automation composition element
+ * @param toscaServiceTemplate ToscaServiceTemplate
+ */
+ public static void setServiceTemplatePolicyInfo(AutomationCompositionElement acElement,
+ ToscaServiceTemplate toscaServiceTemplate) {
+ // Pass respective PolicyTypes or Policies as part of toscaServiceTemplateFragment
+ if (toscaServiceTemplate.getPolicyTypes() == null
+ && toscaServiceTemplate.getToscaTopologyTemplate().getPolicies() == null) {
+ return;
+ }
+ ToscaServiceTemplate toscaServiceTemplateFragment = new ToscaServiceTemplate();
+ toscaServiceTemplateFragment.setPolicyTypes(toscaServiceTemplate.getPolicyTypes());
+ ToscaTopologyTemplate toscaTopologyTemplate = new ToscaTopologyTemplate();
+ toscaTopologyTemplate.setPolicies(toscaServiceTemplate.getToscaTopologyTemplate().getPolicies());
+ toscaServiceTemplateFragment.setToscaTopologyTemplate(toscaTopologyTemplate);
+ toscaServiceTemplateFragment.setDataTypes(toscaServiceTemplate.getDataTypes());
+ acElement.setToscaServiceTemplateFragment(toscaServiceTemplateFragment);
+ }
+
+ /**
+ * Prepare ParticipantDefinitionUpdate to set in the message.
+ *
+ * @param acParticipantType participant type
+ * @param entryKey key for the entry
+ * @param entryValue value relates to toscaNodeTemplate
+ * @param participantDefinitionUpdates list of participantDefinitionUpdates
+ * @param commonPropertiesMap common properties map
+ */
+ public static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier acParticipantType, String entryKey,
+ ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates,
+ Map<String, ToscaNodeType> commonPropertiesMap) {
+
+ var acDefinition = new AutomationCompositionElementDefinition();
+ acDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion()));
+ acDefinition.setAutomationCompositionElementToscaNodeTemplate(entryValue);
+ if (commonPropertiesMap != null) {
+ ToscaNodeType nodeType = commonPropertiesMap.get(entryValue.getType());
+ if (nodeType != null) {
+ acDefinition.setCommonPropertiesMap(nodeType.getProperties());
+ }
+ }
+
+ List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList = new ArrayList<>();
+
+ if (participantDefinitionUpdates.isEmpty()) {
+ participantDefinitionUpdates.add(
+ getParticipantDefinition(acDefinition, acParticipantType, automationCompositionElementDefinitionList));
+ } else {
+ var participantExists = false;
+ for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
+ if (participantDefinitionUpdate.getParticipantType().equals(acParticipantType)) {
+ participantDefinitionUpdate.getAutomationCompositionElementDefinitionList().add(acDefinition);
+ participantExists = true;
+ }
+ }
+ if (!participantExists) {
+ participantDefinitionUpdates.add(getParticipantDefinition(acDefinition, acParticipantType,
+ automationCompositionElementDefinitionList));
+ }
+ }
+ }
+
+ private static ParticipantDefinition getParticipantDefinition(AutomationCompositionElementDefinition acDefinition,
+ ToscaConceptIdentifier acParticipantType,
+ List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList) {
+ var participantDefinition = new ParticipantDefinition();
+ participantDefinition.setParticipantType(acParticipantType);
+ automationCompositionElementDefinitionList.add(acDefinition);
+ participantDefinition.setAutomationCompositionElementDefinitionList(automationCompositionElementDefinitionList);
+ return participantDefinition;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java
deleted file mode 100644
index ed579febb..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ControlLoopElementTest {
- @Test
- void testControlLoopElement() {
- var cle0 = new ControlLoopElement();
- var cle1 = new ControlLoopElement(cle0);
- assertEquals(cle0, cle1);
-
- cle1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- cle1.setDescription("Description");
- cle1.setId(UUID.randomUUID());
- cle1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cle1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
- cle1.setState(ControlLoopState.UNINITIALISED);
-
- var cle2 = new ControlLoopElement(cle1);
- assertEquals(cle1, cle2);
- }
-
- @Test
- void testControlLoopState() {
- var cle0 = new ControlLoopElement();
-
- assertTrue(
- cle0.getOrderedState()
- .equalsControlLoopState(ControlLoopState.UNINITIALISED));
-
- assertTrue(
- cle0.getOrderedState().asState()
- .equalsControlLoopOrderedState(ControlLoopOrderedState.UNINITIALISED));
- }
-
- @Test
- void testControlLoopElementLombok() {
- assertNotNull(new ControlLoopElement());
- var cle0 = new ControlLoopElement();
-
- assertThat(cle0.toString()).contains("ControlLoopElement(");
- assertThat(cle0.hashCode()).isNotZero();
- assertEquals(true, cle0.equals(cle0));
- assertEquals(false, cle0.equals(null));
-
- var cle1 = new ControlLoopElement();
-
- cle1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- cle1.setDescription("Description");
- cle1.setId(UUID.randomUUID());
- cle1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cle1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
- cle1.setState(ControlLoopState.UNINITIALISED);
-
- assertThat(cle1.toString()).contains("ControlLoopElement(");
- assertEquals(false, cle1.hashCode() == 0);
- assertEquals(false, cle1.equals(cle0));
- assertEquals(false, cle1.equals(null));
-
- assertNotEquals(cle1, cle0);
-
- var cle2 = new ControlLoopElement();
-
- // @formatter:off
- assertThatThrownBy(() -> cle2.setDefinition(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setId(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setOrderedState(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cle2.setState(null)). isInstanceOf(NullPointerException.class);
- // @formatter:on
-
- assertNotEquals(cle2, cle0);
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java
deleted file mode 100644
index d9c518b53..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.time.Instant;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ControlLoopTest {
- @Test
- void testControlLoop() {
- var cl0 = new ControlLoop();
- cl0.setDefinition(new ToscaConceptIdentifier("dfName", "1.2.3"));
- assertEquals("dfName", cl0.getType());
- assertEquals("1.2.3", cl0.getTypeVersion());
-
- var cl1 = new ControlLoop(cl0);
- assertEquals(cl0, cl1);
-
- assertEquals(0, cl0.compareTo(cl1));
- }
-
- @Test
- void testControlLoopLombok() {
- assertNotNull(new ControlLoop());
- var cl0 = new ControlLoop();
- cl0.setElements(new LinkedHashMap<>());
-
- assertThat(cl0.toString()).contains("ControlLoop(");
- assertThat(cl0.hashCode()).isNotZero();
- assertEquals(true, cl0.equals(cl0));
- assertEquals(false, cl0.equals(null));
-
- var cl1 = new ControlLoop();
-
- cl1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- cl1.setDescription("Description");
- cl1.setElements(new LinkedHashMap<>());
- cl1.setName("Name");
- cl1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cl1.setState(ControlLoopState.UNINITIALISED);
- cl1.setVersion("0.0.1");
-
- assertThat(cl1.toString()).contains("ControlLoop(");
- assertEquals(false, cl1.hashCode() == 0);
- assertEquals(false, cl1.equals(cl0));
- assertEquals(false, cl1.equals(null));
-
- assertNotEquals(cl1, cl0);
-
- var cl2 = new ControlLoop();
- cl2.setElements(new LinkedHashMap<>());
-
- // @formatter:off
- assertThatThrownBy(() -> cl2.setDefinition(null)). isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cl2.setOrderedState(null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cl2.setState(null)). isInstanceOf(NullPointerException.class);
- // @formatter:on
-
- assertEquals(cl2, cl0);
-
- cl1.setCascadedOrderedState(ControlLoopOrderedState.PASSIVE);
- assertEquals(ControlLoopOrderedState.PASSIVE, cl1.getOrderedState());
-
- cl1.getElements().put(UUID.randomUUID(), new ControlLoopElement());
- cl1.setCascadedOrderedState(ControlLoopOrderedState.RUNNING);
- assertEquals(ControlLoopOrderedState.RUNNING, cl1.getOrderedState());
- assertEquals(ControlLoopOrderedState.RUNNING, cl1.getElements().values().iterator().next().getOrderedState());
-
- assertNull(cl0.getElements().get(UUID.randomUUID()));
- assertNull(cl1.getElements().get(UUID.randomUUID()));
-
- assertEquals(PfKey.NULL_KEY_NAME, cl0.getDefinition().getName());
-
- }
-
- @Test
- void testControlLoopElementStatisticsList() {
- var cl = new ControlLoop();
- List<ClElementStatistics> emptylist = cl.getControlLoopElementStatisticsList(cl);
- assertEquals(List.of(), emptylist);
-
- var cl1 = getControlLoopTest();
- List<ClElementStatistics> list = cl1.getControlLoopElementStatisticsList(cl1);
- assertNotNull(list);
- assertEquals(2, list.size());
- assertEquals(ControlLoopState.UNINITIALISED, list.get(0).getControlLoopState());
- }
-
- private ControlLoop getControlLoopTest() {
- var cl = new ControlLoop();
- cl.setDefinition(new ToscaConceptIdentifier("defName", "1.2.3"));
- cl.setDescription("Description");
- cl.setElements(new LinkedHashMap<>());
- cl.setName("Name");
- cl.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cl.setState(ControlLoopState.UNINITIALISED);
- cl.setVersion("0.0.1");
-
- var uuid = UUID.randomUUID();
- var id = new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipant", "1.0.1");
- var clElement = getControlLoopElementTest(uuid, id);
-
- var uuid2 = UUID.randomUUID();
- var id2 = new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipantIntermediary", "0.0.1");
- var clElement2 = getControlLoopElementTest(uuid2, id2);
-
- cl.getElements().put(uuid, clElement);
- cl.getElements().put(uuid2, clElement2);
- return cl;
- }
-
- private ControlLoopElement getControlLoopElementTest(UUID uuid, ToscaConceptIdentifier id) {
- var clElement = new ControlLoopElement();
- clElement.setId(uuid);
- clElement.setParticipantId(id);
- clElement.setDefinition(id);
- clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
-
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(id);
- clElementStatistics.setControlLoopState(ControlLoopState.UNINITIALISED);
- clElementStatistics.setTimeStamp(Instant.now());
-
- clElement.setClElementStatistics(clElementStatistics);
-
- return clElement;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java
deleted file mode 100644
index 0e6fb8383..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.time.Instant;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfReferenceTimestampKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the {@link JpaClElementStatistics} class.
- */
-class JpaClElementStatisticsTest {
-
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
-
- @Test
- void testJpaClElementStatisticsConstructor() {
- assertThatThrownBy(() -> {
- new JpaClElementStatistics((JpaClElementStatistics) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics((PfReferenceTimestampKey) null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics(null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics(null, new PfConceptKey());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaClElementStatistics(new PfReferenceTimestampKey(), null);
- }).hasMessageMatching("participantId is marked .*ull but is null");
-
- assertNotNull(new JpaClElementStatistics());
- assertNotNull(new JpaClElementStatistics((new PfReferenceTimestampKey())));
- assertNotNull(new JpaClElementStatistics(new PfReferenceTimestampKey(), new PfConceptKey()));
- }
-
- @Test
- void testJpaClElementStatistics() {
- JpaClElementStatistics testJpaClElementStatistics = createJpaClElementStatisticsInstance();
-
- ClElementStatistics cles = createClElementStatisticsInstance();
- assertEquals(cles, testJpaClElementStatistics.toAuthorative());
-
- assertThatThrownBy(() -> {
- testJpaClElementStatistics.fromAuthorative(null);
- }).hasMessageMatching("clElementStatistics is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaClElementStatistics((JpaClElementStatistics) null))
- .isInstanceOf(NullPointerException.class);
-
- JpaClElementStatistics testJpaClElementStatisticsFa = new JpaClElementStatistics();
- testJpaClElementStatisticsFa.setKey(null);
- testJpaClElementStatisticsFa.fromAuthorative(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
- testJpaClElementStatisticsFa.setKey(PfReferenceTimestampKey.getNullKey());
- testJpaClElementStatisticsFa.fromAuthorative(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
- testJpaClElementStatisticsFa.setKey(new PfReferenceTimestampKey("elementName", "0.0.1",
- "a95757ba-b34a-4049-a2a8-46773abcbe5e", Instant.ofEpochSecond(123456L)));
- testJpaClElementStatisticsFa.fromAuthorative(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
-
- testJpaClElementStatisticsFa = new JpaClElementStatistics(cles);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatisticsFa);
-
- assertEquals(1, testJpaClElementStatistics.getKeys().size());
-
- assertEquals("elementName", testJpaClElementStatistics.getKey().getReferenceKey().getParentKeyName());
-
- testJpaClElementStatistics.clean();
- assertEquals("elementName", testJpaClElementStatistics.getKey().getReferenceKey().getParentKeyName());
-
- JpaClElementStatistics testJpaClElementStatistics2 = new JpaClElementStatistics(testJpaClElementStatistics);
- assertEquals(testJpaClElementStatistics, testJpaClElementStatistics2);
- }
-
- @Test
- void testJpaClElementStatisticsValidation() {
- JpaClElementStatistics testJpaClElementStatistics = createJpaClElementStatisticsInstance();
-
- assertThatThrownBy(() -> {
- testJpaClElementStatistics.validate(null);
- }).hasMessageMatching("fieldName is marked .*ull but is null");
-
- assertTrue(testJpaClElementStatistics.validate("").isValid());
- }
-
- @Test
- void testJpaClElementStatisticsCompareTo() {
- JpaClElementStatistics testJpaClElementStatistics = createJpaClElementStatisticsInstance();
-
- JpaClElementStatistics otherJpaClElementStatistics = new JpaClElementStatistics(testJpaClElementStatistics);
- assertEquals(0, testJpaClElementStatistics.compareTo(otherJpaClElementStatistics));
- assertEquals(-1, testJpaClElementStatistics.compareTo(null));
- assertEquals(0, testJpaClElementStatistics.compareTo(testJpaClElementStatistics));
- assertNotEquals(0, testJpaClElementStatistics.compareTo(new DummyJpaClElementStatisticsChild()));
-
- testJpaClElementStatistics.setState(ControlLoopState.PASSIVE);
- assertNotEquals(0, testJpaClElementStatistics.compareTo(otherJpaClElementStatistics));
- testJpaClElementStatistics.setState(ControlLoopState.UNINITIALISED);
- assertEquals(0, testJpaClElementStatistics.compareTo(otherJpaClElementStatistics));
-
- assertEquals(testJpaClElementStatistics, new JpaClElementStatistics(testJpaClElementStatistics));
- }
-
- @Test
- void testJpaClElementStatisticsLombok() {
- assertNotNull(new Participant());
- JpaClElementStatistics cles0 = new JpaClElementStatistics();
-
- assertThat(cles0.toString()).contains("JpaClElementStatistics(");
- assertThat(cles0.hashCode()).isNotZero();
- assertEquals(true, cles0.equals(cles0));
- assertEquals(false, cles0.equals(null));
-
-
- JpaClElementStatistics cles11 = new JpaClElementStatistics();
-
- cles11.setState(ControlLoopState.UNINITIALISED);
-
- assertThat(cles11.toString()).contains("JpaClElementStatistics(");
- assertEquals(false, cles11.hashCode() == 0);
- assertEquals(false, cles11.equals(cles0));
- assertEquals(false, cles11.equals(null));
-
- assertNotEquals(cles11, cles0);
-
- JpaClElementStatistics cles2 = new JpaClElementStatistics();
- assertEquals(cles2, cles0);
- }
-
- private JpaClElementStatistics createJpaClElementStatisticsInstance() {
- ClElementStatistics testCles = createClElementStatisticsInstance();
- JpaClElementStatistics testJpaClElementStatistics = new JpaClElementStatistics();
- testJpaClElementStatistics.setKey(null);
- testJpaClElementStatistics.fromAuthorative(testCles);
- testJpaClElementStatistics.setKey(PfReferenceTimestampKey.getNullKey());
- testJpaClElementStatistics.fromAuthorative(testCles);
-
- return testJpaClElementStatistics;
- }
-
- private ClElementStatistics createClElementStatisticsInstance() {
- ClElementStatistics clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(new ToscaConceptIdentifier("elementName", "0.0.1"));
- clElementStatistics.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- clElementStatistics.setTimeStamp(Instant.ofEpochSecond(123456L));
- clElementStatistics.setControlLoopState(ControlLoopState.UNINITIALISED);
-
- return clElementStatistics;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java
deleted file mode 100644
index 63c5ea3ab..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the {@link JpaControlLoopElement} class.
- */
-class JpaControlLoopElementTest {
-
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
-
- @Test
- void testJpaControlLoopElementConstructor() {
- assertThatThrownBy(() -> {
- new JpaControlLoopElement((JpaControlLoopElement) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement((PfReferenceKey) null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, null, new PfConceptKey("participant", "0.0.1"),
- ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"),
- ControlLoopState.UNINITIALISED);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, null, null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"),
- ControlLoopState.UNINITIALISED);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), null, null);
- }).hasMessageMatching("participantType is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), null, ControlLoopState.UNINITIALISED);
- }).hasMessageMatching("participantType is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(),
- new PfConceptKey("participant", "0.0.1"), null);
- }).hasMessageMatching("state is marked .*ull but is null");
-
- assertNotNull(new JpaControlLoopElement());
- assertNotNull(new JpaControlLoopElement((new PfReferenceKey())));
- assertNotNull(new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(),
- new PfConceptKey("participant", "0.0.1"), ControlLoopState.UNINITIALISED));
- }
-
- @Test
- void testJpaControlLoopElement() {
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- ControlLoopElement cle = createControlLoopElementInstance();
- assertEquals(cle, testJpaControlLoopElement.toAuthorative());
-
- assertThatThrownBy(() -> {
- testJpaControlLoopElement.fromAuthorative(null);
- }).hasMessageMatching("element is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaControlLoopElement((JpaControlLoopElement) null))
- .isInstanceOf(NullPointerException.class);
-
- JpaControlLoopElement testJpaControlLoopElementFa = new JpaControlLoopElement();
- testJpaControlLoopElementFa.setKey(null);
- testJpaControlLoopElementFa.fromAuthorative(cle);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElementFa);
- testJpaControlLoopElementFa.setKey(PfReferenceKey.getNullKey());
- testJpaControlLoopElementFa.fromAuthorative(cle);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElementFa);
- testJpaControlLoopElementFa.setKey(new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION,
- "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- testJpaControlLoopElementFa.fromAuthorative(cle);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElementFa);
-
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", testJpaControlLoopElement.getKey().getLocalName());
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
- new JpaControlLoopElement(createControlLoopElementInstance()).getKey().getLocalName());
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
- ((PfReferenceKey) new JpaControlLoopElement(createControlLoopElementInstance()).getKeys().get(0))
- .getLocalName());
-
- testJpaControlLoopElement.clean();
- assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", testJpaControlLoopElement.getKey().getLocalName());
-
- testJpaControlLoopElement.setDescription(" A Message ");
- testJpaControlLoopElement.clean();
- assertEquals("A Message", testJpaControlLoopElement.getDescription());
-
- JpaControlLoopElement testJpaControlLoopElement2 = new JpaControlLoopElement(testJpaControlLoopElement);
- assertEquals(testJpaControlLoopElement, testJpaControlLoopElement2);
- }
-
- @Test
- void testJpaControlLoopElementOrderedState() throws CoderException {
- ControlLoopElement testControlLoopElement = createControlLoopElementInstance();
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- testJpaControlLoopElement.setOrderedState(null);
- assertEquals(testControlLoopElement, testJpaControlLoopElement.toAuthorative());
- testJpaControlLoopElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
-
- ControlLoopElement noOrderedStateCle = new StandardCoder().decode(
- new File("src/test/resources/json/ControlLoopElementNoOrderedState.json"), ControlLoopElement.class);
-
- JpaControlLoopElement noOrderedStateJpaCle = new JpaControlLoopElement(noOrderedStateCle);
- assertNull(noOrderedStateJpaCle.getOrderedState());
- noOrderedStateCle.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- noOrderedStateJpaCle = new JpaControlLoopElement(noOrderedStateCle);
- assertEquals(testJpaControlLoopElement, noOrderedStateJpaCle);
- }
-
- @Test
- void testJpaControlLoopElementValidation() {
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- assertThatThrownBy(() -> {
- testJpaControlLoopElement.validate(null);
- }).hasMessageMatching("fieldName is marked .*ull but is null");
-
- assertTrue(testJpaControlLoopElement.validate("").isValid());
- }
-
- @Test
- void testJpaControlLoopElementCompareTo() {
- JpaControlLoopElement testJpaControlLoopElement = createJpaControlLoopElementInstance();
-
- JpaControlLoopElement otherJpaControlLoopElement = new JpaControlLoopElement(testJpaControlLoopElement);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- assertEquals(-1, testJpaControlLoopElement.compareTo(null));
- assertEquals(0, testJpaControlLoopElement.compareTo(testJpaControlLoopElement));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(new DummyJpaControlLoopElementChild()));
-
- testJpaControlLoopElement
- .setKey(new PfReferenceKey("BadValue", "0.0.1", "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setKey(new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION,
- "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setDefinition(new PfConceptKey("cleDef", "0.0.1"));
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setDescription("Description");
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setDescription(null);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setState(ControlLoopState.PASSIVE);
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setState(ControlLoopState.UNINITIALISED);
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- testJpaControlLoopElement.setParticipantType(new PfConceptKey("dummy", "0.0.1"));
- assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
- testJpaControlLoopElement.setParticipantType(new PfConceptKey("participantType", "0.0.1"));
- assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement));
-
- assertEquals(testJpaControlLoopElement, new JpaControlLoopElement(testJpaControlLoopElement));
- }
-
- @Test
- void testJpaControlLoopElementLombok() {
- assertNotNull(new Participant());
- JpaControlLoopElement cle0 = new JpaControlLoopElement();
-
- assertThat(cle0.toString()).contains("JpaControlLoopElement(");
- assertThat(cle0.hashCode()).isNotZero();
- assertEquals(true, cle0.equals(cle0));
- assertEquals(false, cle0.equals(null));
-
-
- JpaControlLoopElement cle1 = new JpaControlLoopElement();
-
- cle1.setDefinition(new PfConceptKey("defName", "0.0.1"));
- cle1.setDescription("Description");
- cle1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- cle1.setState(ControlLoopState.UNINITIALISED);
- cle1.setParticipantId(new PfConceptKey("participant", "0.0.1"));
-
- assertThat(cle1.toString()).contains("ControlLoopElement(");
- assertEquals(false, cle1.hashCode() == 0);
- assertEquals(false, cle1.equals(cle0));
- assertEquals(false, cle1.equals(null));
-
- assertNotEquals(cle1, cle0);
-
- JpaControlLoopElement cle2 = new JpaControlLoopElement();
- assertEquals(cle2, cle0);
- }
-
- private JpaControlLoopElement createJpaControlLoopElementInstance() {
- ControlLoopElement testCle = createControlLoopElementInstance();
- JpaControlLoopElement testJpaControlLoopElement = new JpaControlLoopElement();
- testJpaControlLoopElement.setKey(null);
- testJpaControlLoopElement.fromAuthorative(testCle);
- testJpaControlLoopElement.setKey(PfReferenceKey.getNullKey());
- testJpaControlLoopElement.fromAuthorative(testCle);
-
- return testJpaControlLoopElement;
- }
-
- private ControlLoopElement createControlLoopElementInstance() {
- ControlLoopElement controlLoopElement = new ControlLoopElement();
- controlLoopElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
- controlLoopElement.setDefinition(new ToscaConceptIdentifier("cleDef", "0.0.1"));
- controlLoopElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1"));
-
- return controlLoopElement;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
deleted file mode 100644
index d705c49b5..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.LinkedHashMap;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-/**
- * Test the {@link JpaControlLoopTest} class.
- */
-class JpaControlLoopTest {
-
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
-
- @Test
- void testJpaControlLoopConstructor() {
- assertThatThrownBy(() -> {
- new JpaControlLoop((JpaControlLoop) null);
- }).hasMessageMatching("copyConcept is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop((PfConceptKey) null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, null, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, null, ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), null, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), null, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(null, new PfConceptKey(), ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
- }).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, null, null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, null, new LinkedHashMap<>());
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), null, ControlLoopState.UNINITIALISED, new LinkedHashMap<>());
- }).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), null, null);
- }).hasMessageMatching("state is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), null, new LinkedHashMap<>());
- }).hasMessageMatching("state is marked .*ull but is null");
-
- assertThatThrownBy(() -> {
- new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED, null);
- }).hasMessageMatching("elements is marked .*ull but is null");
-
- assertNotNull(new JpaControlLoop());
- assertNotNull(new JpaControlLoop((new PfConceptKey())));
- assertNotNull(new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED,
- new LinkedHashMap<>()));
- }
-
- @Test
- void testJpaControlLoop() {
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- ControlLoop participant = createControlLoopInstance();
- assertEquals(participant, testJpaControlLoop.toAuthorative());
-
- assertThatThrownBy(() -> {
- testJpaControlLoop.fromAuthorative(null);
- }).hasMessageMatching("controlLoop is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaControlLoop((JpaControlLoop) null)).isInstanceOf(NullPointerException.class);
-
- JpaControlLoop testJpaControlLoopFa = new JpaControlLoop();
- testJpaControlLoopFa.setKey(null);
- testJpaControlLoopFa.fromAuthorative(participant);
- assertEquals(testJpaControlLoop, testJpaControlLoopFa);
- testJpaControlLoopFa.setKey(PfConceptKey.getNullKey());
- testJpaControlLoopFa.fromAuthorative(participant);
- assertEquals(testJpaControlLoop, testJpaControlLoopFa);
- testJpaControlLoopFa.setKey(new PfConceptKey("control-loop", "0.0.1"));
- testJpaControlLoopFa.fromAuthorative(participant);
- assertEquals(testJpaControlLoop, testJpaControlLoopFa);
-
- assertEquals("control-loop", testJpaControlLoop.getKey().getName());
- assertEquals("control-loop", new JpaControlLoop(createControlLoopInstance()).getKey().getName());
- assertEquals("control-loop",
- ((PfConceptKey) new JpaControlLoop(createControlLoopInstance()).getKeys().get(0)).getName());
-
- testJpaControlLoop.clean();
- assertEquals("control-loop", testJpaControlLoop.getKey().getName());
-
- testJpaControlLoop.setDescription(" A Message ");
- testJpaControlLoop.clean();
- assertEquals("A Message", testJpaControlLoop.getDescription());
-
- JpaControlLoop testJpaControlLoop2 = new JpaControlLoop(testJpaControlLoop);
- assertEquals(testJpaControlLoop, testJpaControlLoop2);
- }
-
- @Test
- void testJpaControlLoopElementOrderedState() throws CoderException {
- ControlLoop testControlLoop = createControlLoopInstance();
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- testJpaControlLoop.setOrderedState(null);
- assertEquals(testControlLoop, testJpaControlLoop.toAuthorative());
- testJpaControlLoop.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
-
- ControlLoop noOrderedStateCl = new StandardCoder()
- .decode(new File("src/test/resources/json/ControlLoopNoOrderedState.json"), ControlLoop.class);
-
- JpaControlLoop noOrderedStateJpaCl = new JpaControlLoop(noOrderedStateCl);
- assertNull(noOrderedStateJpaCl.getOrderedState());
- noOrderedStateCl.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- noOrderedStateJpaCl = new JpaControlLoop(noOrderedStateCl);
- assertEquals(testJpaControlLoop, noOrderedStateJpaCl);
-
- ControlLoops controlLoopsWithElements = new StandardCoder()
- .decode(new File("src/test/resources/providers/TestControlLoops.json"), ControlLoops.class);
-
- JpaControlLoop jpaControlLoopWithElements =
- new JpaControlLoop(controlLoopsWithElements.getControlLoopList().get(0));
- assertEquals(4, jpaControlLoopWithElements.getElements().size());
- assertEquals(18, jpaControlLoopWithElements.getKeys().size());
- assertThatCode(() -> jpaControlLoopWithElements.clean()).doesNotThrowAnyException();
-
- assertEquals(controlLoopsWithElements.getControlLoopList().get(0), jpaControlLoopWithElements.toAuthorative());
- }
-
- @Test
- void testJpaControlLoopValidation() {
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- assertThatThrownBy(() -> {
- testJpaControlLoop.validate(null);
- }).hasMessageMatching("fieldName is marked .*ull but is null");
-
- assertTrue(testJpaControlLoop.validate("").isValid());
- }
-
- @Test
- void testJpaControlLoopCompareTo() {
- JpaControlLoop testJpaControlLoop = createJpaControlLoopInstance();
-
- JpaControlLoop otherJpaControlLoop = new JpaControlLoop(testJpaControlLoop);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- assertEquals(-1, testJpaControlLoop.compareTo(null));
- assertEquals(0, testJpaControlLoop.compareTo(testJpaControlLoop));
- assertNotEquals(0, testJpaControlLoop.compareTo(new DummyJpaControlLoopChild()));
-
- testJpaControlLoop.setKey(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setKey(new PfConceptKey("control-loop", "0.0.1"));
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setDefinition(new PfConceptKey("controlLoopDefinitionName", "0.0.1"));
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setState(ControlLoopState.PASSIVE);
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setState(ControlLoopState.UNINITIALISED);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setOrderedState(ControlLoopOrderedState.PASSIVE);
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setDescription("A description");
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setDescription(null);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- testJpaControlLoop.setPrimed(true);
- assertNotEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
- testJpaControlLoop.setPrimed(false);
- assertEquals(0, testJpaControlLoop.compareTo(otherJpaControlLoop));
-
- assertEquals(testJpaControlLoop, new JpaControlLoop(testJpaControlLoop));
- }
-
- @Test
- void testJpaControlLoopLombok() {
- assertNotNull(new ControlLoop());
- JpaControlLoop cl0 = new JpaControlLoop();
-
- assertThat(cl0.toString()).contains("JpaControlLoop(");
- assertThat(cl0.hashCode()).isNotZero();
- assertEquals(true, cl0.equals(cl0));
- assertEquals(false, cl0.equals(null));
-
-
- JpaControlLoop cl1 = new JpaControlLoop();
-
- cl1.setDefinition(new PfConceptKey("defName", "0.0.1"));
- cl1.setDescription("Description");
- cl1.setElements(new LinkedHashMap<>());
- cl1.setKey(new PfConceptKey("participant", "0.0.1"));
- cl1.setState(ControlLoopState.UNINITIALISED);
-
- assertThat(cl1.toString()).contains("ControlLoop(");
- assertEquals(false, cl1.hashCode() == 0);
- assertEquals(false, cl1.equals(cl0));
- assertEquals(false, cl1.equals(null));
-
- assertNotEquals(cl1, cl0);
-
- JpaControlLoop cl2 = new JpaControlLoop();
- assertEquals(cl2, cl0);
- }
-
- private JpaControlLoop createJpaControlLoopInstance() {
- ControlLoop testControlLoop = createControlLoopInstance();
- JpaControlLoop testJpaControlLoop = new JpaControlLoop();
- testJpaControlLoop.setKey(null);
- testJpaControlLoop.fromAuthorative(testControlLoop);
- testJpaControlLoop.setKey(PfConceptKey.getNullKey());
- testJpaControlLoop.fromAuthorative(testControlLoop);
-
- return testJpaControlLoop;
- }
-
- private ControlLoop createControlLoopInstance() {
- ControlLoop testControlLoop = new ControlLoop();
- testControlLoop.setName("control-loop");
- testControlLoop.setVersion("0.0.1");
- testControlLoop.setDefinition(new ToscaConceptIdentifier("controlLoopDefinitionName", "0.0.1"));
- testControlLoop.setElements(new LinkedHashMap<>());
-
- return testControlLoop;
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java
deleted file mode 100644
index 82ce8d789..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyList;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.time.Instant;
-import java.util.List;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ClElementStatisticsRepository;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-
-class ClElementStatisticsProviderTest {
- private static final String LIST_IS_NULL = ".*. is marked .*ull but is null";
- private static final Coder CODER = new StandardCoder();
- private static final String CL_ELEMENT_STATS_JSON = "src/test/resources/providers/TestClElementStatistics.json";
-
- private ClElementStatisticsProvider clElementStatisticsProvider;
- private ClElementStatisticsList inputClElementStats;
- private String originalJson = ResourceUtils.getResourceAsString(CL_ELEMENT_STATS_JSON);
-
- /**
- * Set up test ClElement statistics provider.
- *
- * @throws Exception on errors
- */
- @BeforeEach
- void beforeSetupDao() throws Exception {
-
- inputClElementStats = CODER.decode(originalJson, ClElementStatisticsList.class);
- var clElementStatisticsRepository = mock(ClElementStatisticsRepository.class);
-
- var jpaClElementStatisticsList =
- ProviderUtils.getJpaAndValidateList(inputClElementStats.getClElementStatistics(),
- JpaClElementStatistics::new, "control loop element statistics");
-
- for (var clElementStat : jpaClElementStatisticsList) {
- when(clElementStatisticsRepository.getById(eq(clElementStat.getKey()))).thenReturn(clElementStat);
- when(clElementStatisticsRepository.findAllById(eq(List.of(clElementStat.getKey()))))
- .thenReturn(List.of(clElementStat));
- }
-
- when(clElementStatisticsRepository.saveAll(anyList())).thenReturn(jpaClElementStatisticsList);
-
- when(clElementStatisticsRepository.getFiltered(eq(JpaClElementStatistics.class), any()))
- .thenReturn(List.of(jpaClElementStatisticsList.get(0)));
-
- clElementStatisticsProvider = new ClElementStatisticsProvider(clElementStatisticsRepository);
- }
-
- @Test
- void testClElementStatisticsCreate() throws Exception {
- assertThatThrownBy(() -> {
- clElementStatisticsProvider.createClElementStatistics(null);
- }).hasMessageMatching(LIST_IS_NULL);
-
- ClElementStatisticsList createdClElementStats = new ClElementStatisticsList();
- createdClElementStats.setClElementStatistics(
- clElementStatisticsProvider.createClElementStatistics(inputClElementStats.getClElementStatistics()));
-
- assertEquals(inputClElementStats.toString().replaceAll("\\s+", ""),
- createdClElementStats.toString().replaceAll("\\s+", ""));
- }
-
- @Test
- void testGetClElementStatistics() throws Exception {
-
- List<ClElementStatistics> getResponse;
-
- // Return empty list when no data present in db
- getResponse = clElementStatisticsProvider.getClElementStatistics(null, null, null, null);
- assertThat(getResponse).isEmpty();
-
- clElementStatisticsProvider.createClElementStatistics(inputClElementStats.getClElementStatistics());
- ToscaConceptIdentifier identifier = inputClElementStats.getClElementStatistics().get(0).getParticipantId();
- Instant instant = inputClElementStats.getClElementStatistics().get(0).getTimeStamp();
- String id = inputClElementStats.getClElementStatistics().get(0).getId().toString();
- assertEquals(1, clElementStatisticsProvider
- .getClElementStatistics(identifier.getName(), identifier.getVersion(), id, instant).size());
-
- assertEquals(1, clElementStatisticsProvider
- .getFilteredClElementStatistics("name2", "1.0.1", null, null, null, "DESC", 1).size());
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java
deleted file mode 100644
index 4b8617b3d..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.List;
-import java.util.Optional;
-import javax.persistence.EntityNotFoundException;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ControlLoopRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplateRepository;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaNodeTemplatesRepository;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.coder.YamlJsonTranslator;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
-import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
-
-class ControlLoopProviderTest {
-
- private static final String LIST_IS_NULL = "controlLoops is marked .*ull but is null";
- private static final String OBJECT_IS_NULL = "controlLoop is marked non-null but is null";
-
- private static final String ID_NAME = "PMSHInstance1";
- private static final String ID_VERSION = "1.0.1";
- private static final String ID_NAME_NOT_EXTST = "not_exist";
- private static final String ID_NAME_NOT_VALID = "not_valid";
-
- private static final Coder CODER = new StandardCoder();
- private static final String CONTROL_LOOP_JSON = "src/test/resources/providers/TestControlLoops.json";
- private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml";
-
- private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
-
- private ControlLoops inputControlLoops;
- private List<JpaControlLoop> inputControlLoopsJpa;
- private String originalJson = ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON);
-
- @BeforeEach
- void beforeSetupDao() throws Exception {
- inputControlLoops = CODER.decode(originalJson, ControlLoops.class);
- inputControlLoopsJpa = ProviderUtils.getJpaAndValidateList(inputControlLoops.getControlLoopList(),
- JpaControlLoop::new, "control loops");
- }
-
- @Test
- void testControlLoopsSave() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoops(null);
- }).hasMessageMatching(LIST_IS_NULL);
-
- when(controlLoopRepository.saveAll(inputControlLoopsJpa)).thenReturn(inputControlLoopsJpa);
-
- var createdControlLoops = new ControlLoops();
- createdControlLoops
- .setControlLoopList(controlLoopProvider.saveControlLoops(inputControlLoops.getControlLoopList()));
-
- assertEquals(inputControlLoops, createdControlLoops);
-
- when(controlLoopRepository.saveAll(any())).thenThrow(IllegalArgumentException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoops(inputControlLoops.getControlLoopList());
- }).hasMessageMatching("Error in save ControlLoops");
- }
-
- @Test
- void testControlLoopSave() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoop(null);
- }).hasMessageMatching(OBJECT_IS_NULL);
-
- when(controlLoopRepository.save(inputControlLoopsJpa.get(0))).thenReturn(inputControlLoopsJpa.get(0));
-
- var createdControlLoop = controlLoopProvider.saveControlLoop(inputControlLoops.getControlLoopList().get(0));
-
- assertEquals(inputControlLoops.getControlLoopList().get(0), createdControlLoop);
-
- when(controlLoopRepository.save(any())).thenThrow(IllegalArgumentException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.saveControlLoop(inputControlLoops.getControlLoopList().get(0));
- }).hasMessageMatching("Error in save controlLoop");
- }
-
- @Test
- void testGetControlLoops() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- // Return empty list when no data present in db
- List<ControlLoop> getResponse = controlLoopProvider.getControlLoops();
- assertThat(getResponse).isEmpty();
-
- controlLoopProvider.saveControlLoops(inputControlLoops.getControlLoopList());
-
- var controlLoop0 = inputControlLoops.getControlLoopList().get(1);
- var name = controlLoop0.getName();
- var version = controlLoop0.getVersion();
- var controlLoop1 = inputControlLoops.getControlLoopList().get(1);
-
- when(controlLoopRepository.getFiltered(eq(JpaControlLoop.class), any(), any()))
- .thenReturn(List.of(new JpaControlLoop(controlLoop0), new JpaControlLoop(controlLoop1)));
- when(controlLoopRepository.findById(controlLoop0.getKey().asIdentifier().asConceptKey()))
- .thenReturn(Optional.of(new JpaControlLoop(controlLoop0)));
- when(controlLoopRepository.getById(controlLoop0.getKey().asIdentifier().asConceptKey()))
- .thenReturn(new JpaControlLoop(controlLoop0));
- when(controlLoopRepository.getFiltered(JpaControlLoop.class, name, version))
- .thenReturn(List.of(new JpaControlLoop(controlLoop0)));
- when(controlLoopRepository.findById(controlLoop1.getKey().asIdentifier().asConceptKey()))
- .thenReturn(Optional.of(new JpaControlLoop(controlLoop1)));
-
- assertEquals(1, controlLoopProvider.getControlLoops(name, version).size());
-
- var cl = controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)).get();
- assertEquals(inputControlLoops.getControlLoopList().get(1), cl);
-
- cl = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(ID_NAME, ID_VERSION));
- assertEquals(inputControlLoops.getControlLoopList().get(1), cl);
-
- when(controlLoopRepository.getById(any())).thenThrow(EntityNotFoundException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION));
- }).hasMessageMatching("ControlLoop not found");
-
- cl = controlLoopProvider.findControlLoop(ID_NAME, ID_VERSION).get();
- assertEquals(inputControlLoops.getControlLoopList().get(1), cl);
-
- assertThat(controlLoopProvider.findControlLoop(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION)))
- .isEmpty();
-
- when(controlLoopRepository.findById(any())).thenThrow(IllegalArgumentException.class);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.findControlLoop(ID_NAME_NOT_VALID, ID_VERSION);
- }).hasMessageMatching("Not valid parameter");
- }
-
- @Test
- void testDeleteControlLoop() throws Exception {
- var controlLoopRepository = mock(ControlLoopRepository.class);
- var controlLoopProvider = new ControlLoopProvider(controlLoopRepository,
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
-
- assertThatThrownBy(() -> {
- controlLoopProvider.deleteControlLoop(ID_NAME_NOT_EXTST, ID_VERSION);
- }).hasMessageMatching(".*.failed, control loop does not exist");
-
- var controlLoop = inputControlLoops.getControlLoopList().get(0);
- var name = controlLoop.getName();
- var version = controlLoop.getVersion();
-
- when(controlLoopRepository.findById(new PfConceptKey(name, version)))
- .thenReturn(Optional.of(inputControlLoopsJpa.get(0)));
-
- ControlLoop deletedCl = controlLoopProvider.deleteControlLoop(name, version);
- assertEquals(controlLoop, deletedCl);
- }
-
- @Test
- void testDeleteAllInstanceProperties() throws Exception {
- var controlLoopProvider = new ControlLoopProvider(mock(ControlLoopRepository.class),
- mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
- var toscaServiceTemplate = testControlLoopRead();
- controlLoopProvider.deleteInstanceProperties(controlLoopProvider.saveInstanceProperties(toscaServiceTemplate),
- controlLoopProvider.getAllNodeTemplates());
- assertThat(controlLoopProvider.getControlLoops()).isEmpty();
- }
-
- @Test
- void testSaveAndDeleteInstanceProperties() throws Exception {
- var toscaNodeTemplatesRepository = mock(ToscaNodeTemplatesRepository.class);
- var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
- var controlLoopProvider = new ControlLoopProvider(mock(ControlLoopRepository.class),
- toscaNodeTemplateRepository, toscaNodeTemplatesRepository);
- var toscaServiceTest = testControlLoopRead();
-
- controlLoopProvider.saveInstanceProperties(toscaServiceTest);
- verify(toscaNodeTemplatesRepository).save(any());
-
- var name = "org.onap.policy.controlloop.PolicyControlLoopParticipant";
- var version = "2.3.1";
- var elem = toscaServiceTest.getToscaTopologyTemplate().getNodeTemplates().get(name);
- when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version))
- .thenReturn(List.of(new JpaToscaNodeTemplate(elem)));
-
- var filtered = controlLoopProvider.getNodeTemplates(name, version);
- verify(toscaNodeTemplateRepository).getFiltered(JpaToscaNodeTemplate.class, name, version);
-
- controlLoopProvider.deleteInstanceProperties(controlLoopProvider.saveInstanceProperties(toscaServiceTest),
- filtered);
-
- verify(toscaNodeTemplateRepository).delete(any());
- }
-
- @Test
- void testGetNodeTemplates() throws Exception {
- var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
- var controlLoopProvider = new ControlLoopProvider(mock(ControlLoopRepository.class),
- toscaNodeTemplateRepository, mock(ToscaNodeTemplatesRepository.class));
-
- var toscaNodeTemplate0 = new JpaToscaNodeTemplate(new PfConceptKey(ID_NAME, ID_VERSION));
- var toscaNodeTemplate1 = new JpaToscaNodeTemplate(new PfConceptKey("PMSHInstance2", ID_VERSION));
-
- when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, null, null))
- .thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
- when(toscaNodeTemplateRepository.findAll()).thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
- when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, ID_NAME, ID_VERSION))
- .thenReturn(List.of(toscaNodeTemplate0));
-
- // Getting all nodes
- var listNodes = controlLoopProvider.getAllNodeTemplates();
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(2);
-
- listNodes = controlLoopProvider.getNodeTemplates(ID_NAME, ID_VERSION);
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(1);
-
- listNodes = controlLoopProvider.getAllNodeTemplates();
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(2);
-
- var nodeTemplateFilter =
- ToscaTypedEntityFilter.<ToscaNodeTemplate>builder().name(ID_NAME).version(ID_VERSION).build();
-
- listNodes = controlLoopProvider.getFilteredNodeTemplates(nodeTemplateFilter);
- assertNotNull(listNodes);
- assertThat(listNodes).hasSize(1);
-
- assertThatThrownBy(() -> {
- controlLoopProvider.getFilteredNodeTemplates(null);
- }).hasMessageMatching("filter is marked non-null but is null");
- }
-
- private static ToscaServiceTemplate testControlLoopRead() {
- return testControlLoopYamlSerialization(TOSCA_TEMPLATE_YAML);
- }
-
- private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) {
- var controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- return yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java
deleted file mode 100644
index bf2e2fa0a..000000000
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopNotificationTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.jupiter.api.Test;
-
-class ControlLoopNotificationTest {
-
- @Test
- void testControlLoopNotification() {
- ControlLoopNotification cln0 = new ControlLoopNotification();
-
- List<ControlLoopStatus> addedList = new ArrayList<>();
- addedList.add(new ControlLoopStatus());
-
- List<ControlLoopStatus> deletedList = new ArrayList<>();
- deletedList.add(new ControlLoopStatus());
-
- assertEquals(true, cln0.isEmpty());
-
- cln0.setAdded(addedList);
- assertEquals(false, cln0.isEmpty());
- cln0.setAdded(null);
- assertEquals(true, cln0.isEmpty());
-
- cln0.setDeleted(deletedList);
- assertEquals(false, cln0.isEmpty());
- cln0.setDeleted(null);
- assertEquals(true, cln0.isEmpty());
-
- cln0.setAdded(addedList);
- cln0.setDeleted(deletedList);
- assertEquals(false, cln0.isEmpty());
- cln0.setAdded(null);
- cln0.setDeleted(null);
- assertEquals(true, cln0.isEmpty());
- }
-
- @Test
- void testControlLoopNotificationLombok() {
- assertNotNull(new ControlLoopNotification());
- assertNotNull(new ControlLoopNotification(new ArrayList<>(), new ArrayList<>()));
-
- ControlLoopNotification cln0 = new ControlLoopNotification();
-
- assertThat(cln0.toString()).contains("ControlLoopNotification(");
- assertEquals(false, cln0.hashCode() == 0);
- assertEquals(true, cln0.equals(cln0));
- assertEquals(false, cln0.equals(null));
-
-
- ControlLoopNotification cln1 = new ControlLoopNotification();
-
- assertThat(cln1.toString()).contains("ControlLoopNotification(");
- assertEquals(false, cln1.hashCode() == 0);
- assertEquals(true, cln1.equals(cln0));
- assertEquals(false, cln1.equals(null));
- }
-}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsTest.java
index 3bb0050c8..ee79b27b7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatisticsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AcElementStatisticsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -31,37 +31,37 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ClElementStatisticsTest {
+class AcElementStatisticsTest {
@Test
- void testClElementStatisticsLombok() {
- assertNotNull(new ClElementStatistics());
- ClElementStatistics cles0 = new ClElementStatistics();
+ void testAcElementStatisticsLombok() {
+ assertNotNull(new AcElementStatistics());
+ AcElementStatistics aces0 = new AcElementStatistics();
- assertThat(cles0.toString()).contains("ClElementStatistics(");
- assertThat(cles0.hashCode()).isNotZero();
- assertEquals(true, cles0.equals(cles0));
- assertEquals(false, cles0.equals(null));
+ assertThat(aces0.toString()).contains("AcElementStatistics(");
+ assertThat(aces0.hashCode()).isNotZero();
+ assertEquals(true, aces0.equals(aces0));
+ assertEquals(false, aces0.equals(null));
- ClElementStatistics cles1 = new ClElementStatistics();
- cles1.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
- cles1.setTimeStamp(Instant.now());
+ AcElementStatistics aces1 = new AcElementStatistics();
+ aces1.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
+ aces1.setTimeStamp(Instant.now());
- assertThat(cles1.toString()).contains("ClElementStatistics(");
- assertEquals(false, cles1.hashCode() == 0);
- assertEquals(false, cles1.equals(cles0));
- assertEquals(false, cles1.equals(null));
+ assertThat(aces1.toString()).contains("AcElementStatistics(");
+ assertEquals(false, aces1.hashCode() == 0);
+ assertEquals(false, aces1.equals(aces0));
+ assertEquals(false, aces1.equals(null));
- assertNotEquals(cles1, cles0);
+ assertNotEquals(aces1, aces0);
- ClElementStatistics cles2 = new ClElementStatistics();
- cles2.setId(UUID.randomUUID());
+ AcElementStatistics aces2 = new AcElementStatistics();
+ aces2.setId(UUID.randomUUID());
// @formatter:off
- assertThatThrownBy(() -> cles2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> cles2.setTimeStamp(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> aces2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> aces2.setTimeStamp(null)).isInstanceOf(NullPointerException.class);
// @formatter:on
- assertNotEquals(cles2, cles0);
+ assertNotEquals(aces2, aces0);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopConceptPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionConceptPojosTest.java
index daade4d52..1d45e5919 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopConceptPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionConceptPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
@@ -37,12 +37,12 @@ import org.onap.policy.common.utils.test.ToStringTester;
/**
* Class to perform unit tests of all pojos.
*/
-class ControlLoopConceptPojosTest {
+class AutomationCompositionConceptPojosTest {
@Test
void testPojos() {
List<PojoClass> pojoClasses =
- PojoClassFactory.getPojoClasses(ControlLoopConceptPojosTest.class.getPackageName());
+ PojoClassFactory.getPojoClasses(AutomationCompositionConceptPojosTest.class.getPackageName());
// @formatter:off
final Validator validator = ValidatorBuilder
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java
new file mode 100644
index 000000000..4e739db52
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class AutomationCompositionElementTest {
+ @Test
+ void testAutomationCompositionElement() {
+ var ace0 = new AutomationCompositionElement();
+ var ace1 = new AutomationCompositionElement(ace0);
+ assertEquals(ace0, ace1);
+
+ ace1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
+ ace1.setDescription("Description");
+ ace1.setId(UUID.randomUUID());
+ ace1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ace1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
+ ace1.setState(AutomationCompositionState.UNINITIALISED);
+
+ var ace2 = new AutomationCompositionElement(ace1);
+ assertEquals(ace1, ace2);
+ }
+
+ @Test
+ void testAutomationCompositionState() {
+ var ace0 = new AutomationCompositionElement();
+
+ assertTrue(
+ ace0.getOrderedState()
+ .equalsAutomationCompositionState(AutomationCompositionState.UNINITIALISED));
+
+ assertTrue(
+ ace0.getOrderedState().asState()
+ .equalsAutomationCompositionOrderedState(AutomationCompositionOrderedState.UNINITIALISED));
+ }
+
+ @Test
+ void testAutomationCompositionElementLombok() {
+ assertNotNull(new AutomationCompositionElement());
+ var ace0 = new AutomationCompositionElement();
+
+ assertThat(ace0.toString()).contains("AutomationCompositionElement(");
+ assertThat(ace0.hashCode()).isNotZero();
+ assertEquals(true, ace0.equals(ace0));
+ assertEquals(false, ace0.equals(null));
+
+ var ace1 = new AutomationCompositionElement();
+
+ ace1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
+ ace1.setDescription("Description");
+ ace1.setId(UUID.randomUUID());
+ ace1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ace1.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3"));
+ ace1.setState(AutomationCompositionState.UNINITIALISED);
+
+ assertThat(ace1.toString()).contains("AutomationCompositionElement(");
+ assertEquals(false, ace1.hashCode() == 0);
+ assertEquals(false, ace1.equals(ace0));
+ assertEquals(false, ace1.equals(null));
+
+ assertNotEquals(ace1, ace0);
+
+ var ace2 = new AutomationCompositionElement();
+
+ // @formatter:off
+ assertThatThrownBy(() -> ace2.setDefinition(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setId(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setOrderedState(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setParticipantId(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ace2.setState(null)). isInstanceOf(NullPointerException.class);
+ // @formatter:on
+
+ assertNotEquals(ace2, ace0);
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java
new file mode 100644
index 000000000..ad8a1bbea
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionTest.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.models.base.PfKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class AutomationCompositionTest {
+ @Test
+ void testAutomationComposition() {
+ var ac0 = new AutomationComposition();
+ ac0.setDefinition(new ToscaConceptIdentifier("dfName", "1.2.3"));
+ assertEquals("dfName", ac0.getType());
+ assertEquals("1.2.3", ac0.getTypeVersion());
+
+ var ac1 = new AutomationComposition(ac0);
+ assertEquals(ac0, ac1);
+
+ assertEquals(0, ac0.compareTo(ac1));
+ }
+
+ @Test
+ void testAutomationCompositionLombok() {
+ assertNotNull(new AutomationComposition());
+ var ac0 = new AutomationComposition();
+ ac0.setElements(new LinkedHashMap<>());
+
+ assertThat(ac0.toString()).contains("AutomationComposition(");
+ assertThat(ac0.hashCode()).isNotZero();
+ assertEquals(true, ac0.equals(ac0));
+ assertEquals(false, ac0.equals(null));
+
+ var ac1 = new AutomationComposition();
+
+ ac1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
+ ac1.setDescription("Description");
+ ac1.setElements(new LinkedHashMap<>());
+ ac1.setName("Name");
+ ac1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ac1.setState(AutomationCompositionState.UNINITIALISED);
+ ac1.setVersion("0.0.1");
+
+ assertThat(ac1.toString()).contains("AutomationComposition(");
+ assertEquals(false, ac1.hashCode() == 0);
+ assertEquals(false, ac1.equals(ac0));
+ assertEquals(false, ac1.equals(null));
+
+ assertNotEquals(ac1, ac0);
+
+ var ac2 = new AutomationComposition();
+ ac2.setElements(new LinkedHashMap<>());
+
+ // @formatter:off
+ assertThatThrownBy(() -> ac2.setDefinition(null)). isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ac2.setOrderedState(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> ac2.setState(null)). isInstanceOf(NullPointerException.class);
+ // @formatter:on
+
+ assertEquals(ac2, ac0);
+
+ ac1.setCascadedOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ assertEquals(AutomationCompositionOrderedState.PASSIVE, ac1.getOrderedState());
+
+ ac1.getElements().put(UUID.randomUUID(), new AutomationCompositionElement());
+ ac1.setCascadedOrderedState(AutomationCompositionOrderedState.RUNNING);
+ assertEquals(AutomationCompositionOrderedState.RUNNING, ac1.getOrderedState());
+ assertEquals(AutomationCompositionOrderedState.RUNNING,
+ ac1.getElements().values().iterator().next().getOrderedState());
+
+ assertNull(ac0.getElements().get(UUID.randomUUID()));
+ assertNull(ac1.getElements().get(UUID.randomUUID()));
+
+ assertEquals(PfKey.NULL_KEY_NAME, ac0.getDefinition().getName());
+
+ }
+
+ @Test
+ void testAutomationCompositionElementStatisticsList() {
+ var ac = new AutomationComposition();
+ List<AcElementStatistics> emptylist = ac.getAutomationCompositionElementStatisticsList(ac);
+ assertEquals(List.of(), emptylist);
+
+ var ac1 = getAutomationCompositionTest();
+ List<AcElementStatistics> list = ac1.getAutomationCompositionElementStatisticsList(ac1);
+ assertNotNull(list);
+ assertEquals(2, list.size());
+ assertEquals(AutomationCompositionState.UNINITIALISED, list.get(0).getState());
+ }
+
+ private AutomationComposition getAutomationCompositionTest() {
+ var ac = new AutomationComposition();
+ ac.setDefinition(new ToscaConceptIdentifier("defName", "1.2.3"));
+ ac.setDescription("Description");
+ ac.setElements(new LinkedHashMap<>());
+ ac.setName("Name");
+ ac.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ac.setState(AutomationCompositionState.UNINITIALISED);
+ ac.setVersion("0.0.1");
+
+ var uuid = UUID.randomUUID();
+ var id = new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "1.0.1");
+ var acElement = getAutomationCompositionElementTest(uuid, id);
+
+ var uuid2 = UUID.randomUUID();
+ var id2 = new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipantIntermediary",
+ "0.0.1");
+ var acElement2 = getAutomationCompositionElementTest(uuid2, id2);
+
+ ac.getElements().put(uuid, acElement);
+ ac.getElements().put(uuid2, acElement2);
+ return ac;
+ }
+
+ private AutomationCompositionElement getAutomationCompositionElementTest(UUID uuid, ToscaConceptIdentifier id) {
+ var acElement = new AutomationCompositionElement();
+ acElement.setId(uuid);
+ acElement.setParticipantId(id);
+ acElement.setDefinition(id);
+ acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+
+ var acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(id);
+ acElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+ acElementStatistics.setTimeStamp(Instant.now());
+
+ acElement.setAcElementStatistics(acElementStatistics);
+
+ return acElement;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsTest.java
index f55f624bf..de9b884d3 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantStatisticsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantStatisticsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
index 5c429b96c..164c7c1a0 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
index 3fb8b6d7f..5252221a8 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ParticipantUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+package org.onap.policy.clamp.models.acm.concepts;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,12 +36,14 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
class ParticipantUtilsTest {
private static final Coder CODER = new StandardCoder();
- private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml";
- private static final String CONTROL_LOOP_JSON = "src/test/resources/providers/TestControlLoops.json";
- private static final String CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.ControlLoopElement";
- private static final String POLICY_CONTROL_LOOP_ELEMENT =
- "org.onap.policy.clamp.controlloop.PolicyControlLoopElement";
- private static final String PARTICIPANT_CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.Participant";
+ private static final String TOSCA_TEMPLATE_YAML = "examples/acm/PMSubscriptionHandling.yaml";
+ private static final String AUTOMATION_COMPOSITION_JSON =
+ "src/test/resources/providers/TestAutomationCompositions.json";
+ private static final String AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.policy.clamp.acm.AutomationCompositionElement";
+ private static final String POLICY_AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.policy.clamp.acm.PolicyAutomationCompositionElement";
+ private static final String PARTICIPANT_AUTOMATION_COMPOSITION_ELEMENT = "org.onap.policy.clamp.acm.Participant";
private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder();
@Test
@@ -60,25 +62,30 @@ class ParticipantUtilsTest {
@Test
void testGetFirstStartPhase() throws CoderException {
- var serviceTemplate = YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML),
- ToscaServiceTemplate.class);
- var controlLoops = CODER.decode(ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON), ControlLoops.class);
- var result = ParticipantUtils.getFirstStartPhase(controlLoops.getControlLoopList().get(0), serviceTemplate);
+ var serviceTemplate =
+ YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML), ToscaServiceTemplate.class);
+ var automationCompositions =
+ CODER.decode(ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON), AutomationCompositions.class);
+ var result = ParticipantUtils.getFirstStartPhase(automationCompositions.getAutomationCompositionList().get(0),
+ serviceTemplate);
assertThat(result).isZero();
}
@Test
- void testCheckIfNodeTemplateIsControlLoopElement() throws CoderException {
- var serviceTemplate = YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML),
- ToscaServiceTemplate.class);
+ void testCheckIfNodeTemplateIsAutomationCompositionElement() throws CoderException {
+ var serviceTemplate =
+ YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(TOSCA_TEMPLATE_YAML), ToscaServiceTemplate.class);
var nodeTemplate = new ToscaNodeTemplate();
- nodeTemplate.setType(CONTROL_LOOP_ELEMENT);
- assertThat(ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(nodeTemplate, serviceTemplate)).isTrue();
+ nodeTemplate.setType(AUTOMATION_COMPOSITION_ELEMENT);
+ assertThat(ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplate, serviceTemplate))
+ .isTrue();
- nodeTemplate.setType(POLICY_CONTROL_LOOP_ELEMENT);
- assertThat(ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(nodeTemplate, serviceTemplate)).isTrue();
+ nodeTemplate.setType(POLICY_AUTOMATION_COMPOSITION_ELEMENT);
+ assertThat(ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplate, serviceTemplate))
+ .isTrue();
- nodeTemplate.setType(PARTICIPANT_CONTROL_LOOP_ELEMENT);
- assertThat(ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(nodeTemplate, serviceTemplate)).isFalse();
+ nodeTemplate.setType(PARTICIPANT_AUTOMATION_COMPOSITION_ELEMENT);
+ assertThat(ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplate, serviceTemplate))
+ .isFalse();
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java
new file mode 100644
index 000000000..49bb719ac
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionNotificationTest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.jupiter.api.Test;
+
+class AutomationCompositionNotificationTest {
+
+ @Test
+ void testAutomationCompositionNotification() {
+ AutomationCompositionNotification acn0 = new AutomationCompositionNotification();
+
+ List<AutomationCompositionStatus> addedList = new ArrayList<>();
+ addedList.add(new AutomationCompositionStatus());
+
+ List<AutomationCompositionStatus> deletedList = new ArrayList<>();
+ deletedList.add(new AutomationCompositionStatus());
+
+ assertEquals(true, acn0.isEmpty());
+
+ acn0.setAdded(addedList);
+ assertEquals(false, acn0.isEmpty());
+ acn0.setAdded(null);
+ assertEquals(true, acn0.isEmpty());
+
+ acn0.setDeleted(deletedList);
+ assertEquals(false, acn0.isEmpty());
+ acn0.setDeleted(null);
+ assertEquals(true, acn0.isEmpty());
+
+ acn0.setAdded(addedList);
+ acn0.setDeleted(deletedList);
+ assertEquals(false, acn0.isEmpty());
+ acn0.setAdded(null);
+ acn0.setDeleted(null);
+ assertEquals(true, acn0.isEmpty());
+ }
+
+ @Test
+ void testAutomationCompositionNotificationLombok() {
+ assertNotNull(new AutomationCompositionNotification());
+ assertNotNull(new AutomationCompositionNotification(new ArrayList<>(), new ArrayList<>()));
+
+ AutomationCompositionNotification acn0 = new AutomationCompositionNotification();
+
+ assertThat(acn0.toString()).contains("AutomationCompositionNotification(");
+ assertEquals(false, acn0.hashCode() == 0);
+ assertEquals(true, acn0.equals(acn0));
+ assertEquals(false, acn0.equals(null));
+
+
+ AutomationCompositionNotification acn1 = new AutomationCompositionNotification();
+
+ assertThat(acn1.toString()).contains("AutomationCompositionNotification(");
+ assertEquals(false, acn1.hashCode() == 0);
+ assertEquals(true, acn1.equals(acn0));
+ assertEquals(false, acn1.equals(null));
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatusTest.java
index cca5e8554..028566888 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/ControlLoopStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/AutomationCompositionStatusTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -28,21 +28,21 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ControlLoopStatusTest {
+class AutomationCompositionStatusTest {
@Test
- void testControlLoopStatusLombok() {
- assertNotNull(new ControlLoopStatus());
- assertNotNull(new ControlLoopStatus(UUID.randomUUID(), new ToscaConceptIdentifier()));
+ void testAutomationCompositionStatusLombok() {
+ assertNotNull(new AutomationCompositionStatus());
+ assertNotNull(new AutomationCompositionStatus(UUID.randomUUID(), new ToscaConceptIdentifier()));
- ControlLoopStatus cln0 = new ControlLoopStatus();
+ AutomationCompositionStatus acn0 = new AutomationCompositionStatus();
- assertThat(cln0.toString()).contains("ControlLoopStatus(");
- assertEquals(false, cln0.hashCode() == 0);
- assertEquals(true, cln0.equals(cln0));
- assertEquals(false, cln0.equals(null));
+ assertThat(acn0.toString()).contains("AutomationCompositionStatus(");
+ assertEquals(false, acn0.hashCode() == 0);
+ assertEquals(true, acn0.equals(acn0));
+ assertEquals(false, acn0.equals(null));
- ControlLoopStatus cln1 = new ControlLoopStatus();
- assertEquals(true, cln1.equals(cln0));
+ AutomationCompositionStatus acn1 = new AutomationCompositionStatus();
+ assertEquals(true, acn1.equals(acn0));
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/NotificationPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/NotificationPojosTest.java
index 1a89a1b3e..494252acc 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/notification/NotificationPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/notification/NotificationPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.notification;
+package org.onap.policy.clamp.models.acm.messages.dmaap.notification;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
index f312c4863..383a55115 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
@@ -18,51 +18,51 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ControlLoopAckTest {
+class AutomationCompositionAckTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ControlLoopAck((ControlLoopAck) null))
+ assertThatThrownBy(() -> new AutomationCompositionAck((AutomationCompositionAck) null))
.isInstanceOf(NullPointerException.class);
- final var orig = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ final var orig = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionAck(orig).toString()));
// verify with all values
var id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
- var clElementResult = new ControlLoopElementAck(ControlLoopState.UNINITIALISED,
- true, "ControlLoopElement result");
- final var controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult);
- orig.setControlLoopResultMap(controlLoopResultMap);
+ var acElementResult = new AutomationCompositionElementAck(AutomationCompositionState.UNINITIALISED,
+ true, "AutomationCompositionElement result");
+ final var automationCompositionResultMap = Map.of(UUID.randomUUID(), acElementResult);
+ orig.setAutomationCompositionResultMap(automationCompositionResultMap);
orig.setResponseTo(UUID.randomUUID());
orig.setResult(true);
- orig.setMessage("Successfully processed ControlLoopUpdate message");
+ orig.setMessage("Successfully processed AutomationCompositionUpdate message");
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionAck(orig).toString()));
- assertSerializable(orig, ControlLoopAck.class);
+ assertSerializable(orig, AutomationCompositionAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
index 1bf155e9a..6c48afad2 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
@@ -18,48 +18,48 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test the copy constructor and other methods.
*/
-class ControlLoopStateChangeTest {
+class AutomationCompositionStateChangeTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ControlLoopStateChange(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new AutomationCompositionStateChange(null)).isInstanceOf(NullPointerException.class);
- ControlLoopStateChange orig = new ControlLoopStateChange();
+ AutomationCompositionStateChange orig = new AutomationCompositionStateChange();
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopStateChange(orig).toString()));
+ removeVariableFields(new AutomationCompositionStateChange(orig).toString()));
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setMessageId(UUID.randomUUID());
- orig.setOrderedState(ControlLoopOrderedState.RUNNING);
- orig.setCurrentState(ControlLoopState.PASSIVE);
+ orig.setOrderedState(AutomationCompositionOrderedState.RUNNING);
+ orig.setCurrentState(AutomationCompositionState.PASSIVE);
orig.setTimestamp(Instant.ofEpochMilli(3000));
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ControlLoopStateChange(orig).toString()));
+ removeVariableFields(new AutomationCompositionStateChange(orig).toString()));
- assertSerializable(orig, ControlLoopStateChange.class);
+ assertSerializable(orig, AutomationCompositionStateChange.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
index ce56d582a..809256d40 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
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.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
@@ -41,42 +41,42 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
* Test the copy constructor.
*/
-class ControlLoopUpdateTest {
+class AutomationCompositionUpdateTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ControlLoopUpdate(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new AutomationCompositionUpdate(null)).isInstanceOf(NullPointerException.class);
- ControlLoopUpdate orig = new ControlLoopUpdate();
+ AutomationCompositionUpdate orig = new AutomationCompositionUpdate();
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(null);
orig.setMessageId(UUID.randomUUID());
orig.setTimestamp(Instant.ofEpochMilli(3000));
- ControlLoopElement clElement = new ControlLoopElement();
- clElement.setId(UUID.randomUUID());
- clElement.setDefinition(id);
- clElement.setDescription("Description");
- clElement.setOrderedState(ControlLoopOrderedState.PASSIVE);
- clElement.setState(ControlLoopState.PASSIVE);
- clElement.setParticipantId(id);
- clElement.setParticipantType(id);
+ AutomationCompositionElement acElement = new AutomationCompositionElement();
+ acElement.setId(UUID.randomUUID());
+ acElement.setDefinition(id);
+ acElement.setDescription("Description");
+ acElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ acElement.setState(AutomationCompositionState.PASSIVE);
+ acElement.setParticipantId(id);
+ acElement.setParticipantType(id);
ToscaProperty property = new ToscaProperty();
property.setName("test");
property.setType("testType");
Map<String, ToscaProperty> propertiesMap = Map.of("Prop1", property);
- clElement.setPropertiesMap(propertiesMap);
+ acElement.setPropertiesMap(propertiesMap);
ParticipantUpdates participantUpdates = new ParticipantUpdates();
participantUpdates.setParticipantId(id);
- participantUpdates.setControlLoopElementList(List.of(clElement));
+ participantUpdates.setAutomationCompositionElementList(List.of(acElement));
orig.setParticipantUpdatesList(List.of(participantUpdates));
- ControlLoopUpdate other = new ControlLoopUpdate(orig);
+ AutomationCompositionUpdate other = new AutomationCompositionUpdate(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
- assertSerializable(orig, ControlLoopUpdate.class);
+ assertSerializable(orig, AutomationCompositionUpdate.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java
index df82ab071..89a34e33d 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java
index f1ae5f709..59a6d826b 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
index 89546890a..873257696 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
@@ -47,7 +47,7 @@ class ParticipantDeregisterTest {
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java
index 58d3afebc..fa16d145d 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import java.time.Instant;
import java.util.UUID;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java
index 78c278f98..4ff4f3b35 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.junit.Assert.assertEquals;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
index e67fbc143..ce23a821f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
@@ -46,8 +46,8 @@ class ParticipantPojosTest {
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantMessageTest.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessage.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessageTest.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(ControlLoopAck.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(ControlLoopAckTest.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAck.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAckTest.class));
// @formatter:off
final Validator validator = ValidatorBuilder
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java
index 886933aba..10200d86f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
index e86d9e885..d08acda47 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
@@ -47,7 +47,7 @@ class ParticipantRegisterTest {
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java
index 98c127107..92025a707 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
@@ -43,7 +43,7 @@ class ParticipantStatusReqTest {
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
orig.setParticipantId(id);
- orig.setControlLoopId(null);
+ orig.setAutomationCompositionId(null);
orig.setParticipantType(null);
orig.setMessageId(UUID.randomUUID());
orig.setTimestamp(Instant.ofEpochMilli(3000));
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
index b2bce05cc..a33c12f2e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
@@ -18,27 +18,27 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
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.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -58,7 +58,7 @@ class ParticipantStatusTest {
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
ToscaConceptIdentifier type = new ToscaConceptIdentifier("type", "2.3.4");
orig.setParticipantType(type);
@@ -67,14 +67,14 @@ class ParticipantStatusTest {
orig.setHealthStatus(ParticipantHealthStatus.HEALTHY);
orig.setTimestamp(Instant.ofEpochMilli(3000));
- ControlLoopInfo clInfo = getControlLoopInfo(id);
- orig.setControlLoopInfoList(List.of(clInfo));
+ AutomationCompositionInfo acInfo = getAutomationCompositionInfo(id);
+ orig.setAutomationCompositionInfoList(List.of(acInfo));
ParticipantDefinition participantDefinitionUpdate = new ParticipantDefinition();
participantDefinitionUpdate.setParticipantId(id);
participantDefinitionUpdate.setParticipantType(type);
- ControlLoopElementDefinition clDefinition = getClElementDefinition(id);
- participantDefinitionUpdate.setControlLoopElementDefinitionList(List.of(clDefinition));
+ AutomationCompositionElementDefinition acDefinition = getAcElementDefinition(id);
+ participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
assertEquals(removeVariableFields(orig.toString()),
@@ -83,47 +83,47 @@ class ParticipantStatusTest {
assertSerializable(orig, ParticipantStatus.class);
}
- private ControlLoopInfo getControlLoopInfo(ToscaConceptIdentifier id) {
- ControlLoopInfo clInfo = new ControlLoopInfo();
- clInfo.setState(ControlLoopState.PASSIVE2RUNNING);
- clInfo.setControlLoopId(id);
-
- ControlLoopStatistics clStatistics = new ControlLoopStatistics();
- clStatistics.setControlLoopId(id);
- clStatistics.setAverageExecutionTime(12345);
- clStatistics.setEventCount(12345);
- clStatistics.setLastEnterTime(12345);
- clStatistics.setLastExecutionTime(12345);
- clStatistics.setLastStart(12345);
- clStatistics.setTimeStamp(Instant.ofEpochMilli(3000));
- clStatistics.setUpTime(12345);
- ClElementStatisticsList clElementStatisticsList = new ClElementStatisticsList();
- ClElementStatistics clElementStatistics = new ClElementStatistics();
- clElementStatistics.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
- clElementStatistics.setTimeStamp(Instant.now());
- clElementStatisticsList.setClElementStatistics(List.of(clElementStatistics));
- clStatistics.setClElementStatisticsList(clElementStatisticsList);
-
- clInfo.setControlLoopStatistics(clStatistics);
- return clInfo;
+ private AutomationCompositionInfo getAutomationCompositionInfo(ToscaConceptIdentifier id) {
+ AutomationCompositionInfo acInfo = new AutomationCompositionInfo();
+ acInfo.setState(AutomationCompositionState.PASSIVE2RUNNING);
+ acInfo.setAutomationCompositionId(id);
+
+ AutomationCompositionStatistics acStatistics = new AutomationCompositionStatistics();
+ acStatistics.setAutomationCompositionId(id);
+ acStatistics.setAverageExecutionTime(12345);
+ acStatistics.setEventCount(12345);
+ acStatistics.setLastEnterTime(12345);
+ acStatistics.setLastExecutionTime(12345);
+ acStatistics.setLastStart(12345);
+ acStatistics.setTimeStamp(Instant.ofEpochMilli(3000));
+ acStatistics.setUpTime(12345);
+ AcElementStatisticsList acElementStatisticsList = new AcElementStatisticsList();
+ AcElementStatistics acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(new ToscaConceptIdentifier("defName", "0.0.1"));
+ acElementStatistics.setTimeStamp(Instant.now());
+ acElementStatisticsList.setAcElementStatistics(List.of(acElementStatistics));
+ acStatistics.setAcElementStatisticsList(acElementStatisticsList);
+
+ acInfo.setAutomationCompositionStatistics(acStatistics);
+ return acInfo;
}
- private ControlLoopElementDefinition getClElementDefinition(ToscaConceptIdentifier id) {
+ private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) {
ToscaNodeTemplate toscaNodeTemplate = new ToscaNodeTemplate();
toscaNodeTemplate.setName("nodeTemplate");
toscaNodeTemplate.setDerivedFrom("parentNodeTemplate");
toscaNodeTemplate.setDescription("Description of nodeTemplate");
toscaNodeTemplate.setVersion("1.2.3");
- ControlLoopElementDefinition clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(id);
- clDefinition.setControlLoopElementToscaNodeTemplate(toscaNodeTemplate);
+ AutomationCompositionElementDefinition acDefinition = new AutomationCompositionElementDefinition();
+ acDefinition.setAcElementDefinitionId(id);
+ acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate);
ToscaProperty property = new ToscaProperty();
property.setName("test");
property.setType("testType");
Map<String, ToscaProperty> commonPropertiesMap = Map.of("Prop1", property);
- clDefinition.setCommonPropertiesMap(commonPropertiesMap);
- return clDefinition;
+ acDefinition.setCommonPropertiesMap(commonPropertiesMap);
+ return acDefinition;
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java
index d2a191018..9f011a383 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
index d7023d0c1..f8aaffe11 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
@@ -18,20 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
-import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
+import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
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.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
@@ -49,7 +49,7 @@ class ParticipantUpdateTest {
ParticipantUpdate orig = new ParticipantUpdate();
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setControlLoopId(id);
+ orig.setAutomationCompositionId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
@@ -69,8 +69,8 @@ class ParticipantUpdateTest {
ParticipantDefinition participantDefinitionUpdate = new ParticipantDefinition();
participantDefinitionUpdate.setParticipantType(id);
- ControlLoopElementDefinition clDefinition = getClElementDefinition(id);
- participantDefinitionUpdate.setControlLoopElementDefinitionList(List.of(clDefinition));
+ AutomationCompositionElementDefinition acDefinition = getAcElementDefinition(id);
+ participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
ParticipantUpdate other = new ParticipantUpdate(orig);
@@ -80,22 +80,22 @@ class ParticipantUpdateTest {
assertSerializable(orig, ParticipantUpdate.class);
}
- private ControlLoopElementDefinition getClElementDefinition(ToscaConceptIdentifier id) {
+ private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) {
ToscaNodeTemplate toscaNodeTemplate = new ToscaNodeTemplate();
toscaNodeTemplate.setName("nodeTemplate");
toscaNodeTemplate.setDerivedFrom("parentNodeTemplate");
toscaNodeTemplate.setDescription("Description of nodeTemplate");
toscaNodeTemplate.setVersion("1.2.3");
- ControlLoopElementDefinition clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(id);
- clDefinition.setControlLoopElementToscaNodeTemplate(toscaNodeTemplate);
+ AutomationCompositionElementDefinition acDefinition = new AutomationCompositionElementDefinition();
+ acDefinition.setAcElementDefinitionId(id);
+ acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate);
ToscaProperty property = new ToscaProperty();
property.setName("test");
property.setType("testType");
Map<String, ToscaProperty> commonPropertiesMap = Map.of("Prop1", property);
- clDefinition.setCommonPropertiesMap(commonPropertiesMap);
- return clDefinition;
+ acDefinition.setCommonPropertiesMap(commonPropertiesMap);
+ return acDefinition;
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/MessagesRestPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/MessagesRestPojosTest.java
index 435cce8ef..4503be783 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/MessagesRestPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/MessagesRestPojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest;
+package org.onap.policy.clamp.models.acm.messages.rest;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommandTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommandTest.java
index c9902753f..348359743 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationCommandTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationCommandTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
+package org.onap.policy.clamp.models.acm.messages.rest.instantiation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
class InstantiationCommandTest {
@Test
@@ -43,8 +43,8 @@ class InstantiationCommandTest {
InstantiationCommand ic1 = new InstantiationCommand();
- ic1.setControlLoopIdentifierList(new ArrayList<>());
- ic1.setOrderedState(ControlLoopOrderedState.UNINITIALISED);
+ ic1.setAutomationCompositionIdentifierList(new ArrayList<>());
+ ic1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
assertThat(ic1.toString()).contains("InstantiationCommand(");
assertEquals(false, ic1.hashCode() == 0);
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAcElementStatisticsChild.java
index 10150cf59..ebbaf1d42 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAcElementStatisticsChild.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
- * Test class for {@link JpaControlLoop} comparisons.
+ * Test class for {@link JpaAcElementStatistics} comparisons.
*/
-class DummyJpaControlLoopChild extends JpaControlLoop {
+class DummyJpaAcElementStatisticsChild extends JpaAcElementStatistics {
private static final long serialVersionUID = -5101743610779424064L;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopElementChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionChild.java
index 4bacb9255..c7f4351c7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaControlLoopElementChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionChild.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
- * Test class for {@link JpaControlLoopElement} comparisons.
+ * Test class for {@link JpaAutomationComposition} comparisons.
*/
-class DummyJpaControlLoopElementChild extends JpaControlLoopElement {
+class DummyJpaAutomationCompositionChild extends JpaAutomationComposition {
private static final long serialVersionUID = -5101743610779424064L;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaClElementStatisticsChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionElementChild.java
index 94b0b13c7..86723d98f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaClElementStatisticsChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaAutomationCompositionElementChild.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
- * Test class for {@link JpaClElementStatistics} comparisons.
+ * Test class for {@link JpaAutomationCompositionElement} comparisons.
*/
-class DummyJpaClElementStatisticsChild extends JpaClElementStatistics {
+class DummyJpaAutomationCompositionElementChild extends JpaAutomationCompositionElement {
private static final long serialVersionUID = -5101743610779424064L;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantChild.java
index 68dcc319b..6b34cc44e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantChild.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
* Test class for {@link JpaParticipant} comparisons.
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantStatisticsChild.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantStatisticsChild.java
index 2c1f04ea1..95082cac7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/DummyJpaParticipantStatisticsChild.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/DummyJpaParticipantStatisticsChild.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
/**
* Test class for {@link JpaParticipantStatistics} comparisons.
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java
new file mode 100644
index 000000000..4cf7b8af0
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAcElementStatisticsTest.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.time.Instant;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfReferenceTimestampKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Test the {@link JpaAcElementStatistics} class.
+ */
+class JpaAcElementStatisticsTest {
+
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+
+ @Test
+ void testJpaAcElementStatisticsConstructor() {
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics((JpaAcElementStatistics) null);
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics((PfReferenceTimestampKey) null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics(null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics(null, new PfConceptKey());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAcElementStatistics(new PfReferenceTimestampKey(), null);
+ }).hasMessageMatching("participantId is marked .*ull but is null");
+
+ assertNotNull(new JpaAcElementStatistics());
+ assertNotNull(new JpaAcElementStatistics((new PfReferenceTimestampKey())));
+ assertNotNull(new JpaAcElementStatistics(new PfReferenceTimestampKey(), new PfConceptKey()));
+ }
+
+ @Test
+ void testJpaAcElementStatistics() {
+ JpaAcElementStatistics testJpaAcElementStatistics = createJpaAcElementStatisticsInstance();
+
+ AcElementStatistics aces = createAcElementStatisticsInstance();
+ assertEquals(aces, testJpaAcElementStatistics.toAuthorative());
+
+ assertThatThrownBy(() -> {
+ testJpaAcElementStatistics.fromAuthorative(null);
+ }).hasMessageMatching("acElementStatistics is marked .*ull but is null");
+
+ assertThatThrownBy(() -> new JpaAcElementStatistics((JpaAcElementStatistics) null))
+ .isInstanceOf(NullPointerException.class);
+
+ JpaAcElementStatistics testJpaAcElementStatisticsFa = new JpaAcElementStatistics();
+ testJpaAcElementStatisticsFa.setKey(null);
+ testJpaAcElementStatisticsFa.fromAuthorative(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+ testJpaAcElementStatisticsFa.setKey(PfReferenceTimestampKey.getNullKey());
+ testJpaAcElementStatisticsFa.fromAuthorative(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+ testJpaAcElementStatisticsFa.setKey(new PfReferenceTimestampKey("elementName", "0.0.1",
+ "a95757ba-b34a-4049-a2a8-46773abcbe5e", Instant.ofEpochSecond(123456L)));
+ testJpaAcElementStatisticsFa.fromAuthorative(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+
+ testJpaAcElementStatisticsFa = new JpaAcElementStatistics(aces);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatisticsFa);
+
+ assertEquals(1, testJpaAcElementStatistics.getKeys().size());
+
+ assertEquals("elementName", testJpaAcElementStatistics.getKey().getReferenceKey().getParentKeyName());
+
+ testJpaAcElementStatistics.clean();
+ assertEquals("elementName", testJpaAcElementStatistics.getKey().getReferenceKey().getParentKeyName());
+
+ JpaAcElementStatistics testJpaAcElementStatistics2 = new JpaAcElementStatistics(testJpaAcElementStatistics);
+ assertEquals(testJpaAcElementStatistics, testJpaAcElementStatistics2);
+ }
+
+ @Test
+ void testJpaAcElementStatisticsValidation() {
+ JpaAcElementStatistics testJpaAcElementStatistics = createJpaAcElementStatisticsInstance();
+
+ assertThatThrownBy(() -> {
+ testJpaAcElementStatistics.validate(null);
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
+
+ assertTrue(testJpaAcElementStatistics.validate("").isValid());
+ }
+
+ @Test
+ void testJpaAcElementStatisticsCompareTo() {
+ JpaAcElementStatistics testJpaAcElementStatistics = createJpaAcElementStatisticsInstance();
+
+ JpaAcElementStatistics otherJpaAcElementStatistics = new JpaAcElementStatistics(testJpaAcElementStatistics);
+ assertEquals(0, testJpaAcElementStatistics.compareTo(otherJpaAcElementStatistics));
+ assertEquals(-1, testJpaAcElementStatistics.compareTo(null));
+ assertEquals(0, testJpaAcElementStatistics.compareTo(testJpaAcElementStatistics));
+ assertNotEquals(0, testJpaAcElementStatistics.compareTo(new DummyJpaAcElementStatisticsChild()));
+
+ testJpaAcElementStatistics.setState(AutomationCompositionState.PASSIVE);
+ assertNotEquals(0, testJpaAcElementStatistics.compareTo(otherJpaAcElementStatistics));
+ testJpaAcElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+ assertEquals(0, testJpaAcElementStatistics.compareTo(otherJpaAcElementStatistics));
+
+ assertEquals(testJpaAcElementStatistics, new JpaAcElementStatistics(testJpaAcElementStatistics));
+ }
+
+ @Test
+ void testJpaAcElementStatisticsLombok() {
+ assertNotNull(new Participant());
+ JpaAcElementStatistics aces0 = new JpaAcElementStatistics();
+
+ assertThat(aces0.toString()).contains("JpaAcElementStatistics(");
+ assertThat(aces0.hashCode()).isNotZero();
+ assertEquals(true, aces0.equals(aces0));
+ assertEquals(false, aces0.equals(null));
+
+
+ JpaAcElementStatistics aces11 = new JpaAcElementStatistics();
+
+ aces11.setState(AutomationCompositionState.UNINITIALISED);
+
+ assertThat(aces11.toString()).contains("JpaAcElementStatistics(");
+ assertEquals(false, aces11.hashCode() == 0);
+ assertEquals(false, aces11.equals(aces0));
+ assertEquals(false, aces11.equals(null));
+
+ assertNotEquals(aces11, aces0);
+
+ JpaAcElementStatistics aces2 = new JpaAcElementStatistics();
+ assertEquals(aces2, aces0);
+ }
+
+ private JpaAcElementStatistics createJpaAcElementStatisticsInstance() {
+ AcElementStatistics testAces = createAcElementStatisticsInstance();
+ JpaAcElementStatistics testJpaAcElementStatistics = new JpaAcElementStatistics();
+ testJpaAcElementStatistics.setKey(null);
+ testJpaAcElementStatistics.fromAuthorative(testAces);
+ testJpaAcElementStatistics.setKey(PfReferenceTimestampKey.getNullKey());
+ testJpaAcElementStatistics.fromAuthorative(testAces);
+
+ return testJpaAcElementStatistics;
+ }
+
+ private AcElementStatistics createAcElementStatisticsInstance() {
+ AcElementStatistics acElementStatistics = new AcElementStatistics();
+ acElementStatistics.setParticipantId(new ToscaConceptIdentifier("elementName", "0.0.1"));
+ acElementStatistics.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ acElementStatistics.setTimeStamp(Instant.ofEpochSecond(123456L));
+ acElementStatistics.setState(AutomationCompositionState.UNINITIALISED);
+
+ return acElementStatistics;
+ }
+}
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
new file mode 100644
index 000000000..f4257bdd2
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
@@ -0,0 +1,315 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfKey;
+import org.onap.policy.models.base.PfReferenceKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Test the {@link JpaAutomationCompositionElement} class.
+ */
+class JpaAutomationCompositionElementTest {
+
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+
+ @Test
+ void testJpaAutomationCompositionElementConstructor() {
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null);
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement((PfReferenceKey) null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, null, AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, new PfConceptKey("participant", "0.0.1"), null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, null, new PfConceptKey("participant", "0.0.1"),
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), null,
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"),
+ null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"),
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, null, null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, null,
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"),
+ null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"),
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), null, null);
+ }).hasMessageMatching("participantType is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), null,
+ AutomationCompositionState.UNINITIALISED);
+ }).hasMessageMatching("participantType is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(),
+ new PfConceptKey("participant", "0.0.1"), null);
+ }).hasMessageMatching("state is marked .*ull but is null");
+
+ assertNotNull(new JpaAutomationCompositionElement());
+ assertNotNull(new JpaAutomationCompositionElement((new PfReferenceKey())));
+ assertNotNull(new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(),
+ new PfConceptKey("participant", "0.0.1"), AutomationCompositionState.UNINITIALISED));
+ }
+
+ @Test
+ void testJpaAutomationCompositionElement() {
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ AutomationCompositionElement ace = createAutomationCompositionElementInstance();
+ assertEquals(ace, testJpaAutomationCompositionElement.toAuthorative());
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationCompositionElement.fromAuthorative(null);
+ }).hasMessageMatching("element is marked .*ull but is null");
+
+ assertThatThrownBy(() -> new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null))
+ .isInstanceOf(NullPointerException.class);
+
+ JpaAutomationCompositionElement testJpaAutomationCompositionElementFa = new JpaAutomationCompositionElement();
+ testJpaAutomationCompositionElementFa.setKey(null);
+ testJpaAutomationCompositionElementFa.fromAuthorative(ace);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa);
+ testJpaAutomationCompositionElementFa.setKey(PfReferenceKey.getNullKey());
+ testJpaAutomationCompositionElementFa.fromAuthorative(ace);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa);
+ testJpaAutomationCompositionElementFa.setKey(
+ new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ testJpaAutomationCompositionElementFa.fromAuthorative(ace);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa);
+
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ testJpaAutomationCompositionElement.getKey().getLocalName());
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ new JpaAutomationCompositionElement(createAutomationCompositionElementInstance()).getKey().getLocalName());
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ ((PfReferenceKey) new JpaAutomationCompositionElement(createAutomationCompositionElementInstance())
+ .getKeys().get(0)).getLocalName());
+
+ testJpaAutomationCompositionElement.clean();
+ assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e",
+ testJpaAutomationCompositionElement.getKey().getLocalName());
+
+ testJpaAutomationCompositionElement.setDescription(" A Message ");
+ testJpaAutomationCompositionElement.clean();
+ assertEquals("A Message", testJpaAutomationCompositionElement.getDescription());
+
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement2 =
+ new JpaAutomationCompositionElement(testJpaAutomationCompositionElement);
+ assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElement2);
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementOrderedState() throws CoderException {
+ AutomationCompositionElement testAutomationCompositionElement = createAutomationCompositionElementInstance();
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ testJpaAutomationCompositionElement.setOrderedState(null);
+ assertEquals(testAutomationCompositionElement, testJpaAutomationCompositionElement.toAuthorative());
+ testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+
+ AutomationCompositionElement noOrderedStateAce = new StandardCoder().decode(
+ new File("src/test/resources/json/AutomationCompositionElementNoOrderedState.json"),
+ AutomationCompositionElement.class);
+
+ JpaAutomationCompositionElement noOrderedStateJpaAce = new JpaAutomationCompositionElement(noOrderedStateAce);
+ assertNull(noOrderedStateJpaAce.getOrderedState());
+ noOrderedStateAce.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ noOrderedStateJpaAce = new JpaAutomationCompositionElement(noOrderedStateAce);
+ assertEquals(testJpaAutomationCompositionElement, noOrderedStateJpaAce);
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementValidation() {
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationCompositionElement.validate(null);
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
+
+ assertTrue(testJpaAutomationCompositionElement.validate("").isValid());
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementCompareTo() {
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement =
+ createJpaAutomationCompositionElementInstance();
+
+ JpaAutomationCompositionElement otherJpaAutomationCompositionElement =
+ new JpaAutomationCompositionElement(testJpaAutomationCompositionElement);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ assertEquals(-1, testJpaAutomationCompositionElement.compareTo(null));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(testJpaAutomationCompositionElement));
+ assertNotEquals(0,
+ testJpaAutomationCompositionElement.compareTo(new DummyJpaAutomationCompositionElementChild()));
+
+ testJpaAutomationCompositionElement
+ .setKey(new PfReferenceKey("BadValue", "0.0.1", "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setKey(
+ new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setDefinition(new PfConceptKey("aceDef", "0.0.1"));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setDescription("Description");
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setDescription(null);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setState(AutomationCompositionState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setState(AutomationCompositionState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setParticipantType(new PfConceptKey("dummy", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setParticipantType(new PfConceptKey("participantType", "0.0.1"));
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ assertEquals(testJpaAutomationCompositionElement,
+ new JpaAutomationCompositionElement(testJpaAutomationCompositionElement));
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementLombok() {
+ assertNotNull(new Participant());
+ JpaAutomationCompositionElement ace0 = new JpaAutomationCompositionElement();
+
+ assertThat(ace0.toString()).contains("JpaAutomationCompositionElement(");
+ assertThat(ace0.hashCode()).isNotZero();
+ assertEquals(true, ace0.equals(ace0));
+ assertEquals(false, ace0.equals(null));
+
+ JpaAutomationCompositionElement ace1 = new JpaAutomationCompositionElement();
+
+ ace1.setDefinition(new PfConceptKey("defName", "0.0.1"));
+ ace1.setDescription("Description");
+ ace1.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ ace1.setState(AutomationCompositionState.UNINITIALISED);
+ ace1.setParticipantId(new PfConceptKey("participant", "0.0.1"));
+
+ assertThat(ace1.toString()).contains("AutomationCompositionElement(");
+ assertEquals(false, ace1.hashCode() == 0);
+ assertEquals(false, ace1.equals(ace0));
+ assertEquals(false, ace1.equals(null));
+
+ assertNotEquals(ace1, ace0);
+
+ JpaAutomationCompositionElement ace2 = new JpaAutomationCompositionElement();
+ assertEquals(ace2, ace0);
+ }
+
+ private JpaAutomationCompositionElement createJpaAutomationCompositionElementInstance() {
+ AutomationCompositionElement testAce = createAutomationCompositionElementInstance();
+ JpaAutomationCompositionElement testJpaAutomationCompositionElement = new JpaAutomationCompositionElement();
+ testJpaAutomationCompositionElement.setKey(null);
+ testJpaAutomationCompositionElement.fromAuthorative(testAce);
+ testJpaAutomationCompositionElement.setKey(PfReferenceKey.getNullKey());
+ testJpaAutomationCompositionElement.fromAuthorative(testAce);
+
+ return testJpaAutomationCompositionElement;
+ }
+
+ private AutomationCompositionElement createAutomationCompositionElementInstance() {
+ AutomationCompositionElement automationCompositionElement = new AutomationCompositionElement();
+ automationCompositionElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
+ automationCompositionElement.setDefinition(new ToscaConceptIdentifier("aceDef", "0.0.1"));
+ automationCompositionElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1"));
+
+ return automationCompositionElement;
+ }
+}
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
new file mode 100644
index 000000000..a016d1202
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
@@ -0,0 +1,310 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+/**
+ * Test the {@link JpaAutomationCompositionTest} class.
+ */
+class JpaAutomationCompositionTest {
+
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+
+ @Test
+ void testJpaAutomationCompositionConstructor() {
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition((JpaAutomationComposition) null);
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition((PfConceptKey) null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, null, new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, null, AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), null, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), null, new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(null, new PfConceptKey(), AutomationCompositionState.UNINITIALISED,
+ new LinkedHashMap<>());
+ }).hasMessageMatching(NULL_KEY_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, null, null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, null, new LinkedHashMap<>());
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), null, AutomationCompositionState.UNINITIALISED,
+ new LinkedHashMap<>());
+ }).hasMessageMatching("definition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(), null, null);
+ }).hasMessageMatching("state is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(), null, new LinkedHashMap<>());
+ }).hasMessageMatching("state is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, null);
+ }).hasMessageMatching("elements is marked .*ull but is null");
+
+ assertNotNull(new JpaAutomationComposition());
+ assertNotNull(new JpaAutomationComposition((new PfConceptKey())));
+ assertNotNull(new JpaAutomationComposition(new PfConceptKey(), new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>()));
+ }
+
+ @Test
+ void testJpaAutomationComposition() {
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ AutomationComposition participant = createAutomationCompositionInstance();
+ assertEquals(participant, testJpaAutomationComposition.toAuthorative());
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationComposition.fromAuthorative(null);
+ }).hasMessageMatching("automationComposition is marked .*ull but is null");
+
+ assertThatThrownBy(() -> new JpaAutomationComposition((JpaAutomationComposition) null))
+ .isInstanceOf(NullPointerException.class);
+
+ JpaAutomationComposition testJpaAutomationCompositionFa = new JpaAutomationComposition();
+ testJpaAutomationCompositionFa.setKey(null);
+ testJpaAutomationCompositionFa.fromAuthorative(participant);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa);
+ testJpaAutomationCompositionFa.setKey(PfConceptKey.getNullKey());
+ testJpaAutomationCompositionFa.fromAuthorative(participant);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa);
+ testJpaAutomationCompositionFa.setKey(new PfConceptKey("automation-composition", "0.0.1"));
+ testJpaAutomationCompositionFa.fromAuthorative(participant);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa);
+
+ assertEquals("automation-composition", testJpaAutomationComposition.getKey().getName());
+ assertEquals("automation-composition",
+ new JpaAutomationComposition(createAutomationCompositionInstance()).getKey().getName());
+ assertEquals("automation-composition",
+ ((PfConceptKey) new JpaAutomationComposition(createAutomationCompositionInstance()).getKeys().get(0))
+ .getName());
+
+ testJpaAutomationComposition.clean();
+ assertEquals("automation-composition", testJpaAutomationComposition.getKey().getName());
+
+ testJpaAutomationComposition.setDescription(" A Message ");
+ testJpaAutomationComposition.clean();
+ assertEquals("A Message", testJpaAutomationComposition.getDescription());
+
+ JpaAutomationComposition testJpaAutomationComposition2 =
+ new JpaAutomationComposition(testJpaAutomationComposition);
+ assertEquals(testJpaAutomationComposition, testJpaAutomationComposition2);
+ }
+
+ @Test
+ void testJpaAutomationCompositionElementOrderedState() throws CoderException {
+ AutomationComposition testAutomationComposition = createAutomationCompositionInstance();
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ testJpaAutomationComposition.setOrderedState(null);
+ assertEquals(testAutomationComposition, testJpaAutomationComposition.toAuthorative());
+ testJpaAutomationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+
+ AutomationComposition noOrderedStateAc = new StandardCoder().decode(
+ new File("src/test/resources/json/AutomationCompositionNoOrderedState.json"), AutomationComposition.class);
+
+ JpaAutomationComposition noOrderedStateJpaAc = new JpaAutomationComposition(noOrderedStateAc);
+ assertNull(noOrderedStateJpaAc.getOrderedState());
+ noOrderedStateAc.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ noOrderedStateJpaAc = new JpaAutomationComposition(noOrderedStateAc);
+ assertEquals(testJpaAutomationComposition, noOrderedStateJpaAc);
+
+ AutomationCompositions automationCompositionsWithElements = new StandardCoder().decode(
+ new File("src/test/resources/providers/TestAutomationCompositions.json"), AutomationCompositions.class);
+
+ JpaAutomationComposition jpaAutomationCompositionWithElements =
+ new JpaAutomationComposition(automationCompositionsWithElements.getAutomationCompositionList().get(0));
+ assertEquals(4, jpaAutomationCompositionWithElements.getElements().size());
+ assertEquals(18, jpaAutomationCompositionWithElements.getKeys().size());
+ assertThatCode(() -> jpaAutomationCompositionWithElements.clean()).doesNotThrowAnyException();
+
+ assertEquals(automationCompositionsWithElements.getAutomationCompositionList().get(0),
+ jpaAutomationCompositionWithElements.toAuthorative());
+ }
+
+ @Test
+ void testJpaAutomationCompositionValidation() {
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ assertThatThrownBy(() -> {
+ testJpaAutomationComposition.validate(null);
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
+
+ assertTrue(testJpaAutomationComposition.validate("").isValid());
+ }
+
+ @Test
+ void testJpaAutomationCompositionCompareTo() {
+ JpaAutomationComposition testJpaAutomationComposition = createJpaAutomationCompositionInstance();
+
+ JpaAutomationComposition otherJpaAutomationComposition =
+ new JpaAutomationComposition(testJpaAutomationComposition);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ assertEquals(-1, testJpaAutomationComposition.compareTo(null));
+ assertEquals(0, testJpaAutomationComposition.compareTo(testJpaAutomationComposition));
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(new DummyJpaAutomationCompositionChild()));
+
+ testJpaAutomationComposition.setKey(new PfConceptKey("BadValue", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setKey(new PfConceptKey("automation-composition", "0.0.1"));
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setDefinition(new PfConceptKey("automationCompositionDefinitionName", "0.0.1"));
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setState(AutomationCompositionState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setState(AutomationCompositionState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setDescription("A description");
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setDescription(null);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ testJpaAutomationComposition.setPrimed(true);
+ assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+ testJpaAutomationComposition.setPrimed(false);
+ assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
+
+ assertEquals(testJpaAutomationComposition, new JpaAutomationComposition(testJpaAutomationComposition));
+ }
+
+ @Test
+ void testJpaAutomationCompositionLombok() {
+ assertNotNull(new AutomationComposition());
+ JpaAutomationComposition ac0 = new JpaAutomationComposition();
+
+ assertThat(ac0.toString()).contains("JpaAutomationComposition(");
+ assertThat(ac0.hashCode()).isNotZero();
+ assertEquals(true, ac0.equals(ac0));
+ assertEquals(false, ac0.equals(null));
+
+ JpaAutomationComposition ac1 = new JpaAutomationComposition();
+
+ ac1.setDefinition(new PfConceptKey("defName", "0.0.1"));
+ ac1.setDescription("Description");
+ ac1.setElements(new LinkedHashMap<>());
+ ac1.setKey(new PfConceptKey("participant", "0.0.1"));
+ ac1.setState(AutomationCompositionState.UNINITIALISED);
+
+ assertThat(ac1.toString()).contains("AutomationComposition(");
+ assertEquals(false, ac1.hashCode() == 0);
+ assertEquals(false, ac1.equals(ac0));
+ assertEquals(false, ac1.equals(null));
+
+ assertNotEquals(ac1, ac0);
+
+ JpaAutomationComposition ac2 = new JpaAutomationComposition();
+ assertEquals(ac2, ac0);
+ }
+
+ private JpaAutomationComposition createJpaAutomationCompositionInstance() {
+ AutomationComposition testAutomationComposition = createAutomationCompositionInstance();
+ JpaAutomationComposition testJpaAutomationComposition = new JpaAutomationComposition();
+ testJpaAutomationComposition.setKey(null);
+ testJpaAutomationComposition.fromAuthorative(testAutomationComposition);
+ testJpaAutomationComposition.setKey(PfConceptKey.getNullKey());
+ testJpaAutomationComposition.fromAuthorative(testAutomationComposition);
+
+ return testJpaAutomationComposition;
+ }
+
+ private AutomationComposition createAutomationCompositionInstance() {
+ AutomationComposition testAutomationComposition = new AutomationComposition();
+ testAutomationComposition.setName("automation-composition");
+ testAutomationComposition.setVersion("0.0.1");
+ testAutomationComposition
+ .setDefinition(new ToscaConceptIdentifier("automationCompositionDefinitionName", "0.0.1"));
+ testAutomationComposition.setElements(new LinkedHashMap<>());
+
+ return testAutomationComposition;
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatisticsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatisticsTest.java
index aff365515..284d13374 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantStatisticsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantStatisticsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -29,10 +29,10 @@ import static org.junit.Assert.assertTrue;
import java.time.Instant;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfTimestampKey;
@@ -76,8 +76,8 @@ class JpaParticipantStatisticsTest {
void testJpaParticipantStatistics() {
JpaParticipantStatistics testJpaParticipantStatistics = createJpaParticipantStatisticsInstance();
- ParticipantStatistics cles = createParticipantStatisticsInstance();
- assertEquals(cles, testJpaParticipantStatistics.toAuthorative());
+ ParticipantStatistics aces = createParticipantStatisticsInstance();
+ assertEquals(aces, testJpaParticipantStatistics.toAuthorative());
assertThatThrownBy(() -> {
testJpaParticipantStatistics.fromAuthorative(null);
@@ -88,17 +88,17 @@ class JpaParticipantStatisticsTest {
JpaParticipantStatistics testJpaParticipantStatisticsFa = new JpaParticipantStatistics();
testJpaParticipantStatisticsFa.setKey(null);
- testJpaParticipantStatisticsFa.fromAuthorative(cles);
+ testJpaParticipantStatisticsFa.fromAuthorative(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
testJpaParticipantStatisticsFa.setKey(PfTimestampKey.getNullKey());
- testJpaParticipantStatisticsFa.fromAuthorative(cles);
+ testJpaParticipantStatisticsFa.fromAuthorative(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
testJpaParticipantStatisticsFa
.setKey(new PfTimestampKey("participantName", "0.0.1", Instant.ofEpochMilli(123456L)));
- testJpaParticipantStatisticsFa.fromAuthorative(cles);
+ testJpaParticipantStatisticsFa.fromAuthorative(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
- testJpaParticipantStatisticsFa = new JpaParticipantStatistics(cles);
+ testJpaParticipantStatisticsFa = new JpaParticipantStatistics(aces);
assertEquals(testJpaParticipantStatistics, testJpaParticipantStatisticsFa);
assertEquals(2, testJpaParticipantStatistics.getKeys().size());
@@ -171,12 +171,12 @@ class JpaParticipantStatisticsTest {
}
private JpaParticipantStatistics createJpaParticipantStatisticsInstance() {
- ParticipantStatistics testCles = createParticipantStatisticsInstance();
+ ParticipantStatistics testAces = createParticipantStatisticsInstance();
JpaParticipantStatistics testJpaParticipantStatistics = new JpaParticipantStatistics();
testJpaParticipantStatistics.setKey(null);
- testJpaParticipantStatistics.fromAuthorative(testCles);
+ testJpaParticipantStatistics.fromAuthorative(testAces);
testJpaParticipantStatistics.setKey(PfTimestampKey.getNullKey());
- testJpaParticipantStatistics.fromAuthorative(testCles);
+ testJpaParticipantStatistics.fromAuthorative(testAces);
return testJpaParticipantStatistics;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java
index 087292354..776aafa2e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaParticipantTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -28,9 +28,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/PojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/PojosTest.java
index c877f9696..1f40fae5f 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/PojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/PojosTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts;
+package org.onap.policy.clamp.models.acm.persistence.concepts;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java
new file mode 100644
index 000000000..15d1d845d
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcElementStatisticsProviderTest.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.time.Instant;
+import java.util.List;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
+import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAcElementStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.AcElementStatisticsRepository;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+
+class AcElementStatisticsProviderTest {
+ private static final String LIST_IS_NULL = ".*. is marked .*ull but is null";
+ private static final Coder CODER = new StandardCoder();
+ private static final String AC_ELEMENT_STATS_JSON = "src/test/resources/providers/TestAcElementStatistics.json";
+
+ private AcElementStatisticsProvider acElementStatisticsProvider;
+ private AcElementStatisticsList inputAcElementStats;
+ private String originalJson = ResourceUtils.getResourceAsString(AC_ELEMENT_STATS_JSON);
+
+ /**
+ * Set up test AcElement statistics provider.
+ *
+ * @throws Exception on errors
+ */
+ @BeforeEach
+ void beforeSetupDao() throws Exception {
+
+ inputAcElementStats = CODER.decode(originalJson, AcElementStatisticsList.class);
+ var acElementStatisticsRepository = mock(AcElementStatisticsRepository.class);
+
+ var jpaAcElementStatisticsList =
+ ProviderUtils.getJpaAndValidateList(inputAcElementStats.getAcElementStatistics(),
+ JpaAcElementStatistics::new, "automation composition element statistics");
+
+ for (var acElementStat : jpaAcElementStatisticsList) {
+ when(acElementStatisticsRepository.getById(eq(acElementStat.getKey()))).thenReturn(acElementStat);
+ when(acElementStatisticsRepository.findAllById(eq(List.of(acElementStat.getKey()))))
+ .thenReturn(List.of(acElementStat));
+ }
+
+ when(acElementStatisticsRepository.saveAll(anyList())).thenReturn(jpaAcElementStatisticsList);
+
+ when(acElementStatisticsRepository.getFiltered(eq(JpaAcElementStatistics.class), any()))
+ .thenReturn(List.of(jpaAcElementStatisticsList.get(0)));
+
+ acElementStatisticsProvider = new AcElementStatisticsProvider(acElementStatisticsRepository);
+ }
+
+ @Test
+ void testAcElementStatisticsCreate() throws Exception {
+ assertThatThrownBy(() -> {
+ acElementStatisticsProvider.createAcElementStatistics(null);
+ }).hasMessageMatching(LIST_IS_NULL);
+
+ AcElementStatisticsList createdAcElementStats = new AcElementStatisticsList();
+ createdAcElementStats.setAcElementStatistics(
+ acElementStatisticsProvider.createAcElementStatistics(inputAcElementStats.getAcElementStatistics()));
+
+ assertEquals(inputAcElementStats.toString().replaceAll("\\s+", ""),
+ createdAcElementStats.toString().replaceAll("\\s+", ""));
+ }
+
+ @Test
+ void testGetAcElementStatistics() throws Exception {
+
+ List<AcElementStatistics> getResponse;
+
+ // Return empty list when no data present in db
+ getResponse = acElementStatisticsProvider.getAcElementStatistics(null, null, null, null);
+ assertThat(getResponse).isEmpty();
+
+ acElementStatisticsProvider.createAcElementStatistics(inputAcElementStats.getAcElementStatistics());
+ ToscaConceptIdentifier identifier = inputAcElementStats.getAcElementStatistics().get(0).getParticipantId();
+ Instant instant = inputAcElementStats.getAcElementStatistics().get(0).getTimeStamp();
+ String id = inputAcElementStats.getAcElementStatistics().get(0).getId().toString();
+ assertEquals(1, acElementStatisticsProvider
+ .getAcElementStatistics(identifier.getName(), identifier.getVersion(), id, instant).size());
+
+ assertEquals(1, acElementStatisticsProvider
+ .getFilteredAcElementStatistics("name2", "1.0.1", null, null, null, "DESC", 1).size());
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
new file mode 100644
index 000000000..0a367eed8
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java
@@ -0,0 +1,305 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.provider;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import java.util.Optional;
+import javax.persistence.EntityNotFoundException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaNodeTemplatesRepository;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
+
+class AutomationCompositionProviderTest {
+
+ private static final String LIST_IS_NULL = "automationCompositions is marked .*ull but is null";
+ private static final String OBJECT_IS_NULL = "automationComposition is marked non-null but is null";
+
+ private static final String ID_NAME = "PMSHInstance1";
+ private static final String ID_VERSION = "1.0.1";
+ private static final String ID_NAME_NOT_EXTST = "not_exist";
+ private static final String ID_NAME_NOT_VALID = "not_valid";
+
+ private static final Coder CODER = new StandardCoder();
+ private static final String AUTOMATION_COMPOSITION_JSON =
+ "src/test/resources/providers/TestAutomationCompositions.json";
+ private static final String TOSCA_TEMPLATE_YAML = "examples/acm/PMSubscriptionHandling.yaml";
+
+ private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+
+ private AutomationCompositions inputAutomationCompositions;
+ private List<JpaAutomationComposition> inputAutomationCompositionsJpa;
+ private String originalJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON);
+
+ @BeforeEach
+ void beforeSetupDao() throws Exception {
+ inputAutomationCompositions = CODER.decode(originalJson, AutomationCompositions.class);
+ inputAutomationCompositionsJpa =
+ ProviderUtils.getJpaAndValidateList(inputAutomationCompositions.getAutomationCompositionList(),
+ JpaAutomationComposition::new, "automation compositions");
+ }
+
+ @Test
+ void testAutomationCompositionsSave() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.saveAutomationCompositions(null);
+ }).hasMessageMatching(LIST_IS_NULL);
+
+ when(automationCompositionRepository.saveAll(inputAutomationCompositionsJpa))
+ .thenReturn(inputAutomationCompositionsJpa);
+
+ var createdAutomationCompositions = new AutomationCompositions();
+ createdAutomationCompositions.setAutomationCompositionList(automationCompositionProvider
+ .saveAutomationCompositions(inputAutomationCompositions.getAutomationCompositionList()));
+
+ assertEquals(inputAutomationCompositions, createdAutomationCompositions);
+
+ when(automationCompositionRepository.saveAll(any())).thenThrow(IllegalArgumentException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider
+ .saveAutomationCompositions(inputAutomationCompositions.getAutomationCompositionList());
+ }).hasMessageMatching("Error in save AutomationCompositions");
+ }
+
+ @Test
+ void testAutomationCompositionSave() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.saveAutomationComposition(null);
+ }).hasMessageMatching(OBJECT_IS_NULL);
+
+ when(automationCompositionRepository.save(inputAutomationCompositionsJpa.get(0)))
+ .thenReturn(inputAutomationCompositionsJpa.get(0));
+
+ var createdAutomationComposition = automationCompositionProvider
+ .saveAutomationComposition(inputAutomationCompositions.getAutomationCompositionList().get(0));
+
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(0), createdAutomationComposition);
+
+ when(automationCompositionRepository.save(any())).thenThrow(IllegalArgumentException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider
+ .saveAutomationComposition(inputAutomationCompositions.getAutomationCompositionList().get(0));
+ }).hasMessageMatching("Error in save automationComposition");
+ }
+
+ @Test
+ void testGetAutomationCompositions() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ // Return empty list when no data present in db
+ List<AutomationComposition> getResponse = automationCompositionProvider.getAutomationCompositions();
+ assertThat(getResponse).isEmpty();
+
+ automationCompositionProvider
+ .saveAutomationCompositions(inputAutomationCompositions.getAutomationCompositionList());
+
+ var automationComposition0 = inputAutomationCompositions.getAutomationCompositionList().get(1);
+ var name = automationComposition0.getName();
+ var version = automationComposition0.getVersion();
+ var automationComposition1 = inputAutomationCompositions.getAutomationCompositionList().get(1);
+
+ when(automationCompositionRepository.getFiltered(eq(JpaAutomationComposition.class), any(), any()))
+ .thenReturn(List.of(new JpaAutomationComposition(automationComposition0),
+ new JpaAutomationComposition(automationComposition1)));
+ when(automationCompositionRepository.findById(automationComposition0.getKey().asIdentifier().asConceptKey()))
+ .thenReturn(Optional.of(new JpaAutomationComposition(automationComposition0)));
+ when(automationCompositionRepository.getById(automationComposition0.getKey().asIdentifier().asConceptKey()))
+ .thenReturn(new JpaAutomationComposition(automationComposition0));
+ when(automationCompositionRepository.getFiltered(JpaAutomationComposition.class, name, version))
+ .thenReturn(List.of(new JpaAutomationComposition(automationComposition0)));
+ when(automationCompositionRepository.findById(automationComposition1.getKey().asIdentifier().asConceptKey()))
+ .thenReturn(Optional.of(new JpaAutomationComposition(automationComposition1)));
+
+ assertEquals(1, automationCompositionProvider.getAutomationCompositions(name, version).size());
+
+ var ac = automationCompositionProvider
+ .findAutomationComposition(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)).get();
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac);
+
+ ac = automationCompositionProvider.getAutomationComposition(new ToscaConceptIdentifier(ID_NAME, ID_VERSION));
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac);
+
+ when(automationCompositionRepository.getById(any())).thenThrow(EntityNotFoundException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider
+ .getAutomationComposition(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION));
+ }).hasMessageMatching("AutomationComposition not found");
+
+ ac = automationCompositionProvider.findAutomationComposition(ID_NAME, ID_VERSION).get();
+ assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac);
+
+ assertThat(automationCompositionProvider
+ .findAutomationComposition(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION))).isEmpty();
+
+ when(automationCompositionRepository.findById(any())).thenThrow(IllegalArgumentException.class);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.findAutomationComposition(ID_NAME_NOT_VALID, ID_VERSION);
+ }).hasMessageMatching("Not valid parameter");
+ }
+
+ @Test
+ void testDeleteAutomationComposition() throws Exception {
+ var automationCompositionRepository = mock(AutomationCompositionRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository,
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.deleteAutomationComposition(ID_NAME_NOT_EXTST, ID_VERSION);
+ }).hasMessageMatching(".*.failed, automation composition does not exist");
+
+ var automationComposition = inputAutomationCompositions.getAutomationCompositionList().get(0);
+ var name = automationComposition.getName();
+ var version = automationComposition.getVersion();
+
+ when(automationCompositionRepository.findById(new PfConceptKey(name, version)))
+ .thenReturn(Optional.of(inputAutomationCompositionsJpa.get(0)));
+
+ AutomationComposition deletedAc = automationCompositionProvider.deleteAutomationComposition(name, version);
+ assertEquals(automationComposition, deletedAc);
+ }
+
+ @Test
+ void testDeleteAllInstanceProperties() throws Exception {
+ var automationCompositionProvider =
+ new AutomationCompositionProvider(mock(AutomationCompositionRepository.class),
+ mock(ToscaNodeTemplateRepository.class), mock(ToscaNodeTemplatesRepository.class));
+ var toscaServiceTemplate = testAutomationCompositionRead();
+ automationCompositionProvider.deleteInstanceProperties(
+ automationCompositionProvider.saveInstanceProperties(toscaServiceTemplate),
+ automationCompositionProvider.getAllNodeTemplates());
+ assertThat(automationCompositionProvider.getAutomationCompositions()).isEmpty();
+ }
+
+ @Test
+ void testSaveAndDeleteInstanceProperties() throws Exception {
+ var toscaNodeTemplatesRepository = mock(ToscaNodeTemplatesRepository.class);
+ var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
+ var automationCompositionProvider = new AutomationCompositionProvider(
+ mock(AutomationCompositionRepository.class), toscaNodeTemplateRepository, toscaNodeTemplatesRepository);
+ var toscaServiceTest = testAutomationCompositionRead();
+
+ automationCompositionProvider.saveInstanceProperties(toscaServiceTest);
+ verify(toscaNodeTemplatesRepository).save(any());
+
+ var name = "org.onap.policy.acm.PolicyAutomationCompositionParticipant";
+ var version = "2.3.1";
+ var elem = toscaServiceTest.getToscaTopologyTemplate().getNodeTemplates().get(name);
+ when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, name, version))
+ .thenReturn(List.of(new JpaToscaNodeTemplate(elem)));
+
+ var filtered = automationCompositionProvider.getNodeTemplates(name, version);
+ verify(toscaNodeTemplateRepository).getFiltered(JpaToscaNodeTemplate.class, name, version);
+
+ automationCompositionProvider
+ .deleteInstanceProperties(automationCompositionProvider.saveInstanceProperties(toscaServiceTest), filtered);
+
+ verify(toscaNodeTemplateRepository).delete(any());
+ }
+
+ @Test
+ void testGetNodeTemplates() throws Exception {
+ var toscaNodeTemplateRepository = mock(ToscaNodeTemplateRepository.class);
+ var automationCompositionProvider =
+ new AutomationCompositionProvider(mock(AutomationCompositionRepository.class), toscaNodeTemplateRepository,
+ mock(ToscaNodeTemplatesRepository.class));
+
+ var toscaNodeTemplate0 = new JpaToscaNodeTemplate(new PfConceptKey(ID_NAME, ID_VERSION));
+ var toscaNodeTemplate1 = new JpaToscaNodeTemplate(new PfConceptKey("PMSHInstance2", ID_VERSION));
+
+ when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, null, null))
+ .thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
+ when(toscaNodeTemplateRepository.findAll()).thenReturn(List.of(toscaNodeTemplate0, toscaNodeTemplate1));
+ when(toscaNodeTemplateRepository.getFiltered(JpaToscaNodeTemplate.class, ID_NAME, ID_VERSION))
+ .thenReturn(List.of(toscaNodeTemplate0));
+
+ // Getting all nodes
+ var listNodes = automationCompositionProvider.getAllNodeTemplates();
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(2);
+
+ listNodes = automationCompositionProvider.getNodeTemplates(ID_NAME, ID_VERSION);
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(1);
+
+ listNodes = automationCompositionProvider.getAllNodeTemplates();
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(2);
+
+ var nodeTemplateFilter =
+ ToscaTypedEntityFilter.<ToscaNodeTemplate>builder().name(ID_NAME).version(ID_VERSION).build();
+
+ listNodes = automationCompositionProvider.getFilteredNodeTemplates(nodeTemplateFilter);
+ assertNotNull(listNodes);
+ assertThat(listNodes).hasSize(1);
+
+ assertThatThrownBy(() -> {
+ automationCompositionProvider.getFilteredNodeTemplates(null);
+ }).hasMessageMatching("filter is marked non-null but is null");
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionRead() {
+ return testAutomationCompositionYamlSerialization(TOSCA_TEMPLATE_YAML);
+ }
+
+ private static ToscaServiceTemplate testAutomationCompositionYamlSerialization(
+ String automationCompositionFilePath) {
+ var automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ return yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
+ }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
index 9b48735f6..f537e2cd7 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -33,9 +33,9 @@ import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantRepository;
+import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantRepository;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -84,7 +84,7 @@ class ParticipantProviderTest {
}
@Test
- void testGetControlLoops() throws Exception {
+ void testGetAutomationCompositions() throws Exception {
var participantRepository = mock(ParticipantRepository.class);
var participantProvider = new ParticipantProvider(participantRepository);
@@ -119,7 +119,7 @@ class ParticipantProviderTest {
.thenReturn(jpaParticipantList);
final ToscaTypedEntityFilter<Participant> filter = ToscaTypedEntityFilter.<Participant>builder()
- .type("org.onap.domain.pmsh.PMSHControlLoopDefinition").build();
+ .type("org.onap.domain.pmsh.PMSHAutomationCompositionDefinition").build();
assertEquals(1, participantProvider.getFilteredParticipants(filter).size());
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProviderTest.java
index 16f4958a9..3c6b1eb83 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantStatisticsProviderTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -33,10 +33,10 @@ import java.time.Instant;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ParticipantStatisticsRepository;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics;
+import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantStatisticsRepository;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -89,7 +89,7 @@ class ParticipantStatisticsProviderTest {
}
@Test
- void testGetControlLoops() throws Exception {
+ void testGetAutomationCompositions() throws Exception {
// Return empty list when no data present in db
List<ParticipantStatistics> getResponse =
participantStatisticsProvider.getParticipantStatistics(null, null, null);
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProviderTest.java
index 523a4fb88..4d998717e 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ServiceTemplateProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ServiceTemplateProviderTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider;
+package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository.ToscaServiceTemplateRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.ToscaServiceTemplateRepository;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -117,7 +117,7 @@ class ServiceTemplateProviderTest {
var serviceTemplateProvider = new ServiceTemplateProvider(serviceTemplateRepository);
assertThatThrownBy(() -> serviceTemplateProvider.getToscaServiceTemplate("Name", "1.0.0"))
- .hasMessage("Control Loop definitions not found");
+ .hasMessage("Automation composition definitions not found");
}
@Test
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImplTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java
index 8b5357457..7210a6afd 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/repository/FilterRepositoryImplTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.controlloop.persistence.repository;
+package org.onap.policy.clamp.models.acm.persistence.repository;
import static org.assertj.core.api.Assertions.assertThat;
@@ -26,9 +26,9 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ProviderUtils;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
+import org.onap.policy.clamp.models.acm.persistence.provider.ProviderUtils;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -38,11 +38,12 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.provider.impl.ModelsProvider;
class FilterRepositoryImplTest {
- private static final String CONTROL_LOOP_JSON = "src/test/resources/providers/TestControlLoops.json";
+ private static final String AUTOMATION_COMPOSITION_JSON =
+ "src/test/resources/providers/TestAutomationCompositions.json";
private static final Coder CODER = new StandardCoder();
private static final AtomicInteger dbNameCounter = new AtomicInteger();
- private static final String originalJson = ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON);
- private static List<JpaControlLoop> jpaControlLoops;
+ private static final String originalJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON);
+ private static List<JpaAutomationComposition> jpaAutomationCompositions;
private PfDao pfDao;
@BeforeEach
@@ -51,17 +52,18 @@ class FilterRepositoryImplTest {
parameters.setDatabaseDriver("org.h2.Driver");
parameters.setName("PolicyProviderParameterGroup");
parameters.setImplementation("org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl");
- parameters.setDatabaseUrl("jdbc:h2:mem:controlLoopProviderTestDb" + dbNameCounter.getAndDecrement());
+ parameters.setDatabaseUrl("jdbc:h2:mem:automationCompositionProviderTestDb" + dbNameCounter.getAndDecrement());
parameters.setDatabaseUser("policy");
parameters.setDatabasePassword("P01icY");
parameters.setPersistenceUnit("ToscaConceptTest");
pfDao = ModelsProvider.init(parameters);
- var inputControlLoops = CODER.decode(originalJson, ControlLoops.class);
- jpaControlLoops = ProviderUtils.getJpaAndValidateList(inputControlLoops.getControlLoopList(),
- JpaControlLoop::new, "ControlLoops");
+ var inputAutomationCompositions = CODER.decode(originalJson, AutomationCompositions.class);
+ jpaAutomationCompositions =
+ ProviderUtils.getJpaAndValidateList(inputAutomationCompositions.getAutomationCompositionList(),
+ JpaAutomationComposition::new, "AutomationCompositions");
- pfDao.createCollection(jpaControlLoops);
+ pfDao.createCollection(jpaAutomationCompositions);
}
@Test
@@ -77,10 +79,11 @@ class FilterRepositoryImplTest {
return pfDao;
}
};
- var result = filterRepositoryImpl.getFiltered(JpaControlLoop.class, null, null);
+ var result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, null, null);
assertThat(result).hasSize(2);
- result = filterRepositoryImpl.getFiltered(JpaControlLoop.class, jpaControlLoops.get(0).getName(), null);
+ result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class,
+ jpaAutomationCompositions.get(0).getName(), null);
assertThat(result).hasSize(1);
}
@@ -96,11 +99,11 @@ class FilterRepositoryImplTest {
// @formatter:off
PfFilterParameters filterParams = PfFilterParameters
.builder()
- .name(jpaControlLoops.get(0).getName())
+ .name(jpaAutomationCompositions.get(0).getName())
.build();
// @formatter:on
- var result = filterRepositoryImpl.getFiltered(JpaControlLoop.class, filterParams);
+ var result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, filterParams);
assertThat(result).hasSize(1);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/rest/RestUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java
index 4dedae200..a62f78ba2 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/rest/RestUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/rest/RestUtilsTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.models.rest;
+package org.onap.policy.clamp.models.acm.rest;
import static org.assertj.core.api.Assertions.assertThat;
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
new file mode 100644
index 000000000..a5434240a
--- /dev/null
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.utils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
+
+class AcmUtilsTest {
+
+ private ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.0.0");
+ private ToscaConceptIdentifier idNode =
+ new ToscaConceptIdentifier("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", "0.0.0");
+
+ @Test
+ void testCommonUtilsParticipantUpdate() {
+ var acElement = new AutomationCompositionElement();
+ List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ assertThat(participantUpdates).isEmpty();
+
+ AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
+ assertThat(participantUpdates).isNotEmpty();
+ assertEquals(acElement, participantUpdates.get(0).getAutomationCompositionElementList().get(0));
+
+ AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
+ assertNotEquals(id, participantUpdates.get(0).getParticipantId());
+
+ acElement.setParticipantId(id);
+ acElement.setParticipantType(id);
+ AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
+ assertEquals(id, participantUpdates.get(1).getParticipantId());
+ }
+
+ @Test
+ void testCommonUtilsServiceTemplate() {
+ var acElement = new AutomationCompositionElement();
+ var toscaServiceTemplate = getDummyToscaServiceTemplate();
+ AcmUtils.setServiceTemplatePolicyInfo(acElement, toscaServiceTemplate);
+ assertEquals(getDummyToscaDataTypeMap(), acElement.getToscaServiceTemplateFragment().getDataTypes());
+ }
+
+ @Test
+ void testCommonUtilsDefinitionUpdate() {
+ var toscaServiceTemplate = getDummyToscaServiceTemplate();
+ List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
+ assertThat(participantDefinitionUpdates).isEmpty();
+
+ checkParticipantDefinitionUpdate(toscaServiceTemplate, participantDefinitionUpdates);
+ assertThat(participantDefinitionUpdates).isNotEmpty();
+ assertEquals(id, participantDefinitionUpdates.get(0).getParticipantType());
+
+ checkParticipantDefinitionUpdate(toscaServiceTemplate, participantDefinitionUpdates);
+ assertEquals(idNode, participantDefinitionUpdates.get(0).getAutomationCompositionElementDefinitionList().get(0)
+ .getAcElementDefinitionId());
+ }
+
+ private ToscaServiceTemplate getDummyToscaServiceTemplate() {
+ var toscaServiceTemplate = new ToscaServiceTemplate();
+ var policyTypes = getDummyPolicyTypesMap();
+ toscaServiceTemplate.setPolicyTypes(policyTypes);
+
+ var dataTypes = getDummyToscaDataTypeMap();
+ dataTypes.put("onap.datatypes.ToscaConceptIdentifier", new ToscaDataType());
+ toscaServiceTemplate.setDataTypes(dataTypes);
+
+ var toscaTopologyTemplate = new ToscaTopologyTemplate();
+ Map<String, ToscaPolicy> policy = new HashMap<>();
+ toscaTopologyTemplate.setPolicies(List.of(policy));
+ var nodeTemplates = getDummyNodeTemplates();
+ toscaTopologyTemplate.setNodeTemplates(nodeTemplates);
+
+ toscaServiceTemplate.setToscaTopologyTemplate(toscaTopologyTemplate);
+ toscaServiceTemplate.setDerivedFrom("tosca.nodetypes.Root");
+ toscaServiceTemplate.setDescription("description");
+ toscaServiceTemplate.setMetadata(null);
+ toscaServiceTemplate.setName("name");
+ toscaServiceTemplate.setToscaDefinitionsVersion("1.0.0");
+ toscaServiceTemplate.setVersion("1.0.1");
+ return toscaServiceTemplate;
+ }
+
+ private Map<String, ToscaPolicyType> getDummyPolicyTypesMap() {
+ Map<String, ToscaPolicyType> policyTypes = new HashMap<>();
+ policyTypes.put("onap.policies.Match", new ToscaPolicyType());
+ return policyTypes;
+ }
+
+ private Map<String, ToscaDataType> getDummyToscaDataTypeMap() {
+ Map<String, ToscaDataType> dataTypes = new HashMap<>();
+ dataTypes.put("onap.datatypes.ToscaConceptIdentifier", new ToscaDataType());
+ return dataTypes;
+ }
+
+ private Map<String, ToscaNodeTemplate> getDummyNodeTemplates() {
+ Map<String, ToscaNodeTemplate> nodeTemplates = new HashMap<>();
+ var nodeTemplate = new ToscaNodeTemplate();
+ nodeTemplate.setType("org.onap.policy.clamp.acm.AutomationCompositionElement");
+ nodeTemplates.put("org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", nodeTemplate);
+ return nodeTemplates;
+ }
+
+ private void checkParticipantDefinitionUpdate(ToscaServiceTemplate toscaServiceTemplate,
+ List<ParticipantDefinition> participantDefinitionUpdates) {
+
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
+ .getNodeTemplates().entrySet()) {
+ if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
+ toscaServiceTemplate)) {
+ AcmUtils.prepareParticipantDefinitionUpdate(id, toscaInputEntry.getKey(), toscaInputEntry.getValue(),
+ participantDefinitionUpdates, null);
+ }
+ }
+ }
+}
diff --git a/models/src/test/resources/META-INF/persistence.xml b/models/src/test/resources/META-INF/persistence.xml
index 54495a2fe..9bd136229 100644
--- a/models/src/test/resources/META-INF/persistence.xml
+++ b/models/src/test/resources/META-INF/persistence.xml
@@ -52,11 +52,11 @@
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTrigger</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoopElement</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics</class>
- <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionElement</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipantStatistics</class>
+ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaClElementStatistics</class>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
diff --git a/models/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml b/models/src/test/resources/examples/acm/PMSubscriptionHandling.yaml
index 8e8f3cd39..c8796ac49 100644
--- a/models/src/test/resources/examples/controlloop/PMSubscriptionHandling.yaml
+++ b/models/src/test/resources/examples/acm/PMSubscriptionHandling.yaml
@@ -26,8 +26,8 @@ data_types:
version:
type: string
required: true
- org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo:
- name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo
+ org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo:
+ name: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo
version: 0.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -303,14 +303,14 @@ policy_types:
derived_from: onap.policies.Monitoring
metadata: {}
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
required: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -327,11 +327,11 @@ node_types:
- greater-or-equal: 0
metadata:
common: true
- description: A value indicating the start phase in which this control loop element will be started, the
- first start phase is zero. Control Loop Elements are started in their start_phase order and stopped
- in reverse start phase order. Control Loop Elements with the same start phase are started and
- stopped simultaneously
- org.onap.policy.clamp.controlloop.ControlLoop:
+ description: A value indicating the start phase in which this automation composition element will be started,
+ the first start phase is zero. Automation composition elements are started in their start_phase
+ order and stopped in reverse start phase order. Automation composition elements with the same start
+ phase are started and stopped simultaneously
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -343,9 +343,9 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
dcae_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -357,10 +357,10 @@ node_types:
type: list
required: false
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo
- org.onap.policy.clamp.controlloop.PolicyControlLoopElement:
+ type: org.onap.datatypes.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElementConsulInfo
+ org.onap.policy.clamp.acm.PolicyAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
policy_type_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -368,9 +368,9 @@ node_types:
policy_id:
type: onap.datatypes.ToscaConceptIdentifier
required: false
- org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ org.onap.policy.clamp.acm.CDSAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
cds_blueprint_id:
type: onap.datatypes.ToscaConceptIdentifier
@@ -390,36 +390,36 @@ topology_template:
name: operational.apex.pmcontrol
version: 1.0.0
node_templates:
- org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ org.onap.policy.acm.PolicyAutomationCompositionParticipant:
version: 2.3.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
- org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant:
version: 2.2.1
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for DCAE microservices
properties:
provider: ONAP
org.onap.domain.pmsh.PMSH_DCAEMicroservice:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement
+ type: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant
version: 2.3.4
dcae_blueprint:
tosca_definitions_version: cloudify_dsl_1_3
@@ -635,64 +635,64 @@ topology_template:
managedObjectDNsBasic:
- DN: dnc
- DN: dnd
- org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ description: Automation composition element for the monitoring policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.3.1
policy_type_id:
name: onap.policies.monitoring.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_monitoring_policy
- org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+ type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for the operational policy for Performance Management Subscription Handling
+ description: Automation composition element for the operational policy for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ name: org.onap.policy.acm.PolicyAutomationCompositionParticipant
version: 2.2.1
policy_type_id:
name: onap.policies.operational.pm-subscription-handler
version: 1.0.0
policy_id:
get_input: pmsh_operational_policy
- org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.CDSControlLoopElement
+ type: org.onap.policy.clamp.acm.CDSAutomationCompositionElement
type_version: 1.0.0
- description: Control loop element for CDS for Performance Management Subscription Handling
+ description: Automation composition element for CDS for Performance Management Subscription Handling
properties:
provider: Ericsson
participantType:
- name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant
version: 3.2.1
cds_blueprint_id:
name: org.onap.ccsdk.cds.PMSHCdsBlueprint
version: 1.0.0
- org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ org.onap.domain.pmsh.PMSHAutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for Performance Management Subscription Handling
+ description: Automation composition for Performance Management Subscription Handling
properties:
provider: Ericsson
elements:
- name: org.onap.domain.pmsh.PMSH_DCAEMicroservice
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement
version: 1.2.3
- - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement
version: 1.2.3
policies:
- MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test:
@@ -753,7 +753,7 @@ topology_template:
onap.datatypes.monitoring.managedObjectDNsBasic:
DN: dnd
- operational.apex.pmcontrol:
- type: onap.policies.controlloop.operational.common.Apex
+ type: onap.policies.acm.operational.common.Apex
type_version: 1.0.0
version: 1.0.0
metadata:
@@ -3212,7 +3212,7 @@ topology_template:
jsonAdapters:
Instant:
adaptedClass: java.time.Instant
- adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter
+ adaptorClass: org.onap.policy.acm.util.Serialization$GsonInstantAdapter
eventInputParameters:
DCAEConsumer:
carrierTechnologyParameters:
diff --git a/models/src/test/resources/json/ControlLoopElementNoOrderedState.json b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
index 33a63e604..872499abf 100644
--- a/models/src/test/resources/json/ControlLoopElementNoOrderedState.json
+++ b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json
@@ -1,7 +1,7 @@
{
"id": "a95757ba-b34a-4049-a2a8-46773abcbe5e",
"definition": {
- "name": "cleDef",
+ "name": "aceDef",
"version": "0.0.1"
},
"participantType": {
diff --git a/models/src/test/resources/json/ControlLoopNoOrderedState.json b/models/src/test/resources/json/AutomationCompositionNoOrderedState.json
index 6bff97580..d61a61117 100644
--- a/models/src/test/resources/json/ControlLoopNoOrderedState.json
+++ b/models/src/test/resources/json/AutomationCompositionNoOrderedState.json
@@ -1,12 +1,12 @@
{
"definition": {
- "name": "controlLoopDefinitionName",
+ "name": "automationCompositionDefinitionName",
"version": "0.0.1"
},
"state": "UNINITIALISED",
"orderedState": null,
"elements": [
],
- "name": "control-loop",
+ "name": "automation-composition",
"version": "0.0.1"
}
diff --git a/models/src/test/resources/providers/TestClElementStatistics.json b/models/src/test/resources/providers/TestAcElementStatistics.json
index ae19e560d..cceb91d14 100644
--- a/models/src/test/resources/providers/TestClElementStatistics.json
+++ b/models/src/test/resources/providers/TestAcElementStatistics.json
@@ -1,5 +1,5 @@
{
- "clElementStatistics":[
+ "acElementStatistics":[
{
"participantId":{
"name":"name1",
@@ -7,8 +7,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
"timeStamp": "2021-01-10T13:45:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":250
+ "state": "UNINITIALISED",
+ "acElementUptime":250
},
{
"participantId":{
@@ -17,8 +17,8 @@
},
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"timeStamp": "2021-01-10T14:25:00.000Z",
- "controlLoopState": "UNINITIALISED",
- "clElementUptime":330
+ "state": "UNINITIALISED",
+ "acElementUptime":330
}
]
}
diff --git a/models/src/test/resources/providers/TestControlLoops.json b/models/src/test/resources/providers/TestAutomationCompositions.json
index fedda9600..906785244 100644
--- a/models/src/test/resources/providers/TestControlLoops.json
+++ b/models/src/test/resources/providers/TestAutomationCompositions.json
@@ -1,8 +1,8 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -15,63 +15,63 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE automation composition element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS automation composition element for the PMSH instance 0 automation composition"
}
},
"name": "PMSHInstance0",
"version": "1.0.1",
- "description": "PMSH control loop instance 0"
+ "description": "PMSH automation composition instance 0"
},
{
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "UNINITIALISED",
@@ -84,59 +84,59 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "DCAE Control Loop Element for the PMSH instance 1 control loop"
+ "description": "DCAE automation composition element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c25": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c25",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Monitoring Policy element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c26": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c26",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop"
+ "description": "Operational Policy element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c27": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c27",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
- "description": "CDS Control Loop Element for the PMSH instance 1 control loop"
+ "description": "CDS element for the PMSH instance 1 automation composition"
}
},
"name": "PMSHInstance1",
"version": "1.0.1",
- "description": "PMSH control loop instance 1"
+ "description": "PMSH automation composition instance 1"
}
]
}
diff --git a/models/src/test/resources/providers/TestParticipant.json b/models/src/test/resources/providers/TestParticipant.json
index 4722ead9b..7e4f9540f 100644
--- a/models/src/test/resources/providers/TestParticipant.json
+++ b/models/src/test/resources/providers/TestParticipant.json
@@ -2,14 +2,14 @@
"name": "dummy_participant1",
"version": "1.0.1",
"definition":{
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"participantState": "PASSIVE",
"healthStatus": "HEALTHY",
"description": "A dummy PMSH participant1",
"participantType":{
- "name": "org.onap.domain.pmsh.PolicyControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PolicyAutomationCompositionDefinition",
"version": "1.0.0"
}
}
diff --git a/models/src/test/resources/providers/UpdateControlLoops.json b/models/src/test/resources/providers/UpdateAutomationCompositions.json
index 2d6bd0753..f118ea799 100644
--- a/models/src/test/resources/providers/UpdateControlLoops.json
+++ b/models/src/test/resources/providers/UpdateAutomationCompositions.json
@@ -1,15 +1,15 @@
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
"definition": {
- "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "PMSH control loop instance 0",
+ "description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
@@ -18,54 +18,54 @@
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
"version": "2.3.4"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ "description": "DCAE element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Monitoring Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "2.3.1"
},
"participantType": {
- "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "1.0.0"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ "description": "Operational Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
"definition": {
- "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement",
+ "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
"participantType": {
- "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant",
+ "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
"version": "2.2.1"
},
"state": "RUNNING",
"orderedState": "RUNNING",
- "description": "CDS Control Loop Element for the PMSH instance 0 control loop"
+ "description": "CDS element for the PMSH instance 0 automation composition"
}
}
}