VertxJobsService extends RestJobsService { @Override public String scheduleProcessInstanceJob(ProcessInstanceJobDescription description) { String callback = getCallbackEndpoint(description); LOGGER.debug("Job to be scheduled {} with callback URL {}", description, callback); final Job job = JobBuilder.builder() .id(description.id()) .expirationTime(description.expirationTime().get()) .repeatInterval(description.expirationTime().repeatInterval()) .repeatLimit(description.expirationTime().repeatLimit()) .priority(0) .callbackEndpoint(callback) .processId(description.processId()) .processInstanceId(description.processInstanceId()) .rootProcessId(description.rootProcessId()) .rootProcessInstanceId(description.rootProcessInstanceId()) .build(); client.post(JOBS_PATH).sendJson(job, res -> { if (res.succeeded() && res.result().statusCode() == 200) { LOGGER.debug("Creating of the job {} done with status code {} ", job, res.result().statusCode()); } else { LOGGER.error("Scheduling of job {} failed with response code {}", job, res.result().statusCode(), res.cause()); } }); return job.getId(); } @Inject  VertxJobsService(@ConfigProperty(name = "kogito.jobs-service.url") String jobServiceUrl,
                            @ConfigProperty(name = "kogito.service.url") String callbackEndpoint,
                            Vertx vertx,
                            Instance<WebClient> providedWebClient);   VertxJobsService(); @Override String scheduleProcessJob(ProcessJobDescription description); @Override String scheduleProcessInstanceJob(ProcessInstanceJobDescription description); @Override boolean cancelJob(String id); @Override ZonedDateTime getScheduledTime(String id);  }
@Test void testScheduleProcessInstanceJob(@Mock HttpRequest<Buffer> request) { when(webClient.post(anyString())).thenReturn(request); ProcessInstanceJobDescription processInstanceJobDescription = ProcessInstanceJobDescription.of(123, ExactExpirationTime.now(), "processInstanceId", "processId"); tested.scheduleProcessInstanceJob(processInstanceJobDescription); verify(webClient).post("/jobs"); ArgumentCaptor<Job> jobArgumentCaptor = forClass(Job.class); verify(request).sendJson(jobArgumentCaptor.capture(), any(Handler.class)); Job job = jobArgumentCaptor.getValue(); assertThat(job.getId()).isEqualTo(processInstanceJobDescription.id()); assertThat(job.getExpirationTime()).isEqualTo(processInstanceJobDescription.expirationTime().get()); assertThat(job.getProcessInstanceId()).isEqualTo(processInstanceJobDescription.processInstanceId()); assertThat(job.getProcessId()).isEqualTo(processInstanceJobDescription.processId()); }