1 25 26 package org.objectweb.jonas.jtests.clients.jca15; 27 28 import junit.framework.*; 29 import java.io.BufferedReader ; 30 import java.io.FileInputStream ; 31 import java.io.InputStreamReader ; 32 import java.io.IOException ; 33 import java.lang.String ; 34 import java.rmi.RemoteException ; 35 import javax.rmi.PortableRemoteObject ; 36 import java.util.Collection ; 37 import java.util.Enumeration ; 38 import java.util.Hashtable ; 39 import java.util.Properties ; 40 import javax.ejb.FinderException ; 41 import javax.ejb.RemoveException ; 42 import javax.naming.Context ; 43 import javax.naming.InitialContext ; 44 import javax.naming.NamingException ; 45 46 import org.objectweb.jonas.jtests.beans.jca15.InboundCAHome; 47 import org.objectweb.jonas.jtests.beans.jca15.InboundCA; 48 import org.objectweb.jonas.jtests.util.JTestCase; 49 50 53 public class F_inboundTest extends JTestCase { 54 55 static Context ctx = null; 56 57 59 protected static String BEAN_HOME = "InboundCAHome"; 60 static InboundCAHome home = null; 61 static InboundCA bean = null; 62 private static final String RAR_JNDI_NAME = "eis/ErsatzEIS"; 63 int CloseType = 0; 64 65 public F_inboundTest(String name) { 66 super(name); 67 } 68 69 protected void setUp() { 70 super.setUp(); 71 72 74 try { 75 76 78 if (ctx == null) { 79 ctx = new InitialContext (); 80 } 81 82 if (home == null) { 83 useBeans("jca15", false); } 85 86 88 if (home == null) { 89 home = (InboundCAHome)PortableRemoteObject.narrow( 90 ctx.lookup(BEAN_HOME), 91 InboundCAHome.class); 92 bean = home.create(); 93 } 94 95 assertTrue (5 == 5); 96 97 } catch (Exception e) { 98 fail("Cannot do setUp: " +e); 99 } 100 } 101 113 protected void tearDown() throws Exception { 114 bean.closeUp(CloseType); 115 } 116 protected void startUp(String testName) { 117 try { 118 bean.method1(RAR_JNDI_NAME, testName); 119 } catch (Exception ee) { 120 ee.printStackTrace(); 121 System.exit(2); 122 } 123 } 124 132 public void testSetEIS_URLMethod() throws Exception { 133 startUp("testSetEIS_URLMethod"); 134 String url = bean.getEIS_URL(); 135 assertEquals("ErsatzEIS", url); 136 } 137 147 public void testDeliverMsg() throws Exception { 148 startUp("testDeliverMsg"); 149 boolean b = bean.deliverMsg("String message 11111111111111111111 to endpoint."); 150 assertTrue(b); 151 b = bean.deliverMsg("String message 22222222222222222222 to endpoint."); 152 assertTrue(b); 153 } 154 156 public static Test suite() { 157 return new TestSuite(F_inboundTest.class); 158 } 159 160 public static void main (String args[]) { 161 162 String testtorun = null; 163 164 166 for (int argn = 0; argn < args.length; argn++) { 167 168 String s_arg = args[argn]; 169 Integer i_arg; 170 171 if (s_arg.equals("-n")) { 172 testtorun = args[++argn]; 173 } 174 } 175 176 if (testtorun == null) { 177 junit.textui.TestRunner.run(suite()); 178 } else { 179 junit.textui.TestRunner.run(new F_inboundTest(testtorun)); 180 } 181 } 182 } 183 | Popular Tags |