[Jboss-cvs] JBossAS SVN: r56252 - branches/JBoss_4_0_3_SP1_JBAS_3453/testsuite/src/main/org/jboss/test/jca/test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 25 06:33:20 EDT 2006
Author: weston.price at jboss.com
Date: 2006-08-25 06:33:20 -0400 (Fri, 25 Aug 2006)
New Revision: 56252
Modified:
branches/JBoss_4_0_3_SP1_JBAS_3453/testsuite/src/main/org/jboss/test/jca/test/SupportCodeUnitTestCase.java
Log:
[JBAS-3453] Unit test cases for both purge policy, as well as external
code support.
Modified: branches/JBoss_4_0_3_SP1_JBAS_3453/testsuite/src/main/org/jboss/test/jca/test/SupportCodeUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3453/testsuite/src/main/org/jboss/test/jca/test/SupportCodeUnitTestCase.java 2006-08-25 10:32:54 UTC (rev 56251)
+++ branches/JBoss_4_0_3_SP1_JBAS_3453/testsuite/src/main/org/jboss/test/jca/test/SupportCodeUnitTestCase.java 2006-08-25 10:33:20 UTC (rev 56252)
@@ -2,7 +2,7 @@
import java.sql.SQLException;
-import org.jboss.resource.adapter.jdbc.JdbcSupportCodeHandler;
+import org.jboss.resource.adapter.jdbc.support.JdbcSupportCodeHandler;
import org.jboss.test.JBossTestCase;
public class SupportCodeUnitTestCase extends JBossTestCase
@@ -13,8 +13,46 @@
super(name);
}
+
+ public void testAbsoluteValueCodeSupport() throws Exception
+ {
+ String url = "jca/support-code/absolute-support-code.xml";
+ JdbcSupportCodeHandler handler = JdbcSupportCodeHandler.getInstance(url, null, null, null);
+ SQLException stale = new SQLException("Dummy", "NoState", 1);
+ SQLException fatal = new SQLException("Dummy", "NoState", 6);
+ assertTrue(handler.isStaleConnection(stale));
+ assertTrue(handler.isExceptionFatal(fatal));
+
+ }
+ public void testMixedStaleAndFatalCodeSupport() throws Exception
+ {
+ String url = "jca/support-code/mixed-stale-fatal-code.xml";
+ JdbcSupportCodeHandler handler = JdbcSupportCodeHandler.getInstance(url, null, null, null);
+ SQLException stale = new SQLException("Dummy", "NoState", 4);
+ SQLException fatal = new SQLException("Dummy", "NoState", 4);
+ assertTrue(handler.isStaleConnection(stale));
+ assertTrue(handler.isExceptionFatal(fatal));
+
+
+ }
- public void testInitJdbcSupportCodeHandler() throws Exception
+ public void testStaleAndFatalSupportCode() throws Exception
+ {
+ String url = "jca/support-code/stale-and-fatal-code.xml";
+ JdbcSupportCodeHandler handler = JdbcSupportCodeHandler.getInstance(url, null, null, null);
+ SQLException stale = new SQLException("Dummy", "NoState", 1);
+ SQLException fatal = new SQLException("Dummy", "NoState", 5);
+
+ assertTrue(handler.isStaleConnection(stale));
+ assertFalse(handler.isExceptionFatal(stale));
+ assertFalse(handler.isStaleConnection(fatal));
+ assertTrue(handler.isExceptionFatal(fatal));
+
+
+ }
+
+
+ public void testStaleSupportCode() throws Exception
{
String url = "jca/support-code/support-only-stale.xml";
JdbcSupportCodeHandler handler = JdbcSupportCodeHandler.getInstance(url, null, null, null);
@@ -25,8 +63,24 @@
assertFalse(handler.isExceptionFatal(sqe));
-
}
-
-
+
+ /**
+ * Invalid external code file.
+ *
+ * @throws Exception
+ */
+ public void testInvalidJdbcUrl() throws Exception
+ {
+
+ String url = "jca/support-code/invalid-support-code.xml";
+ JdbcSupportCodeHandler handler = JdbcSupportCodeHandler.getInstance(url, null, null, null);
+ SQLException stale = new SQLException("Dummy", "NoState", 4);
+ SQLException fatal = new SQLException("Dummy", "NoState", 4);
+
+ assertTrue(handler.getFatalCodeCount() == 0);
+ assertTrue(handler.getStaleCodeCount() == 0);
+ assertFalse(handler.isStaleConnection(stale));
+ assertFalse(handler.isExceptionFatal(fatal));
+ }
}
More information about the jboss-cvs-commits
mailing list