Fix SonarQube warnings
[cps.git] / cps-ncmp-rest / src / test / groovy / org / onap / cps / ncmp / rest / controller / handlers / NcmpDatastoreRequestHandlerSpec.groovy
index ddeac51..bdd0e71 100644 (file)
@@ -25,6 +25,7 @@ import org.onap.cps.ncmp.api.impl.exception.InvalidDatastoreException
 import org.onap.cps.ncmp.api.impl.exception.InvalidOperationException
 import org.onap.cps.ncmp.api.models.DataOperationDefinition
 import org.onap.cps.ncmp.api.models.DataOperationRequest
+import org.onap.cps.ncmp.api.models.CmResourceAddress
 import org.onap.cps.ncmp.rest.exceptions.OperationNotSupportedException
 import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor
 import spock.lang.Specification
@@ -48,12 +49,13 @@ class NcmpDatastoreRequestHandlerSpec extends Specification {
             objectUnderTest.notificationFeatureEnabled = notificationFeatureEnabled
         and: 'a flag to track the network service call'
             def networkServiceMethodCalled = false
+        and: 'a CM resource address'
+            def cmResourceAddress = new CmResourceAddress('ds', 'ch1', 'resource1')
         and: 'the (mocked) service will use the flag to indicate if it is called'
-            mockNetworkCmProxyDataService.getResourceDataForCmHandle('ds', 'ch1', 'resource1', 'options', _, _, NO_AUTH_HEADER) >> {
-                networkServiceMethodCalled = true
-            }
+            mockNetworkCmProxyDataService.getResourceDataForCmHandle(cmResourceAddress, 'options', _, _, NO_AUTH_HEADER) >>
+                { networkServiceMethodCalled = true }
         when: 'get request is executed with topic = #topic'
-            objectUnderTest.executeRequest('ds', 'ch1', 'resource1', 'options', topic, false, NO_AUTH_HEADER)
+            objectUnderTest.executeRequest(cmResourceAddress, 'options', topic, false, NO_AUTH_HEADER)
         then: 'the task is executed in an async fashion or not'
             expectedCalls * spiedCpsNcmpTaskExecutor.executeTask(*_)
         and: 'the service request is invoked'