Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF13911D04 for ; Thu, 24 Apr 2014 14:38:00 +0000 (UTC) Received: (qmail 95759 invoked by uid 500); 24 Apr 2014 14:38:00 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 95710 invoked by uid 500); 24 Apr 2014 14:37:59 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 95703 invoked by uid 99); 24 Apr 2014 14:37:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2014 14:37:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2014 14:37:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1942623889E1; Thu, 24 Apr 2014 14:37:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1589747 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest: NsTest.java NsTestError.java Date: Thu, 24 Apr 2014 14:37:37 -0000 To: derby-commits@db.apache.org From: rhillegas@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140424143738.1942623889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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. *

*/ -public class NsTestError +public class NsTestError implements Comparable { /////////////////////////////////////////////////////////////////////////////////// // @@ -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 // ///////////////////////////////////////////////////////////////////////////////////