From: John Keeney Date: Thu, 2 Sep 2021 09:26:50 +0000 (+0000) Subject: Merge " ECS, deleting jobs when the type is deleted" X-Git-Tag: 1.2.0~107 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=f09d7ed9c458244bd8edbf38f689cff75bd19790;hp=3724a5ee563ed1635c5f4de1032d9c966873cc52;p=nonrtric.git Merge " ECS, deleting jobs when the type is deleted" --- 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 29426ab0..6c3c05dd 100644 --- 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 @@ -190,6 +190,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); } diff --git a/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java b/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java index df938adf..12d4e472 100644 --- a/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java +++ b/enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java @@ -555,9 +555,12 @@ class ApplicationTest { @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");