X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=cps-ncmp-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Finventory%2FCompositeStateBuilderSpec.groovy;h=c2cdd9bc2ee43f0d866080e1def4cb76efab9cba;hb=21171253eb47349832e1e1d4952a42051c19be05;hp=fa437987b5d0949bceae206d822cae44ec00feea;hpb=bef15a680d6cf10acea2ddb52b281284f8a83247;p=cps.git diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CompositeStateBuilderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CompositeStateBuilderSpec.groovy index fa437987b..c2cdd9bc2 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CompositeStateBuilderSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CompositeStateBuilderSpec.groovy @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2022 Bell Canada - * Modifications Copyright (C) 2022 Nordix Foundation. + * Modifications Copyright (C) 2022-2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,13 @@ package org.onap.cps.ncmp.api.inventory +import org.onap.cps.ncmp.api.impl.inventory.CmHandleState +import org.onap.cps.ncmp.api.impl.inventory.CompositeState +import org.onap.cps.ncmp.api.impl.inventory.CompositeStateBuilder +import org.onap.cps.ncmp.api.impl.inventory.DataStoreSyncState +import org.onap.cps.ncmp.api.impl.inventory.LockReasonCategory import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.DataNodeBuilder -import org.onap.cps.ncmp.api.inventory.CompositeStateBuilder import spock.lang.Specification import java.time.OffsetDateTime @@ -38,7 +42,7 @@ class CompositeStateBuilderSpec extends Specification { def static cmHandleId = 'myHandle1' def static cmHandleXpath = "/dmi-registry/cm-handles[@id='${cmHandleId}/state']" def static stateDataNodes = [new DataNodeBuilder().withXpath("/dmi-registry/cm-handles[@id='${cmHandleId}']/state/lock-reason") - .withLeaves(['reason': 'LOCKED_MODULE_SYNC_FAILED', 'details': 'lock details']).build(), + .withLeaves(['reason': 'MODULE_SYNC_FAILED', 'details': 'lock details']).build(), new DataNodeBuilder().withXpath("/dmi-registry/cm-handles[@id='${cmHandleId}']/state/datastores") .withChildDataNodes(Arrays.asList(new DataNodeBuilder() .withXpath("/dmi-registry/cm-handles[@id='${cmHandleId}']/state/datastores/operational") @@ -48,7 +52,7 @@ class CompositeStateBuilderSpec extends Specification { def "Composite State Specification"() { when: 'using composite state builder ' def compositeState = new CompositeStateBuilder().withCmHandleState(CmHandleState.ADVISED) - .withLockReason(LockReasonCategory.LOCKED_MODULE_SYNC_FAILED,"").withOperationalDataStores(DataStoreSyncState.UNSYNCHRONIZED, + .withLockReason(LockReasonCategory.MODULE_SYNC_FAILED,"").withOperationalDataStores(DataStoreSyncState.UNSYNCHRONIZED, formattedDateAndTime.toString()).withLastUpdatedTime(formattedDateAndTime).build() then: 'it matches expected cm handle state and data store sync state' assert compositeState.cmHandleState == CmHandleState.ADVISED @@ -69,7 +73,7 @@ class CompositeStateBuilderSpec extends Specification { def finalCompositeStateBuilder = new CompositeStateBuilder() .withCmHandleState(CmHandleState.ADVISED) .withLastUpdatedTime(formattedDateAndTime.toString()) - .withLockReason(LockReasonCategory.LOCKED_MODULE_SYNC_FAILED, 'locked details') + .withLockReason(LockReasonCategory.MODULE_SYNC_FAILED, 'locked details') .withOperationalDataStores(DataStoreSyncState.SYNCHRONIZED, formattedDateAndTime) when: 'build is called' def result = finalCompositeStateBuilder.build() @@ -78,7 +82,7 @@ class CompositeStateBuilderSpec extends Specification { and: 'built result should have correct values' assert !result.getDataSyncEnabled() assert result.getLastUpdateTime() == formattedDateAndTime - assert result.getLockReason().getLockReasonCategory() == LockReasonCategory.LOCKED_MODULE_SYNC_FAILED + assert result.getLockReason().getLockReasonCategory() == LockReasonCategory.MODULE_SYNC_FAILED assert result.getLockReason().getDetails() == 'locked details' assert result.getCmHandleState() == CmHandleState.ADVISED assert result.getDataStores().getOperationalDataStore().getDataStoreSyncState() == DataStoreSyncState.SYNCHRONIZED