1 package org.jboss.test.jca.test; 2 3 import java.net.URL ; 4 5 import javax.ejb.EJBException ; 6 import javax.naming.InitialContext ; 7 import javax.rmi.PortableRemoteObject ; 8 9 import junit.framework.Test; 10 11 import org.jboss.test.JBossTestCase; 12 import org.jboss.test.jca.interfaces.JDBCComplianceSession; 13 import org.jboss.test.jca.interfaces.JDBCComplianceSessionHome; 14 15 public class JDBCComplianceUnitTestCase extends JBossTestCase 16 { 17 private JDBCComplianceSession ejb; 18 private JDBCComplianceSessionHome home; 19 20 public JDBCComplianceUnitTestCase(String name) 21 { 22 super(name); 23 24 } 25 26 public void testCloseJDBCCompliance() throws Exception 27 { 28 29 try 30 { 31 32 ejb.testJdbcCloseCompliance(); 33 34 }catch(Throwable t) 35 { 36 fail("Duplicate close should not throw exception"); 37 38 } 39 40 } 41 42 protected void setUp() throws Exception 43 { 44 InitialContext ctx = super.getInitialContext(); 45 Object anon = ctx.lookup("JDBCComplianceBean"); 46 home = (JDBCComplianceSessionHome)PortableRemoteObject.narrow(anon, JDBCComplianceSessionHome.class); 47 ejb = home.create(); 48 49 } 50 public static Test suite() throws Exception 51 { 52 Test t1 = getDeploySetup(JDBCComplianceUnitTestCase.class, "jdbc-comp-ejb.jar"); 53 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 54 URL url = cl.getResource("jca/compliance/compliance-ds.xml"); 55 Test t2 = getDeploySetup(t1, url.toString()); 56 return t2; 57 } 58 } 59 | Popular Tags |