@Test public void testPublish() throws JMSException { setupDefaultMockedConnectionBehaviour(); cut.setDestinationType(JmsEventTransportImpl.DestinationType.Queue); cut.initThreadPool(); cut.notify(evsd); cut.publish(DummyEventImpl.BOBS_ADDRESS); JMSDestinationResolver alwaysResolvesNull = new JMSDestinationResolver<String>() { @Override public String resolveDestination(Class<? extends Event> eventClass, Object[] args) { return null; } }; cut.setDestinationResolver(alwaysResolvesNull); when(mockedSession.createProducer(null)).thenThrow(new JMSException("xx")); try { cut.publish(DummyEventImpl.BOBS_ADDRESS); fail("An exception should have been thrown here"); } catch (CougarException ignored) {} }
@Override public void publish(Event event) throws CougarException { String destinationName = destinationResolver.resolveDestination(event.getClass(), null); publish(event, destinationName, eventServiceBindingDescriptor); }
JmsEventTransportImpl extends AbstractRegisterableTransport implements EventTransport, ApplicationContextAware, InitializingBean { @Override public void publish(Event event) throws CougarException { String destinationName = destinationResolver.resolveDestination(event.getClass(), null); publish(event, destinationName, eventServiceBindingDescriptor); } }
JmsEventTransportImpl extends AbstractRegisterableTransport implements EventTransport, ApplicationContextAware, InitializingBean { @Override public void publish(Event event) throws CougarException { String destinationName = destinationResolver.resolveDestination(event.getClass(), null); publish(event, destinationName, eventServiceBindingDescriptor); } JmsEventTransportImpl(ConnectionFactory connectionFactory); }
JmsEventTransportImpl extends AbstractRegisterableTransport implements EventTransport, ApplicationContextAware, InitializingBean { @Override public void publish(Event event) throws CougarException { String destinationName = destinationResolver.resolveDestination(event.getClass(), null); publish(event, destinationName, eventServiceBindingDescriptor); } JmsEventTransportImpl(ConnectionFactory connectionFactory); void init(); void initThreadPool(); void initialiseExecutionContext(); void destroy(); @Override void publish(Event event); void publish(Event event, String destinationName, EventServiceBindingDescriptor eventServiceBindingDescriptor); Future<Boolean> requestConnectionToBroker(); void closeConnection(); @Override void subscribe(String eventName, Object[] args, final ExecutionObserver observer); DestinationType getDestinationType(); @Required void setDestinationType(DestinationType destinationType); void setThreadPoolSize(int threadPoolSize); JMSEventMarshaller getEventMarshaller(); @Required void setEventMarshaller(JMSEventMarshaller eventMarshaller); EventUnMarshaller getEventUnMarshaller(); @Required void setEventUnMarshaller(EventUnMarshaller eventUnMarshaller); EventErrorHandler getErrorHandler(); @Required void setErrorHandler(EventErrorHandler errorHandler); @Override void notify(BindingDescriptor bindingDescriptor); @Override void notify(BindingDescriptor bindingDescriptor, EventTransportMode mode); JMSDestinationResolver<String> getDestinationResolver(); @Required void setDestinationResolver(JMSDestinationResolver<String> destinationResolver); void setMonitorRegistry(MonitorRegistry monitorRegistry); @Required void setConnectionMonitor(ConnectionMonitor connectionMonitor); @Override void setApplicationContext(ApplicationContext applicationContext); @Override void afterPropertiesSet(); int getAcknowledgementMode(); void setAcknowledgementMode(int acknowledgementMode); ExecutionContext getExecutionContext(); void setExecutionContext(final ExecutionContext executionContext); String getTransportIdentifier(); void setTransportIdentifier(String transportIdentifier); String getUsername(); @Required void setUsername(String username); String getPassword(); @Required void setPassword(String password); }
JmsEventTransportImpl extends AbstractRegisterableTransport implements EventTransport, ApplicationContextAware, InitializingBean { @Override public void publish(Event event) throws CougarException { String destinationName = destinationResolver.resolveDestination(event.getClass(), null); publish(event, destinationName, eventServiceBindingDescriptor); } JmsEventTransportImpl(ConnectionFactory connectionFactory); void init(); void initThreadPool(); void initialiseExecutionContext(); void destroy(); @Override void publish(Event event); void publish(Event event, String destinationName, EventServiceBindingDescriptor eventServiceBindingDescriptor); Future<Boolean> requestConnectionToBroker(); void closeConnection(); @Override void subscribe(String eventName, Object[] args, final ExecutionObserver observer); DestinationType getDestinationType(); @Required void setDestinationType(DestinationType destinationType); void setThreadPoolSize(int threadPoolSize); JMSEventMarshaller getEventMarshaller(); @Required void setEventMarshaller(JMSEventMarshaller eventMarshaller); EventUnMarshaller getEventUnMarshaller(); @Required void setEventUnMarshaller(EventUnMarshaller eventUnMarshaller); EventErrorHandler getErrorHandler(); @Required void setErrorHandler(EventErrorHandler errorHandler); @Override void notify(BindingDescriptor bindingDescriptor); @Override void notify(BindingDescriptor bindingDescriptor, EventTransportMode mode); JMSDestinationResolver<String> getDestinationResolver(); @Required void setDestinationResolver(JMSDestinationResolver<String> destinationResolver); void setMonitorRegistry(MonitorRegistry monitorRegistry); @Required void setConnectionMonitor(ConnectionMonitor connectionMonitor); @Override void setApplicationContext(ApplicationContext applicationContext); @Override void afterPropertiesSet(); int getAcknowledgementMode(); void setAcknowledgementMode(int acknowledgementMode); ExecutionContext getExecutionContext(); void setExecutionContext(final ExecutionContext executionContext); String getTransportIdentifier(); void setTransportIdentifier(String transportIdentifier); String getUsername(); @Required void setUsername(String username); String getPassword(); @Required void setPassword(String password);  }