1 24 25 package org.objectweb.jtests.jms.conform.topic; 26 27 import org.objectweb.jtests.jms.framework.*; 28 import junit.framework.*; 29 30 import javax.jms.*; 31 32 33 39 public class TemporaryTopicTest extends PubSubTestCase { 40 41 private TemporaryTopic tempTopic; 42 private TopicSubscriber tempSubscriber; 43 44 47 public void testTemporaryTopic() { 48 try { 49 publisherConnection.stop(); 51 subscriberConnection.stop(); 52 tempTopic = subscriberSession.createTemporaryTopic(); 54 publisher = publisherSession.createPublisher(tempTopic); 57 tempSubscriber = subscriberSession.createSubscriber(tempTopic); 59 subscriberConnection.start(); 60 publisherConnection.start(); 61 62 TextMessage message = publisherSession.createTextMessage(); 63 message.setText("testTemporaryTopic"); 64 publisher.publish(message); 65 66 Message m = tempSubscriber.receive(TestConfig.TIMEOUT); 67 assertTrue(m instanceof TextMessage); 68 TextMessage msg = (TextMessage)m; 69 assertEquals("testTemporaryTopic", msg.getText()); 70 } catch (JMSException e) { 71 fail(e); 72 } 73 } 74 75 78 public static Test suite() { 79 return new TestSuite(TemporaryTopicTest.class); 80 } 81 82 public TemporaryTopicTest(String name) { 83 super(name); 84 } 85 } 86 | Popular Tags |