@Test public void testBindMessageConsumer() throws JMSException { String testConsumedMT = "consumed_mt"; String testConsumedMV = "consumed_mv"; String testMessageSelector = "MESSAGE_TYPE" + " = '" + testConsumedMT + "' AND MESSAGE_VERSION = '" + testConsumedMV + "'"; EasyMock.expect(consumerMock.getConsumedMessageType()).andReturn(testConsumedMT); EasyMock.expect(consumerMock.getConsumedMessageVersion()).andReturn(testConsumedMV); EasyMock.expect(sessionMock.createConsumer(destMock, testMessageSelector)) .andReturn(jmsConsumerMock); EasyMock.expect(providerMock.getSession()).andReturn(sessionMock); EasyMock.expect(providerMock.getDestination()).andReturn(destMock); jmsConsumerMock.setMessageListener(EasyMock .isA(JMSAdapterMessagesListener.class)); EasyMock.replay(consumerMock, destMock, sessionMock, jmsConsumerMock, providerMock); ConsumerFactory consumerFactory = new ConsumerFactory(); consumerFactory.setProvider(providerMock); consumerFactory.bindMessageConsumer(consumerMock); EasyMock.verify(consumerMock, destMock, sessionMock, jmsConsumerMock, providerMock); }
@Bind(aggregate = true, optional = true) public void bindMessageConsumer(ProviderMessageConsumer consumer) { try { MessageConsumer jmsConsumer = getSession().createConsumer( getDestination(), getMessageTypeSelector(consumer.getConsumedMessageType(), consumer.getConsumedMessageVersion())); JMSMessageConsumerImpl cntJMSMessageConsumer = new JMSMessageConsumerImpl(); cntJMSMessageConsumer.setCommunoteMessageConsumer(consumer); cntJMSMessageConsumer.setJmsMessageConsumer(jmsConsumer); cntJMSMessageConsumer.setJmsSender(jmsSender); jmsMessageConsumers.put(consumer, cntJMSMessageConsumer); cntJMSMessageConsumer.start(); LOG.debug("JMS message consumer has been instantiated and bound."); } catch (JMSException e) { LOG.error("JMS message consumer has not been instantiated. " + consumer.getClass().getName(), e); } }
ConsumerFactory { @Bind(aggregate = true, optional = true) public void bindMessageConsumer(ProviderMessageConsumer consumer) { try { MessageConsumer jmsConsumer = getSession().createConsumer( getDestination(), getMessageTypeSelector(consumer.getConsumedMessageType(), consumer.getConsumedMessageVersion())); JMSMessageConsumerImpl cntJMSMessageConsumer = new JMSMessageConsumerImpl(); cntJMSMessageConsumer.setCommunoteMessageConsumer(consumer); cntJMSMessageConsumer.setJmsMessageConsumer(jmsConsumer); cntJMSMessageConsumer.setJmsSender(jmsSender); jmsMessageConsumers.put(consumer, cntJMSMessageConsumer); cntJMSMessageConsumer.start(); LOG.debug("JMS message consumer has been instantiated and bound."); } catch (JMSException e) { LOG.error("JMS message consumer has not been instantiated. " + consumer.getClass().getName(), e); } } }
ConsumerFactory { @Bind(aggregate = true, optional = true) public void bindMessageConsumer(ProviderMessageConsumer consumer) { try { MessageConsumer jmsConsumer = getSession().createConsumer( getDestination(), getMessageTypeSelector(consumer.getConsumedMessageType(), consumer.getConsumedMessageVersion())); JMSMessageConsumerImpl cntJMSMessageConsumer = new JMSMessageConsumerImpl(); cntJMSMessageConsumer.setCommunoteMessageConsumer(consumer); cntJMSMessageConsumer.setJmsMessageConsumer(jmsConsumer); cntJMSMessageConsumer.setJmsSender(jmsSender); jmsMessageConsumers.put(consumer, cntJMSMessageConsumer); cntJMSMessageConsumer.start(); LOG.debug("JMS message consumer has been instantiated and bound."); } catch (JMSException e) { LOG.error("JMS message consumer has not been instantiated. " + consumer.getClass().getName(), e); } }  }
ConsumerFactory { @Bind(aggregate = true, optional = true) public void bindMessageConsumer(ProviderMessageConsumer consumer) { try { MessageConsumer jmsConsumer = getSession().createConsumer( getDestination(), getMessageTypeSelector(consumer.getConsumedMessageType(), consumer.getConsumedMessageVersion())); JMSMessageConsumerImpl cntJMSMessageConsumer = new JMSMessageConsumerImpl(); cntJMSMessageConsumer.setCommunoteMessageConsumer(consumer); cntJMSMessageConsumer.setJmsMessageConsumer(jmsConsumer); cntJMSMessageConsumer.setJmsSender(jmsSender); jmsMessageConsumers.put(consumer, cntJMSMessageConsumer); cntJMSMessageConsumer.start(); LOG.debug("JMS message consumer has been instantiated and bound."); } catch (JMSException e) { LOG.error("JMS message consumer has not been instantiated. " + consumer.getClass().getName(), e); } }  @Bind(aggregate = true, optional = true) void bindMessageConsumer(ProviderMessageConsumer consumer); @Validate void init(); @Invalidate void stopConsumerFactory(); @Unbind(aggregate = true) void unbindMessageConsumer(ProviderMessageConsumer consumer); }
ConsumerFactory { @Bind(aggregate = true, optional = true) public void bindMessageConsumer(ProviderMessageConsumer consumer) { try { MessageConsumer jmsConsumer = getSession().createConsumer( getDestination(), getMessageTypeSelector(consumer.getConsumedMessageType(), consumer.getConsumedMessageVersion())); JMSMessageConsumerImpl cntJMSMessageConsumer = new JMSMessageConsumerImpl(); cntJMSMessageConsumer.setCommunoteMessageConsumer(consumer); cntJMSMessageConsumer.setJmsMessageConsumer(jmsConsumer); cntJMSMessageConsumer.setJmsSender(jmsSender); jmsMessageConsumers.put(consumer, cntJMSMessageConsumer); cntJMSMessageConsumer.start(); LOG.debug("JMS message consumer has been instantiated and bound."); } catch (JMSException e) { LOG.error("JMS message consumer has not been instantiated. " + consumer.getClass().getName(), e); } }  @Bind(aggregate = true, optional = true) void bindMessageConsumer(ProviderMessageConsumer consumer); @Validate void init(); @Invalidate void stopConsumerFactory(); @Unbind(aggregate = true) void unbindMessageConsumer(ProviderMessageConsumer consumer);  }