From: Toine Siebelink Date: Tue, 14 Nov 2023 15:51:39 +0000 (+0000) Subject: Merge "Adjust performance test timings" X-Git-Tag: 3.4.1~37 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=0fdda53aa0dde9ec3a4c1b287b3ff8da4a75da5c;hp=09086b5a7ce9a7467b42c6a86374f22318aaa4cd;p=cps.git Merge "Adjust performance test timings" --- diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index e1ff400c8..1f87a1ef9 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -101,6 +101,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService private final CpsDataService cpsDataService; private final IMap moduleSyncStartedOnCmHandles; private final Map trustLevelPerCmHandle; + private final Map trustLevelPerDmiPlugin; @Override public DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule( @@ -108,15 +109,17 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService dmiPluginRegistration.validateDmiPluginRegistration(); final DmiPluginRegistrationResponse dmiPluginRegistrationResponse = new DmiPluginRegistrationResponse(); + setTrustLevelPerDmiPlugin(dmiPluginRegistration); + if (!dmiPluginRegistration.getRemovedCmHandles().isEmpty()) { dmiPluginRegistrationResponse.setRemovedCmHandles( parseAndProcessDeletedCmHandlesInRegistration(dmiPluginRegistration.getRemovedCmHandles())); } if (!dmiPluginRegistration.getCreatedCmHandles().isEmpty()) { - populateTrustLevelPerCmHandleCache(dmiPluginRegistration); dmiPluginRegistrationResponse.setCreatedCmHandles( parseAndProcessCreatedCmHandlesInRegistration(dmiPluginRegistration)); + populateTrustLevelPerCmHandleCache(dmiPluginRegistration); } if (!dmiPluginRegistration.getUpdatedCmHandles().isEmpty()) { dmiPluginRegistrationResponse.setUpdatedCmHandles( @@ -128,6 +131,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService dmiPluginRegistrationResponse.setUpgradedCmHandles( parseAndProcessUpgradedCmHandlesInRegistration(dmiPluginRegistration)); } + return dmiPluginRegistrationResponse; } @@ -521,4 +525,12 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } } + private void setTrustLevelPerDmiPlugin(final DmiPluginRegistration dmiPluginRegistration) { + if (DmiPluginRegistration.isNullEmptyOrBlank(dmiPluginRegistration.getDmiDataPlugin())) { + trustLevelPerDmiPlugin.put(dmiPluginRegistration.getDmiPlugin(), TrustLevel.COMPLETE); + } else { + trustLevelPerDmiPlugin.put(dmiPluginRegistration.getDmiDataPlugin(), TrustLevel.COMPLETE); + } + } + } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy index 5588ec781..9f15e1fa5 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy @@ -69,6 +69,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { def mockCpsDataService = Mock(CpsDataService) def mockModuleSyncStartedOnCmHandles = Mock(IMap) def trustLevelPerCmHandle = [:] + def trustLevelPerDmiPlugin = [:] def objectUnderTest = getObjectUnderTest() def 'DMI Registration: Create, Update, Delete & Upgrade operations are processed in the right order'() { @@ -160,11 +161,14 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration) then: 'create cm handles registration and sync modules is called with the correct plugin information' 1 * objectUnderTest.parseAndProcessCreatedCmHandlesInRegistration(dmiPluginRegistration) + and: 'dmi is added to the dmi trustLevel map' + assert trustLevelPerDmiPlugin.size() == 1 + assert trustLevelPerDmiPlugin.containsKey(expectedDmiPluginRegisteredName) where: - scenario | dmiPlugin | dmiModelPlugin | dmiDataPlugin - 'combined DMI plugin' | 'service1' | '' | '' - 'data & model DMI plugins' | '' | 'service1' | 'service2' - 'data & model using same service' | '' | 'service1' | 'service1' + scenario | dmiPlugin | dmiModelPlugin | dmiDataPlugin || expectedDmiPluginRegisteredName + 'combined DMI plugin' | 'service1' | '' | '' || 'service1' + 'data & model DMI plugins' | '' | 'service1' | 'service2' || 'service2' + 'data & model using same service' | '' | 'service1' | 'service1' || 'service1' } def 'Create CM-handle Validation: Invalid DMI plugin service name with #scenario'() { @@ -435,7 +439,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { return Spy(new NetworkCmProxyDataServiceImpl(spiedJsonObjectMapper, mockDmiDataOperations, mockNetworkCmProxyDataServicePropertyHandler, mockInventoryPersistence, mockCmHandleQueries, stubbedNetworkCmProxyCmHandlerQueryService, mockLcmEventsCmHandleStateHandler, mockCpsDataService, - mockModuleSyncStartedOnCmHandles, trustLevelPerCmHandle)) + mockModuleSyncStartedOnCmHandles, trustLevelPerCmHandle, trustLevelPerDmiPlugin)) } def addPersistedYangModelCmHandles(ids) { diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy index af65cfc1a..71511cc16 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy @@ -76,6 +76,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { def mockCpsCmHandlerQueryService = Mock(NetworkCmProxyCmHandleQueryService) def mockLcmEventsCmHandleStateHandler = Mock(LcmEventsCmHandleStateHandler) def stubModuleSyncStartedOnCmHandles = Stub(IMap) + def stubTrustLevelPerCmHandle = Stub(Map) def stubTrustLevelPerDmiPlugin = Stub(Map) def NO_TOPIC = null @@ -95,6 +96,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockLcmEventsCmHandleStateHandler, mockCpsDataService, stubModuleSyncStartedOnCmHandles, + stubTrustLevelPerCmHandle, stubTrustLevelPerDmiPlugin) def cmHandleXPath = "/dmi-registry/cm-handles[@id='testCmHandle']"