@Test public void shouldGetChannelByChannelInfo() { String displayName = "Test"; String moduleName = "test-1"; Channel expected = new Channel(); expected.setDisplayName(displayName); expected.setModuleName(moduleName); expected.setModuleVersion(VERSION); when(channelsDataService.findByModuleName(moduleName)).thenReturn(expected); when(bundleContext.getBundles()).thenReturn(new Bundle[]{bundle}); when(bundle.getSymbolicName()).thenReturn(moduleName); Channel actual = channelService.getChannel(moduleName); assertNotNull(actual); assertEquals(expected, actual); }
@Override @Transactional public Channel getChannel(final String moduleName) { List<String> symbolicNames = WebBundleUtil.getSymbolicNames(bundleContext); return symbolicNames.contains(moduleName) ? channelsDataService.findByModuleName(moduleName) : null; }
ChannelServiceImpl implements ChannelService { @Override @Transactional public Channel getChannel(final String moduleName) { List<String> symbolicNames = WebBundleUtil.getSymbolicNames(bundleContext); return symbolicNames.contains(moduleName) ? channelsDataService.findByModuleName(moduleName) : null; } }
ChannelServiceImpl implements ChannelService { @Override @Transactional public Channel getChannel(final String moduleName) { List<String> symbolicNames = WebBundleUtil.getSymbolicNames(bundleContext); return symbolicNames.contains(moduleName) ? channelsDataService.findByModuleName(moduleName) : null; } @Autowired  ChannelServiceImpl(TriggerEventService triggerEventService, ChannelsDataService channelsDataService, EventRelay eventRelay); }
ChannelServiceImpl implements ChannelService { @Override @Transactional public Channel getChannel(final String moduleName) { List<String> symbolicNames = WebBundleUtil.getSymbolicNames(bundleContext); return symbolicNames.contains(moduleName) ? channelsDataService.findByModuleName(moduleName) : null; } @Autowired  ChannelServiceImpl(TriggerEventService triggerEventService, ChannelsDataService channelsDataService, EventRelay eventRelay); @Override @Transactional void registerChannel(ChannelRequest channelRequest); @Override @Transactional void unregisterChannel(String moduleName); @Override @Transactional void registerChannel(final InputStream stream, String moduleName, String moduleVersion); @Override @Transactional synchronized void addOrUpdate(final Channel channel); @Override @Transactional synchronized void delete(final String moduleName); @Override @Transactional List<Channel> getAllChannels(); @Override @Transactional Channel getChannel(final String moduleName); @Override @Transactional boolean channelExists(String moduleName); @Autowired(required = false) void setBundleContext(BundleContext bundleContext); }
ChannelServiceImpl implements ChannelService { @Override @Transactional public Channel getChannel(final String moduleName) { List<String> symbolicNames = WebBundleUtil.getSymbolicNames(bundleContext); return symbolicNames.contains(moduleName) ? channelsDataService.findByModuleName(moduleName) : null; } @Autowired  ChannelServiceImpl(TriggerEventService triggerEventService, ChannelsDataService channelsDataService, EventRelay eventRelay); @Override @Transactional void registerChannel(ChannelRequest channelRequest); @Override @Transactional void unregisterChannel(String moduleName); @Override @Transactional void registerChannel(final InputStream stream, String moduleName, String moduleVersion); @Override @Transactional synchronized void addOrUpdate(final Channel channel); @Override @Transactional synchronized void delete(final String moduleName); @Override @Transactional List<Channel> getAllChannels(); @Override @Transactional Channel getChannel(final String moduleName); @Override @Transactional boolean channelExists(String moduleName); @Autowired(required = false) void setBundleContext(BundleContext bundleContext);  }