+ void putEiProducerWithOneType_rejecting() throws JsonMappingException, JsonProcessingException, ServiceException {
+ putEiProducerWithOneTypeRejecting("simulateProducerError", EI_TYPE_ID);
+ String url = ConsumerConsts.API_ROOT + "/eitypes/typeId/eijobs/jobId";
+ String body = gson.toJson(eiJobInfo());
+ testErrorCode(restClient().put(url, body), HttpStatus.CONFLICT, "Job not accepted by any producers");
+
+ ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
+ assertThat(simulatorResults.noOfRejectedCreate).isEqualTo(1);
+ }
+
+ @Test
+ void testPutEiJob_jsonSchemavalidationError() throws Exception {
+ putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+
+ String url = ConsumerConsts.API_ROOT + "/eitypes/typeId/eijobs/jobId";
+ // The element with name "property1" is mandatory in the schema
+ ConsumerEiJobInfo jobInfo =
+ new ConsumerEiJobInfo(jsonObject("{ \"XXstring\" : \"value\" }"), "owner", "targetUri");
+ String body = gson.toJson(jobInfo);
+
+ testErrorCode(restClient().put(url, body), HttpStatus.CONFLICT, "Json validation failure");
+ }
+
+ @Test
+ void testGetEiProducerTypes() throws Exception {
+ final String EI_TYPE_ID_2 = EI_TYPE_ID + "_2";
+ putEiProducerWithOneType("producer1", EI_TYPE_ID);
+ putEiJob(EI_TYPE_ID, "jobId");
+ putEiProducerWithOneType("producer2", EI_TYPE_ID_2);
+ putEiJob(EI_TYPE_ID_2, "jobId2");
+ String url = ProducerConsts.API_ROOT + "/eitypes";
+
+ ResponseEntity<String> resp = restClient().getForEntity(url).block();
+ assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
+ assertThat(resp.getBody()).contains(EI_TYPE_ID);
+ assertThat(resp.getBody()).contains(EI_TYPE_ID_2);
+ }
+
+ @Test
+ void testReplacingEiProducerTypes() throws Exception {
+ final String REPLACED_TYPE_ID = "replaced";
+ putEiProducerWithOneType(EI_PRODUCER_ID, REPLACED_TYPE_ID);
+ putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+