summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2022-05-27 10:58:52 +0100
committerToineSiebelink <toine.siebelink@est.tech>2022-05-31 17:53:58 +0100
commitd1a7dad5af98a7f3397f8535ba88129a0f7dce11 (patch)
treee7b378bea44828aeff76196772819764e03b2251 /cps-ncmp-rest/src
parentf31c7f8bd4985c84f9126d071439c1a4de57f704 (diff)
Handle RestTemplate Error handling so NCMP cna report correct server status
- Moved resposne handling to DmRestClient - Clean up incorrect/redundant tests in CmProxyDataServiceImplSpec Issue-ID: CPS-1056 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I78ba87d6af7255d85758893cfef237d75227875a
Diffstat (limited to 'cps-ncmp-rest/src')
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy6
1 files changed, 3 insertions, 3 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
index fd3203b5b1..45ed3d3070 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
@@ -47,6 +47,7 @@ import spock.lang.Specification
import static org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandlerSpec.ApiType.NCMP
import static org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandlerSpec.ApiType.NCMPINVENTORY
+import static org.springframework.http.HttpStatus.BAD_GATEWAY
import static org.springframework.http.HttpStatus.BAD_REQUEST
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR
import static org.springframework.http.HttpStatus.NOT_FOUND
@@ -121,10 +122,9 @@ class NetworkCmProxyRestExceptionHandlerSpec extends Specification {
def 'Failing DMI Request - passthrough scenario'() {
given: 'failing DMI request'
- mockNetworkCmProxyDataService.getResourceDataPassThroughRunningForCmHandle(*_) >> { throw new HttpClientRequestException('Error Message Details NCMP', 'Bad Request from DMI', 400) }
+ setupTestException(new HttpClientRequestException('Error Message Details NCMP', 'Bad Request from DMI', 400) , NCMP)
when: 'the DMI request is executed'
- def response = mvc.perform(get("$dataNodeBaseEndpointNcmp/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=stores:bookstore/categories=100"))
- .andReturn().response
+ def response = performTestRequest(NCMP)
then: 'NCMP service responds with 502 Bad Gateway status'
response.status == HttpStatus.BAD_GATEWAY.value()
and: 'the NCMP response also contains the original DMI response details'