aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org
diff options
context:
space:
mode:
authorJosephKeenan <joseph.keenan@est.tech>2022-01-20 16:30:18 +0000
committerJosephKeenan <joseph.keenan@est.tech>2022-01-27 13:13:30 +0000
commitec674c778a0db04491c75f837cea92dd8ed4f2ff (patch)
treef572f1f1f0bb98da916e92a883db7e1d2e3142ae /cps-ncmp-service/src/test/groovy/org
parent1fabab11daa688a169fd2623cdc08c39232da10b (diff)
[TECHDEBT] Align CPS NCMP REST API Specification and Implementationmr/823/126723/8
- Updated ncmp.yml to align implementation with specification - Added new Exception classes to differentiate between server NCMP issues and client based NCMP issues - Added 500 error to specification - Added org.onap.cps.utils to list of packages in LayeredArchitectureTest as build was failing Issue-ID: CPS-823 Signed-off-by: JosephKeenan <joseph.keenan@est.tech> Change-Id: Ic646db5cc4dfc8d14106c8374b7c62cc9f9ab6e7
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy3
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy12
2 files changed, 9 insertions, 6 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
index b954b41ef2..3984b3c997 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.cps.api.CpsAdminService
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsModuleService
+import org.onap.cps.ncmp.api.impl.exception.DmiRequestException
import org.onap.cps.ncmp.api.impl.exception.NcmpException
import org.onap.cps.ncmp.api.impl.operations.DmiDataOperations
import org.onap.cps.ncmp.api.impl.operations.DmiModelOperations
@@ -172,7 +173,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
when: 'registration is called with incorrect DMI plugin information'
objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
then: 'an NcmpException is thrown with correct message details'
- def exceptionThrown = thrown(NcmpException)
+ def exceptionThrown = thrown(DmiRequestException)
assert exceptionThrown.getMessage().contains(expectedMessageDetails)
and: 'registration is not called'
0 * objectUnderTest.parseAndCreateCmHandlesInDmiRegistrationAndSyncModules(dmiPluginRegistration)
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index 51af0f55e1..2cd5731062 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -22,6 +22,9 @@
package org.onap.cps.ncmp.api.impl
+
+import org.onap.cps.ncmp.api.impl.exception.ServerNcmpException
+
import static org.onap.cps.ncmp.api.impl.operations.DmiOperations.DataStoreEnum.PASSTHROUGH_OPERATIONAL
import static org.onap.cps.ncmp.api.impl.operations.DmiOperations.DataStoreEnum.PASSTHROUGH_RUNNING
import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.CREATE
@@ -94,12 +97,11 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
'testResourceId', CREATE,
'{some-json}', 'application/json')
then: 'exception is thrown'
- def exceptionThrown = thrown(NcmpException.class)
+ def exceptionThrown = thrown(ServerNcmpException.class)
and: 'details contains (not found) error code: 404'
exceptionThrown.details.contains('404')
}
-
def 'Get resource data for pass-through operational from dmi.'() {
given: 'a data node'
def dataNode = getDataNode(true)
@@ -139,7 +141,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
'testAcceptParam',
'(a=1,b=2)')
then: 'exception is thrown with the expected details'
- def exceptionThrown = thrown(NcmpException.class)
+ def exceptionThrown = thrown(ServerNcmpException.class)
exceptionThrown.details == 'DMI status code: 404, DMI response body: NOK-json'
}
@@ -162,7 +164,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
'testAcceptParam',
'(a=1,b=2)')
then: 'exception is thrown'
- def exceptionThrown = thrown(NcmpException.class)
+ def exceptionThrown = thrown(ServerNcmpException.class)
and: 'details contains the original response'
exceptionThrown.details.contains('NOK-json')
}
@@ -207,7 +209,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
'testAcceptParam',
'(a=1,b=2)')
then: 'exception is thrown'
- def exceptionThrown = thrown(NcmpException.class)
+ def exceptionThrown = thrown(ServerNcmpException.class)
and: 'details contains the original response'
exceptionThrown.details.contains('NOK-json')
}