From ee4242c9d89dc1a814f12d0f90880e3f21745f43 Mon Sep 17 00:00:00 2001 From: leventecsanyi Date: Fri, 26 Jul 2024 13:25:12 +0200 Subject: Get data job result - extended openapi - added not-implemented http error for result endpoint - added testware - added stub implementation - fixed writeDataJob bug in stub Issue-ID: CPS-2296 Signed-off-by: leventecsanyi Change-Id: I9398cb73b635bec360df886372690187ff54e0d4 --- .../stub/controller/DmiRestStubController.java | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java') diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java index b8b46f06..5021ae76 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java @@ -89,7 +89,7 @@ public class DmiRestStubController { private long readDataForCmHandleDelayMs; @Value("${delay.write-data-for-cm-handle-delay-ms}") private long writeDataForCmHandleDelayMs; - private AtomicInteger subJobWriteRequestCounter; + private final AtomicInteger subJobWriteRequestCounter = new AtomicInteger(); /** * This code defines a REST API endpoint for adding new the module set tag mapping. The endpoint receives the @@ -293,6 +293,27 @@ public class DmiRestStubController { return ResponseEntity.ok("FINISHED"); } + /** + * Retrieves the result of a given data job identified by {@code requestId} and {@code dataProducerJobId}. + * + * @param requestId Identifier for the overall Datajob (required) + * @param dataProducerJobId Identifier for the data producer job (required) + * @param dataProducerId Identifier for the data producer as a query parameter (required) + * @param destination The destination of the results, Kafka topic name or s3 bucket name (required) + * @return A ResponseEntity with HTTP status 200 (OK) and the data job's result as an Object. + */ + @GetMapping("/v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/result") + public ResponseEntity retrieveDataJobResult( + @PathVariable("requestId") final String requestId, + @PathVariable("dataProducerJobId") final String dataProducerJobId, + @RequestParam(name = "dataProducerId") String dataProducerId, + @RequestParam(name = "destination") String destination) { + log.debug("Received request to retrieve data job result. Request ID: {}, Data Producer Job ID: {}, " + + "Data Producer ID: {}, Destination: {}", + requestId, dataProducerJobId, dataProducerId, destination); + return ResponseEntity.ok(Map.of("result", "some status")); + } + private CloudEvent buildAndGetCloudEvent(final String topic, final String requestId, final DataOperationEvent dataOperationEvent) { CloudEvent cloudEvent = null; -- cgit 1.2.3-korg