PollableTaskService { @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) public PollableTask getPollableTask(long id) { return pollableTaskRepository.findById(id).orElse(null); }  @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) PollableTask getPollableTask(long id); PollableTask createPollableTask(Long parentId, String name, String message, int expectedSubTaskNumber); @Transactional(propagation = Propagation.REQUIRES_NEW) PollableTask createPollableTask(Long parentId, String name, String message, int expectedSubTaskNumber, long timeout); @Transactional(propagation = Propagation.REQUIRES_NEW) PollableTask finishTask(long id, String messageOverride, ExceptionHolder exceptionHolder, Integer expectedSubTaskNumberOverride); @Transactional(propagation = Propagation.REQUIRES_NEW) PollableTask updateExpectedSubTaskNumber(long id, int expectedSubTaskNumber); PollableTask waitForPollableTask(Long pollableId); PollableTask waitForPollableTask(Long pollableId, long timeout); PollableTask waitForPollableTask(Long pollableId, long timeout, long sleepTime); List<PollableTask> getAllPollableTasksWithError(PollableTask pollableTask); final static Long NO_TIMEOUT; }
@Test public void testGetPollableTask() { PollableTask createPollableTask = pollableTaskService.createPollableTask(null, testIdWatcher.getEntityName("testGetPollableTask"), "a message", 0); PollableTask pollableTask = pollableTaskService.getPollableTask(createPollableTask.getId()); assertEquals(pollableTask.getId(), createPollableTask.getId()); assertEquals(pollableTask.getName(), createPollableTask.getName()); assertEquals("a message", createPollableTask.getMessage()); assertEquals("\"a message\"", createPollableTask.getMessageAsJson()); assertEquals(0, createPollableTask.getExpectedSubTaskNumber()); assertNull(createPollableTask.getFinishedDate()); assertFalse(createPollableTask.isAllFinished()); }