1 24 25 package org.objectweb.jonas.jtests.clients.entity; 26 27 import javax.naming.NamingException ; 28 import javax.rmi.PortableRemoteObject ; 29 30 import junit.framework.Test; 31 import junit.framework.TestSuite; 32 33 import org.objectweb.jonas.jtests.beans.relation.lcp.Session2; 34 import org.objectweb.jonas.jtests.beans.relation.lcp.Session2Home; 35 import org.objectweb.jonas.jtests.util.JTestCase; 36 37 38 43 public class F_Relation_lcpEC2 extends JTestCase { 44 45 private static Session2Home home = null; 46 47 public F_Relation_lcpEC2(String name) { 48 super(name); 49 } 50 51 protected static boolean isInit = false; 52 53 protected void setUp() { 54 super.setUp(); 55 if (!isInit) { 56 useBeans("lcp", true); 57 try { 58 home = (Session2Home) PortableRemoteObject.narrow(ictx.lookup("relation_lcp_Session2"), 59 Session2Home.class); 60 } catch (NamingException e) { 61 fail("Cannot get bean home: " + e.getMessage()); 62 } 63 isInit = true; 64 } 65 } 66 67 71 public void testGetExistChildren() throws Exception { 72 Session2 s = home.create(); 73 assertEquals("c1_1,c1_2", s.getSimpleChildren("p1")); 74 } 75 76 80 public void testGetNoExistChildren() throws Exception { 81 Session2 s = home.create(); 82 assertEquals("", s.getSimpleChildren("p0")); 83 } 84 85 89 public void testGetExistParent() throws Exception { 90 Session2 s = home.create(); 91 assertEquals("p1", s.getChildParent("c1_1")); 92 } 93 94 98 public void testGetNoExistParent() throws Exception { 99 Session2 s = home.create(); 100 assertEquals("", s.getChildParent("c0")); 101 } 102 103 protected boolean initStateOK() throws Exception { 104 return true; 105 } 106 107 108 public static Test suite() { 109 return new TestSuite(F_Relation_lcpEC2.class); 110 } 111 112 public static void main (String args[]) { 113 String testtorun = null; 114 for (int argn = 0; argn < args.length; argn++) { 116 String sarg = args[argn]; 117 if (sarg.equals("-n")) { 118 testtorun = args[++argn]; 119 } 120 } 121 if (testtorun == null) { 122 junit.textui.TestRunner.run(suite()); 123 } else { 124 junit.textui.TestRunner.run(new F_Relation_lcpEC2(testtorun)); 125 } 126 } 127 } 128 | Popular Tags |