summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-09-23 12:36:17 +0100
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2024-09-24 09:38:53 +0000
commit5d09a374c9947f32e8b942fd35bcdfbee4dc8acb (patch)
tree2e4743d051086857ac65d6d68aa612d50daf8d84 /cps-ncmp-service/src/test/groovy
parent7ff089b982cf195b2ec599e1cf6df441bcc21138 (diff)
Revert "Correctly report trust level if DMI is down"
This reverts commit https://gerrit.onap.org/r/c/cps/+/138853 Reason for revert: Commit caused performance issues in CM handle search Manual rebase was required to integrate changes for alternate-id support made since original commit was merged. Issue-ID: CPS-2375 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I5ef743ea053589fa17c10587317a3534c2714c4b
Diffstat (limited to 'cps-ncmp-service/src/test/groovy')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy3
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy11
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManagerSpec.groovy5
3 files changed, 11 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
index 9e07de48bf..fec07556eb 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
@@ -244,8 +244,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
and: 'query cm handle method returns two cm handles'
mockParameterizedCmHandleQueryService.queryCmHandles(
spiedJsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class))
- >> [new YangModelCmHandle(id: 'ch-0', dmiProperties: [], publicProperties: []),
- new YangModelCmHandle(id: 'ch-1', dmiProperties: [], publicProperties: [])]
+ >> [new NcmpServiceCmHandle(cmHandleId: 'ch-0'), new NcmpServiceCmHandle(cmHandleId: 'ch-1')]
and: 'a trust level for cm handles'
mockTrustLevelManager.getEffectiveTrustLevel(*_) >> TrustLevel.COMPLETE
when: 'execute cm handle search is called'
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy
index 08644202c6..013bace04d 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2024 Nordix Foundation
+ * 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.
@@ -22,6 +22,7 @@ package org.onap.cps.ncmp.impl.inventory
import org.onap.cps.cpspath.parser.PathParsingException
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters
+import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.spi.FetchDescendantsOption
import org.onap.cps.spi.exceptions.DataInUseException
@@ -138,10 +139,10 @@ class ParameterizedCmHandleQueryServiceSpec extends Specification {
and: 'the inventory service is called with teh correct if and returns a yang model cm handle'
1 * mockInventoryPersistence.getYangModelCmHandles(['ch1']) >>
[new YangModelCmHandle(id: 'abc', dmiProperties: [new YangModelCmHandle.Property('name','value')], publicProperties: [])]
- and: 'the expected cm handle(s) are returned as Yang Model cm handles'
- assert result[0] instanceof YangModelCmHandle
+ and: 'the expected cm handle(s) are returned as NCMP Service cm handles'
+ assert result[0] instanceof NcmpServiceCmHandle
assert result.size() == 1
- assert result[0].dmiProperties.size() == 1
+ assert result[0].dmiProperties == [name:'value']
}
def 'Query cm handle ids when the query is empty.'() {
@@ -164,7 +165,7 @@ class ParameterizedCmHandleQueryServiceSpec extends Specification {
def result = objectUnderTest.queryCmHandles(cmHandleQueryParameters)
then: 'the correct cm handles are returned'
assert result.size() == 4
- assert result.id.containsAll('PNFDemo1', 'PNFDemo2', 'PNFDemo3', 'PNFDemo4')
+ assert result.cmHandleId.containsAll('PNFDemo1', 'PNFDemo2', 'PNFDemo3', 'PNFDemo4')
}
def 'Query CMHandleId with #scenario.' () {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManagerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManagerSpec.groovy
index 7dc9602e46..fe762f891a 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManagerSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManagerSpec.groovy
@@ -25,6 +25,7 @@ import org.onap.cps.ncmp.api.inventory.models.TrustLevel
import org.onap.cps.ncmp.impl.inventory.InventoryPersistence
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.utils.events.CmAvcEventPublisher
+import spock.lang.Ignore
import spock.lang.Specification
class TrustLevelManagerSpec extends Specification {
@@ -135,13 +136,15 @@ class TrustLevelManagerSpec extends Specification {
0 * mockAttributeValueChangeEventPublisher.publishAvcEvent(*_)
}
+ @Ignore
+ // TODO: CPS-2375
def 'Select effective trust level among CmHandle and dmi plugin'() {
given: 'a non trusted dmi'
trustLevelPerDmiPlugin.put('my-dmi', TrustLevel.NONE)
and: 'a trusted CmHandle'
trustLevelPerCmHandle.put('ch-1', TrustLevel.COMPLETE)
when: 'effective trust level selected'
- def effectiveTrustLevel = objectUnderTest.getEffectiveTrustLevel('my-dmi', 'ch-1')
+ def effectiveTrustLevel = objectUnderTest.getEffectiveTrustLevel('ch-1')
then: 'effective trust level is trusted'
assert effectiveTrustLevel == TrustLevel.NONE
}