@Test public void shouldRegisterChannel() { String triggerEvent = "{ displayName: 'displayName', subject: 'subject', eventParameters: [{ displayName: 'displayName', eventKey: 'eventKey' }] }"; String channel = String.format("{displayName: %s, triggerTaskEvents: [%s]}", BUNDLE_SYMBOLIC_NAME, triggerEvent); InputStream stream = new ByteArrayInputStream(channel.getBytes(Charset.forName("UTF-8"))); channelService.registerChannel(stream, BUNDLE_SYMBOLIC_NAME, VERSION); ArgumentCaptor<Channel> captor = ArgumentCaptor.forClass(Channel.class); verify(channelsDataService).create(captor.capture()); Channel c = captor.getValue(); assertEquals(BUNDLE_SYMBOLIC_NAME, c.getDisplayName()); assertEquals(BUNDLE_SYMBOLIC_NAME, c.getModuleName()); assertEquals(VERSION, c.getModuleVersion()); assertEquals(1, c.getTriggerTaskEvents().size()); assertEquals(new TriggerEvent("displayName", "subject", null, asList(new EventParameter("displayName", "eventKey")), ""), c.getTriggerTaskEvents().get(0)); }
@Override @Transactional public void registerChannel(ChannelRequest channelRequest) { LOGGER.info("Registering channel: {}", channelRequest.getModuleName()); addOrUpdate(ChannelBuilder.fromChannelRequest(channelRequest).build()); }
ChannelServiceImpl implements ChannelService { @Override @Transactional public void registerChannel(ChannelRequest channelRequest) { LOGGER.info("Registering channel: {}", channelRequest.getModuleName()); addOrUpdate(ChannelBuilder.fromChannelRequest(channelRequest).build()); } }
ChannelServiceImpl implements ChannelService { @Override @Transactional public void registerChannel(ChannelRequest channelRequest) { LOGGER.info("Registering channel: {}", channelRequest.getModuleName()); addOrUpdate(ChannelBuilder.fromChannelRequest(channelRequest).build()); } @Autowired  ChannelServiceImpl(TriggerEventService triggerEventService, ChannelsDataService channelsDataService, EventRelay eventRelay); }
ChannelServiceImpl implements ChannelService { @Override @Transactional public void registerChannel(ChannelRequest channelRequest) { LOGGER.info("Registering channel: {}", channelRequest.getModuleName()); addOrUpdate(ChannelBuilder.fromChannelRequest(channelRequest).build()); } @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 void registerChannel(ChannelRequest channelRequest) { LOGGER.info("Registering channel: {}", channelRequest.getModuleName()); addOrUpdate(ChannelBuilder.fromChannelRequest(channelRequest).build()); } @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);  }