From 2077b4020f8dc25c11a91341f8a5b36e0992d0c6 Mon Sep 17 00:00:00 2001
From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de>
Date: Wed, 23 Sep 2015 15:11:37 +0200
Subject: [PATCH] removed obsolete test configs

---
 .../ExceptionHandlingTest.java                | 43 ------------
 .../ExceptionTestConfiguration.java           | 40 -----------
 .../ExceptionTestConsumerStage.java           | 32 ---------
 .../ExceptionTestProducerStage.java           | 67 -------------------
 4 files changed, 182 deletions(-)
 delete mode 100644 src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java
 delete mode 100644 src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java
 delete mode 100644 src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java

diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java
index c1b1de38..5fb16e84 100644
--- a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java
+++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java
@@ -16,9 +16,7 @@
 package teetime.framework.exceptionHandling;
 
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
-import org.junit.Ignore;
 import org.junit.Test;
 
 import teetime.framework.Execution;
@@ -26,26 +24,6 @@ import teetime.framework.ExecutionException;
 
 public class ExceptionHandlingTest {
 
-	private Execution<ExceptionTestConfiguration> execution;
-
-	public ExceptionTestConfiguration newInstances() {
-		ExceptionTestConfiguration configuration = new ExceptionTestConfiguration();
-		execution = new Execution<ExceptionTestConfiguration>(configuration);
-		return configuration;
-	}
-
-	public void exceptionPassingAndTermination() {
-		newInstances();
-		execution.executeBlocking();
-		fail(); // Should never be executed
-	}
-
-	public void terminatesAllStages() {
-		ExceptionTestConfiguration config = newInstances();
-		execution.executeBlocking();
-		fail(); // Should never be executed
-	}
-
 	@Test
 	public void testException() {
 		boolean exceptionArised = false;
@@ -58,25 +36,4 @@ public class ExceptionHandlingTest {
 		assertTrue(exceptionArised);
 	}
 
-	@Ignore
-	@Test
-	public void forAFewTimes() {
-		for (int i = 0; i < 100; i++) {
-			boolean exceptionArised = false;
-			try {
-				exceptionPassingAndTermination(); // listener did not kill thread too early;
-			} catch (ExecutionException e) {
-				exceptionArised = true;
-			}
-			assertTrue(exceptionArised);
-
-			exceptionArised = false;
-			try {
-				terminatesAllStages();
-			} catch (ExecutionException e) {
-				exceptionArised = true;
-			}
-			assertTrue(exceptionArised);
-		}
-	}
 }
diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java
deleted file mode 100644
index 79f7ff1d..00000000
--- a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://christianwulf.github.io/teetime)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package teetime.framework.exceptionHandling;
-
-import teetime.framework.Configuration;
-
-public class ExceptionTestConfiguration extends Configuration {
-
-	ExceptionTestProducerStage first;
-	ExceptionTestConsumerStage second;
-	ExceptionTestProducerStage third;
-
-	public ExceptionTestConfiguration() {
-		super(new TestListenerFactory());
-
-		first = new ExceptionTestProducerStage();
-		second = new ExceptionTestConsumerStage();
-		third = new ExceptionTestProducerStage();
-
-		connectPorts(first.getOutputPort(), second.getInputPort());
-		// this.addThreadableStage(new ExceptionTestStage());
-
-		second.declareActive();
-		third.declareActive();
-	}
-
-}
diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java
deleted file mode 100644
index 0f2df92f..00000000
--- a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://christianwulf.github.io/teetime)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package teetime.framework.exceptionHandling;
-
-import teetime.framework.AbstractConsumerStage;
-
-public class ExceptionTestConsumerStage extends AbstractConsumerStage<Object> {
-
-	private int numberOfExecutions = 0;
-
-	@Override
-	protected void execute(final Object element) {
-		if (numberOfExecutions % 1000 == 0) {
-			throw new IllegalStateException("1000 loops");
-		}
-		numberOfExecutions++;
-	}
-
-}
diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java
deleted file mode 100644
index 40bb6f5f..00000000
--- a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://christianwulf.github.io/teetime)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package teetime.framework.exceptionHandling;
-
-import teetime.framework.AbstractProducerStage;
-import teetime.framework.InputPort;
-import teetime.framework.TerminationStrategy;
-
-public class ExceptionTestProducerStage extends AbstractProducerStage<Object> {
-
-	private static int instances = 0;
-	private TerminationStrategy strategy;
-	public int numberOfExecutions = 0;
-	private final InputPort<Object> input = createInputPort();
-
-	ExceptionTestProducerStage() {
-		switch (instances) {
-		case 0: {
-			strategy = TerminationStrategy.BY_SELF_DECISION;
-			break;
-		}
-		case 1: {
-			strategy = TerminationStrategy.BY_INTERRUPT;
-			break;
-		}
-		default: {
-			strategy = TerminationStrategy.BY_SELF_DECISION;
-		}
-		}
-
-		instances++;
-	}
-
-	@Override
-	protected void execute() {
-		getOutputPort().send(new Object());
-		if (numberOfExecutions++ >= 10000 && strategy == TerminationStrategy.BY_SELF_DECISION) {
-			this.terminate();
-		}
-	}
-
-	@Override
-	public TerminationStrategy getTerminationStrategy() {
-		return strategy;
-	}
-
-	@Override
-	public String getId() {
-		if (strategy == TerminationStrategy.BY_INTERRUPT) {
-			return "Infinite" + super.getId();
-		}
-		return "Finite" + super.getId();
-	}
-}
-- 
GitLab