You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by fu...@apache.org on 2006/03/16 00:54:57 UTC

svn commit: r386221 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/jdbcapi/XATest.java util/TestUtil.java

Author: fuzzylogic
Date: Wed Mar 15 15:54:56 2006
New Revision: 386221

URL: http://svn.apache.org/viewcvs?rev=386221&view=rev
Log:
DERBY-434 DERBY-1052: Fix XA tests in remote server testing.

Committed for Myrna Van Lunteren <m....@gmail.com>

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java?rev=386221&r1=386220&r2=386221&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Wed Mar 15 15:54:56 2006
@@ -74,6 +74,10 @@
         // DERBY-966 holdability testing
         derby966(dsx);
 
+        // for cleaning up, make a clean new connection
+        Connection dmc2 = ij.startJBMS();
+        cleanUp(dmc2);
+
         System.out.println("XATest complete");
     }
 
@@ -1152,6 +1156,16 @@
         
         XAConnection xac = xads.getXAConnection("mamta", "mamtapwd");
         
+    }
+
+    private static void cleanUp(Connection conn) throws SQLException
+    {
+        String testObjects[] = { "view XATESTUTIL.global_xactTable", 
+                                 "schema XATESTUTIL restrict", "table app.foo", "table foo" };
+        Statement stmt = conn.createStatement();
+        TestUtil.cleanUpTest(stmt, testObjects);
+        conn.commit();
+        stmt.close();
     }
  
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java?rev=386221&r1=386220&r2=386221&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java Wed Mar 15 15:54:56 2006
@@ -399,6 +399,12 @@
 		try {
 		ds  = Class.forName(classname).newInstance();
 
+		// for remote server testing, check whether the hostName is set for the test
+		// if so, and serverName is not yet set explicitly for the datasource, set it now
+		String hostName = getHostName();
+		if ( (!isEmbeddedFramework()) && (hostName != null ) && (attrs.getProperty("serverName") == null) )
+			attrs.setProperty("serverName", hostName);
+
 		for (Enumeration propNames = attrs.propertyNames(); 
 			 propNames.hasMoreElements();)
 		{