diff options
Diffstat (limited to 'integration-test')
3 files changed, 22 insertions, 66 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy index 42fb964d52..6ae14dd11b 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy @@ -458,8 +458,8 @@ class QueryServiceIntegrationSpec extends FunctionalSpecBase { assert result.anchorName.toSet() == [BOOKSTORE_ANCHOR_1, BOOKSTORE_ANCHOR_2].toSet() } - def 'Query with a limit of #limit.' () { - when: + def 'Query data nodes with a limit of #limit.' () { + when: 'a query for data nodes is executed with a result limit' def result = objectUnderTest.queryDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories', OMIT_DESCENDANTS, limit) then: 'the expected number of nodes is returned' assert countDataNodesInTree(result) == expectedNumberOfResults @@ -470,4 +470,17 @@ class QueryServiceIntegrationSpec extends FunctionalSpecBase { 0 || 5 -1 || 5 } + + def 'Query data leaf with a limit of #limit.' () { + when: 'a query for data leaf is executed with a result limit' + def result = objectUnderTest.queryDataLeaf(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories/@name', limit, String) + then: 'the expected number of leaf values is returned' + assert result.size() == expectedNumberOfResults + where: 'the following parameters are used' + limit || expectedNumberOfResults + 1 || 1 + 2 || 2 + 0 || 5 + -1 || 5 + } } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy deleted file mode 100644 index cd2fc6ed7e..0000000000 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.cps.integration.performance.ncmp - -import org.onap.cps.integration.ResourceMeter -import org.onap.cps.integration.performance.base.NcmpPerfTestBase -import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher - -import java.util.stream.Collectors - -import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME -import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR -import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS - -class CmHandleQueryByAlternateIdPerfTest extends NcmpPerfTestBase { - - AlternateIdMatcher objectUnderTest - ResourceMeter resourceMeter = new ResourceMeter() - - def setup() { objectUnderTest = alternateIdMatcher } - - def 'Query cm handle by longest match alternate id'() { - when: 'an alternate id as cps path query' - resourceMeter.start() - def cpsPath = "/a/b/c/d-5/e/f/g/h/i" - def dataNodes = objectUnderTest.getYangModelCmHandleByLongestMatchingAlternateId(cpsPath, '/') - and: 'the ids of the result are extracted and converted to xpath' - def cpsXpaths = 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' - cpsDataService.getDataNodesForMultipleXpaths(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, cpsXpaths, OMIT_DESCENDANTS) - resourceMeter.stop() - def durationInSeconds = resourceMeter.getTotalTimeInSeconds() - print 'Total time in seconds to query ch handle by alternate id: ' + durationInSeconds - then: 'the required operations are performed within required time and memory limit' - recordAndAssertResourceUsage('Look up cm-handle by longest match alternate-id', 1, durationInSeconds, 300, resourceMeter.getTotalMemoryUsageInMB()) - } -} diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy index 27ff155471..c71426032d 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy @@ -27,6 +27,7 @@ import org.onap.cps.ncmp.api.datajobs.models.DataJobMetadata import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest import org.onap.cps.ncmp.api.datajobs.models.WriteOperation import org.springframework.beans.factory.annotation.Autowired +import spock.lang.Ignore /** * This test does not depend on common performance test data. Hence it just extends the integration spec base. @@ -49,21 +50,18 @@ class WriteDataJobPerfTest extends CpsIntegrationSpecBase { return new DataJobWriteRequest(writeOperations) } + @Ignore // CPS-2691 def 'Performance test for writeDataJob method'() { - given: 'register 1,000 cm handles (with alternative ids)' - registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', 1000, 1, ModuleNameStrategy.UNIQUE, { it -> "/SubNetwork=Europe/SubNetwork=Ireland/MeContext=MyRadioNode${it}/ManagedElement=MyManagedElement${it}" }) - def authorization = 'my authorization header' - def numberOfWriteOperations = 1000 - def dataJobWriteRequest = populateDataJobWriteRequests(numberOfWriteOperations) - def myDataJobMetadata = new DataJobMetadata('d1', '', '') - def dataJobId = 'my-data-job-id' + given: 'register 10_000 cm handles (with alternative ids)' + registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', 10_000, 1, ModuleNameStrategy.UNIQUE, { it -> "/SubNetwork=Europe/SubNetwork=Ireland/MeContext=MyRadioNode${it}/ManagedElement=MyManagedElement${it}" }) + def dataJobWriteRequest = populateDataJobWriteRequests(10_000) when: 'sending a write job to NCMP with dynamically generated write operations' resourceMeter.start() - dataJobService.writeDataJob(authorization, dataJobId, myDataJobMetadata, dataJobWriteRequest) + dataJobService.writeDataJob('', '', new DataJobMetadata('d1', '', ''), dataJobWriteRequest) resourceMeter.stop() then: 'record the result. Not asserted, just recorded in See https://lf-onap.atlassian.net/browse/CPS-2691' println "*** CPS-2691 Execution time: ${resourceMeter.totalTimeInSeconds} seconds" cleanup: 'deregister test cm handles' - deregisterSequenceOfCmHandles(DMI1_URL, 1000, 1) + deregisterSequenceOfCmHandles(DMI1_URL, 10_000, 1) } } |