1 24 25 package org.objectweb.jonas.jtests.clients.entity; 26 27 import java.util.Collection ; 28 29 import javax.naming.NamingException ; 30 import javax.rmi.PortableRemoteObject ; 31 32 import junit.framework.Test; 33 import junit.framework.TestSuite; 34 35 import org.objectweb.jonas.jtests.beans.relation.tier.TestFacade; 36 import org.objectweb.jonas.jtests.beans.relation.tier.TestFacadeHome; 37 import org.objectweb.jonas.jtests.util.JTestCase; 38 39 40 41 45 public class F_TierEC2 extends JTestCase { 46 47 private static TestFacadeHome facadeHome = null; 48 49 public F_TierEC2(String name) { 50 super(name); 51 } 52 53 protected static boolean isInit = false; 54 55 protected void setUp() { 56 super.setUp(); 57 if (!isInit) { 58 useBeans("tier", true); 59 try { 60 facadeHome = (TestFacadeHome) 61 PortableRemoteObject.narrow(ictx.lookup("Rel_Tier_TestFacadeHomeRemote"), 62 TestFacadeHome.class); 63 } catch (NamingException e) { 64 fail("Cannot get bean home: " + e.getMessage()); 65 } 66 isInit = true; 67 } 68 } 69 70 74 public void testFindByTiemorOrTiephy() throws Exception { 75 Collection c; 76 TestFacade facade = facadeHome.create(); 77 c = facade.tierfindByTiemorOrTiephy("none"); 78 assertEquals("Number of 'none' Tier: ", 0, c.size()); 79 c = facade.tierfindByTiemorOrTiephy("helene joanin"); 80 assertEquals("Number of 'helene joanin' Tier: ", 1, c.size()); 81 } 82 83 protected boolean initStateOK() throws Exception { 84 return true; 85 } 86 87 public static Test suite() { 88 return new TestSuite(F_TierEC2.class); 89 } 90 91 public static void main (String args[]) { 92 String testtorun = null; 93 for (int argn = 0; argn < args.length; argn++) { 95 String sarg = args[argn]; 96 if (sarg.equals("-n")) { 97 testtorun = args[++argn]; 98 } 99 } 100 if (testtorun == null) { 101 junit.textui.TestRunner.run(suite()); 102 } else { 103 junit.textui.TestRunner.run(new F_TierEC2(testtorun)); 104 } 105 } 106 } 107 | Popular Tags |