db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r152926 - in incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/checkDataSource.out tests/jdbcapi/checkDataSource.java
Date Tue, 08 Feb 2005 19:37:51 GMT
Author: kmarsden
Date: Tue Feb  8 11:37:48 2005
New Revision: 152926

URL: http://svn.apache.org/viewcvs?view=rev&rev=152926
Log:
checking in patch for test case for jira 95 for myrna@golux.com

Modified:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out?view=diff&r1=152925&r2=152926
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
Tue Feb  8 11:37:48 2005
@@ -426,6 +426,8 @@
 acxs 2
 autocommitxastart expected  : XAException - null
 acxs 3
+testing jira 95 for DataSource; ok - expected exception: XCY00
+testing jira 95 for XADataSource; ok - expected exception: XCY00
 DataSource - EMPTY
   getConnection() - XJ004:Database '' not found.
   getConnection(null, null) - XJ004:Database '' not found.

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?view=diff&r1=152925&r2=152926
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Tue Feb  8 11:37:48 2005
@@ -527,7 +527,38 @@
 		conn4.close();
 		xac4.close();
 		
+
+
+		// test jira-derby 95 - a NullPointerException was returned when passing
+		// an incorrect database name (a url in this case) - should now give error XCY00
+		Connection dmc95 = ij.startJBMS();
+		String sqls; 
+		try {
+			testJira95ds( dmc95, "jdbc:derby:mydb" );
+		} catch (SQLException sqle) {
+			sqls = sqle.getSQLState();
+			if (sqls.equals("XCY00"))
+				System.out.println("; ok - expected exception: " + sqls);
+			else 
+				System.out.println("; wrong, unexpected exception: " + sqls + " - " + sqle.toString());
+		} catch (Exception e) {
+				System.out.println("; wrong, unexpected exception: " + e.toString());
+		}
+			
+		try {
+			testJira95xads( dmc95, "jdbc:derby:wombat" );
+		} catch (SQLException sqle) {
+			sqls = sqle.getSQLState();
+			if (sqls.equals("XCY00"))
+				System.out.println("; ok - expected exception: " + sqls + "\n");
+			else 
+				System.out.println("; wrong - unexpected exception: " + sqls + " - " + sqle.toString());
+		} catch (Exception e) {
+				System.out.println("; wrong, unexpected exception: " + e.toString());
+		}
+
 		testDSRequestAuthentication();
+		
 	}
 
 	protected void showXAException(String tag, XAException xae) {
@@ -1268,6 +1299,25 @@
 		conn.close();
 
 	}
+
+	public void testJira95ds(Connection conn, String dbName) throws SQLException
+	{
+		System.out.print("\ntesting jira 95 for DataSource");
+		EmbeddedDataSource ds = new EmbeddedDataSource();
+		ds.setDatabaseName(dbName);
+		Connection conn1 = ds.getConnection();
+		conn1.close();
+	}
+	
+	public void testJira95xads(Connection conn, String dbName) throws SQLException
+	{
+		System.out.print("testing jira 95 for XADataSource");
+		EmbeddedXADataSource dxs = new EmbeddedXADataSource();
+		dxs.setDatabaseName(dbName);
+		Connection conn2 = dxs.getXAConnection().getConnection();
+		conn2.close();
+	}
+
 
 }
 class cdsXid implements Xid, Serializable



Mime
View raw message