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 rh...@apache.org on 2014/04/24 16:37:37 UTC
svn commit: r1589747 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest:
NsTest.java NsTestError.java
Author: rhillegas
Date: Thu Apr 24 14:37:37 2014
New Revision: 1589747
URL: http://svn.apache.org/r1589747
Log:
DERBY-6533: Sort NsTest errors by the timestamp of their first occurrence; commit derby-6533-08-aa-sortErrors.diff.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTestError.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java?rev=1589747&r1=1589746&r2=1589747&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java Thu Apr 24 14:37:37 2014
@@ -20,6 +20,7 @@
*/
package org.apache.derbyTesting.system.nstest;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Properties;
import java.util.Date;
@@ -668,10 +669,15 @@ public class NsTest extends Thread
if ( _errors.size() > 0 )
{
+ // sort the errors by the timestamps of their first occurrences
+ NsTestError[] errors = new NsTestError[ _errors.size() ];
+ _errors.values().toArray( errors );
+ Arrays.sort( errors );
+
countAndPrintSQLStates();
- for ( String key : _errors.keySet() )
+ for ( NsTestError error : errors )
{
- printError( key );
+ printError( error );
}
}
}
@@ -714,11 +720,10 @@ public class NsTest extends Thread
statisticsLogger.println( "\n" );
}
- private static void printError( String key )
+ private static void printError( NsTestError error )
{
- String stackTrace = key;
- NsTestError error = _errors.get( key );
Throwable throwable = error.throwable();
+ String stackTrace = getStackTrace( throwable );
int count = error.count();
Timestamp firstOccurrenceTime = new Timestamp( error.getFirstOccurrenceTime() );
Timestamp lastOccurrenceTime = new Timestamp( error.getLastOccurrenceTime() );
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTestError.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTestError.java?rev=1589747&r1=1589746&r2=1589747&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTestError.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/NsTestError.java Thu Apr 24 14:37:37 2014
@@ -26,7 +26,7 @@ package org.apache.derbyTesting.system.n
* HashMap keyed by the error's stack trace.
* </p>
*/
-public class NsTestError
+public class NsTestError implements Comparable<NsTestError>
{
///////////////////////////////////////////////////////////////////////////////////
//
@@ -80,6 +80,26 @@ public class NsTestError
///////////////////////////////////////////////////////////////////////////////////
//
+ // Comparable BEHAVIOR
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+ public int compareTo( NsTestError that )
+ {
+ if ( that == null ) { return -1; }
+ else
+ {
+ long thisVal = this._firstOccurrenceTime;
+ long thatVal = that._firstOccurrenceTime;
+
+ if ( thisVal < thatVal ) { return -1; }
+ else if ( thisVal > thatVal ) { return 1; }
+ else { return 0; }
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
// OTHER BEHAVIOR
//
///////////////////////////////////////////////////////////////////////////////////