diff --git a/pom.xml b/pom.xml index 54c3776472b18945c484fc666dbc7ed8a8e6987a..0f2af0928057eaca96ffc6e948cb2a4dd3cc3e04 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>17.0</version> + <version>18.0</version> </dependency> <dependency> <groupId>org.jctools</groupId> diff --git a/src/main/java/teetime/framework/CompositeStage.java b/src/main/java/teetime/framework/CompositeStage.java index d5c4986ca115bf2aa7ecf17f780b3798c76dbb64..4765fe8732ddd8673de456815fc0d1e410208bf8 100644 --- a/src/main/java/teetime/framework/CompositeStage.java +++ b/src/main/java/teetime/framework/CompositeStage.java @@ -29,7 +29,7 @@ import teetime.framework.validation.InvalidPortConnection; * Represents a minimal stage that composes several other stages. * * @since 1.1 - * @author Christian Wulf + * @author Christian Wulf, Nelson Tavares de Sousa * */ @SuppressWarnings("PMD.AbstractNaming") diff --git a/src/test/java/teetime/examples/cipher/CipherConfiguration.java b/src/test/java/teetime/examples/cipher/CipherConfiguration.java index 11ef38fa8370c2b3a054a1f25f7d56deef717ac9..6192ad227144e28d6a2f5735c52567104043fb5e 100644 --- a/src/test/java/teetime/examples/cipher/CipherConfiguration.java +++ b/src/test/java/teetime/examples/cipher/CipherConfiguration.java @@ -43,14 +43,14 @@ public class CipherConfiguration extends AnalysisConfiguration { final CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); final ByteArrayFileWriter writer = new ByteArrayFileWriter(output); - final IPipeFactory factory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); - - factory.create(init.getOutputPort(), f2b.getInputPort()); - factory.create(f2b.getOutputPort(), enc.getInputPort()); - factory.create(enc.getOutputPort(), comp.getInputPort()); - factory.create(comp.getOutputPort(), decomp.getInputPort()); - factory.create(decomp.getOutputPort(), decrypt.getInputPort()); - factory.create(decrypt.getOutputPort(), writer.getInputPort()); + final IPipeFactory intraFactory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); + + intraFactory.create(init.getOutputPort(), f2b.getInputPort()); + intraFactory.create(f2b.getOutputPort(), enc.getInputPort()); + intraFactory.create(enc.getOutputPort(), comp.getInputPort()); + intraFactory.create(comp.getOutputPort(), decomp.getInputPort()); + intraFactory.create(decomp.getOutputPort(), decrypt.getInputPort()); + intraFactory.create(decrypt.getOutputPort(), writer.getInputPort()); // this.getFiniteProducerStages().add(init); this.addThreadableStage(init); diff --git a/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java b/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java index f89a44a2b4268fb54ed8758cd0b3c8fb4ae37549..05bc367b8a953b691cd09b6e9c2bfe247816ce83 100644 --- a/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java +++ b/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java @@ -18,6 +18,7 @@ package teetime.examples.tokenizer; import java.io.File; import teetime.framework.AnalysisConfiguration; +import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; import teetime.stage.ByteArray2String; @@ -32,6 +33,7 @@ import teetime.stage.string.Tokenizer; public class TokenizerConfiguration extends AnalysisConfiguration { + private static final IPipeFactory INTRA_PIPE_FACTORY = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); private final Counter<String> counter; public TokenizerConfiguration(final String inputFile, final String password) { @@ -45,17 +47,17 @@ public class TokenizerConfiguration extends AnalysisConfiguration { final Tokenizer tokenizer = new Tokenizer(" "); this.counter = new Counter<String>(); - PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( + INTRA_PIPE_FACTORY.create( init.getOutputPort(), f2b.getInputPort()); - PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( + INTRA_PIPE_FACTORY.create( f2b.getOutputPort(), decomp.getInputPort()); - PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( + INTRA_PIPE_FACTORY.create( decomp.getOutputPort(), decrypt.getInputPort()); - PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( + INTRA_PIPE_FACTORY.create( decrypt.getOutputPort(), b2s.getInputPort()); - PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( + INTRA_PIPE_FACTORY.create( b2s.getOutputPort(), tokenizer.getInputPort()); - PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( + INTRA_PIPE_FACTORY.create( tokenizer.getOutputPort(), this.counter.getInputPort()); // this.getFiniteProducerStages().add(init); diff --git a/src/test/java/teetime/stage/WordCountingTest.java b/src/test/java/teetime/stage/WordCountingTest.java index 5c033b7ab18fdbcccec3a43eee898c4bd9a148f2..facd4fb2f82cdfe13bc9e63af62454a64a1bb6cf 100644 --- a/src/test/java/teetime/stage/WordCountingTest.java +++ b/src/test/java/teetime/stage/WordCountingTest.java @@ -26,11 +26,12 @@ import teetime.stage.util.CountingMap; public class WordCountingTest { + private final File testFile = new File("src/test/resources/data/output.txt"); + @Test public void test1() { int threads = 6; - WordCountingConfiguration wcc = new WordCountingConfiguration(threads, new File("src/test/resources/data/output.txt"), new File( - "src/test/resources/data/output.txt")); + WordCountingConfiguration wcc = new WordCountingConfiguration(threads, testFile, testFile); Analysis analysis = new Analysis(wcc); analysis.start(); CountingMap<String> map = wcc.getResult();