@Test public void shouldGetTrigger() throws Exception { TriggerEvent expectedTrigger = prepareTrigger(); TaskTriggerInformation triggerInformation = prepareTaskTriggerInformation(expectedTrigger); when(triggerEventsDataService.byChannelModuleNameAndSubject(MODULE_NAME, expectedTrigger.getSubject())).thenReturn(null); when(dynamicChannelLoader.getTrigger(eq(triggerInformation))).thenReturn(expectedTrigger); TriggerEvent trigger = triggerEventService.getTrigger(triggerInformation); verify(triggerEventsDataService, times(1)).byChannelModuleNameAndSubject(MODULE_NAME, expectedTrigger.getSubject()); verify(dynamicChannelLoader, times(1)).getTrigger(triggerInformation); assertEquals(expectedTrigger, trigger); }
@Override @Transactional public TriggerEvent getTrigger(TaskTriggerInformation triggerInformation) { TriggerEvent triggerEvent = triggerEventsDataService.byChannelModuleNameAndSubject( triggerInformation.getModuleName(), triggerInformation.getSubject()); return triggerEvent != null ? triggerEvent : dynamicChannelLoader.getTrigger(triggerInformation); }
TriggerEventServiceImpl implements TriggerEventService { @Override @Transactional public TriggerEvent getTrigger(TaskTriggerInformation triggerInformation) { TriggerEvent triggerEvent = triggerEventsDataService.byChannelModuleNameAndSubject( triggerInformation.getModuleName(), triggerInformation.getSubject()); return triggerEvent != null ? triggerEvent : dynamicChannelLoader.getTrigger(triggerInformation); } }
TriggerEventServiceImpl implements TriggerEventService { @Override @Transactional public TriggerEvent getTrigger(TaskTriggerInformation triggerInformation) { TriggerEvent triggerEvent = triggerEventsDataService.byChannelModuleNameAndSubject( triggerInformation.getModuleName(), triggerInformation.getSubject()); return triggerEvent != null ? triggerEvent : dynamicChannelLoader.getTrigger(triggerInformation); }  }
TriggerEventServiceImpl implements TriggerEventService { @Override @Transactional public TriggerEvent getTrigger(TaskTriggerInformation triggerInformation) { TriggerEvent triggerEvent = triggerEventsDataService.byChannelModuleNameAndSubject( triggerInformation.getModuleName(), triggerInformation.getSubject()); return triggerEvent != null ? triggerEvent : dynamicChannelLoader.getTrigger(triggerInformation); }  @Override @Transactional List<TriggerEvent> getDynamicTriggers(String moduleName, int page, int pareSize); @Override @Transactional List<TriggerEvent> getStaticTriggers(String moduleName, int page, int pageSize); @Override @Transactional TriggerEvent getTrigger(TaskTriggerInformation triggerInformation); @Override @Transactional boolean triggerExists(TaskTriggerInformation information); @Override boolean providesDynamicTriggers(String moduleName); @Override @Transactional long countStaticTriggers(String moduleName); @Override long countDynamicTriggers(String moduleName); @Override @Transactional Set<TaskError> validateTrigger(TaskTriggerInformation trigger); @Autowired void setTriggerEventsDataService(TriggerEventsDataService triggerEventsDataService); @Autowired void setChannelsDataService(ChannelsDataService channelsDataService); @Autowired void setDynamicChannelLoader(DynamicChannelLoader dynamicChannelLoader); }
TriggerEventServiceImpl implements TriggerEventService { @Override @Transactional public TriggerEvent getTrigger(TaskTriggerInformation triggerInformation) { TriggerEvent triggerEvent = triggerEventsDataService.byChannelModuleNameAndSubject( triggerInformation.getModuleName(), triggerInformation.getSubject()); return triggerEvent != null ? triggerEvent : dynamicChannelLoader.getTrigger(triggerInformation); }  @Override @Transactional List<TriggerEvent> getDynamicTriggers(String moduleName, int page, int pareSize); @Override @Transactional List<TriggerEvent> getStaticTriggers(String moduleName, int page, int pageSize); @Override @Transactional TriggerEvent getTrigger(TaskTriggerInformation triggerInformation); @Override @Transactional boolean triggerExists(TaskTriggerInformation information); @Override boolean providesDynamicTriggers(String moduleName); @Override @Transactional long countStaticTriggers(String moduleName); @Override long countDynamicTriggers(String moduleName); @Override @Transactional Set<TaskError> validateTrigger(TaskTriggerInformation trigger); @Autowired void setTriggerEventsDataService(TriggerEventsDataService triggerEventsDataService); @Autowired void setChannelsDataService(ChannelsDataService channelsDataService); @Autowired void setDynamicChannelLoader(DynamicChannelLoader dynamicChannelLoader);  }