1 25 26 package org.objectweb.jonas.jtests.clients.distribution; 27 28 import javax.naming.NamingException ; 29 import javax.rmi.PortableRemoteObject ; 30 31 import junit.framework.Test; 32 import junit.framework.TestSuite; 33 34 import org.objectweb.jonas.jtests.beans.relation.omb.AHomeRemote; 35 import org.objectweb.jonas.jtests.beans.relation.omb.BHomeRemote; 36 import org.objectweb.jonas.jtests.beans.relation.omb.BRemote; 37 import org.objectweb.jonas.jtests.beans.relation.omb.Front; 38 import org.objectweb.jonas.jtests.beans.relation.omb.FrontHome; 39 import org.objectweb.jonas.jtests.util.JTestCase; 40 41 47 public class F_FrontalCMP2 extends JTestCase { 48 49 private static String BEAN_HOME_A = "relation_omb_AHome"; 50 protected static AHomeRemote ahome = null; 51 private static String BEAN_HOME_B = "relation_omb_BHome"; 52 protected static BHomeRemote bhome = null; 53 protected static FrontHome fhome = null; 54 55 public F_FrontalCMP2(String name) { 56 super(name); 57 } 58 59 60 protected void setUp() { 61 super.setUp(); 62 if (fhome == null) { 63 useBeans("omb", false); 64 try { 65 fhome = (FrontHome) PortableRemoteObject.narrow(ictx.lookup("relation_omb_FrontHome"), FrontHome.class); 66 ahome = (AHomeRemote) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_A), AHomeRemote.class); 67 bhome = (BHomeRemote) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_B), BHomeRemote.class); 68 assertNotNull(fhome); 69 assertNotNull(ahome); 70 assertNotNull(bhome); 71 } catch (NamingException e) { 72 fail("Cannot get bean home"); 73 } 74 } 75 } 76 77 82 public void testCreateFind() throws Exception { 83 Front front = fhome.create("project", "role"); 85 BRemote br = bhome.findByName("role", "project"); 87 br.remove(); 88 ahome.remove("project"); 89 front.remove(); 90 } 91 92 public static Test suite() { 93 return new TestSuite(F_FrontalCMP2.class); 94 } 95 96 public static void main (String args[]) { 97 String testtorun = null; 98 for (int argn = 0; argn < args.length; argn++) { 100 String s_arg = args[argn]; 101 Integer i_arg; 102 if (s_arg.equals("-n")) { 103 testtorun = args[++argn]; 104 } 105 } 106 if (testtorun == null) { 107 junit.textui.TestRunner.run(suite()); 108 } else { 109 junit.textui.TestRunner.run(new F_FrontalCMP2(testtorun)); 110 } 111 } 112 } 113 | Popular Tags |