1 25 26 package org.objectweb.jonas.jtests.clients.session; 27 28 import junit.framework.Test; 29 import junit.framework.TestSuite; 30 import javax.rmi.PortableRemoteObject ; 31 import org.objectweb.jonas.jtests.beans.applimet.Appli; 32 import org.objectweb.jonas.jtests.beans.applimet.AppliHome; 33 import org.objectweb.jonas.jtests.beans.applimet.Met; 34 import org.objectweb.jonas.jtests.beans.applimet.MetHome; 35 import org.objectweb.jonas.jtests.util.JTestCase; 36 37 38 41 public class F_Applimet extends JTestCase { 42 43 protected static AppliHome applihome = null; 44 protected static MetHome methome = null; 45 46 public F_Applimet(String name) { 47 super(name); 48 } 49 50 protected void setUp() { 51 super.setUp(); 52 useBeans("applimet", true); } 54 55 public AppliHome getAppliHome() throws Exception { 56 if (applihome == null) { 57 applihome = (AppliHome) PortableRemoteObject.narrow(ictx.lookup("AppliBean"), AppliHome.class) ; 58 } 59 assertTrue(applihome != null); 60 return applihome; 61 } 62 63 public MetHome getMetHome() throws Exception { 64 if (methome == null) { 65 methome = (MetHome) PortableRemoteObject.narrow(ictx.lookup("MetBean"), MetHome.class) ; 66 } 67 assertTrue(methome != null); 68 return methome; 69 } 70 71 public void testScenario1() throws Exception { 72 Met met = getMetHome().create(); 73 met.methode1(); 74 met.remove(); 75 } 76 77 public void testScenario2() throws Exception { 78 Appli appli = getAppliHome().create(); 79 appli.methodeApplicative(); 80 appli.remove(); 81 } 82 83 public void testMoscone1() throws Exception { 84 Met met = getMetHome().create(); 85 met.moscone1(); 86 met.remove(); 87 } 88 89 public void testMoscone2() throws Exception { 90 Met met = getMetHome().create(); 91 met.getconn(); 92 met.useconn(); 93 met.closeconn(); 94 met.remove(); 95 } 96 97 public void testMoscone3() throws Exception { 98 Met met = getMetHome().create(); 99 met.getconntx(); 100 met.useconn(); 101 met.closeconn(); 102 met.remove(); 103 } 104 105 public void testRollbackOnlyNoTx() throws Exception { 106 Appli appli = getAppliHome().create(); 107 appli.noTxMethod(); 108 appli.remove(); 109 } 110 111 public static Test suite() { 112 return new TestSuite(F_Applimet.class); 113 } 114 115 116 public static void main (String args[]) throws Exception { 117 String testtorun = null; 118 for (int argn = 0; argn < args.length; argn++) { 120 String s_arg = args[argn]; 121 Integer i_arg; 122 if (s_arg.equals("-n")) { 123 testtorun = args[++argn]; 124 } 125 } 126 if (testtorun == null) { 127 junit.textui.TestRunner.run(suite()); 128 } else { 129 junit.textui.TestRunner.run(new F_Applimet(testtorun)); 130 } 131 } 132 } 133 | Popular Tags |