1 22 package org.jboss.test.jbossmessaging.ra; 23 24 import javax.jms.MessageConsumer ; 25 import javax.jms.Session ; 26 import javax.jms.Topic ; 27 import javax.jms.TopicConnection ; 28 29 import javax.jms.TopicConnectionFactory ; 30 import javax.jms.TopicSession ; 31 32 import javax.management.ObjectName ; 33 34 import javax.naming.Context ; 35 36 import junit.framework.Test; 37 38 import org.jboss.test.JBossTestSetup; 39 40 49 public class RaTopicUnitTestCase 50 extends RaTest 51 { 52 private final static String TOPIC_FACTORY = "ConnectionFactory"; 53 private final static String TOPIC = "topic/testTopic"; 54 private final static String JNDI = "TxTopicPublisher"; 55 56 62 public RaTopicUnitTestCase(String name) throws Exception 63 { 64 super(name, JNDI); 65 } 66 67 73 protected void init(final Context context) throws Exception 74 { 75 TopicConnectionFactory factory = 76 (TopicConnectionFactory )context.lookup(TOPIC_FACTORY); 77 78 connection = factory.createTopicConnection(); 79 80 session = ((TopicConnection )connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE); 81 82 Topic topic = (Topic )context.lookup(TOPIC); 83 84 consumer = ((TopicSession )session).createSubscriber(topic); 85 } 86 87 public static Test suite() throws Exception 88 { 89 return new JBossTestSetup(getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar")) 90 { 91 protected void setUp() throws Exception 92 { 93 super.setUp(); 94 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 95 String resourceName = getJMSResourceRelativePathname("test-destinations-service.xml") ; 96 deploy (loader.getResource(resourceName).toString()); 97 } 98 99 protected void tearDown() throws Exception 100 { 101 super.tearDown(); 102 103 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 113 String resourceName = getJMSResourceRelativePathname("test-destinations-service.xml") ; 114 undeploy (loader.getResource(resourceName).toString()); 115 } 116 }; 117 } 118 119 120 } 121 | Popular Tags |