1 25 26 package org.objectweb.jonas.jtests.clients.jms; 27 28 import javax.naming.NamingException ; 29 import javax.rmi.PortableRemoteObject ; 30 import junit.framework.Test; 31 import junit.framework.TestSuite; 32 import org.objectweb.jonas.jtests.util.JTestCase; 33 import org.objectweb.jonas.jtests.beans.message.Sender; 34 import org.objectweb.jonas.jtests.beans.message.SenderHome; 35 import org.objectweb.jonas.jtests.beans.message.Sender1_2; 36 import org.objectweb.jonas.jtests.beans.message.Sender1_2Home; 37 38 public class F_TestsWithBMT extends JTestCase { 39 40 41 private static String BEAN_HOME = "messageSender1_2SFHome"; 42 43 protected static Sender1_2Home home = null; 44 45 public F_TestsWithBMT(String name) { 46 super(name); 47 } 48 49 50 public Sender1_2Home getHome() { 51 if (home == null) { 52 try { 53 home = (Sender1_2Home) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME), Sender1_2Home.class); 54 } catch (NamingException e) { 55 fail("Cannot get bean home1"); 56 } 57 } 58 return home; 59 } 60 61 66 protected void setUp() { 67 super.setUp(); 68 useBeans("message", true); 69 } 70 71 75 83 public void testSendOnTopic1_1() throws Exception { 84 Sender1_2 s = getHome().create(); 85 int val = 200; 86 s.sendOnDestinationWithTxBeforeSession("JunitTopic1", val, 1, true); 87 assertEquals(2, s.check(val, 2, 4)); 88 s.remove(); 89 } 90 91 99 public void testSendOnTopic1_2() throws Exception { 100 Sender1_2 s = getHome().create(); 101 int val = 200; 102 s.sendOnDestinationWithTxBeforeSession("JunitTopic1", val, 1, false); 103 assertEquals(0, s.check(val, 2, 4)); 104 s.remove(); 105 } 106 107 115 public void testSendOnTopic1_3() throws Exception { 116 Sender1_2 s = getHome().create(); 117 int val = 200; 118 s.sendOnDestinationWithTxAfterSession("JunitTopic1", val, 1, true); 119 assertEquals(2, s.check(val, 2, 4)); 120 s.remove(); 121 } 122 123 132 public void testSendOnTopic1_4() throws Exception { 133 Sender1_2 s = getHome().create(); 134 int val = 200; 135 s.sendOnDestinationWithTxAfterSession("JunitTopic1", val, 1, false); 136 assertEquals(0, s.check(val, 2, 4)); 137 s.remove(); 138 } 139 140 141 142 143 146 public static Test suite() { 147 return new TestSuite(F_TestsWithBMT.class); 148 } 149 150 public static void main (String args[]) { 151 String testtorun = null; 152 for (int argn = 0; argn < args.length; argn++) { 154 String s_arg = args[argn]; 155 Integer i_arg; 156 if (s_arg.equals("-n")) { 157 testtorun = args[++argn]; 158 } 159 } 160 if (testtorun == null) { 161 junit.textui.TestRunner.run(suite()); 162 } else { 163 junit.textui.TestRunner.run(new F_TestsWithBMT(testtorun)); 164 } 165 } 166 } 167 | Popular Tags |