@Test public void shouldFindTasksForGivenTrigger() { Task t = new Task("name", trigger, asList(action)); TriggerEvent triggerEvent = new TriggerEvent(); triggerEvent.setSubject(trigger.getSubject()); when(tasksDataService.executeQuery(Matchers.<QueryExecution<Object>>any())).thenReturn(asList(t)); List<Task> tasks = taskService.findActiveTasksForTrigger(triggerEvent); assertEquals(asList(t), tasks); }
@Override @Transactional public List<Task> findActiveTasksForTrigger(final TriggerEvent trigger) { return (trigger == null) ? Collections.<Task>emptyList() : findActiveTasksForTriggerSubject(trigger.getSubject()); }
TaskServiceImpl implements TaskService { @Override @Transactional public List<Task> findActiveTasksForTrigger(final TriggerEvent trigger) { return (trigger == null) ? Collections.<Task>emptyList() : findActiveTasksForTriggerSubject(trigger.getSubject()); } }
TaskServiceImpl implements TaskService { @Override @Transactional public List<Task> findActiveTasksForTrigger(final TriggerEvent trigger) { return (trigger == null) ? Collections.<Task>emptyList() : findActiveTasksForTriggerSubject(trigger.getSubject()); }  }
TaskServiceImpl implements TaskService { @Override @Transactional public List<Task> findActiveTasksForTrigger(final TriggerEvent trigger) { return (trigger == null) ? Collections.<Task>emptyList() : findActiveTasksForTriggerSubject(trigger.getSubject()); }  @Override @Transactional Set<TaskError> save(final Task task); @Override @Transactional void setEnabledOrDisabled(final Task task); @Override @Transactional ActionEvent getActionEventFor(TaskActionInformation taskActionInformation); @Override @Transactional List<Task> getAllTasks(); @Override @Transactional List<Task> findTasksByName(String name); @Override @Transactional List<Task> findActiveTasksForTrigger(final TriggerEvent trigger); @Override @Transactional List<Task> findActiveTasksForTriggerSubject(final String subject); @Override TasksEventParser findCustomParser(String name); @Override @Transactional Task getTask(Long taskId); @Override @Transactional void deleteTask(Long taskId); @MotechListener(subjects = CHANNEL_UPDATE_SUBJECT) @Transactional void validateTasksAfterChannelUpdate(MotechEvent event); @MotechListener(subjects = DATA_PROVIDER_UPDATE_SUBJECT) @Transactional void validateTasksAfterTaskDataProviderUpdate(MotechEvent event); @Override @Transactional String exportTask(Long taskId); @Override @Transactional Task importTask(String json); @Override @Transactional List<Task> findTasksDependentOnModule(final String moduleName); @Autowired void setTasksDataService(TasksDataService tasksDataService); @Autowired void setChannelService(ChannelService channelService); @Autowired void setProviderService(TaskDataProviderService providerService); @Autowired void setEventRelay(EventRelay eventRelay); @Autowired void setBundleContext(BundleContext bundleContext); @Autowired void setTaskValidator(TaskValidator taskValidator); @Autowired void setTriggerEventService(TriggerEventService triggerEventService); @Autowired void setTaskMigrationManager(TaskMigrationManager taskMigrationManager); }
TaskServiceImpl implements TaskService { @Override @Transactional public List<Task> findActiveTasksForTrigger(final TriggerEvent trigger) { return (trigger == null) ? Collections.<Task>emptyList() : findActiveTasksForTriggerSubject(trigger.getSubject()); }  @Override @Transactional Set<TaskError> save(final Task task); @Override @Transactional void setEnabledOrDisabled(final Task task); @Override @Transactional ActionEvent getActionEventFor(TaskActionInformation taskActionInformation); @Override @Transactional List<Task> getAllTasks(); @Override @Transactional List<Task> findTasksByName(String name); @Override @Transactional List<Task> findActiveTasksForTrigger(final TriggerEvent trigger); @Override @Transactional List<Task> findActiveTasksForTriggerSubject(final String subject); @Override TasksEventParser findCustomParser(String name); @Override @Transactional Task getTask(Long taskId); @Override @Transactional void deleteTask(Long taskId); @MotechListener(subjects = CHANNEL_UPDATE_SUBJECT) @Transactional void validateTasksAfterChannelUpdate(MotechEvent event); @MotechListener(subjects = DATA_PROVIDER_UPDATE_SUBJECT) @Transactional void validateTasksAfterTaskDataProviderUpdate(MotechEvent event); @Override @Transactional String exportTask(Long taskId); @Override @Transactional Task importTask(String json); @Override @Transactional List<Task> findTasksDependentOnModule(final String moduleName); @Autowired void setTasksDataService(TasksDataService tasksDataService); @Autowired void setChannelService(ChannelService channelService); @Autowired void setProviderService(TaskDataProviderService providerService); @Autowired void setEventRelay(EventRelay eventRelay); @Autowired void setBundleContext(BundleContext bundleContext); @Autowired void setTaskValidator(TaskValidator taskValidator); @Autowired void setTriggerEventService(TriggerEventService triggerEventService); @Autowired void setTaskMigrationManager(TaskMigrationManager taskMigrationManager); static final List<String> IGNORED_FIELDS; }