aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service
diff options
context:
space:
mode:
authorBruno Sakoto <bruno.sakoto@bell.ca>2021-04-26 14:37:57 +0000
committerGerrit Code Review <gerrit@onap.org>2021-04-26 14:37:57 +0000
commit8895ce4bc508874e95321f97acc014f5e5be7fa7 (patch)
treee9238c39d2fced59f3a8e9ade2f040e639a34141 /cps-service
parent51ddaf6a3e004e9e9940d6ae3dc9b9e01188a85b (diff)
parent2b7d23c2ffa067732df1ecc3879d252646dad2da (diff)
Merge "Get Data under anchor using single root"
Diffstat (limited to 'cps-service')
-rwxr-xr-x[-rw-r--r--]cps-service/src/main/java/org/onap/cps/spi/exceptions/DataNodeNotFoundException.java11
-rwxr-xr-xcps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy8
2 files changed, 18 insertions, 1 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/spi/exceptions/DataNodeNotFoundException.java b/cps-service/src/main/java/org/onap/cps/spi/exceptions/DataNodeNotFoundException.java
index 125b93d70a..6e7ac3b897 100644..100755
--- a/cps-service/src/main/java/org/onap/cps/spi/exceptions/DataNodeNotFoundException.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/exceptions/DataNodeNotFoundException.java
@@ -39,4 +39,15 @@ public class DataNodeNotFoundException extends DataValidationException {
.format("DataNode with xpath %s was not found for anchor %s and dataspace %s.", xpath,
anchorName, dataspaceName));
}
+
+ /**
+ * Constructor.
+ *
+ * @param dataspaceName the name of the dataspace
+ * @param anchorName the anchor name
+ */
+ public DataNodeNotFoundException(final String dataspaceName, final String anchorName) {
+ super("DataNode not found", String.format(
+ "DataNode not found for anchor %s and dataspace %s.", anchorName, dataspaceName));
+ }
}
diff --git a/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy
index d2f43c9362..8592af908d 100755
--- a/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy
@@ -119,12 +119,18 @@ class CpsExceptionsSpec extends Specification {
+ "Anchor records associated.")
}
- def 'Creating a exception that a datanode does not exist.'() {
+ def 'Creating a exception that a datanode with a specified xpath does not exist.'() {
expect: 'the exception details contains the correct message with dataspace name and xpath.'
(new DataNodeNotFoundException(dataspaceName, anchorName, xpath)).details
== "DataNode with xpath ${xpath} was not found for anchor ${anchorName} and dataspace ${dataspaceName}."
}
+ def 'Creating a exception that a datanode does not exist.'() {
+ expect: 'the exception details contains the correct message with dataspace name and anchor.'
+ (new DataNodeNotFoundException(dataspaceName, anchorName)).details
+ == "DataNode not found for anchor ${anchorName} and dataspace ${dataspaceName}."
+ }
+
def 'Creating a exception that a dataspace already exists.'() {
expect: 'the exception details contains the correct message with dataspace name.'
(AlreadyDefinedException.forDataspace(dataspaceName, rootCause)).details