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 km...@apache.org on 2005/02/27 22:30:57 UTC
svn commit: r155642 - in incubator/derby/code/trunk/java:
drda/org/apache/derby/impl/drda/
testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/
testing/org/apache/derbyTesting/functionTests/suites/
testing/org/apache/derbyTesting/functionTests/util/
tools/org/apache/derby/impl/tools/ij/
Author: kmarsden
Date: Sun Feb 27 13:30:56 2005
New Revision: 155642
URL: http://svn.apache.org/viewcvs?view=rev&rev=155642
Log:
Fix DRDAXAprotocol to accept flags for recover
Add netclient to xa helper.
Add additional test for derby network client
Modified:
incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAXAProtocol.java
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/netxaPositive.out
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java
Modified: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAXAProtocol.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAXAProtocol.java?view=diff&r1=155641&r2=155642
==============================================================================
--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAXAProtocol.java (original)
+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAXAProtocol.java Sun Feb 27 13:30:56 2005
@@ -104,7 +104,9 @@
if (xid == null)
connThread.missingCodePoint(CodePoint.XID);
- if (! readXAFlags)
+ // All but Recover and forget require xaFlags
+ if (syncType != CodePoint.SYNCTYPE_REQ_FORGET &&
+ ! readXAFlags)
if (SanityManager.DEBUG)
connThread.missingCodePoint(CodePoint.XAFLAGS);
}
@@ -146,7 +148,10 @@
break;
case CodePoint.SYNCTYPE_INDOUBT:
//recover sync type
- recoverXA();
+ if (readXAFlags)
+ recoverXA(xaflags);
+ else
+ recoverXA();
break;
default:
connThread.invalidCodePoint(codePoint);
@@ -459,19 +464,25 @@
xaRetVal, null);
}
+ // JCC doesn't send xaflags but always wants TMSTARTRSCAN.
+ //So default to that if we got no xaflags
+ private void recoverXA() throws DRDAProtocolException
+ {
+ recoverXA(XAResource.TMSTARTRSCAN);
+ }
/**
* Call recover. Send SYNCCRD response with indoubt list
*
* @throws DRDAProtocolException
*/
- private void recoverXA() throws DRDAProtocolException
+ private void recoverXA(int xaflags) throws DRDAProtocolException
{
XAResource xaResource = getXAResource();
int xaRetVal = xaResource.XA_OK;
Xid[] indoubtXids = null;
try {
- indoubtXids = xaResource.recover(XAResource.TMSTARTRSCAN);
+ indoubtXids = xaResource.recover(xaflags);
} catch (XAException xe)
{
xaRetVal = processXAException(xe);
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/netxaPositive.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/netxaPositive.out?view=diff&r1=155641&r2=155642
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/netxaPositive.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/netxaPositive.out Sun Feb 27 13:30:56 2005
@@ -109,6 +109,6 @@
ij(XA)> xa_prepare 3;
ij(XA)> -- should fail with XA_NOTA because we prepared a read only transaction
xa_commit xa_1Phase 3;
-IJ ERROR: XAER_PROTO
+IJ ERROR: XAER_NOTA
ij(XA)> disconnect;
ij>
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall?view=diff&r1=155641&r2=155642
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall Sun Feb 27 13:30:56 2005
@@ -1 +1,2 @@
derbynet/netxaPositive.sql
+jdbcapi/xaStateTran.sql
Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java?view=diff&r1=155641&r2=155642
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java Sun Feb 27 13:30:56 2005
@@ -122,6 +122,11 @@
return false;
}
+ public static boolean isEmbeddedFramework()
+ {
+ return (getFramework() == EMBEDDED_FRAMEWORK);
+ }
+
/**
Get the framework from the System Property framework
@return constant for framework being used
@@ -242,7 +247,7 @@
* will mean ds.setDatabaseName("wombat") will be called
* @return datasource for current framework
*/
- public static javax.sql.XADataSource getXADatasource(Properties attrs)
+ public static javax.sql.XADataSource getXADataSource(Properties attrs)
{
String classname = getDataSourcePrefix() + XA_DATASOURCE_STRING + "DataSource";
@@ -260,12 +265,11 @@
*/
public static javax.sql.ConnectionPoolDataSource getConnectionPoolDataSource(Properties attrs)
{
-
String classname = getDataSourcePrefix() + CONNECTION_POOL_DATASOURCE_STRING + "DataSource";
return (javax.sql.ConnectionPoolDataSource) getDataSourceWithReflection(classname, attrs);
}
- private static String getDataSourcePrefix()
+ public static String getDataSourcePrefix()
{
framework = getFramework();
switch(framework)
@@ -277,13 +281,15 @@
case DERBY_NET_CLIENT_FRAMEWORK:
return "org.apache.derby.jdbc.Client";
case EMBEDDED_FRAMEWORK:
- return "org.apache.derby.jdbc.Embed";
+ return "org.apache.derby.jdbc.Embedded";
default:
Exception e = new Exception("FAIL: No DataSource Prefix for framework: " + framework);
e.printStackTrace();
}
return null;
}
+
+
static private Class[] STRING_ARG_TYPE = {String.class};
static private Class[] INT_ARG_TYPE = {Integer.TYPE};
Modified: incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java?view=diff&r1=155641&r2=155642
==============================================================================
--- incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java (original)
+++ incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/xaHelper.java Sun Feb 27 13:30:56 2005
@@ -53,6 +53,7 @@
private PooledConnection currentPooledConnection;
private boolean isJCC;
+ private boolean isNetClient;
private String framework;
xaHelper()
@@ -62,10 +63,12 @@
public void setFramework(String fm)
{
- framework = fm.toUpperCase();
+ framework = fm.toUpperCase(Locale.ENGLISH);
if (framework.endsWith("NET") ||
framework.equals("DB2JCC"))
isJCC = true;
+ else if (framework.equals("DERBYNETCLIENT"))
+ isNetClient = true;
}
@@ -84,16 +87,13 @@
databaseName = parser.stringValue(dbname.image);
- if (isJCC)
+ if (isJCC || isNetClient)
{
xaHelper.setDataSourceProperty(currentXADataSource,
"ServerName", "localhost");
xaHelper.setDataSourceProperty(currentXADataSource,
"portNumber", 1527);
- xaHelper.setDataSourceProperty(currentXADataSource,
- "driverType", 4);
-
xaHelper.setDataSourceProperty(currentXADataSource,
"retrieveMessagesFromServerOnGetMessage", true);
String user;
@@ -107,12 +107,15 @@
//xaHelper.setDataSourceProperty(currentXADataSource,
//"traceFile", "trace.out." + framework);
}
+ if (isJCC)
+ xaHelper.setDataSourceProperty(currentXADataSource,
+ "driverType", 4);
xaHelper.setDataSourceProperty(currentXADataSource, "databaseName", databaseName);
if (shutdown != null && shutdown.toString().toLowerCase(Locale.ENGLISH).equals("shutdown"))
{
- if (isJCC)
+ if (isJCC || isNetClient)
xaHelper.setDataSourceProperty(currentXADataSource,"databaseName", databaseName + ";shutdown=true");
else
xaHelper.setDataSourceProperty(currentXADataSource, "shutdownDatabase", "shutdown");
@@ -124,7 +127,7 @@
}
else if (create != null && create.toLowerCase(java.util.Locale.ENGLISH).equals("create"))
{
- if (isJCC)
+ if (isJCC || isNetClient)
xaHelper.setDataSourceProperty(currentXADataSource,"databaseName", databaseName + ";create=true");
else
xaHelper.setDataSourceProperty(currentXADataSource,
@@ -373,13 +376,14 @@
case XAException.XAER_RMERR : error = "XAER_RMERR "; break;
case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break;
}
+ //t.printStackTrace(System.out);
throw new ijException(error);
}
else // StandardException or run time exception, log it first
{
String info = LocalizedResource.getMessage("IJ_01SeeClouLog", t.toString(), t.getMessage());
- t.printStackTrace(System.out);
+ // t.printStackTrace(System.out);
throw new ijException(info);
}
}
@@ -485,6 +489,9 @@
if (isJCC)
return (XADataSource)
(Class.forName("com.ibm.db2.jcc.DB2XADataSource").newInstance());
+ else if (isNetClient)
+ return (XADataSource)
+ (Class.forName("org.apache.derby.jdbc.ClientXADataSource").newInstance());
else
return (XADataSource)(Class.forName("org.apache.derby.jdbc.EmbeddedXADataSource").newInstance());
}