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);
}
@Test
void producerDeleteEiType() throws Exception {
putInfoType(TYPE_ID);
+ this.putEiJob(TYPE_ID, "job1");
+ this.putEiJob(TYPE_ID, "job2");
deleteInfoType(TYPE_ID);
assertThat(this.infoTypes.size()).isZero();
+ assertThat(this.infoJobs.size()).isZero(); // Test that also the job is deleted
testErrorCode(restClient().delete(deleteInfoTypeUrl(TYPE_ID)), HttpStatus.NOT_FOUND,
"Information type not found");