Registration Optimization remaining Code Comments 42/139542/1
authorToineSiebelink <toine.siebelink@est.tech>
Mon, 25 Nov 2024 09:37:31 +0000 (09:37 +0000)
committerToineSiebelink <toine.siebelink@est.tech>
Mon, 25 Nov 2024 09:37:31 +0000 (09:37 +0000)
Issue-ID: CPS-2478
Change-Id: I0aa3804225f053ff99176056fe71322a23cff31c
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/DmiModelOperations.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncServiceSpec.groovy
integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/ModuleSyncWatchdogIntegrationSpec.groovy

index a056efd..2d45103 100644 (file)
@@ -34,7 +34,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
 import org.onap.cps.ncmp.api.inventory.models.YangResource;
 import org.onap.cps.ncmp.impl.dmi.DmiProperties;
 import org.onap.cps.ncmp.impl.dmi.DmiRestClient;
@@ -50,7 +49,6 @@ import org.springframework.stereotype.Service;
 /**
  * Operations class for DMI Model.
  */
-@Slf4j
 @RequiredArgsConstructor
 @Service
 public class DmiModelOperations {
index e479fff..d00d3ab 100644 (file)
@@ -44,7 +44,6 @@ abstract class DmiOperationsBaseSpec extends Specification {
     ObjectMapper spyObjectMapper = Spy()
 
     def yangModelCmHandle = new YangModelCmHandle()
-    def otherYangModelCmHandle = new YangModelCmHandle()
     def static dmiServiceName = 'myServiceName'
     def static cmHandleId = 'some-cm-handle'
     def static alternateId = 'alt-id-' + cmHandleId
index 2f13a9a..f5c4ea4 100644 (file)
@@ -91,7 +91,7 @@ class ModuleSyncServiceSpec extends Specification {
             def yangModelCmHandle = createAdvisedCmHandle(moduleSetTag)
         and: 'the service returns a list of module references when queried with the specified attributes'
             mockCpsModuleService.getModuleReferencesByAttribute(*_) >> [new ModuleReference('module1', '1')]
-        and: 'exception occurs when try to store result'
+        and: 'exception occurs when trying to store result'
             def testException = new RuntimeException('test')
             mockCpsModuleService.createSchemaSetFromModules(*_) >> { throw testException }
         when: 'module sync is triggered'
@@ -110,7 +110,7 @@ class ModuleSyncServiceSpec extends Specification {
     def 'Sync models for a cm handle with previously cached module set tag.'() {
         given: 'a cm handle to be synced'
             def yangModelCmHandle = createAdvisedCmHandle('cached-tag')
-        and: 'The module set tag exist in the private cache'
+        and: 'The module set tag exists in the private cache'
             def moduleReferences = [ new ModuleReference('module1','1') ]
             def cachedModuleDelta = new ModuleDelta(moduleReferences, [:])
             objectUnderTest.privateModuleSetCache.put('cached-tag', cachedModuleDelta)
@@ -125,7 +125,7 @@ class ModuleSyncServiceSpec extends Specification {
     def 'Attempt to sync using a module set tag already being processed by a different instance or thread.'() {
         given: 'a cm handle to be synced'
             def yangModelCmHandle = createAdvisedCmHandle('duplicateTag')
-        and: 'The module set tag already exist in the processing semaphore set'
+        and: 'The module set tag already exists in the processing semaphore set'
             mockModuleSetTagsBeingProcessed.add('duplicate-processing-tag') > false
         when: 'module sync is triggered'
             objectUnderTest.syncAndCreateSchemaSetAndAnchor(yangModelCmHandle)
index 02a10cf..aea5c10 100644 (file)
@@ -266,9 +266,9 @@ abstract class CpsIntegrationSpecBase extends Specification {
     def registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(dmiPlugin, moduleSetTag, numberOfCmHandles, offset) {
         def cmHandles = []
         def id = offset
-        def moduleReferences = (1..200).collect { moduleSetTag + '_Module_' + it.toString() }
+        def moduleReferences = (1..200).collect {  "${moduleSetTag}Module${it}" }
         (1..numberOfCmHandles).each {
-            def ncmpServiceCmHandle = new NcmpServiceCmHandle(cmHandleId: 'ch-'+id, moduleSetTag: moduleSetTag, alternateId: NO_ALTERNATE_ID)
+            def ncmpServiceCmHandle = new NcmpServiceCmHandle(cmHandleId: "ch-${id}", moduleSetTag: moduleSetTag, alternateId: NO_ALTERNATE_ID)
             cmHandles.add(ncmpServiceCmHandle)
             dmiDispatcher1.moduleNamesPerCmHandleId[ncmpServiceCmHandle.cmHandleId] = moduleReferences
             dmiDispatcher2.moduleNamesPerCmHandleId[ncmpServiceCmHandle.cmHandleId] = moduleReferences
index 963bc1f..20fa546 100644 (file)
@@ -132,7 +132,7 @@ class ModuleSyncWatchdogIntegrationSpec extends CpsIntegrationSpecBase {
     }
 
     def logInstrumentation(timer, description) {
-        System.out.println('*** CPS-2478, ' + description + ' : ' + timer.count()+ ' times, total ' + timer.totalTime(TimeUnit.MILLISECONDS) + ' ms')
+        println "*** CPS-2478, $description : Invoked ${timer.count()} times, Total Time: ${timer.totalTime(TimeUnit.MILLISECONDS)} ms, Mean Time: ${timer.mean(TimeUnit.MILLISECONDS)} ms"
         return true
     }