+ assertThat(this.eiProducers.size()).isZero();
+ assertThat(this.eiTypes.size()).isZero();
+ assertThat(this.eiJobs.size()).isZero();
+ }
+
+ @Test
+ void testGetProducerEiType() throws JsonMappingException, JsonProcessingException, ServiceException {
+ putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/eitypes/" + EI_TYPE_ID;
+ ResponseEntity<String> resp = restClient().getForEntity(url).block();
+ assertThat(resp.getBody()).contains(EI_PRODUCER_ID);
+ }
+
+ @Test
+ void testGetProducerIdentifiers() throws JsonMappingException, JsonProcessingException, ServiceException {
+ putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/eiproducers";
+ ResponseEntity<String> resp = restClient().getForEntity(url).block();
+ assertThat(resp.getBody()).contains(EI_PRODUCER_ID);
+ }
+
+ private void assertProducerOpState(String producerId,
+ ProducerStatusInfo.OperationalState expectedOperationalState) {
+ String statusUrl = ProducerConsts.API_ROOT + "/eiproducers/" + producerId + "/status";
+ ResponseEntity<String> resp = restClient().getForEntity(statusUrl).block();
+ ProducerStatusInfo statusInfo = gson.fromJson(resp.getBody(), ProducerStatusInfo.class);
+ assertThat(statusInfo.opState).isEqualTo(expectedOperationalState);
+ }
+
+ @Test
+ void testProducerSupervision() throws JsonMappingException, JsonProcessingException, ServiceException {
+ putEiProducerWithOneTypeRejecting("simulateProducerError", EI_TYPE_ID);
+
+ assertThat(this.eiProducers.size()).isEqualTo(1);
+ assertThat(this.eiTypes.size()).isEqualTo(1);
+ assertProducerOpState("simulateProducerError", ProducerStatusInfo.OperationalState.ENABLED);
+
+ this.producerSupervision.createTask().blockLast();
+ this.producerSupervision.createTask().blockLast();
+ assertThat(this.eiProducers.size()).isEqualTo(1);
+ assertProducerOpState("simulateProducerError", ProducerStatusInfo.OperationalState.DISABLED);
+
+ // After 3 failed checks, the producer shall be deregisterred
+ this.producerSupervision.createTask().blockLast();