01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * 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
40: JBossTestCase {
41: public JDBCStatementTestsConnectionUnitTestCase(String name) {
42: super (name);
43: }
44:
45: public static Test suite() throws Exception {
46: Test t1 = getDeploySetup(
47: JDBCStatementTestsConnectionUnitTestCase.class,
48: "jcatest.jar");
49: Test t2 = getDeploySetup(t1, "testadapter-ds.xml");
50: Test t3 = getDeploySetup(t2, "testdriver-ds.xml");
51: Test t4 = getDeploySetup(t3, "jbosstestdriver.jar");
52: return getDeploySetup(t4, "jbosstestadapter.rar");
53: }
54:
55: /** This test will probably fail with a class cast exception if run
56: * twice. The DriverManager appears to be keeping a static
57: * reference to the Driver class, so reloading the
58: * jbosstestdriver.sar will result in incompatible classes being
59: * used.
60: */
61: public void testJDBCStatementTestsConnection() throws Exception {
62: JDBCStatementTestsConnectionSessionHome home = (JDBCStatementTestsConnectionSessionHome) getInitialContext()
63: .lookup("JDBCStatementTestsConnectionSession");
64: JDBCStatementTestsConnectionSession s = home.create();
65: s.testConnectionObtainable();
66: }
67:
68: public void testConfiguredQueryTimeout() throws Exception {
69: JDBCStatementTestsConnectionSessionHome home = (JDBCStatementTestsConnectionSessionHome) getInitialContext()
70: .lookup("JDBCStatementTestsConnectionSession");
71: JDBCStatementTestsConnectionSession s = home.create();
72: s.testConfiguredQueryTimeout();
73: }
74:
75: public void testTransactionQueryTimeout() throws Exception {
76: JDBCStatementTestsConnectionSessionHome home = (JDBCStatementTestsConnectionSessionHome) getInitialContext()
77: .lookup("JDBCStatementTestsConnectionSession");
78: JDBCStatementTestsConnectionSession s = home.create();
79: s.testTransactionQueryTimeout();
80: }
81:
82: public void testTransactionQueryTimeoutMarkedRollback()
83: throws Exception {
84: JDBCStatementTestsConnectionSessionHome home = (JDBCStatementTestsConnectionSessionHome) getInitialContext()
85: .lookup("JDBCStatementTestsConnectionSession");
86: JDBCStatementTestsConnectionSession s = home.create();
87: s.testTransactionQueryTimeoutMarkedRollback();
88: }
89:
90: public void testLazyAutoCommit() throws Exception {
91: JDBCStatementTestsConnectionSessionHome home = (JDBCStatementTestsConnectionSessionHome) getInitialContext()
92: .lookup("JDBCStatementTestsConnectionSession");
93: JDBCStatementTestsConnectionSession s = home.create();
94: s.testLazyAutoCommit();
95: }
96:
97: }
|