commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nutty...@apache.org
Subject svn commit: r441254 - in /jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework: FaultingTestStage.java TestStage.java
Date Thu, 07 Sep 2006 22:06:14 GMT
Author: nuttycom
Date: Thu Sep  7 15:06:13 2006
New Revision: 441254

URL: http://svn.apache.org/viewvc?view=rev&rev=441254
Log:
Improved documentation & added logging of faults

Modified:
    jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/FaultingTestStage.java
    jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/TestStage.java

Modified: jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/FaultingTestStage.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/FaultingTestStage.java?view=diff&rev=441254&r1=441253&r2=441254
==============================================================================
--- jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/FaultingTestStage.java
(original)
+++ jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/FaultingTestStage.java
Thu Sep  7 15:06:13 2006
@@ -16,13 +16,21 @@
 
 package org.apache.commons.pipeline.testFramework;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.commons.pipeline.*;
 import org.apache.commons.pipeline.validation.ConsumedTypes;
 import org.apache.commons.pipeline.validation.ProducesConsumed;
 
+/**
+ * This stage will generate {@link StageException}s for every other object this
+ * stage processes. By design, the even numbered objects will cause a <CODE>StageException</CODE>
+ * to be thrown (counting the first object as 1).
+ */
 @ConsumedTypes(Object.class)
 @ProducesConsumed
 public class FaultingTestStage extends TestStage {
+    private Log log = LogFactory.getLog(FaultingTestStage.class);
     private int counter = 0;
     
     public FaultingTestStage(int index) {
@@ -30,7 +38,11 @@
     }
     
     public void process(Object obj) throws StageException {
-        if (++counter % 2 == 0) throw new StageException("Planned fault in stage " + super.getIndex()
+ ".");
+        if (++counter % 2 == 0) {
+            log.error("Planned fault in stage " + this + ".");
+            throw new StageException(this, "Planned fault in stage " + super.getIndex() +
".");
+        }
+        
         super.process(obj);
     }
 }

Modified: jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/TestStage.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/TestStage.java?view=diff&rev=441254&r1=441253&r2=441254
==============================================================================
--- jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/TestStage.java
(original)
+++ jakarta/commons/sandbox/pipeline/trunk/src/main/java/org/apache/commons/pipeline/testFramework/TestStage.java
Thu Sep  7 15:06:13 2006
@@ -37,6 +37,11 @@
     public boolean postprocessed = false;
     public boolean released = false;
     
+    /**
+     * Construct a TestStage with a numeric index used to easily identify this stage. 
+     * The {@link getIndex} and {@link toString} methods use this index.
+     * @param index acts as an identification number
+     */
     public TestStage(int index) {
         this.index = index;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message