db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Zaun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-309) minor extensions to tck20's JDO_Test and ThreadExceptionHandler
Date Fri, 17 Feb 2006 17:53:25 GMT
    [ http://issues.apache.org/jira/browse/JDO-309?page=comments#action_12366824 ] 

Martin Zaun commented on JDO-309:
---------------------------------

The planned extensions to tck20's JDO_Test (based on Craig's suggestion):

$ 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 

> minor extensions to tck20's JDO_Test and ThreadExceptionHandler
> ---------------------------------------------------------------
>
>          Key: JDO-309
>          URL: http://issues.apache.org/jira/browse/JDO-309
>      Project: JDO
>         Type: New Feature
>   Components: tck20
>     Reporter: Martin Zaun
>     Priority: Trivial

>
> JDO_Test should be extended for methods collection error messages.
> ThreadExceptionHandler should be extended for clearing stored exceptions.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message