Skip to content
Snippets Groups Projects
Commit 4e583dce authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

added first test

parent 41fff673
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javadocOutputDir>apidocs</javadocOutputDir> <javadocOutputDir>apidocs</javadocOutputDir>
<java.version>1.6</java.version> <java.version>1.6</java.version>
<checkstyle.version>2.16</checkstyle.version> <checkstyle.version>2.16</checkstyle.version>
<findbugs.version>3.0.1</findbugs.version> <findbugs.version>3.0.1</findbugs.version>
......
...@@ -118,7 +118,7 @@ public final class Execution<T extends Configuration> { ...@@ -118,7 +118,7 @@ public final class Execution<T extends Configuration> {
} }
// TODO: implement // TODO: implement
private void abortEventually() { public void abortEventually() {
configurationContext.abortConfigurationRun(); configurationContext.abortConfigurationRun();
waitForTermination(); waitForTermination();
} }
......
package teetime.framework;
import org.junit.Test;
import teetime.stage.InitialElementProducer;
public class TerminationTest {
@Test(timeout = 2000)
public void doesNotGetStuckInAdd() throws InterruptedException {
Execution<TerminationConfig> execution = new Execution<TerminationConfig>(new TerminationConfig());
execution.executeNonBlocking();
Thread.sleep(1000);
execution.abortEventually();
}
private class TerminationConfig extends Configuration {
InitialElementProducer<Integer> init = new InitialElementProducer<Integer>(1, 2, 3, 4, 5, 6);
DoesNotRetrieveElements sinkStage = new DoesNotRetrieveElements();
public TerminationConfig() {
connectPorts(init.getOutputPort(), sinkStage.getInputPort(), 1);
addThreadableStage(sinkStage);
}
}
private class DoesNotRetrieveElements extends AbstractConsumerStage<Integer> {
@Override
protected void execute(final Integer element) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// Will happen in this test
}
}
@Override
protected void terminate() {
Thread.currentThread().interrupt();
System.out.println("TADA " + this.shouldBeTerminated());
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment