aboutsummaryrefslogtreecommitdiffstats
path: root/integration-test/src
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2025-02-28 14:09:27 +0000
committerGerrit Code Review <gerrit@onap.org>2025-02-28 14:09:27 +0000
commitb0269d5b66bc668f3e4b10f181bd290ddbac680f (patch)
tree8ba6ace86683b6f229230ea5ee17fe2c7edb889d /integration-test/src
parent42559ccded4750e7298ed7c2a08f062c90023617 (diff)
parentb3dfa9ba4771b3d98bbfbdb870b8ed063d4dd2ce (diff)
Merge "Change order of CM Handle Reference lookup depending on special character"
Diffstat (limited to 'integration-test/src')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy2
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/AlternateIdSpec.groovy24
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/AlternateIdPerfTest.groovy47
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy8
4 files changed, 65 insertions, 16 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
index 693cf992ee..9b79af95ff 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
@@ -281,7 +281,7 @@ abstract class CpsIntegrationSpecBase extends Specification {
def modulePrefix = moduleNameStrategy.OVERLAPPING.equals(moduleNameStrategy) ? 'same' : moduleSetTag
def moduleReferences = (1..200).collect { "${modulePrefix}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: "alt=${id}")
cmHandles.add(ncmpServiceCmHandle)
dmiDispatcher1.moduleNamesPerCmHandleId[ncmpServiceCmHandle.cmHandleId] = moduleReferences
dmiDispatcher2.moduleNamesPerCmHandleId[ncmpServiceCmHandle.cmHandleId] = moduleReferences
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/AlternateIdSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/AlternateIdSpec.groovy
index 222b3c0f6f..b1b777c79f 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/AlternateIdSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/AlternateIdSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2024 Nordix Foundation
+ * Copyright (C) 2024-2025 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
@@ -30,16 +30,13 @@ class AlternateIdSpec extends CpsIntegrationSpecBase {
def setup() {
dmiDispatcher1.moduleNamesPerCmHandleId['ch-1'] = ['M1', 'M2']
- registerCmHandle(DMI1_URL, 'ch-1', NO_MODULE_SET_TAG, 'alternateId')
}
- def cleanup() {
- deregisterCmHandle(DMI1_URL, 'ch-1')
- }
-
- def 'AlternateId in pass-through data operations should return OK status.'() {
- given: 'the URL for the pass-through data request'
- def url = '/ncmp/v1/ch/alternateId/data/ds/ncmp-datastore:passthrough-running'
+ def 'Pass-through data operations using #scenario as reference.'() {
+ given: 'a cm handle with an alternate id'
+ registerCmHandle(DMI1_URL, 'ch-1', NO_MODULE_SET_TAG, alternateId)
+ and: 'the URL for the pass-through data request'
+ def url = "/ncmp/v1/ch/${cmHandleReference}/data/ds/ncmp-datastore:passthrough-running"
when: 'a pass-through data request is sent to NCMP'
def response = mvc.perform(get(url)
.queryParam('resourceIdentifier', 'my-resource-id')
@@ -47,8 +44,13 @@ class AlternateIdSpec extends CpsIntegrationSpecBase {
.andReturn().response
then: 'response status is Ok'
assert response.status == HttpStatus.OK.value()
+ cleanup: 'remove the test cm handle'
+ deregisterCmHandle(DMI1_URL, 'ch-1')
+ where: 'the following ids are used'
+ scenario | alternateId | cmHandleReference
+ 'standard id' | 'dont care' | 'ch-1'
+ 'alt-id with =' | 'alt=1' | 'alt=1'
+ 'alt-id without =' | 'alt-1' | 'alt-1'
}
-
-
}
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/AlternateIdPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/AlternateIdPerfTest.groovy
new file mode 100644
index 0000000000..b9d57cf14d
--- /dev/null
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/AlternateIdPerfTest.groovy
@@ -0,0 +1,47 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2025 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.base.CpsIntegrationSpecBase
+
+/**
+ * This test does not depend on common performance test data. Hence it just extends the integration spec base.
+ */
+class AlternateIdPerfTest extends CpsIntegrationSpecBase {
+
+ def resourceMeter = new ResourceMeter()
+
+ def 'Alternate Id Lookup Performance.'() {
+ given: 'register 1,000 cm handles (with alternative ids)'
+ registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', 1000, 1)
+ when: 'perform a 1,000 lookups by alternate id'
+ resourceMeter.start()
+ (1..1000).each {
+ networkCmProxyInventoryFacade.getNcmpServiceCmHandle("alt=${it}")
+ }
+ resourceMeter.stop()
+ then: 'record the result. Not asserted, just recorded in See https://lf-onap.atlassian.net/browse/CPS-2605'
+ println "*** CPS-2605 Execution time: ${resourceMeter.totalTimeInSeconds} ms"
+ cleanup: 'deregister test cm handles'
+ deregisterSequenceOfCmHandles(DMI1_URL, 1000, 1)
+ }
+}
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 5389732181..dbf7e71710 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
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023-2024 Nordix Foundation
+ * Copyright (C) 2023-2025 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ class CmHandleQueryPerfTest extends NcmpPerfTestBase {
cpsDataService.getDataNodes(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR,
'/dmi-registry/cm-handles[@id="cm-' + it + '"]', OMIT_DESCENDANTS)
objectUnderTest.queryDataNodes(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR,
- '/dmi-registry/cm-handles[@alternate-id="alt-' + it + '"]', OMIT_DESCENDANTS)
+ '/dmi-registry/cm-handles[@alternate-id="alt=' + it + '"]', OMIT_DESCENDANTS)
}
resourceMeter.stop()
then: 'resource usage is as expected'
@@ -100,7 +100,7 @@ class CmHandleQueryPerfTest extends NcmpPerfTestBase {
resourceMeter.start()
(1..100).each {
count += cpsQueryService.queryDataNodes(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR,
- '/dmi-registry/cm-handles[@alternate-id="alt-' + it + '"]', OMIT_DESCENDANTS).size()
+ '/dmi-registry/cm-handles[@alternate-id="alt=' + it + '"]', OMIT_DESCENDANTS).size()
}
resourceMeter.stop()
then:
@@ -116,7 +116,7 @@ class CmHandleQueryPerfTest extends NcmpPerfTestBase {
def 'A batch of CM-handles is looked up by alternate-id.'() {
given: 'a CPS Path Query to look up 100 alternate-ids in a single operation'
- def cpsPathQuery = '/dmi-registry/cm-handles[' + (1..100).collect { "@alternate-id='alt-${it}'" }.join(' or ') + ']'
+ def cpsPathQuery = '/dmi-registry/cm-handles[' + (1..100).collect { "@alternate-id='alt=${it}'" }.join(' or ') + ']'
when: 'CM-handles are looked up by alternate-ids in a single query'
resourceMeter.start()
def count = cpsQueryService.queryDataNodes(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR, cpsPathQuery, OMIT_DESCENDANTS).size()