Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Add test for consumer restclient"
[nonrtric.git]
/
enrichment-coordinator-service
/
src
/
main
/
java
/
org
/
oransc
/
enrichment
/
controllers
/
r1producer
/
ProducerController.java
diff --git
a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java
b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java
index
15bd56d
..
0aa6974
100644
(file)
--- a/
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java
+++ b/
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java
@@
-46,6
+46,7
@@
import org.oransc.enrichment.repository.InfoJobs;
import org.oransc.enrichment.repository.InfoProducer;
import org.oransc.enrichment.repository.InfoProducers;
import org.oransc.enrichment.repository.InfoType;
import org.oransc.enrichment.repository.InfoProducer;
import org.oransc.enrichment.repository.InfoProducers;
import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypeSubscriptions;
import org.oransc.enrichment.repository.InfoTypes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.oransc.enrichment.repository.InfoTypes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@
-75,6
+76,9
@@
public class ProducerController {
@Autowired
private InfoProducers infoProducers;
@Autowired
private InfoProducers infoProducers;
+ @Autowired
+ private InfoTypeSubscriptions typeSubscriptions;
+
@GetMapping(path = ProducerConsts.API_ROOT + "/info-types", produces = MediaType.APPLICATION_JSON_VALUE) //
@Operation(summary = "Info Type identifiers", description = "") //
@ApiResponses(
@GetMapping(path = ProducerConsts.API_ROOT + "/info-types", produces = MediaType.APPLICATION_JSON_VALUE) //
@Operation(summary = "Info Type identifiers", description = "") //
@ApiResponses(
@@
-145,7
+149,10
@@
public class ProducerController {
if (registrationInfo.jobDataSchema == null) {
return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
}
if (registrationInfo.jobDataSchema == null) {
return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
}
- this.infoTypes.put(new InfoType(infoTypeId, registrationInfo.jobDataSchema));
+ InfoType newDefinition =
+ new InfoType(infoTypeId, registrationInfo.jobDataSchema, registrationInfo.typeSpecificInformation);
+ this.infoTypes.put(newDefinition);
+ this.typeSubscriptions.notifyTypeRegistered(newDefinition);
return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
}
return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
}
@@
-184,6
+191,8
@@
public class ProducerController {
return ErrorResponse.create("The type has active producers: " + firstProducerId, HttpStatus.NOT_ACCEPTABLE);
}
this.infoTypes.remove(type);
return ErrorResponse.create("The type has active producers: " + firstProducerId, HttpStatus.NOT_ACCEPTABLE);
}
this.infoTypes.remove(type);
+ infoJobs.getJobsForType(type).forEach(job -> infoJobs.remove(job, infoProducers)); // Delete jobs for the type
+ this.typeSubscriptions.notifyTypeRemoved(type);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@
-386,7
+395,7
@@
public class ProducerController {
}
private ProducerInfoTypeInfo toInfoTypeInfo(InfoType t) {
}
private ProducerInfoTypeInfo toInfoTypeInfo(InfoType t) {
- return new ProducerInfoTypeInfo(t.getJobDataSchema());
+ return new ProducerInfoTypeInfo(t.getJobDataSchema()
, t.getTypeSpecificInfo()
);
}
private InfoProducers.InfoProducerRegistrationInfo toProducerRegistrationInfo(String infoProducerId,
}
private InfoProducers.InfoProducerRegistrationInfo toProducerRegistrationInfo(String infoProducerId,