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

instead of the whole CompositeStage, only the first stage gets added to

the threadable jobs list
parent 0c2b62be
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,8 @@ import teetime.util.Pair;
* To start the analysis {@link #executeBlocking()} needs to be executed.
* This class will automatically create threads and join them without any further commitment.
*
* @author Christian Wulf, Nelson Tavares de Sousa
*
* @param <T>
* the type of the {@link AnalysisConfiguration}
*/
......
......@@ -61,8 +61,12 @@ public abstract class AnalysisConfiguration {
* A arbitrary stage, which will be added to the configuration and executed in a thread.
*/
protected void addThreadableStage(final Stage stage) {
if (stage instanceof AbstractCompositeStage) {
this.threadableStageJobs.add(((AbstractCompositeStage) stage).getFirstStage());
} else {
this.threadableStageJobs.add(stage);
}
}
/**
* Connects two stages with a pipe within the same thread.
......
......@@ -15,7 +15,10 @@
*/
package teetime.framework;
import static org.junit.Assert.assertTrue;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.io.File;
import java.util.HashSet;
......@@ -39,12 +42,14 @@ public class TraversorTest {
@Test
public void traverse() {
TestConfiguration tc = new TestConfiguration();
new Analysis<TestConfiguration>(tc);
traversor.traverse(tc.init);
Set<Stage> comparingStages = new HashSet<Stage>();
comparingStages.add(tc.init);
comparingStages.add(tc.f2b);
comparingStages.add(tc.distributor);
assertTrue(comparingStages.equals(traversor.getVisitedStage()));
assertThat(tc.distributor.getOwningThread(), is(not(tc.distributor.getOutputPorts()[0].pipe.getTargetPort().getOwningStage().getOwningThread())));
assertEquals(comparingStages, traversor.getVisitedStage());
}
// WordCounterConfiguration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment