Search in sources :

Example 1 with Traverser

use of teetime.framework.Traverser in project TeeTime by teetime-framework.

the class IntraStageCollectorTest method testVisitedStages.

@Test
public void testVisitedStages() {
    TestConfiguration config = new TestConfiguration();
    IntraStageCollector collector = new IntraStageCollector(config.init);
    Traverser traversor = new Traverser(collector);
    traversor.traverse(config.init);
    assertThat(collector.getIntraStages(), containsInAnyOrder(config.init, config.f2b, config.distributor));
}
Also used : Traverser(teetime.framework.Traverser) TestConfiguration(teetime.framework.TestConfiguration) Test(org.junit.Test)

Example 2 with Traverser

use of teetime.framework.Traverser in project TeeTime by teetime-framework.

the class A2InvalidThreadAssignmentCheck method check.

@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public void check() {
    int color = DEFAULT_COLOR;
    ObjectIntMap<AbstractStage> colors = new ObjectIntHashMap<AbstractStage>();
    ThreadPainter threadPainter = new ThreadPainter();
    Traverser traverser = new Traverser(threadPainter);
    for (AbstractStage threadableStage : threadableStages) {
        color++;
        colors.put(threadableStage, color);
        threadPainter.reset(colors, color, threadableStages);
        traverser.traverse(threadableStage);
    }
}
Also used : ObjectIntHashMap(com.carrotsearch.hppc.ObjectIntHashMap) Traverser(teetime.framework.Traverser) AbstractStage(teetime.framework.AbstractStage)

Example 3 with Traverser

use of teetime.framework.Traverser in project TeeTime by teetime-framework.

the class NextActiveStageShouldTerminate method isMet.

@Override
public boolean isMet() {
    // traverse at runtime (!) until another active (consumer) stage was found
    Traverser traverser = new Traverser(visitor, alwaysFalseCondition);
    traverser.traverse(stage);
    InputPort<?> inputPortOfActiveStage = visitor.getActiveConsumerStageInputPort();
    AbstractStage activeStage = inputPortOfActiveStage.getOwningStage();
    for (InputPort<?> inputPort : StageFacade.INSTANCE.getInputPorts(activeStage)) {
        if (inputPort != inputPortOfActiveStage && !inputPort.isClosed()) {
            return false;
        }
    }
    return true;
}
Also used : Traverser(teetime.framework.Traverser) AbstractStage(teetime.framework.AbstractStage)

Example 4 with Traverser

use of teetime.framework.Traverser in project TeeTime by teetime-framework.

the class A1ThreadableStageCollectorTest method testVisit.

@Test
public void testVisit() throws Exception {
    TestConfiguration config = new TestConfiguration();
    Collection<AbstractStage> startStages = ConfigurationFacade.INSTANCE.getStartStages(config);
    A1ThreadableStageCollector stageCollector = new A1ThreadableStageCollector();
    Traverser traversor = new Traverser(stageCollector);
    for (AbstractStage startStage : startStages) {
        traversor.traverse(startStage);
    }
    Set<AbstractStage> newThreadableStages = stageCollector.getThreadableStages();
    assertThat(newThreadableStages, hasSize(4));
}
Also used : Traverser(teetime.framework.Traverser) TestConfiguration(teetime.framework.TestConfiguration) AbstractStage(teetime.framework.AbstractStage) Test(org.junit.Test)

Aggregations

Traverser (teetime.framework.Traverser)4 AbstractStage (teetime.framework.AbstractStage)3 Test (org.junit.Test)2 TestConfiguration (teetime.framework.TestConfiguration)2 ObjectIntHashMap (com.carrotsearch.hppc.ObjectIntHashMap)1