From dce6dfe44d952591780ef2a8b2375d4d1de5f5ba Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Fri, 21 Apr 2023 10:54:11 +0100 Subject: Use exact type for objectUnderTest in groovy tests 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 Change-Id: I3dabf82ef9d07b3c18f9820fa768344c2eeec1b6 --- .../cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy | 3 ++- .../cps/integration/performance/cps/CpsAdminServiceLimits.groovy | 3 ++- .../onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy | 3 ++- .../org/onap/cps/integration/performance/cps/GetPerfTest.groovy | 3 ++- .../org/onap/cps/integration/performance/cps/QueryPerfTest.groovy | 3 ++- .../cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy | 5 +++-- 6 files changed, 13 insertions(+), 7 deletions(-) (limited to 'integration-test/src/test/groovy/org') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy index a8ab5cab57..91a4c8ac0e 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy @@ -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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy index 2c7c6ce35c..7875caec35 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy @@ -20,12 +20,13 @@ 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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy index 1cb4ed800c..2df910194d 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy @@ -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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy index 4676c908b9..c072755d31 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy @@ -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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy index 496842096f..065365748c 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy @@ -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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy index 443dd7efd7..5d7c9de51e 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy @@ -21,13 +21,14 @@ 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' -- cgit 1.2.3-korg