@Test public void shouldDeleteAllTaskActivitiesForGivenTask() { when(taskActivitiesDataService.byTask(TASK_ID)).thenReturn(activities); activityService.deleteActivitiesForTask(TASK_ID); verify(taskActivitiesDataService, times(activities.size())).delete(any(TaskActivity.class)); }
@Override @Transactional public void deleteActivitiesForTask(Long taskId) { for (TaskActivity msg : taskActivitiesDataService.byTask(taskId)) { taskActivitiesDataService.delete(msg); } }
TaskActivityServiceImpl implements TaskActivityService { @Override @Transactional public void deleteActivitiesForTask(Long taskId) { for (TaskActivity msg : taskActivitiesDataService.byTask(taskId)) { taskActivitiesDataService.delete(msg); } } }
TaskActivityServiceImpl implements TaskActivityService { @Override @Transactional public void deleteActivitiesForTask(Long taskId) { for (TaskActivity msg : taskActivitiesDataService.byTask(taskId)) { taskActivitiesDataService.delete(msg); } } @Autowired  TaskActivityServiceImpl(TaskActivitiesDataService taskActivitiesDataService); }
TaskActivityServiceImpl implements TaskActivityService { @Override @Transactional public void deleteActivitiesForTask(Long taskId) { for (TaskActivity msg : taskActivitiesDataService.byTask(taskId)) { taskActivitiesDataService.delete(msg); } } @Autowired  TaskActivityServiceImpl(TaskActivitiesDataService taskActivitiesDataService); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) long addTaskStarted(Task task, Map<String, Object> parameters); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addTaskFiltered(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) boolean addSuccessfulExecution(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addFilteredExecution(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addFailedExecution(Long activityId, Throwable e); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addTaskDisabledWarning(Task task); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addWarning(Task task, String key, String field); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addWarningWithException(Task task, String key, String field, Exception e); @Override @Transactional void deleteActivitiesForTask(Long taskId); @Override @Transactional TaskActivity getTaskActivityById(Long activityId); @Override @Transactional List<TaskActivity> getLatestActivities(); @Override @Transactional List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange,
                                               QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange,
                                                QueryParams queryParams, boolean lastExecution); @Override @Transactional long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, boolean lastExecution); @Override @Transactional long getTaskActivitiesCount(Long taskId, TaskActivityType type); @Override @Transactional long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, boolean lastExecution); @Override @Transactional long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, boolean lastExecution); @Override @Transactional long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, boolean lastExecution); }
TaskActivityServiceImpl implements TaskActivityService { @Override @Transactional public void deleteActivitiesForTask(Long taskId) { for (TaskActivity msg : taskActivitiesDataService.byTask(taskId)) { taskActivitiesDataService.delete(msg); } } @Autowired  TaskActivityServiceImpl(TaskActivitiesDataService taskActivitiesDataService); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) long addTaskStarted(Task task, Map<String, Object> parameters); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addTaskFiltered(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) boolean addSuccessfulExecution(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addFilteredExecution(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addFailedExecution(Long activityId, Throwable e); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addTaskDisabledWarning(Task task); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addWarning(Task task, String key, String field); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addWarningWithException(Task task, String key, String field, Exception e); @Override @Transactional void deleteActivitiesForTask(Long taskId); @Override @Transactional TaskActivity getTaskActivityById(Long activityId); @Override @Transactional List<TaskActivity> getLatestActivities(); @Override @Transactional List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange,
                                               QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange,
                                                QueryParams queryParams, boolean lastExecution); @Override @Transactional long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, boolean lastExecution); @Override @Transactional long getTaskActivitiesCount(Long taskId, TaskActivityType type); @Override @Transactional long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, boolean lastExecution); @Override @Transactional long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, boolean lastExecution); @Override @Transactional long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, boolean lastExecution);  }