flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esam...@apache.org
Subject svn commit: r1156887 - /incubator/flume/branches/flume-728/flume-ng-core/src/test/java/org/apache/flume/core/TestLogicalNode.java
Date Fri, 12 Aug 2011 00:47:16 GMT
Author: esammer
Date: Fri Aug 12 00:47:16 2011
New Revision: 1156887

URL: http://svn.apache.org/viewvc?rev=1156887&view=rev
Log:
- Added a (currently failing) unit test of an interrupted open() in LogicalNode.

Modified:
    incubator/flume/branches/flume-728/flume-ng-core/src/test/java/org/apache/flume/core/TestLogicalNode.java

Modified: incubator/flume/branches/flume-728/flume-ng-core/src/test/java/org/apache/flume/core/TestLogicalNode.java
URL: http://svn.apache.org/viewvc/incubator/flume/branches/flume-728/flume-ng-core/src/test/java/org/apache/flume/core/TestLogicalNode.java?rev=1156887&r1=1156886&r2=1156887&view=diff
==============================================================================
--- incubator/flume/branches/flume-728/flume-ng-core/src/test/java/org/apache/flume/core/TestLogicalNode.java
(original)
+++ incubator/flume/branches/flume-728/flume-ng-core/src/test/java/org/apache/flume/core/TestLogicalNode.java
Fri Aug 12 00:47:16 2011
@@ -6,7 +6,6 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.flume.lifecycle.LifecycleController;
 import org.apache.flume.lifecycle.LifecycleException;
 import org.apache.flume.lifecycle.LifecycleState;
-import org.apache.flume.sink.LoggerSink;
 import org.apache.flume.sink.NullSink;
 import org.apache.flume.source.SequenceGeneratorSource;
 import org.junit.Assert;
@@ -28,7 +27,7 @@ public class TestLogicalNode {
 
     node.setName("test-node-n1");
     node.setSource(new SequenceGeneratorSource());
-    node.setSink(new LoggerSink());
+    node.setSink(new NullSink());
   }
 
   @Test
@@ -52,6 +51,28 @@ public class TestLogicalNode {
   }
 
   @Test
+  public void testInterruptStart() throws LifecycleException,
+      InterruptedException {
+    Context context = new Context();
+
+    Thread.currentThread().interrupt();
+    node.start(context);
+    boolean reached = LifecycleController.waitForOneOf(node,
+        new LifecycleState[] { LifecycleState.START, LifecycleState.ERROR },
+        5000);
+
+    Assert.assertTrue("Matched a lifecycle state", reached);
+    Assert.assertEquals(LifecycleState.START, node.getLifecycleState());
+
+    node.stop(context);
+    reached = LifecycleController.waitForOneOf(node, new LifecycleState[] {
+        LifecycleState.STOP, LifecycleState.ERROR }, 5000);
+
+    Assert.assertTrue("Matched a lifecycle state", reached);
+    Assert.assertEquals(LifecycleState.STOP, node.getLifecycleState());
+  }
+
+  @Test
   public void testMultipleNodes() throws LifecycleException,
       InterruptedException {
 



Mime
View raw message