1 22 package org.jboss.test.cmp2.jbas3541; 23 24 import java.util.Iterator ; 25 import javax.naming.InitialContext ; 26 import javax.naming.NamingException ; 27 import org.jboss.test.JBossTestCase; 28 import org.jboss.test.util.ejb.EJBTestCase; 29 import junit.framework.Test; 30 31 35 public class JBAS3541UnitTestCase 36 extends EJBTestCase 37 { 38 public static Test suite() throws Exception 39 { 40 return JBossTestCase.getDeploySetup(JBAS3541UnitTestCase.class, "cmp2-jbas3541.jar"); 41 } 42 43 public JBAS3541UnitTestCase(String methodName) 44 { 45 super(methodName); 46 } 47 48 protected void setUp() throws Exception 49 { 50 getALocalHome().create(new Long (1), new Integer (2)); 51 } 52 53 protected void tearDown() throws Exception 54 { 55 getALocalHome().remove(new Long (1)); 56 } 57 58 60 public void testJBAS3541() throws Throwable 61 { 62 Iterator all = getALocalHome().findByIntField(100000).iterator(); 63 assertTrue(all.hasNext()); 64 ALocal a = (ALocal)all.next(); 65 assertEquals(new Integer (2), a.getIntField()); 66 } 67 68 70 private ALocalHome getALocalHome() 71 throws NamingException 72 { 73 return (ALocalHome)lookup("ALocal"); 74 } 75 76 private Object lookup(String name) throws NamingException 77 { 78 InitialContext ic = new InitialContext (); 79 return ic.lookup(name); 80 } 81 } 82 | Popular Tags |