PollableTaskService { @Transactional(propagation = Propagation.REQUIRES_NEW) public PollableTask updateExpectedSubTaskNumber(long id, int expectedSubTaskNumber) { PollableTask pollableTask = getPollableTask(id); pollableTask.setExpectedSubTaskNumber(expectedSubTaskNumber); return pollableTaskRepository.save(pollableTask); }  @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 testUpdateExpectedSubTaskNumber() { PollableTask createPollableTask = pollableTaskService.createPollableTask(null, testIdWatcher.getEntityName("testUpdateExpectedSubTaskNumber"), null, 1); assertEquals(1, createPollableTask.getExpectedSubTaskNumber()); pollableTaskService.updateExpectedSubTaskNumber(createPollableTask.getId(), 12); createPollableTask = pollableTaskService.getPollableTask(createPollableTask.getId()); assertEquals(12, createPollableTask.getExpectedSubTaskNumber()); }