db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1589404 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest: NsTest.java NsTestError.java tester/TesterObject.java
Date Wed, 23 Apr 2014 13:25:58 GMT
Author: rhillegas
Date: Wed Apr 23 13:25:57 2014
New Revision: 1589404

URL: http://svn.apache.org/r1589404
Log:
DERBY-6533: Add more defensive code to NsTest; commit derby-6533-07-aa-moreDefensiveCode.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
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.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=1589404&r1=1589403&r2=1589404&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 Wed
Apr 23 13:25:57 2014
@@ -720,6 +720,8 @@ public class NsTest extends Thread
         NsTestError error = _errors.get( key );
         Throwable   throwable = error.throwable();
         int             count = error.count();
+        Timestamp   firstOccurrenceTime = new Timestamp( error.getFirstOccurrenceTime() );
+        Timestamp   lastOccurrenceTime = new Timestamp( error.getLastOccurrenceTime() );
         String      sqlState = (throwable instanceof SQLException) ? 
             ((SQLException) throwable).getSQLState() : null;
 
@@ -735,6 +737,12 @@ public class NsTest extends Thread
         buffer.append( "\n" );
         buffer.append( ERROR_BANNER2 );
         buffer.append( "\n" );
+        buffer.append( ERROR_BANNER2 );
+        buffer.append( "First occurrence at " + firstOccurrenceTime );
+        buffer.append( ", last occurrence at " + lastOccurrenceTime );
+        buffer.append( "\n" );
+        buffer.append( ERROR_BANNER2 );
+        buffer.append( "\n" );
         buffer.append( ERROR_BANNER1 );
         buffer.append( "\n" );
         buffer.append( stackTrace );

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=1589404&r1=1589403&r2=1589404&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
Wed Apr 23 13:25:57 2014
@@ -42,6 +42,8 @@ public  class   NsTestError
 
     private Throwable   _throwable;
     private int             _count;
+    private long            _firstOccurrenceTime;
+    private long            _lastOccurrenceTime;
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -54,6 +56,8 @@ public  class   NsTestError
     {
         _throwable = throwable;
         _count = 1;
+        _firstOccurrenceTime = System.currentTimeMillis();
+        _lastOccurrenceTime = _firstOccurrenceTime;
     }
 
     ///////////////////////////////////////////////////////////////////////////////////
@@ -67,6 +71,12 @@ public  class   NsTestError
 
     /** Get the number of times this error was seen */
     public  int count() { return _count; }
+
+    /** Get the timestamp of the first occurrence */
+    public  long    getFirstOccurrenceTime() { return _firstOccurrenceTime; }
+
+    /** Get the timestamp of the last occurrence */
+    public  long    getLastOccurrenceTime() { return _lastOccurrenceTime; }
   
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -75,7 +85,11 @@ public  class   NsTestError
     ///////////////////////////////////////////////////////////////////////////////////
 
     /** Increment the number of times this error was seen */
-    public  void    increment() { _count++; }
+    public  void    increment()
+    {
+        _count++;
+        _lastOccurrenceTime = System.currentTimeMillis();
+    }
     
 }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java?rev=1589404&r1=1589403&r2=1589404&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
Wed Apr 23 13:25:57 2014
@@ -183,6 +183,7 @@ public class TesterObject {
 					NsTest.addStats(NsTest.FAILED_UPDATE, 1);
 			} catch (Exception e) {
 				printException("executing update_one_row", e);
+                if ( NsTest.deadConnection( e ) ) { markDeadConnection(); }
 			}
 			break;
 
@@ -196,6 +197,7 @@ public class TesterObject {
 					NsTest.addStats(NsTest.FAILED_DELETE, 1);
 			} catch (Exception e) {
 				printException("executing delete_one_row()", e);
+                if ( NsTest.deadConnection( e ) ) { markDeadConnection(); }
 			}
 			break;
 



Mime
View raw message