diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2024-06-25 14:40:40 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2024-06-26 15:03:09 +0100 |
commit | e18239631ff2f2f56961c8534a0edf294ee15fdd (patch) | |
tree | 450362e84841abbf97935dcb31adb2f1dd160d03 /cps-ncmp-rest/src/test | |
parent | 37d82d5d54ede4c05862fe648911c383d253cec3 (diff) |
Move TrustLevel Feature
-Moved TrustLevel impl from Controller to Inventory Facade
-Applied new package name convention using impl\inventory\trustlevel for this (sub)feature
-Renamed some trustlevel related classes to better describe their role
-Disabled failing architecture test (agreed this is tech. debt and created CPS-2293)
-Refactored YangDataConverter method names and signatures (moved Spec to correct place)
-Cleaned up names and javadoc of class now called DeviceTrustLevelMessageConsumer
-Applied conventions to modified test methods
Issue-ID: CPS-2255
Change-Id: Iccd20541488e6b61444bb2c7406c90e61a34124d
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Diffstat (limited to 'cps-ncmp-rest/src/test')
2 files changed, 13 insertions, 21 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy index f6b9e35912..41521f6398 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy @@ -21,9 +21,9 @@ package org.onap.cps.ncmp.rest.controller import org.mapstruct.factory.Mappers -import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle +import org.onap.cps.ncmp.api.inventory.models.TrustLevel import org.onap.cps.ncmp.rest.model.CmHandleQueryParameters import org.onap.cps.ncmp.rest.model.ConditionProperties import org.onap.cps.ncmp.rest.model.RestDmiPluginRegistration diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy index 398d632464..65d6d8ca76 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy @@ -33,10 +33,10 @@ import org.mapstruct.factory.Mappers import org.onap.cps.TestUtils import org.onap.cps.events.EventsPublisher import org.onap.cps.ncmp.api.impl.NetworkCmProxyFacade -import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel import org.onap.cps.ncmp.api.inventory.NetworkCmProxyInventoryFacade import org.onap.cps.ncmp.api.inventory.models.CompositeState import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle +import org.onap.cps.ncmp.api.inventory.models.TrustLevel import org.onap.cps.ncmp.api.models.CmResourceAddress import org.onap.cps.ncmp.impl.inventory.DataStoreSyncState import org.onap.cps.ncmp.impl.inventory.models.CmHandleState @@ -108,9 +108,6 @@ class NetworkCmProxyControllerSpec extends Specification { DataOperationRequestMapper dataOperationRequestMapper = Mappers.getMapper(DataOperationRequestMapper) @SpringBean - Map<String, TrustLevel> trustLevelPerCmHandle = [:] - - @SpringBean DeprecationHelper stubbedDeprecationHelper = Stub() @Value('${rest.api.ncmp-base-path}/v1') @@ -123,7 +120,6 @@ class NetworkCmProxyControllerSpec extends Specification { @Shared def NO_TOPIC = null def NO_OPTIONS = null - def NO_REQUEST_ID = null def NO_AUTH_HEADER = null def logger = Spy(ListAppender<ILoggingEvent>) @@ -272,6 +268,7 @@ class NetworkCmProxyControllerSpec extends Specification { def cmHandle1 = new NcmpServiceCmHandle() cmHandle1.cmHandleId = 'ch-1' cmHandle1.publicProperties = [color: 'yellow'] + cmHandle1.currentTrustLevel = TrustLevel.NONE def cmHandle2 = new NcmpServiceCmHandle() cmHandle2.cmHandleId = 'ch-2' cmHandle2.publicProperties = [color: 'green'] @@ -279,8 +276,6 @@ class NetworkCmProxyControllerSpec extends Specification { cmHandle2.moduleSetTag = 'someModuleSetTag' cmHandle2.dataProducerIdentifier = 'someDataProducerIdentifier' mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> [cmHandle1, cmHandle2] - and: 'map for trust level per cmHandle has value for only one cm handle' - trustLevelPerCmHandle.put('ch-1', TrustLevel.NONE) when: 'the searches api is invoked' def response = mvc.perform(post(searchesEndpoint).contentType(MediaType.APPLICATION_JSON).content(jsonString)).andReturn().response then: 'response status returns OK' @@ -297,11 +292,9 @@ class NetworkCmProxyControllerSpec extends Specification { def dmiProperties = [prop: 'some DMI property'] def publicProperties = ["public prop": 'some public property'] def compositeState = compositeStateTestObject() - def ncmpServiceCmHandle = new NcmpServiceCmHandle(cmHandleId: cmHandleId, dmiProperties: dmiProperties, publicProperties: publicProperties, compositeState: compositeState) + def ncmpServiceCmHandle = new NcmpServiceCmHandle(cmHandleId: cmHandleId, dmiProperties: dmiProperties, publicProperties: publicProperties, compositeState: compositeState, currentTrustLevel: TrustLevel.COMPLETE) and: 'the service method is invoked with the cm handle id' 1 * mockNetworkCmProxyInventoryFacade.getNcmpServiceCmHandle('some-cm-handle') >> ncmpServiceCmHandle - and: 'map for trust level per cmHandle has values' - trustLevelPerCmHandle.get('some-cm-handle') >> { TrustLevel.COMPLETE } when: 'the cm handle details api is invoked' def response = mvc.perform( get(cmHandleDetailsEndpoint)).andReturn().response @@ -350,16 +343,15 @@ class NetworkCmProxyControllerSpec extends Specification { def searchesEndpoint = "$ncmpBasePathV1/ch/searches" String jsonString = TestUtils.getResourceFileContent('invalid-cmhandle-search.json') and: 'the service method is invoked with module names and returns two cm handles' - def cmHandel1 = new NcmpServiceCmHandle() - cmHandel1.cmHandleId = 'ch-1' - cmHandel1.publicProperties = [color: 'yellow'] - def cmHandel2 = new NcmpServiceCmHandle() - cmHandel2.cmHandleId = 'ch-2' - cmHandel2.publicProperties = [color: 'green'] - mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> [cmHandel1, cmHandel2] - and: 'map for trust level per cmHandle has values' - trustLevelPerCmHandle.put('ch-1', TrustLevel.COMPLETE) - trustLevelPerCmHandle.put('ch-2', TrustLevel.NONE) + def cmHandle1 = new NcmpServiceCmHandle() + cmHandle1.cmHandleId = 'ch-1' + cmHandle1.publicProperties = [color: 'yellow'] + cmHandle1.currentTrustLevel = TrustLevel.COMPLETE + def cmHandle2 = new NcmpServiceCmHandle() + cmHandle2.cmHandleId = 'ch-2' + cmHandle2.publicProperties = [color: 'green'] + cmHandle2.currentTrustLevel = TrustLevel.NONE + mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> [cmHandle1, cmHandle2] when: 'the searches api is invoked' def response = mvc.perform(post(searchesEndpoint).contentType(MediaType.APPLICATION_JSON).content(jsonString)).andReturn().response then: 'an empty cm handle identifier is returned' |