summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2022-08-18 10:15:43 +0100
committerToineSiebelink <toine.siebelink@est.tech>2022-08-18 10:22:58 +0100
commitd3c353e8293fc31d443fa39f76eadb187039015b (patch)
tree4c96ecb1f4ca95235fc31d7de53f895f3d86295d
parent060499cb5a89a0fd3d8480132ed82d2e291839dc (diff)
Ensure Additional Properties for CM Handles are included
- seems like bug is not present on master - modified test to ensure the behavior is tested now - (intelliJ) cleaned up so unused stuff Issue-ID: CPS-1212 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I6882df4277e50ef869c6a1e9b093ee83dbcdf78e
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdogSpec.groovy3
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy12
2 files changed, 13 insertions, 2 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdogSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdogSpec.groovy
index 863977a64f..81268cbc0b 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdogSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdogSpec.groovy
@@ -21,12 +21,11 @@
package org.onap.cps.ncmp.api.inventory.sync
-import org.mockito.Mock
+
import org.onap.cps.ncmp.api.impl.event.lcm.LcmEventsCmHandleStateHandler
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
import org.onap.cps.ncmp.api.inventory.CmHandleState
import org.onap.cps.ncmp.api.inventory.CompositeState
-import org.onap.cps.ncmp.api.inventory.DataStoreSyncState
import org.onap.cps.ncmp.api.inventory.InventoryPersistence
import org.onap.cps.ncmp.api.inventory.LockReasonCategory
import org.onap.cps.ncmp.api.inventory.CompositeStateBuilder
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
index 82e9d33ae7..fb4ca3933d 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
@@ -62,13 +62,25 @@ class SyncUtilsSpec extends Specification{
@Shared
def dataNode = new DataNode(leaves: ['id': 'cm-handle-123'])
+ @Shared
+ def dataNodeAdditionalProperties = new DataNode(leaves: ['name': 'dmiProp1', 'value': 'dmiValue1'])
+
+
def 'Get an advised Cm-Handle where ADVISED cm handle #scenario'() {
given: 'the inventory persistence service returns a collection of data nodes'
mockCmHandleQueries.getCmHandlesByState(CmHandleState.ADVISED) >> dataNodeCollection
+ and: 'we have some additional (dmi, private) properties'
+ dataNodeAdditionalProperties.xpath = dataNode.xpath + '/additional-properties[@name="dmiProp1"]'
+ dataNode.childDataNodes = [dataNodeAdditionalProperties]
when: 'get advised cm handles are fetched'
def yangModelCmHandles = objectUnderTest.getAdvisedCmHandles()
then: 'the returned data node collection is the correct size'
yangModelCmHandles.size() == expectedDataNodeSize
+ and: 'if there is a data node the additional (dmi, private) properties are included'
+ if (expectedDataNodeSize > 0) {
+ assert yangModelCmHandles[0].dmiProperties[0].name == 'dmiProp1'
+ assert yangModelCmHandles[0].dmiProperties[0].value == 'dmiValue1'
+ }
and: 'yang model collection contains the correct data'
yangModelCmHandles.stream().map(yangModel -> yangModel.id).collect(Collectors.toSet()) ==
dataNodeCollection.stream().map(dataNode -> dataNode.leaves.get("id")).collect(Collectors.toSet())