1 7 package org.jboss.test.messaging; 8 9 import org.jboss.messaging.channel.plugins.handler.ChannelHandler; 10 import org.jboss.messaging.channel.plugins.handler.ExclusiveChannelHandler; 11 import org.jboss.messaging.interfaces.Consumer; 12 import org.jboss.messaging.memory.MemoryMessageSet; 13 import org.jboss.test.jms.BaseJMSTest; 14 15 21 public class ExclusiveChannelTestCase extends BaseJMSTest 22 { 23 25 27 29 31 public ExclusiveChannelTestCase(String name) 32 { 33 super(name); 34 } 35 36 38 public void testSomething() 39 throws Exception 40 { 41 ChannelHandler handler = getExclusiveChannelHandler(); 42 Consumer consumer = new AcceptAllConsumer(); 43 TestMessageReference t1 = new TestMessageReference(); 44 handler.addMessage(t1); 45 TestMessageReference t2 = new TestMessageReference(); 46 handler.addMessage(t2); 47 TestMessageReference r = (TestMessageReference) handler.removeMessage(consumer); 48 assertEquals(t1.getMessageID(), r.getMessageID()); 49 r = (TestMessageReference) handler.removeMessage(consumer); 50 assertEquals(t2.getMessageID(), r.getMessageID()); 51 } 52 53 55 protected ChannelHandler getExclusiveChannelHandler() 56 { 57 MemoryMessageSet mms = new MemoryMessageSet(new TestMessageReference.TestMessageReferenceComparator()); 58 return new ExclusiveChannelHandler(mms); 59 } 60 61 63 65 } 67 | Popular Tags |