QuartzPollableTaskScheduler { public <I, O> PollableFuture<O> scheduleJob(Class<? extends QuartzPollableJob<I, O>> clazz, I input) { QuartzJobInfo<I, O> quartzJobInfo = QuartzJobInfo.newBuilder(clazz). withInput(input). withMessage(clazz.getSimpleName()). build(); return scheduleJob(quartzJobInfo); }  PollableFuture<O> scheduleJob(Class<? extends QuartzPollableJob<I, O>> clazz, I input); PollableFuture<O> scheduleJob(QuartzJobInfo<I, O> quartzJobInfo);  }
@Test public void test() throws ExecutionException, InterruptedException { PollableFuture<AQuartzPollableJobOutput> pollableFuture = quartzPollableTaskScheduler.scheduleJob(AQuartzPollableJob.class, 10L); AQuartzPollableJobOutput s = pollableFuture.get(); assertEquals("output: 10", s.getOutput()); PollableFuture<AQuartzPollableJobOutput> stringPollableFuture2 = quartzPollableTaskScheduler.scheduleJob(AQuartzPollableJob.class, 10L); AQuartzPollableJobOutput s2 = stringPollableFuture2.get(); assertEquals("output: 10", s2.getOutput()); }
@Test public void testVoid() throws ExecutionException, InterruptedException { PollableFuture<Void> pollableFuture = quartzPollableTaskScheduler.scheduleJob(VoidQuartzPollableJob.class, 10L); Void aVoid = pollableFuture.get(); assertEquals(null, aVoid); try { Object output = pollableTaskBlobStorage.getOutputJson(pollableFuture.getPollableTask().getId()); fail(); } catch(RuntimeException re) { assertTrue(re.getMessage().startsWith("Can't get the output json for:")); } }