/*
* ============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");
*
* @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,
.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()));
}
/*
* ============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");
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.'() {
when: 'the data job status checked'
def result = dataJobStatusService.getDataJobStatus(authorization, dmiServiceName, dataProducerId, dataProducerJobId)
then: 'the status is that defined in the mock service.'
- assert result == 'status details from mock service'
+ assert result == '{"status":"status details from mock service"}'
}
}