diff options
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/dmi/DmiRestClient.java | 7 | ||||
-rw-r--r-- | cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiRestClientSpec.groovy | 9 |
2 files changed, 7 insertions, 9 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/dmi/DmiRestClient.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/dmi/DmiRestClient.java index a177272dff..ccda476081 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/dmi/DmiRestClient.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/dmi/DmiRestClient.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2024 Nordix Foundation + * Copyright (C) 2021-2025 Nordix Foundation * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -150,7 +150,7 @@ public class DmiRestClient { * * @param urlTemplateParameters The URL template parameters for the DMI data job status endpoint. * @param authorization The authorization token to be added to the request headers. - * @return A Mono emitting the status of the data job as a String. + * @return A Mono emitting the status of the data job in JSON format. * @throws DmiClientRequestException If there is an error during the DMI request. */ public Mono<String> getDataJobStatus(final UrlTemplateParameters urlTemplateParameters, @@ -160,8 +160,7 @@ public class DmiRestClient { .uri(urlTemplateParameters.urlTemplate(), urlTemplateParameters.urlVariables()) .headers(httpHeaders -> configureHttpHeaders(httpHeaders, authorization)) .retrieve() - .bodyToMono(JsonNode.class) - .map(jsonNode -> jsonNode.path("status").asText()) + .bodyToMono(String.class) .onErrorMap(throwable -> handleDmiClientException(throwable, OperationType.READ.getOperationName())); } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiRestClientSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiRestClientSpec.groovy index 4d47ef14a0..c968a32b3c 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiRestClientSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiRestClientSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2024 Nordix Foundation + * Copyright (C) 2021-2025 Nordix Foundation * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -168,13 +168,12 @@ class DmiRestClientSpec extends Specification { def 'DMI GET Operation for DMI Data Service '() { given: 'the Data web client returns a valid response entity for the expected parameters' mockDataServicesWebClient.get() >> mockRequestBody - def jsonNode = jsonObjectMapper.convertJsonString('{"status":"some status"}', JsonNode.class) - ((ObjectNode) jsonNode).put('status', 'some status') - mockResponse.bodyToMono(JsonNode.class) >> Mono.just(jsonNode) + def result = '{"status":"some status"}' + mockResponse.bodyToMono(String.class) >> Mono.just(result) when: 'GET operation is invoked for Data Service' def response = objectUnderTest.getDataJobStatus(urlTemplateParameters, NO_AUTH_HEADER).block() then: 'the response equals to the expected value' - assert response == 'some status' + assert response == '{"status":"some status"}' } def 'Get data job result from DMI.'() { |