summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceImpl.java4
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceSpec.groovy2
-rw-r--r--cps-rest/docs/openapi/components.yml2
-rw-r--r--cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy10
-rw-r--r--cps-service/src/main/java/org/onap/cps/spi/FetchDescendantsOption.java8
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy2
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/spi/FetchDescendantsOptionSpec.groovy4
-rw-r--r--docs/api/swagger/cps/openapi.yaml16
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy32
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy8
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy5
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy5
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy11
13 files changed, 61 insertions, 48 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceImpl.java
index 54d89ba00..b79106310 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceImpl.java
@@ -27,7 +27,7 @@ import static org.onap.cps.ncmp.api.impl.utils.CmHandleQueryConditions.WITH_CPS_
import static org.onap.cps.ncmp.api.impl.utils.RestQueryParametersValidator.validateCpsPathConditionProperties;
import static org.onap.cps.ncmp.api.impl.utils.RestQueryParametersValidator.validateModuleNameConditionProperties;
import static org.onap.cps.ncmp.api.impl.utils.YangDataConverter.convertYangModelCmHandleToNcmpServiceCmHandle;
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY;
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY;
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
import java.util.ArrayList;
@@ -204,7 +204,7 @@ public class NetworkCmProxyCmHandleQueryServiceImpl implements NetworkCmProxyCmH
}
private Collection<String> getAllCmHandleIds() {
- final DataNode dataNode = inventoryPersistence.getDataNode("/dmi-registry", DIRECT_CHILDREN_ONLY)
+ final DataNode dataNode = inventoryPersistence.getDataNode("/dmi-registry", DIRECT_CHILD_ONLY)
.iterator().next();
return collectCmHandleIdsFromDataNodes(dataNode.getChildDataNodes());
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceSpec.groovy
index bff822218..fc0ed5f41 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandleQueryServiceSpec.groovy
@@ -127,7 +127,7 @@ class NetworkCmProxyCmHandleQueryServiceSpec extends Specification {
given: 'We use an empty query'
def cmHandleQueryParameters = new CmHandleQueryServiceParameters()
and: 'the inventory persistence returns the dmi registry datanode with just ids'
- mockInventoryPersistence.getDataNode("/dmi-registry", FetchDescendantsOption.DIRECT_CHILDREN_ONLY) >> [dmiRegistry]
+ mockInventoryPersistence.getDataNode("/dmi-registry", FetchDescendantsOption.DIRECT_CHILD_ONLY) >> [dmiRegistry]
when: 'the query is executed for both cm handle ids'
def result = objectUnderTest.queryCmHandleIds(cmHandleQueryParameters)
then: 'the correct expected cm handles are returned'
diff --git a/cps-rest/docs/openapi/components.yml b/cps-rest/docs/openapi/components.yml
index a7c13002b..a72130562 100644
--- a/cps-rest/docs/openapi/components.yml
+++ b/cps-rest/docs/openapi/components.yml
@@ -263,7 +263,7 @@ components:
descendantsInQuery:
name: descendants
in: query
- description: Number of descendants to query. Allowed values are 'none', 'all', -1 (for all), 0 (for none) and any positive number.
+ description: Number of descendants to query. Allowed values are 'none', 'all', 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive number.
required: false
schema:
type: string
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
index c4bb23ce4..09e9ff5c4 100644
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
@@ -25,6 +25,7 @@ package org.onap.cps.rest.controller
import org.onap.cps.utils.PrefixResolver
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
@@ -97,17 +98,21 @@ class QueryRestControllerSpec extends Specification {
def dataNode1 = new DataNodeBuilder().withXpath('/xpath')
.withLeaves([leaf: 'value', leafList: ['leaveListElement1', 'leaveListElement2']]).build()
mockCpsQueryService.queryDataNodes(dataspaceName, anchorName, cpsPath, { descendantsOption -> {
- assert descendantsOption.depth == 2}}) >> [dataNode1, dataNode1]
+ assert descendantsOption.depth == expectedDepth}}) >> [dataNode1, dataNode1]
when: 'query data nodes API is invoked'
def response =
mvc.perform(
get(dataNodeEndpointV2)
.param('cps-path', cpsPath)
- .param('descendants', '2'))
+ .param('descendants', includeDescendantsOptionString))
.andReturn().response
then: 'the response contains the the datanode in json format'
assert response.status == HttpStatus.OK.value()
assert response.getContentAsString().contains('{"xpath":{"leaf":"value","leafList":["leaveListElement1","leaveListElement2"]}}')
+ where: 'the following options for include descendants are provided in the request'
+ scenario | includeDescendantsOptionString || expectedDepth
+ 'direct children' | 'direct' || 1
+ 'descendants' | '2' || 2
}
def 'Query data node by cps path for the given dataspace across all anchors with #scenario.'() {
@@ -139,5 +144,6 @@ class QueryRestControllerSpec extends Specification {
'no descendants by default' | '' || OMIT_DESCENDANTS
'no descendant explicitly' | 'none' || OMIT_DESCENDANTS
'descendants' | 'all' || INCLUDE_ALL_DESCENDANTS
+ 'direct children' | 'direct' || DIRECT_CHILD_ONLY
}
}
diff --git a/cps-service/src/main/java/org/onap/cps/spi/FetchDescendantsOption.java b/cps-service/src/main/java/org/onap/cps/spi/FetchDescendantsOption.java
index 02574995d..76d9bba7e 100644
--- a/cps-service/src/main/java/org/onap/cps/spi/FetchDescendantsOption.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/FetchDescendantsOption.java
@@ -30,8 +30,8 @@ import org.onap.cps.spi.exceptions.DataValidationException;
@RequiredArgsConstructor
public class FetchDescendantsOption {
- public static final FetchDescendantsOption DIRECT_CHILDREN_ONLY
- = new FetchDescendantsOption(1, "DirectChildrenOnly");
+ public static final FetchDescendantsOption DIRECT_CHILD_ONLY
+ = new FetchDescendantsOption(1, "DirectChildOnly");
public static final FetchDescendantsOption OMIT_DESCENDANTS
= new FetchDescendantsOption(0, "OmitDescendants");
public static final FetchDescendantsOption INCLUDE_ALL_DESCENDANTS
@@ -42,7 +42,7 @@ public class FetchDescendantsOption {
}
private static final Pattern FETCH_DESCENDANTS_OPTION_PATTERN =
- Pattern.compile("^$|^all$|^none$|^[0-9]+$|^-1$");
+ Pattern.compile("^$|^all$|^none$|^direct$|^[0-9]+$|^-1$|^1$");
private final int depth;
@@ -96,6 +96,8 @@ public class FetchDescendantsOption {
return FetchDescendantsOption.OMIT_DESCENDANTS;
} else if ("-1".equals(fetchDescendantsOptionAsString) || "all".equals(fetchDescendantsOptionAsString)) {
return FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+ } else if ("1".equals(fetchDescendantsOptionAsString) || "direct".equals(fetchDescendantsOptionAsString)) {
+ return FetchDescendantsOption.DIRECT_CHILD_ONLY;
} else {
final Integer depth = Integer.valueOf(fetchDescendantsOptionAsString);
return new FetchDescendantsOption(depth);
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
index 553027a4b..4e3d27964 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
@@ -45,7 +45,7 @@ class CpsQueryServiceImplSpec extends Specification {
1 * mockCpsValidator.validateNameCharacters(dataspaceName, anchorName)
where: 'all fetch descendants options are supported'
fetchDescendantsOption << [FetchDescendantsOption.OMIT_DESCENDANTS, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS,
- FetchDescendantsOption.DIRECT_CHILDREN_ONLY, new FetchDescendantsOption(10)]
+ FetchDescendantsOption.DIRECT_CHILD_ONLY, new FetchDescendantsOption(10)]
}
def 'Query data nodes across all anchors by cps path with #fetchDescendantsOption.'() {
diff --git a/cps-service/src/test/groovy/org/onap/cps/spi/FetchDescendantsOptionSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/spi/FetchDescendantsOptionSpec.groovy
index 24f3487d1..b095bfd3d 100644
--- a/cps-service/src/test/groovy/org/onap/cps/spi/FetchDescendantsOptionSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/spi/FetchDescendantsOptionSpec.groovy
@@ -85,6 +85,8 @@ class FetchDescendantsOptionSpec extends Specification {
'all descendants using all' | 'all' || -1
'No descendants by default' | '' || 0
'No descendants using none' | 'none' || 0
+ 'direct child using number' | '1' || 1
+ 'direct child using direct' | 'direct' || 1
'til 10th descendants using number' | '10' || 10
}
@@ -94,7 +96,7 @@ class FetchDescendantsOptionSpec extends Specification {
where: 'the following option is used'
fetchDescendantsOption || expectedStringValue
FetchDescendantsOption.OMIT_DESCENDANTS || 'OmitDescendants'
- FetchDescendantsOption.DIRECT_CHILDREN_ONLY || 'DirectChildrenOnly'
+ FetchDescendantsOption.DIRECT_CHILD_ONLY || 'DirectChildOnly'
FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS || 'IncludeAllDescendants'
new FetchDescendantsOption(2) || 'Depth=2'
}
diff --git a/docs/api/swagger/cps/openapi.yaml b/docs/api/swagger/cps/openapi.yaml
index ace45f844..eb6c4240c 100644
--- a/docs/api/swagger/cps/openapi.yaml
+++ b/docs/api/swagger/cps/openapi.yaml
@@ -1316,8 +1316,8 @@ paths:
schema:
default: /
type: string
- - description: "Number of descendants to query. Allowed values are 'none', 'all',\
- \ -1 (for all), 0 (for none) and any positive number."
+ - description: "Number of descendants to query. Allowed values are 'none', 'all', 'direct',\
+ \ 1 (for direct), -1 (for all), 0 (for none) and any positive number."
in: query
name: descendants
required: false
@@ -2261,8 +2261,8 @@ paths:
schema:
default: /
type: string
- - description: "Number of descendants to query. Allowed values are 'none', 'all',\
- \ -1 (for all), 0 (for none) and any positive number."
+ - description: "Number of descendants to query. Allowed values are 'none', 'all', 'direct',\
+ \ 1 (for direct), -1 (for all), 0 (for none) and any positive number."
in: query
name: descendants
required: false
@@ -2350,8 +2350,8 @@ paths:
schema:
default: /
type: string
- - description: "Number of descendants to query. Allowed values are 'none', 'all',\
- \ -1 (for all), 0 (for none) and any positive number."
+ - description: "Number of descendants to query. Allowed values are 'none', 'all', 'direct',\
+ \ 1 (for direct), -1 (for all), 0 (for none) and any positive number."
in: query
name: descendants
required: false
@@ -2532,8 +2532,8 @@ components:
example: false
type: boolean
descendantsInQuery:
- description: "Number of descendants to query. Allowed values are 'none', 'all',\
- \ -1 (for all), 0 (for none) and any positive number."
+ description: "Number of descendants to query. Allowed values are 'none', 'all', 'direct',\
+ \ 1 (for direct), -1 (for all), 0 (for none) and any positive number."
in: query
name: descendants
required: false
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 6b556d3bc..a942721a4 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
@@ -35,7 +35,7 @@ import org.onap.cps.spi.exceptions.DataspaceNotFoundException
import java.time.OffsetDateTime
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
@@ -66,7 +66,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
where: 'the following option is used'
fetchDescendantsOption || expectNumberOfDataNodes
OMIT_DESCENDANTS || 1
- DIRECT_CHILDREN_ONLY || 7
+ DIRECT_CHILD_ONLY || 7
INCLUDE_ALL_DESCENDANTS || 28
new FetchDescendantsOption(2) || 28
}
@@ -84,7 +84,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
def 'Read data nodes with error: #cpsPath'() {
when: 'attempt to get data nodes using invalid path'
- objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, cpsPath, DIRECT_CHILDREN_ONLY)
+ objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, cpsPath, DIRECT_CHILD_ONLY)
then: 'a #expectedException is thrown'
thrown(expectedException)
where:
@@ -95,7 +95,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
def 'Read (multiple) data nodes (batch) with #cpsPath'() {
when: 'attempt to get data nodes using invalid path'
- objectUnderTest.getDataNodesForMultipleXpaths(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, [ cpsPath ], DIRECT_CHILDREN_ONLY)
+ objectUnderTest.getDataNodesForMultipleXpaths(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, [ cpsPath ], DIRECT_CHILD_ONLY)
then: 'no exception is thrown'
noExceptionThrown()
where:
@@ -106,7 +106,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
when: 'the "root" is deleted'
objectUnderTest.deleteDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, [ '/' ], now)
and: 'attempt to get the top level data node'
- objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore', DIRECT_CHILDREN_ONLY)
+ objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore', DIRECT_CHILD_ONLY)
then: 'an datanode not found exception is thrown'
thrown(DataNodeNotFoundException)
cleanup:
@@ -143,7 +143,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
when: 'the new datanode is saved'
objectUnderTest.saveData(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , parentXpath, json, now)
then: 'it can be retrieved by its normalized xpath'
- def result = objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, normalizedXpathToNode, DIRECT_CHILDREN_ONLY)
+ def result = objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, normalizedXpathToNode, DIRECT_CHILD_ONLY)
assert result.size() == 1
assert result[0].xpath == normalizedXpathToNode
and: 'there is now one extra datanode'
@@ -228,8 +228,8 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
when: 'the new list elements are saved'
objectUnderTest.saveListElements(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', json, now)
then: 'they can be retrieved by their xpaths'
- objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new1"]', DIRECT_CHILDREN_ONLY).size() == 1
- objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new2"]', DIRECT_CHILDREN_ONLY).size() == 1
+ objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new1"]', DIRECT_CHILD_ONLY).size() == 1
+ objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new2"]', DIRECT_CHILD_ONLY).size() == 1
and: 'there are now two extra data nodes'
assert originalCountBookstoreChildNodes + 2 == countDataNodesInBookstore()
when: 'the new elements are deleted'
@@ -271,8 +271,8 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
when: 'the batches of new list element(s) are saved'
objectUnderTest.saveListElementsBatch(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', [json1, json2], 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
+ assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new1"]', DIRECT_CHILD_ONLY).size() == 1
+ assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new2"]', DIRECT_CHILD_ONLY).size() == 1
and: 'there are now two extra data nodes'
assert originalCountBookstoreChildNodes + 2 == countDataNodesInBookstore()
when: 'the new elements are deleted'
@@ -324,20 +324,20 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
def thrown = thrown(AlreadyDefinedException)
assert thrown.alreadyDefinedObjectNames == [ "/bookstore/categories[@code='1']" ] as Set
and: 'the new data node has been added i.e. can be retrieved'
- assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new"]', DIRECT_CHILDREN_ONLY).size() == 1
+ assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new"]', DIRECT_CHILD_ONLY).size() == 1
}
def 'Replace list content #scenario.'() {
given: 'the bookstore categories 1 and 2 exist and have at least 1 child each '
- assert countDataNodesInTree(objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="1"]', DIRECT_CHILDREN_ONLY)) > 1
- assert countDataNodesInTree(objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="2"]', DIRECT_CHILDREN_ONLY)) > 1
+ assert countDataNodesInTree(objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="1"]', DIRECT_CHILD_ONLY)) > 1
+ assert countDataNodesInTree(objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="2"]', DIRECT_CHILD_ONLY)) > 1
when: 'the categories list is replaced with just category "1" and without child nodes (books)'
def json = '{"categories": [ {"code":"' +categoryCode + '"' + childJson + '} ] }'
objectUnderTest.replaceListContent(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore', json, now)
then: 'the new replaced category can be retrieved but has no children anymore'
- assert expectedNumberOfDataNodes == countDataNodesInTree(objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="' +categoryCode + '"]', DIRECT_CHILDREN_ONLY))
+ assert expectedNumberOfDataNodes == countDataNodesInTree(objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="' +categoryCode + '"]', DIRECT_CHILD_ONLY))
when: 'attempt to retrieve a category (code) not in the new list'
- objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="2"]', DIRECT_CHILDREN_ONLY)
+ objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="2"]', DIRECT_CHILD_ONLY)
then: 'a datanode not found exception occurs'
thrown(DataNodeNotFoundException)
cleanup:
@@ -401,7 +401,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
json = '{"webinfo": {"domain-name":"newdomain.com" ,"contact-email":"info@newdomain.com" }}'
objectUnderTest.updateDataNodeAndDescendants(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore', json, now)
then: 'webinfo has been updated with teh new details'
- def result = objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/webinfo', DIRECT_CHILDREN_ONLY)
+ def result = objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/webinfo', DIRECT_CHILD_ONLY)
result.leaves.'domain-name'[0] == 'newdomain.com'
result.leaves.'contact-email'[0] == 'info@newdomain.com'
cleanup:
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy
index 74496d301..463a8feff 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy
@@ -27,7 +27,7 @@ import org.onap.cps.integration.base.FunctionalSpecBase
import org.onap.cps.spi.FetchDescendantsOption
import org.onap.cps.spi.exceptions.CpsPathException
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
@@ -232,7 +232,7 @@ class CpsQueryServiceIntegrationSpec extends FunctionalSpecBase {
where: 'the following data is used'
scenario | fetchDescendantsOption || expectedNumberOfNodes
'no' | OMIT_DESCENDANTS || 1
- 'direct' | DIRECT_CHILDREN_ONLY || 7
+ 'direct' | DIRECT_CHILD_ONLY || 7
'all' | INCLUDE_ALL_DESCENDANTS || 28
}
@@ -282,7 +282,7 @@ class CpsQueryServiceIntegrationSpec extends FunctionalSpecBase {
where: 'the following data is used'
scenario | fetchDescendantsOption || expectedNumberOfNodesPerAnchor
'no' | OMIT_DESCENDANTS || 1
- 'direct' | DIRECT_CHILDREN_ONLY || 7
+ 'direct' | DIRECT_CHILD_ONLY || 7
'all' | INCLUDE_ALL_DESCENDANTS || 28
}
@@ -296,7 +296,7 @@ class CpsQueryServiceIntegrationSpec extends FunctionalSpecBase {
where: 'the following data is used'
scenario | fetchDescendantsOption || expectedNumberOfNodesPerAnchor
'no' | OMIT_DESCENDANTS || 1
- 'direct' | DIRECT_CHILDREN_ONLY || 7
+ 'direct' | DIRECT_CHILD_ONLY || 7
'all' | INCLUDE_ALL_DESCENDANTS || 28
}
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy
index 9cb65ab8f..4a1178bcf 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2023 Nordix Foundation
+ * Modifications Copyright (C) 2023 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
@@ -24,7 +25,7 @@ import java.time.OffsetDateTime
import org.onap.cps.api.CpsDataService
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase {
@@ -92,7 +93,7 @@ class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase {
}
def countDataNodes() {
- def results = objectUnderTest.getDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor', '/bookstore/categories[@code=1]', DIRECT_CHILDREN_ONLY)
+ def results = objectUnderTest.getDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor', '/bookstore/categories[@code=1]', DIRECT_CHILD_ONLY)
return results[0].childDataNodes.size()
}
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 f6ca5fcc1..ea5db69dc 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
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2023 Nordix Foundation
+ * Modifications Copyright (C) 2023 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
@@ -23,7 +24,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
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
@@ -45,7 +46,7 @@ class GetPerfTest extends CpsPerfTestBase {
where: 'the following parameters are used'
scenario | fetchDescendantsOption | anchor || durationLimit | expectedNumberOfDataNodes
'no descendants' | OMIT_DESCENDANTS | 'openroadm1' || 20 | 1
- 'direct descendants' | DIRECT_CHILDREN_ONLY | 'openroadm2' || 100 | 1 + 50
+ 'direct descendants' | DIRECT_CHILD_ONLY | 'openroadm2' || 100 | 1 + 50
'all descendants' | INCLUDE_ALL_DESCENDANTS | 'openroadm3' || 200 | 1 + 50 * 86
}
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 78e0d01bc..3ae25ca4a 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
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2023 Nordix Foundation
+ * Modifications Copyright (C) 2023 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
@@ -23,7 +24,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
+import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILD_ONLY
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
@@ -83,7 +84,7 @@ class QueryPerfTest extends CpsPerfTestBase {
where: 'the following parameters are used'
scenario | fetchDescendantsOption | anchor || durationLimit | expectedNumberOfDataNodes
'no descendants' | OMIT_DESCENDANTS | 'openroadm1' || 15 | 50
- 'direct descendants' | DIRECT_CHILDREN_ONLY | 'openroadm2' || 60 | 50 * 2
+ 'direct descendants' | DIRECT_CHILD_ONLY | 'openroadm2' || 60 | 50 * 2
'all descendants' | INCLUDE_ALL_DESCENDANTS | 'openroadm3' || 150 | 50 * 86
}
@@ -99,9 +100,9 @@ class QueryPerfTest extends CpsPerfTestBase {
recordAndAssertPerformance("Query ancestors with ${scenario}", durationLimit, durationInMillis)
where: 'the following parameters are used'
scenario | fetchDescendantsOption | anchor || durationLimit | expectedNumberOfDataNodes
- 'no descendants' | OMIT_DESCENDANTS | 'openroadm1' || 15 | 1
- 'direct descendants' | DIRECT_CHILDREN_ONLY | 'openroadm2' || 60 | 1 + 50
- 'all descendants' | INCLUDE_ALL_DESCENDANTS | 'openroadm3' || 150 | 1 + 50 * 86
+ 'no descendants' | OMIT_DESCENDANTS | 'openroadm1' || 15 | 1
+ 'direct descendants' | DIRECT_CHILD_ONLY | 'openroadm2' || 60 | 1 + 50
+ 'all descendants' | INCLUDE_ALL_DESCENDANTS | 'openroadm3' || 150 | 1 + 50 * 86
}
}