summaryrefslogtreecommitdiffstats
path: root/dmi-service
diff options
context:
space:
mode:
authorleventecsanyi <levente.csanyi@est.tech>2024-07-26 13:25:12 +0200
committerleventecsanyi <levente.csanyi@est.tech>2024-07-26 16:41:38 +0200
commitee4242c9d89dc1a814f12d0f90880e3f21745f43 (patch)
treeba07625919bbf93de269a7d46d97888a6b780c6e /dmi-service
parent7f49c706b6fba519d34099b08450b884d53c798b (diff)
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 <levente.csanyi@est.tech> Change-Id: I9398cb73b635bec360df886372690187ff54e0d4
Diffstat (limited to 'dmi-service')
-rw-r--r--dmi-service/openapi/openapi-datajob.yml22
-rw-r--r--dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java41
-rw-r--r--dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy12
3 files changed, 63 insertions, 12 deletions
diff --git a/dmi-service/openapi/openapi-datajob.yml b/dmi-service/openapi/openapi-datajob.yml
index 68ee3ecc..aa93623c 100644
--- a/dmi-service/openapi/openapi-datajob.yml
+++ b/dmi-service/openapi/openapi-datajob.yml
@@ -74,6 +74,20 @@ paths:
responses:
"501":
$ref: '#/components/responses/NotImplemented'
+ /v1/dataJob/{requestId}/dataProducerJob/{dataProducerJobId}/result:
+ get:
+ description: Retrieve the result of a data job.
+ operationId: getDataJobResult
+ parameters:
+ - $ref: '#/components/parameters/requestIdInPath'
+ - $ref: '#/components/parameters/dataProducerJobIdInPath'
+ - $ref: '#/components/parameters/dataProducerIdInQuery'
+ - $ref: '#/components/parameters/destinationInQuery'
+ tags:
+ - dmi-datajob
+ responses:
+ "501":
+ $ref: '#/components/responses/NotImplemented'
components:
parameters:
@@ -101,6 +115,14 @@ components:
schema:
type: string
example: some-data-producer-identifier
+ destinationInQuery:
+ name: destination
+ in: query
+ description: The destination of the results (Kafka topic name or s3 bucket name)
+ required: true
+ schema:
+ type: string
+ example: some-destination
schemas:
ErrorMessage:
type: object
diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java
index 8cf9f1fb..928ec6b6 100644
--- a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java
+++ b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestController.java
@@ -34,13 +34,13 @@ public class DmiDatajobsRestController implements DmiDatajobApi {
/**
* This method is not implemented for ONAP DMI plugin.
*
- * @param requestId Identifier for the overall Datajob (required)
- * @param subjobReadRequest Operation body (optional)
- * @return (@ code ResponseEntity) response entity
+ * @param requestId Identifier for the overall Datajob (required)
+ * @param subjobReadRequest Operation body (optional)
+ * @return (@ code ResponseEntity) Response entity
*/
@Override
public ResponseEntity<Void> readDataJob(final String requestId,
- final SubjobReadRequest subjobReadRequest) {
+ final SubjobReadRequest subjobReadRequest) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@@ -48,23 +48,23 @@ public class DmiDatajobsRestController implements DmiDatajobApi {
/**
* This method is not implemented for ONAP DMI plugin.
*
- * @param requestId Identifier for the overall Datajob (required)
- * @param subjobWriteRequest Operation body (optional)
- * @return (@ code ResponseEntity) response entity
+ * @param requestId Identifier for the overall Datajob (required)
+ * @param subjobWriteRequest Operation body (optional)
+ * @return (@ code ResponseEntity) Response entity
*/
@Override
public ResponseEntity<Void> writeDataJob(final String requestId,
- final SubjobWriteRequest subjobWriteRequest) {
+ final SubjobWriteRequest subjobWriteRequest) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* This method is not implemented for ONAP DMI plugin.
*
- * @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)
- * @return ResponseEntity(Void) response entity indicating the method is not implemented
+ * @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)
+ * @return ResponseEntity Response entity indicating the method is not implemented
*/
@Override
public ResponseEntity<Void> getDataJobStatus(final String requestId,
@@ -72,4 +72,21 @@ public class DmiDatajobsRestController implements DmiDatajobApi {
final String dataProducerId) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
+
+ /**
+ * This method is not implemented for ONAP DMI plugin.
+ *
+ * @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 ResponseEntity Response entity indicating the method is not implemented
+ */
+ @Override
+ public ResponseEntity<Void> getDataJobResult(final String requestId,
+ final String dataProducerJobId,
+ final String dataProducerId,
+ final String destination) {
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ }
}
diff --git a/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy b/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy
index 69d2ebd2..6c05f6f3 100644
--- a/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy
+++ b/dmi-service/src/test/groovy/org/onap/cps/ncmp/dmi/datajobs/rest/controller/DmiDatajobsRestControllerSpec.groovy
@@ -79,4 +79,16 @@ class DmiDatajobsRestControllerSpec extends Specification{
then: 'response value is Not Implemented'
response.status == HttpStatus.NOT_IMPLEMENTED.value()
}
+
+ def 'get result request should return 501 HTTP Status' () {
+ given: 'URL to get the result of a data job'
+ def getStatus = "${basePathV1}/dataJob/some-identifier/dataProducerJob/some-producer-job-identifier/result?dataProducerId=some-data-producer-identifier&destination=some-destination"
+ when: 'the request is performed'
+ def response = mvc.perform(
+ get(getStatus)
+ .contentType('application/json')
+ ).andReturn().response
+ then: 'response value is Not Implemented'
+ response.status == HttpStatus.NOT_IMPLEMENTED.value()
+ }
}