Skip to content
Snippets Groups Projects
Commit 90994950 authored by Christian Wulf's avatar Christian Wulf
Browse files

fixed some indent issues

parent 9bc7c20f
No related branches found
No related tags found
No related merge requests found
......@@ -47,20 +47,13 @@ public class TokenizerConfiguration extends AnalysisConfiguration {
final Tokenizer tokenizer = new Tokenizer(" ");
this.counter = new Counter<String>();
INTRA_PIPE_FACTORY.create(
init.getOutputPort(), f2b.getInputPort());
INTRA_PIPE_FACTORY.create(
f2b.getOutputPort(), decomp.getInputPort());
INTRA_PIPE_FACTORY.create(
decomp.getOutputPort(), decrypt.getInputPort());
INTRA_PIPE_FACTORY.create(
decrypt.getOutputPort(), b2s.getInputPort());
INTRA_PIPE_FACTORY.create(
b2s.getOutputPort(), tokenizer.getInputPort());
INTRA_PIPE_FACTORY.create(
tokenizer.getOutputPort(), this.counter.getInputPort());
INTRA_PIPE_FACTORY.create(init.getOutputPort(), f2b.getInputPort());
INTRA_PIPE_FACTORY.create(f2b.getOutputPort(), decomp.getInputPort());
INTRA_PIPE_FACTORY.create(decomp.getOutputPort(), decrypt.getInputPort());
INTRA_PIPE_FACTORY.create(decrypt.getOutputPort(), b2s.getInputPort());
INTRA_PIPE_FACTORY.create(b2s.getOutputPort(), tokenizer.getInputPort());
INTRA_PIPE_FACTORY.create(tokenizer.getOutputPort(), this.counter.getInputPort());
// this.getFiniteProducerStages().add(init);
this.addThreadableStage(init);
}
......
......@@ -23,11 +23,20 @@ import static org.junit.Assert.assertThat;
import static teetime.framework.test.StageTester.test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import teetime.framework.Analysis;
import teetime.framework.AnalysisConfiguration;
import teetime.framework.AnalysisException;
import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering;
import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
import teetime.util.Pair;
/**
* @author Nils Christian Ehmke
*/
......@@ -45,7 +54,10 @@ public class InstanceOfFilterTest {
final List<Clazz> results = new ArrayList<InstanceOfFilterTest.Clazz>();
final Object clazz = new Clazz();
test(filter).and().send(clazz).to(filter.getInputPort()).and().receive(results).from(filter.getMatchedOutputPort()).start();
test(filter)
.and().send(clazz).to(filter.getInputPort())
.and().receive(results).from(filter.getMatchedOutputPort())
.start();
assertThat(results, contains(clazz));
}
......@@ -55,7 +67,10 @@ public class InstanceOfFilterTest {
final List<Clazz> results = new ArrayList<InstanceOfFilterTest.Clazz>();
final Object clazz = new SubClazz();
test(filter).and().send(clazz).to(filter.getInputPort()).and().receive(results).from(filter.getMatchedOutputPort()).start();
test(filter)
.and().send(clazz).to(filter.getInputPort())
.and().receive(results).from(filter.getMatchedOutputPort())
.start();
assertThat(results, contains(clazz));
}
......@@ -65,7 +80,10 @@ public class InstanceOfFilterTest {
final List<Clazz> results = new ArrayList<InstanceOfFilterTest.Clazz>();
final Object object = new Object();
test(filter).and().send(object).to(filter.getInputPort()).and().receive(results).from(filter.getMatchedOutputPort()).start();
test(filter)
.and().send(object).to(filter.getInputPort())
.and().receive(results).from(filter.getMatchedOutputPort())
.start();
assertThat(results, is(empty()));
}
......@@ -81,7 +99,10 @@ public class InstanceOfFilterTest {
input.add(new SubClazz());
input.add(new Object());
test(filter).and().send(input).to(filter.getInputPort()).and().receive(results).from(filter.getMatchedOutputPort()).start();
test(filter)
.and().send(input).to(filter.getInputPort())
.and().receive(results).from(filter.getMatchedOutputPort())
.start();
assertThat(results, hasSize(2));
}
......@@ -92,4 +113,34 @@ public class InstanceOfFilterTest {
private static class SubClazz extends Clazz {
}
@Test
public void filterShouldSendToBothOutputPorts() throws Exception {
InstanceOfFilterTestConfig config = new InstanceOfFilterTestConfig();
Analysis analysis = new Analysis(config);
try {
analysis.execute();
} catch (AnalysisException e) {
Collection<Pair<Thread, Throwable>> thrownExceptions = e.getThrownExceptions();
// TODO: handle exception
}
}
private static class InstanceOfFilterTestConfig extends AnalysisConfiguration {
private final IPipeFactory pipeFactory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false);
public InstanceOfFilterTestConfig() {
InitialElementProducer<Object> elementProducer = new InitialElementProducer<Object>();
InstanceOfFilter<Object, Clazz> instanceOfFilter = new InstanceOfFilter<Object, Clazz>(Clazz.class);
CollectorSink<Clazz> clazzCollector = new CollectorSink<Clazz>();
CollectorSink<Object> mismatchedCollector = new CollectorSink<Object>();
pipeFactory.create(elementProducer.getOutputPort(), instanceOfFilter.getInputPort());
pipeFactory.create(instanceOfFilter.getMatchedOutputPort(), clazzCollector.getInputPort());
pipeFactory.create(instanceOfFilter.getMismatchedOutputPort(), mismatchedCollector.getInputPort());
addThreadableStage(elementProducer);
}
}
}
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