KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.jca.test;
23
24 import junit.framework.*;
25 import org.jboss.test.JBossTestCase;
26 import org.jboss.test.jca.interfaces.JDBCStatementTestsConnectionSession;
27 import org.jboss.test.jca.interfaces.JDBCStatementTestsConnectionSessionHome;
28
29 /**
30  * JDBCStatementTestsConnectionUnitTestCase.java
31  *
32  *
33  * Created: Fri Feb 14 15:15:47 2003
34  *
35  * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
36  * @version
37  */

38
39 public class JDBCStatementTestsConnectionUnitTestCase extends JBossTestCase {
40    public JDBCStatementTestsConnectionUnitTestCase(String JavaDoc name)
41    {
42       super(name);
43    }
44
45    public static Test suite() throws Exception JavaDoc
46    {
47       Test t1 = getDeploySetup(JDBCStatementTestsConnectionUnitTestCase.class, "jcatest.jar");
48       Test t2 = getDeploySetup(t1, "testadapter-ds.xml");
49       Test t3 = getDeploySetup(t2, "testdriver-ds.xml");
50       Test t4 = getDeploySetup(t3, "jbosstestdriver.jar");
51       return getDeploySetup(t4, "jbosstestadapter.rar");
52    }
53
54    /** This test will probably fail with a class cast exception if run
55     * twice. The DriverManager appears to be keeping a static
56     * reference to the Driver class, so reloading the
57     * jbosstestdriver.sar will result in incompatible classes being
58     * used.
59     */

60    public void testJDBCStatementTestsConnection() throws Exception JavaDoc
61    {
62       JDBCStatementTestsConnectionSessionHome home =
63          (JDBCStatementTestsConnectionSessionHome)getInitialContext().lookup("JDBCStatementTestsConnectionSession");
64       JDBCStatementTestsConnectionSession s = home.create();
65       s.testConnectionObtainable();
66    }
67
68    public void testConfiguredQueryTimeout() throws Exception JavaDoc
69    {
70       JDBCStatementTestsConnectionSessionHome home =
71          (JDBCStatementTestsConnectionSessionHome)getInitialContext().lookup("JDBCStatementTestsConnectionSession");
72       JDBCStatementTestsConnectionSession s = home.create();
73       s.testConfiguredQueryTimeout();
74    }
75
76    public void testTransactionQueryTimeout() throws Exception JavaDoc
77    {
78       JDBCStatementTestsConnectionSessionHome home =
79          (JDBCStatementTestsConnectionSessionHome)getInitialContext().lookup("JDBCStatementTestsConnectionSession");
80       JDBCStatementTestsConnectionSession s = home.create();
81       s.testTransactionQueryTimeout();
82    }
83
84    public void testTransactionQueryTimeoutMarkedRollback() throws Exception JavaDoc
85    {
86       JDBCStatementTestsConnectionSessionHome home =
87          (JDBCStatementTestsConnectionSessionHome)getInitialContext().lookup("JDBCStatementTestsConnectionSession");
88       JDBCStatementTestsConnectionSession s = home.create();
89       s.testTransactionQueryTimeoutMarkedRollback();
90    }
91
92    public void testLazyAutoCommit() throws Exception JavaDoc
93    {
94       JDBCStatementTestsConnectionSessionHome home =
95          (JDBCStatementTestsConnectionSessionHome)getInitialContext().lookup("JDBCStatementTestsConnectionSession");
96       JDBCStatementTestsConnectionSession s = home.create();
97       s.testLazyAutoCommit();
98    }
99
100 }
101
Popular Tags