JmsConsumer extends JmsConsumerImpl { public JmsConsumer withEndpoint(String s) { setEndpoint(s); return this; } JmsConsumer();   JmsConsumer(boolean transacted); JmsConsumer withEndpoint(String s);  }
@Test public void testDurableTopicConsume() throws Exception { Assume.assumeTrue(JmsConfig.jmsTestsEnabled()); String rfc6167 = "jms:topic:" + getName() + "?subscriptionId=" + getName(); JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167); consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE"); StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer); MockMessageListener jms = new MockMessageListener(); standaloneConsumer.registerAdaptrisMessageListener(jms); StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167)); LifecycleHelper.prepare(standaloneConsumer); LifecycleHelper.prepare(standaloneProducer); execute(standaloneConsumer, standaloneProducer, createMessage(null), jms); assertMessages(jms, 1); }
@Test public void testSharedDurableTopicConsume() throws Exception { Assume.assumeTrue(JmsConfig.jmsTestsEnabled()); String rfc6167 = "jms:topic:" + getName() + "?subscriptionId=MySubId&sharedConsumerId=" + getName(); JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167); consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE"); StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer); MockMessageListener jms = new MockMessageListener(); standaloneConsumer.registerAdaptrisMessageListener(jms); StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167)); execute(standaloneConsumer, standaloneProducer, createMessage(null), jms); assertMessages(jms, 1); }
@Test public void testSharedTopicConsume() throws Exception { Assume.assumeTrue(JmsConfig.jmsTestsEnabled()); String rfc6167 = "jms:topic:" + getName() + "?sharedConsumerId=" + getName(); JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167); consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE"); StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer); MockMessageListener jms = new MockMessageListener(); standaloneConsumer.registerAdaptrisMessageListener(jms); StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167)); execute(standaloneConsumer, standaloneProducer, createMessage(null), jms); assertMessages(jms, 1); }
@Test public void testTopicConsume() throws Exception { Assume.assumeTrue(JmsConfig.jmsTestsEnabled()); String rfc6167 = "jms:topic:" + getName(); JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167);; consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE"); StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer); MockMessageListener jms = new MockMessageListener(); standaloneConsumer.registerAdaptrisMessageListener(jms); StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167)); execute(standaloneConsumer, standaloneProducer, createMessage(null), jms); assertMessages(jms, 1); }
@Test public void testQueueConsume() throws Exception { Assume.assumeTrue(JmsConfig.jmsTestsEnabled()); String rfc6167 = "jms:queue:" + getName(); JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167); consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE"); StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer); MockMessageListener jms = new MockMessageListener(); standaloneConsumer.registerAdaptrisMessageListener(jms); StandaloneProducer producer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167)); LifecycleHelper.prepare(standaloneConsumer); LifecycleHelper.prepare(producer); execute(standaloneConsumer, producer, createMessage(null), jms); assertMessages(jms, 1); }