Use exact type for objectUnderTest in groovy tests 67/134267/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Fri, 21 Apr 2023 09:54:11 +0000 (10:54 +0100)
committerDaniel Hanrahan <daniel.hanrahan@est.tech>
Fri, 21 Apr 2023 09:58:47 +0000 (09:58 +0000)
Intelli-J doesn't know the type of objectUnderTest since it is
assigned in setup function. Thus many IDE features such as as
JavaDocs and error detection of wrong arguments are unavailable.
By setting the exact type, all IDE features are enabled.

Issue-ID: CPS-1621
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I3dabf82ef9d07b3c18f9820fa768344c2eeec1b6

integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy

index a8ab5ca..91a4c8a 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.cps.integration.functional
 
+import org.onap.cps.api.CpsAdminService
 import org.onap.cps.integration.base.CpsIntegrationSpecBase
 import org.onap.cps.spi.exceptions.AlreadyDefinedException
 import org.onap.cps.spi.exceptions.AnchorNotFoundException
@@ -27,7 +28,7 @@ import org.onap.cps.spi.exceptions.DataspaceNotFoundException
 
 class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase {
 
-    def objectUnderTest
+    CpsAdminService objectUnderTest
 
     def setup() { objectUnderTest = cpsAdminService }
 
index 2c7c6ce..7875cae 100644 (file)
 
 package org.onap.cps.integration.performance.cps
 
+import org.onap.cps.api.CpsAdminService
 import org.onap.cps.integration.performance.base.CpsPerfTestBase
 import org.springframework.dao.DataAccessResourceFailureException
 
 class CpsAdminServiceLimits extends CpsPerfTestBase {
 
-    def objectUnderTest
+    CpsAdminService objectUnderTest
 
     def setup() { objectUnderTest = cpsAdminService }
 
index 1cb4ed8..2df9101 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.cps.integration.performance.cps
 
 import java.time.OffsetDateTime
+import org.onap.cps.api.CpsDataService
 import org.onap.cps.integration.performance.base.CpsPerfTestBase
 import org.springframework.dao.DataAccessResourceFailureException
 import org.springframework.transaction.TransactionSystemException
@@ -29,7 +30,7 @@ import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
 
 class CpsDataServiceLimits extends CpsPerfTestBase {
 
-    def objectUnderTest
+    CpsDataService objectUnderTest
 
     def setup() { objectUnderTest = cpsDataService }
 
index 4676c90..c072755 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.cps.integration.performance.cps
 
+import org.onap.cps.api.CpsDataService
 import org.onap.cps.integration.performance.base.CpsPerfTestBase
 
 import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
@@ -28,7 +29,7 @@ import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
 
 class GetPerfTest extends CpsPerfTestBase {
 
-    def objectUnderTest
+    CpsDataService objectUnderTest
 
     def setup() { objectUnderTest = cpsDataService }
 
index 4968420..0653657 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.cps.integration.performance.cps
 
+import org.onap.cps.api.CpsQueryService
 import org.onap.cps.integration.performance.base.CpsPerfTestBase
 
 import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
@@ -28,7 +29,7 @@ import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
 
 class QueryPerfTest extends CpsPerfTestBase {
 
-    def objectUnderTest
+    CpsQueryService objectUnderTest
 
     def setup() { objectUnderTest = cpsQueryService }
 
index 443dd7e..5d7c9de 100644 (file)
 package org.onap.cps.integration.performance.ncmp
 
 import java.util.stream.Collectors
+import org.onap.cps.api.CpsQueryService
 import org.onap.cps.integration.performance.base.NcmpRegistryPerfTestBase
 import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
 import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
 
 class CmHandleQueryPerfTest extends NcmpRegistryPerfTestBase {
 
-    def objectUnderTest
+    CpsQueryService objectUnderTest
 
     def setup() { objectUnderTest = cpsQueryService }
 
@@ -35,7 +36,7 @@ class CmHandleQueryPerfTest extends NcmpRegistryPerfTestBase {
         when: 'a cps-path query on name-value pair is performed (without getting descendants)'
             stopWatch.start()
             def cpsPath = '//additional-properties[@name="neType" and @value="RadioNode"]/ancestor::cm-handles'
-            def dataNodes = cpsQueryService.queryDataNodes(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR, cpsPath, OMIT_DESCENDANTS)
+            def dataNodes = objectUnderTest.queryDataNodes(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR, cpsPath, OMIT_DESCENDANTS)
         and: 'the ids of the result are extracted and converted to xpath'
             def xpaths = dataNodes.stream().map(dataNode -> "/dmi-registry/cm-handles[@id='${dataNode.leaves.id}']".toString() ).collect(Collectors.toSet())
         and: 'a single get is executed to get all the parent objects and their descendants'