X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=enrichment-coordinator-service%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fenrichment%2Fcontroller%2FConsumerSimulatorController.java;h=27160f13c89e199f558f8f3552d8ba11b01920b8;hb=3724a5ee563ed1635c5f4de1032d9c966873cc52;hp=660277f7cd4ffe83a3a2c6e2aee79c8fd64b0b0a;hpb=718fc1767c5534e0606c7ffeb3bb23db6b8d9b0e;p=nonrtric.git diff --git a/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/controller/ConsumerSimulatorController.java b/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/controller/ConsumerSimulatorController.java index 660277f7..27160f13 100644 --- a/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/controller/ConsumerSimulatorController.java +++ b/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/controller/ConsumerSimulatorController.java @@ -35,8 +35,10 @@ import java.util.List; import lombok.Getter; import org.oransc.enrichment.controllers.VoidResponse; -import org.oransc.enrichment.controllers.consumer.ConsumerConsts; -import org.oransc.enrichment.controllers.consumer.ConsumerEiJobStatus; +import org.oransc.enrichment.controllers.a1e.A1eConsts; +import org.oransc.enrichment.controllers.a1e.A1eEiJobStatus; +import org.oransc.enrichment.controllers.r1consumer.ConsumerConsts; +import org.oransc.enrichment.controllers.r1consumer.ConsumerTypeRegistrationInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; @@ -48,31 +50,37 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @RestController("ConsumerSimulatorController") -@Tag(name = ConsumerConsts.CONSUMER_API_CALLBACKS_NAME) public class ConsumerSimulatorController { private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); public static class TestResults { - public List status = Collections.synchronizedList(new ArrayList()); + public List eiJobStatusCallbacks = + Collections.synchronizedList(new ArrayList()); + public List typeRegistrationInfoCallbacks = + Collections.synchronizedList(new ArrayList()); public void reset() { - status.clear(); + eiJobStatusCallbacks.clear(); + typeRegistrationInfoCallbacks.clear(); } } @Getter private TestResults testResults = new TestResults(); - public static String getJobStatusUrl(String eiJobId) { - return "/example_dataconsumer/eijobs/" + eiJobId + "/status"; + public static String getJobStatusUrl(String infoJobId) { + return "/example_dataconsumer/info_jobs/" + infoJobId + "/status"; } - @PostMapping(path = "/example_dataconsumer/eijobs/{eiJobId}/status", produces = MediaType.APPLICATION_JSON_VALUE) + @Tag(name = A1eConsts.CONSUMER_API_CALLBACKS_NAME) + @PostMapping( + path = "/example_dataconsumer/info_jobs/{infoJobId}/status", + produces = MediaType.APPLICATION_JSON_VALUE) @Operation( - summary = "Callback for changed EI job status", - description = "The primitive is implemented by the data consumer and is invoked when a EI job status has been changed.") + summary = "Callback for changed Information Job status", + description = "The primitive is implemented by the data consumer and is invoked when a Information Job status has been changed.") @ApiResponses( value = { // @ApiResponse( @@ -81,10 +89,36 @@ public class ConsumerSimulatorController { content = @Content(schema = @Schema(implementation = VoidResponse.class))) // }) public ResponseEntity jobStatusCallback( // - @PathVariable("eiJobId") String eiJobId, // - @RequestBody ConsumerEiJobStatus status) { - logger.info("Job status callback status: {} eiJobId: {}", status.state, eiJobId); - this.testResults.status.add(status); + @PathVariable("infoJobId") String infoJobId, // + @RequestBody A1eEiJobStatus status) { + logger.info("Job status callback status: {} infoJobId: {}", status.state, infoJobId); + this.testResults.eiJobStatusCallbacks.add(status); + return new ResponseEntity<>(HttpStatus.OK); + } + + private static final String TYPE_STATUS_CALLBACK_URL = "/example_dataconsumer/info_type_status"; + + public static String getTypeStatusCallbackUrl() { + return TYPE_STATUS_CALLBACK_URL; + } + + @Tag(name = ConsumerConsts.CONSUMER_API_CALLBACKS_NAME) + @PostMapping(path = TYPE_STATUS_CALLBACK_URL, produces = MediaType.APPLICATION_JSON_VALUE) + @Operation( + summary = "Callback for changed Information type registration status", + description = "The primitive is implemented by the data consumer and is invoked when a Information type status has been changed.
" + + "Subscription are managed by primitives in '" + ConsumerConsts.CONSUMER_API_NAME + "'") + @ApiResponses( + value = { // + @ApiResponse( + responseCode = "200", + description = "OK", // + content = @Content(schema = @Schema(implementation = VoidResponse.class))) // + }) + public ResponseEntity typeStatusCallback( // + @RequestBody ConsumerTypeRegistrationInfo status) { + logger.info("Job type registration status callback status: {}", status); + this.testResults.typeRegistrationInfoCallbacks.add(status); return new ResponseEntity<>(HttpStatus.OK); }