Merge "Add test for consumer restclient"
[nonrtric.git] / enrichment-coordinator-service / src / main / java / org / oransc / enrichment / controllers / r1producer / ProducerController.java
index 29426ab..0aa6974 100644 (file)
@@ -149,7 +149,8 @@ public class ProducerController {
         if (registrationInfo.jobDataSchema == null) {
             return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
         }
-        InfoType newDefinition = 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);
@@ -190,6 +191,7 @@ public class ProducerController {
             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);
     }
@@ -393,7 +395,7 @@ public class ProducerController {
     }
 
     private ProducerInfoTypeInfo toInfoTypeInfo(InfoType t) {
-        return new ProducerInfoTypeInfo(t.getJobDataSchema());
+        return new ProducerInfoTypeInfo(t.getJobDataSchema(), t.getTypeSpecificInfo());
     }
 
     private InfoProducers.InfoProducerRegistrationInfo toProducerRegistrationInfo(String infoProducerId,