summaryrefslogtreecommitdiffstats
path: root/integration-test
diff options
context:
space:
mode:
Diffstat (limited to 'integration-test')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy20
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy28
2 files changed, 9 insertions, 39 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy
index b107a87e88..e143099943 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* Modifications Copyright (C) 2023 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
@@ -276,12 +276,11 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
assert originalCountBookstoreChildNodes == countDataNodesInBookstore()
}
- def 'Add and Delete a batch of lists (element) data nodes.'() {
- given: 'two new (categories) data nodes in two separate batches'
- def json1 = '{"categories": [ {"code":"new1"} ] }'
- def json2 = '{"categories": [ {"code":"new2"} ] } '
+ def 'Add and Delete a batch of list element data nodes.'() {
+ given: 'two new (categories) data nodes in a single batch'
+ def json = '{"categories": [ {"code":"new1"}, {"code":"new2"} ] }'
when: 'the batches of new list element(s) are saved'
- objectUnderTest.saveListElementsBatch(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', [json1, json2], now)
+ objectUnderTest.saveListElements(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', json, now)
then: 'they can be retrieved by their xpaths'
assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new1"]', DIRECT_CHILDREN_ONLY).size() == 1
assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new2"]', DIRECT_CHILDREN_ONLY).size() == 1
@@ -294,12 +293,11 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
assert originalCountBookstoreChildNodes == countDataNodesInBookstore()
}
- def 'Add and Delete a batch of lists (element) data nodes with partial success.'() {
- given: 'two new (categories) data nodes in two separate batches'
- def jsonNewElement = '{"categories": [ {"code":"new1"} ] }'
- def jsonExistingElement = '{"categories": [ {"code":"1"} ] } '
+ def 'Add and Delete a batch of list element data nodes with partial success.'() {
+ given: 'one existing and one new (categories) data nodes in a single batch'
+ def json = '{"categories": [ {"code":"new1"}, {"code":"1"} ] }'
when: 'the batches of new list element(s) are saved'
- objectUnderTest.saveListElementsBatch(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', [jsonNewElement, jsonExistingElement], now)
+ objectUnderTest.saveListElements(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', json, now)
then: 'an already defined (batch) exception is thrown for the existing path'
def exceptionThrown = thrown(AlreadyDefinedException)
assert exceptionThrown.alreadyDefinedObjectNames == ['/bookstore/categories[@code=\'1\']' ] as Set
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy
index a5669baf6a..1898f436bf 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy
@@ -106,32 +106,4 @@ class WritePerfTest extends CpsPerfTestBase {
400 || 28 | 250
}
- def 'Writing openroadm list data using saveListElementsBatch.'() {
- given: 'an anchor and empty container node for openroadm'
- cpsAnchorService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, LARGE_SCHEMA_SET, WRITE_TEST_ANCHOR)
- cpsDataService.saveData(CPS_PERFORMANCE_TEST_DATASPACE, WRITE_TEST_ANCHOR,
- '{ "openroadm-devices": { "openroadm-device": []}}', now)
- and: 'a list of device nodes to add'
- def innerNode = readResourceDataFile('openroadm/innerNode.json')
- def multipleJsonData = (1..totalNodes).collect {
- '{ "openroadm-device": [' + innerNode.replace('NODE_ID_HERE', it.toString()) + ']}' }
- when: 'device nodes are added'
- resourceMeter.start()
- cpsDataService.saveListElementsBatch(CPS_PERFORMANCE_TEST_DATASPACE, WRITE_TEST_ANCHOR, '/openroadm-devices', multipleJsonData, OffsetDateTime.now())
- resourceMeter.stop()
- then: 'the operation takes less than #expectedDuration and memory used is within limit'
- recordAndAssertResourceUsage("Saving batch of ${totalNodes} lists",
- expectedDuration, resourceMeter.getTotalTimeInSeconds(),
- memoryLimit, resourceMeter.getTotalMemoryUsageInMB())
- cleanup:
- cpsDataService.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, WRITE_TEST_ANCHOR, OffsetDateTime.now())
- cpsAnchorService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, WRITE_TEST_ANCHOR)
- where:
- totalNodes || expectedDuration | memoryLimit
- 50 || 16 | 500
- 100 || 32 | 500
- 200 || 64 | 1000
- 400 || 128 | 1250
- }
-
}