From 8e136f47503a70b905818c4be03b8df350950857 Mon Sep 17 00:00:00 2001
From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de>
Date: Thu, 30 Jul 2015 12:23:39 +0200
Subject: [PATCH] added test for normal abort

---
 .../teetime/framework/TerminationTest.java    | 20 +++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/test/java/teetime/framework/TerminationTest.java b/src/test/java/teetime/framework/TerminationTest.java
index 367636ec..2c0bffe3 100644
--- a/src/test/java/teetime/framework/TerminationTest.java
+++ b/src/test/java/teetime/framework/TerminationTest.java
@@ -8,8 +8,18 @@ import java.util.Arrays;
 
 import org.junit.Test;
 
+import teetime.stage.basic.Sink;
+
 public class TerminationTest {
 
+	@Test(timeout = 1000)
+	public void correctAbort() throws InterruptedException {
+		TerminationConfig configuration = new TerminationConfig(10);
+		Execution<TerminationConfig> execution = new Execution<TerminationConfig>(configuration);
+		execution.executeNonBlocking();
+		execution.abortEventually();
+	}
+
 	@Test(timeout = 3000)
 	public void doesNotGetStuckInAdd() throws InterruptedException {
 		TerminationConfig configuration = new TerminationConfig(1);
@@ -25,8 +35,14 @@ public class TerminationTest {
 		DoesNotRetrieveElements sinkStage = new DoesNotRetrieveElements();
 
 		public TerminationConfig(final int capacity) {
-			connectPorts(init.getOutputPort(), sinkStage.getInputPort(), capacity);
-			addThreadableStage(sinkStage);
+			if (capacity == 1) {
+				connectPorts(init.getOutputPort(), sinkStage.getInputPort(), capacity);
+				addThreadableStage(sinkStage);
+			} else {
+				Sink<Integer> sink = new Sink<Integer>();
+				connectPorts(init.getOutputPort(), sink.getInputPort(), capacity);
+				addThreadableStage(sink);
+			}
 		}
 
 	}
-- 
GitLab