Michael, Craig,
here are my extensions to tck20's JDO_Test.java for the error message
handling. They're independent from the ThreadSafe fixes I'm working
on, so, I'll better file a separate, minor JIRA task to check them in.
Martin
$ svn diff src/java/org/apache/jdo/tck/JDO_Test.java
Index: src/java/org/apache/jdo/tck/JDO_Test.java
===================================================================
--- src/java/org/apache/jdo/tck/JDO_Test.java (revision 375502)
+++ src/java/org/apache/jdo/tck/JDO_Test.java (working copy)
@@ -128,6 +128,10 @@
/** identitytype value for datastoreidentity. */
public static final String DATASTORE_IDENTITY = "datastoreidentity";
+ /** New line.
+ */
+ public static final String NL = System.getProperty("line.separator");
+
/**
* String indicating the type of identity used for the current test case.
* The value is either "applicationidentity" or "datastoreidentity".
@@ -147,6 +151,10 @@
/** The Properties object for the PersistenceManagerFactory. */
protected static Properties PMFPropertiesObject;
+ /** A buffer of of error messages.
+ */
+ protected static StringBuffer messages;
+
/** The PersistenceManagerFactory. */
protected PersistenceManagerFactory pmf;
@@ -537,13 +545,36 @@
return props;
}
+ /** Appends to error messages.
+ */
+ protected static synchronized void appendMessage(String message) {
+ if (messages == null) {
+ messages = new StringBuffer();
+ }
+ messages.append(message);
+ messages.append(NL);
+ }
+
+ /**
+ * Returns collected error messages, or <code>null</code> if there
+ * are none, and clears the buffer.
+ */
+ protected static synchronized String popMessages() {
+ if (messages == null) {
+ return null;
+ }
+ final String msg = messages.toString();
+ messages = null;
+ return msg;
+ }
+
/**
* Prints the specified msg (if debug is true), before it aborts the
* test case.
*/
public void fail(String assertionFailure, String msg) {
if (debug) logger.debug(msg);
- fail(assertionFailure + "\n" + msg);
+ fail(assertionFailure + NL + msg);
}
// Helper methods to check for supported options