From 4d3fe3a5663f5340d1516708ddcc3fe1eb4b1c35 Mon Sep 17 00:00:00 2001
From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de>
Date: Wed, 4 Nov 2015 15:48:58 +0100
Subject: [PATCH] enhanced test

---
 .../java/teetime/framework/Execution.java     | 13 ++++++-----
 .../java/teetime/framework/RunnerConfig.java  | 22 +++++++++++++++++++
 .../java/teetime/framework/RunnerTest.java    |  7 +++++-
 3 files changed, 35 insertions(+), 7 deletions(-)
 create mode 100644 src/test/java/teetime/framework/RunnerConfig.java

diff --git a/src/main/java/teetime/framework/Execution.java b/src/main/java/teetime/framework/Execution.java
index f0242ad1..53e733e3 100644
--- a/src/main/java/teetime/framework/Execution.java
+++ b/src/main/java/teetime/framework/Execution.java
@@ -22,6 +22,9 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import teetime.framework.signal.ValidatingSignal;
 import teetime.framework.validation.AnalysisNotValidException;
 
@@ -41,7 +44,7 @@ import teetime.framework.validation.AnalysisNotValidException;
  */
 public final class Execution<T extends Configuration> {
 
-	// private static final Logger LOGGER = LoggerFactory.getLogger(Execution.class);
+	private static final Logger LOGGER = LoggerFactory.getLogger(Execution.class);
 
 	private final T configuration;
 	private final ConfigurationContext configurationContext;
@@ -177,13 +180,11 @@ public final class Execution<T extends Configuration> {
 					instances.add((Configuration) obj);
 				}
 			} catch (ClassNotFoundException e) {
-				System.out.println("Could not find class: " + each);
+				LOGGER.error("Could not find class " + each);
 			} catch (InstantiationException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+				LOGGER.error("Could not instantiate class " + each, e);
 			} catch (IllegalAccessException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+				LOGGER.error("IllegalAccessException arised while instantiating class " + each, e);
 			}
 		}
 		return instances;
diff --git a/src/test/java/teetime/framework/RunnerConfig.java b/src/test/java/teetime/framework/RunnerConfig.java
new file mode 100644
index 00000000..b61674a7
--- /dev/null
+++ b/src/test/java/teetime/framework/RunnerConfig.java
@@ -0,0 +1,22 @@
+package teetime.framework;
+
+import teetime.stage.InitialElementProducer;
+
+public class RunnerConfig extends Configuration {
+
+	public static boolean executed = false;
+
+	public RunnerConfig() {
+		connectPorts(new InitialElementProducer<Object>(new Object()).getOutputPort(), new StaticSetter().getInputPort());
+	}
+
+	private class StaticSetter extends AbstractConsumerStage<Object> {
+
+		@Override
+		protected void execute(final Object element) {
+			executed = true;
+		}
+
+	}
+
+}
diff --git a/src/test/java/teetime/framework/RunnerTest.java b/src/test/java/teetime/framework/RunnerTest.java
index 3b5f45c1..f3c1f96f 100644
--- a/src/test/java/teetime/framework/RunnerTest.java
+++ b/src/test/java/teetime/framework/RunnerTest.java
@@ -1,12 +1,17 @@
 package teetime.framework;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import org.junit.Test;
 
 public class RunnerTest {
 
 	@Test
 	public void test() {
-		Execution.main(new String[] { "teetime.framework.CompositeProducerConfig" });
+		assertFalse(RunnerConfig.executed);
+		Execution.main(new String[] { "teetime.framework.RunnerConfig" });
+		assertTrue(RunnerConfig.executed);
 	}
 
 }
-- 
GitLab