KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jca > test > JDBCComplianceUnitTestCase


1 package org.jboss.test.jca.test;
2
3 import java.net.URL JavaDoc;
4
5 import javax.ejb.EJBException JavaDoc;
6 import javax.naming.InitialContext JavaDoc;
7 import javax.rmi.PortableRemoteObject JavaDoc;
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 JavaDoc name)
21    {
22       super(name);
23       
24    }
25
26    public void testCloseJDBCCompliance() throws Exception JavaDoc
27    {
28       
29       try
30       {
31          
32          ejb.testJdbcCloseCompliance();
33          
34       }catch(Throwable JavaDoc t)
35       {
36          fail("Duplicate close should not throw exception");
37          
38       }
39       
40    }
41
42    protected void setUp() throws Exception JavaDoc
43    {
44       InitialContext JavaDoc ctx = super.getInitialContext();
45       Object JavaDoc 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 JavaDoc
51    {
52       Test t1 = getDeploySetup(JDBCComplianceUnitTestCase.class, "jdbc-comp-ejb.jar");
53       ClassLoader JavaDoc cl = Thread.currentThread().getContextClassLoader();
54       URL JavaDoc url = cl.getResource("jca/compliance/compliance-ds.xml");
55       Test t2 = getDeploySetup(t1, url.toString());
56       return t2;
57    }
58 }
59
Popular Tags