1 24 25 package org.objectweb.jtests.jms.conform.connection; 26 27 import org.objectweb.jtests.jms.framework.*; 28 import javax.jms.*; 29 import junit.framework.*; 30 31 36 37 public class TopicConnectionTest extends PubSubTestCase { 38 39 45 public void testSetClientID_1() { 46 try { 47 subscriberConnection.close(); 49 subscriberConnection = null; 50 51 subscriberConnection = subscriberTCF.createTopicConnection(); 52 if (subscriberConnection.getClientID() == null) { 54 subscriberConnection.setClientID("testSetClientID_1"); 55 assertEquals("testSetClientID_1", subscriberConnection.getClientID()); 56 } 57 assertTrue(subscriberConnection.getClientID() != null); 59 60 subscriberConnection.setClientID("another client ID"); 62 fail("Should raise a javax.jms.IllegalStateException"); 63 } catch (javax.jms.IllegalStateException e) { 64 } catch (JMSException e) { 65 fail("Should raise a javax.jms.IllegalStateException, not a "+ e); 66 } catch (java.lang.IllegalStateException e) { 67 fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException"); 68 } 69 } 70 71 78 public void testSetClientID_2() { 79 try { 80 subscriberConnection.close(); 82 subscriberConnection = null; 83 84 subscriberConnection = subscriberTCF.createTopicConnection(); 85 if (subscriberConnection.getClientID() != null) { 87 return; 88 } 89 90 subscriberConnection.start(); 92 93 subscriberConnection.setClientID("testSetClientID_2"); 95 fail("Should throw a javax.jms.IllegalStateException"); 96 } catch (javax.jms.IllegalStateException e) { 97 } catch (JMSException e) { 98 fail("Should raise a javax.jms.IllegalStateException, not a "+ e); 99 } catch (java.lang.IllegalStateException e) { 100 fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException"); 101 } 102 } 103 104 107 public static Test suite() { 108 return new TestSuite(TopicConnectionTest.class); 109 } 110 111 public TopicConnectionTest(String name) { 112 super(name); 113 } 114 } 115 116 117 118 | Popular Tags |