summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcps-rest/docs/api/swagger/cpsAdmin.yml2
-rwxr-xr-xcps-rest/docs/api/swagger/cpsData.yml3
-rwxr-xr-xcps-rest/docs/api/swagger/openapi.yml5
-rwxr-xr-x[-rw-r--r--]cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy22
-rw-r--r--pom.xml33
5 files changed, 54 insertions, 11 deletions
diff --git a/cps-rest/docs/api/swagger/cpsAdmin.yml b/cps-rest/docs/api/swagger/cpsAdmin.yml
index f1bac8dda5..5040e2cf8d 100755
--- a/cps-rest/docs/api/swagger/cpsAdmin.yml
+++ b/cps-rest/docs/api/swagger/cpsAdmin.yml
@@ -1,4 +1,4 @@
-dataspace:
+dataspaces:
post:
description: Create a new dataspace
tags:
diff --git a/cps-rest/docs/api/swagger/cpsData.yml b/cps-rest/docs/api/swagger/cpsData.yml
index eabed28365..24644899a4 100755
--- a/cps-rest/docs/api/swagger/cpsData.yml
+++ b/cps-rest/docs/api/swagger/cpsData.yml
@@ -1,4 +1,4 @@
-nodesByDataspaceAndAnchor:
+nodeByDataspaceAndAnchor:
get:
description: Get a node with an option to retrieve all the children for a given anchor and dataspace
tags:
@@ -23,6 +23,7 @@ nodesByDataspaceAndAnchor:
$ref: 'components.yml#/components/responses/NotFound'
x-codegen-request-body-name: xpath
+nodesByDataspaceAndAnchor:
post:
description: Create a node for a given anchor and dataspace
tags:
diff --git a/cps-rest/docs/api/swagger/openapi.yml b/cps-rest/docs/api/swagger/openapi.yml
index 5b9e5f4b6c..2ead202398 100755
--- a/cps-rest/docs/api/swagger/openapi.yml
+++ b/cps-rest/docs/api/swagger/openapi.yml
@@ -25,7 +25,7 @@ tags:
paths:
/v1/dataspaces:
- $ref: 'cpsAdmin.yml#/dataspace'
+ $ref: 'cpsAdmin.yml#/dataspaces'
/v1/dataspaces/{dataspace-name}:
$ref: 'cpsAdmin.yml#/dataspaceByDataspaceName'
@@ -42,6 +42,9 @@ paths:
/v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}:
$ref: 'cpsAdmin.yml#/schemaSetBySchemaSetName'
+ /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node:
+ $ref: 'cpsData.yml#/nodeByDataspaceAndAnchor'
+
/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes:
$ref: 'cpsData.yml#/nodesByDataspaceAndAnchor'
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
index c5fd162030..cca94d1aec 100644..100755
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
@@ -68,7 +68,7 @@ class DataRestControllerSpec extends Specification {
@Value('${rest.api.cps-base-path}')
def basePath
- def dataNodeEndpoint
+ def dataNodeBaseEndpoint
def dataspaceName = 'my_dataspace'
def anchorName = 'my_anchor'
@@ -81,15 +81,16 @@ class DataRestControllerSpec extends Specification {
.withChildDataNodes([new DataNodeBuilder().withXpath("/parent/child").build()]).build()
def setup() {
- dataNodeEndpoint = "$basePath/v1/dataspaces/$dataspaceName/anchors/$anchorName/nodes"
+ dataNodeBaseEndpoint = "$basePath/v1/dataspaces/$dataspaceName"
}
def 'Create a node.'() {
given: 'some json to create a data node'
+ def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/nodes"
def json = 'some json (this is not validated)'
when: 'post is invoked with datanode endpoint and json'
def response = mvc.perform(
- post(dataNodeEndpoint).contentType(MediaType.APPLICATION_JSON).content(json)
+ post(endpoint).contentType(MediaType.APPLICATION_JSON).content(json)
).andReturn().response
then: 'a created response is returned'
response.status == HttpStatus.CREATED.value()
@@ -101,10 +102,11 @@ class DataRestControllerSpec extends Specification {
def 'Get data node with leaves'() {
given: 'the service returns data node leaves'
def xpath = 'some xPath'
+ def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/node"
mockCpsDataService.getDataNode(dataspaceName, anchorName, xpath, OMIT_DESCENDANTS) >> dataNodeWithLeavesNoChildren
when: 'get request is performed through REST API'
def response = mvc.perform(
- get(dataNodeEndpoint).param('xpath', xpath)
+ get(endpoint).param('xpath', xpath)
).andReturn().response
then: 'a success response is returned'
response.status == HttpStatus.OK.value()
@@ -118,9 +120,10 @@ class DataRestControllerSpec extends Specification {
def 'Get data node with #scenario.'() {
given: 'the service returns data node with #scenario'
def xpath = 'some xPath'
+ def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/node"
mockCpsDataService.getDataNode(dataspaceName, anchorName, xpath, expectedCpsDataServiceOption) >> dataNode
when: 'get request is performed through REST API'
- def response = mvc.perform(get(dataNodeEndpoint)
+ def response = mvc.perform(get(endpoint)
.param('xpath', xpath)
.param('include-descendants', includeDescendantsOption))
.andReturn().response
@@ -138,10 +141,11 @@ class DataRestControllerSpec extends Specification {
@Unroll
def 'Get data node error scenario: #scenario.'() {
given: 'the service throws an exception'
+ def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/node"
mockCpsDataService.getDataNode(dataspaceName, anchorName, xpath, _) >> { throw exception }
when: 'get request is performed through REST API'
def response = mvc.perform(
- get(dataNodeEndpoint).param("xpath", xpath)
+ get(endpoint).param("xpath", xpath)
).andReturn().response
then: 'a success response is returned'
response.status == httpStatus.value()
@@ -157,9 +161,10 @@ class DataRestControllerSpec extends Specification {
def 'Update data node leaves: #scenario.'() {
given: 'json data'
def jsonData = 'json data'
+ def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/nodes"
when: 'patch request is performed'
def response = mvc.perform(
- patch(dataNodeEndpoint)
+ patch(endpoint)
.contentType(MediaType.APPLICATION_JSON)
.content(jsonData)
.param('xpath', xpath)
@@ -178,9 +183,10 @@ class DataRestControllerSpec extends Specification {
def 'Replace data node tree: #scenario.'() {
given: 'json data'
def jsonData = 'json data'
+ def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/nodes"
when: 'put request is performed'
def response = mvc.perform(
- put(dataNodeEndpoint)
+ put(endpoint)
.contentType(MediaType.APPLICATION_JSON)
.content(jsonData)
.param('xpath', xpath)
diff --git a/pom.xml b/pom.xml
index d8bd8c90e2..22742a34ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,3 +1,22 @@
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (c) 2020 Linux Foundation.
+ Modifications Copyright (C) 2021 Bell Canada.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -39,4 +58,18 @@
<module>spotbugs</module>
<module>cps-application</module>
</modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>versions-maven-plugin</artifactId>
+ <version>2.8.1</version>
+ <configuration>
+ <processAllModules>true</processAllModules>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>