From bec9f5bce42a66795bbd71256e79034e9ef6d566 Mon Sep 17 00:00:00 2001 From: Nelson Tavares de Sousa <ntd@informatik.uni-kiel.de> Date: Tue, 18 Nov 2014 17:01:41 +0100 Subject: [PATCH] solved checkstyle issues --- ...rStage.java => AbstractConsumerStage.java} | 4 +-- ...rStage.java => AbstractProducerStage.java} | 2 +- .../java/teetime/framework/AbstractStage.java | 22 +++++++------- src/main/java/teetime/framework/Analysis.java | 8 +++-- .../framework/AnalysisConfiguration.java | 11 +++---- .../framework/{Stage.java => IStage.java} | 6 ++-- .../{Terminable.java => ITerminable.java} | 2 +- .../java/teetime/framework/InputPort.java | 10 +++---- .../java/teetime/framework/RunnableStage.java | 18 ++++++------ ...Pipe.java => AbstractInterThreadPipe.java} | 4 +-- ...Pipe.java => AbstractIntraThreadPipe.java} | 5 ++-- .../teetime/framework/pipe/AbstractPipe.java | 8 ++--- .../framework/pipe/CommittablePipe.java | 14 ++++----- .../teetime/framework/pipe/DummyPipe.java | 2 ++ .../pipe/OrderedGrowableArrayPipe.java | 4 +-- .../pipe/OrderedGrowableArrayPipeFactory.java | 4 ++- .../framework/pipe/OrderedGrowablePipe.java | 4 +-- .../framework/pipe/PipeFactoryLoader.java | 14 ++++----- .../framework/pipe/PipeFactoryRegistry.java | 8 ++--- .../teetime/framework/pipe/RelayTestPipe.java | 2 +- .../framework/pipe/SingleElementPipe.java | 6 ++-- .../pipe/SingleElementPipeFactory.java | 4 ++- .../java/teetime/framework/pipe/SpScPipe.java | 4 +-- .../framework/pipe/SpScPipeFactory.java | 4 ++- .../framework/pipe/UnorderedGrowablePipe.java | 10 +++---- .../pipe/UnorderedGrowablePipeFactory.java | 4 ++- .../framework/signal/StartingSignal.java | 8 +++-- .../framework/signal/TerminatingSignal.java | 8 +++-- .../framework/signal/ValidatingSignal.java | 4 ++- .../validation/AnalysisNotValidException.java | 2 +- .../validation/InvalidPortConnection.java | 4 +-- .../java/teetime/stage/ByteArray2String.java | 4 +-- src/main/java/teetime/stage/Cache.java | 4 +-- .../java/teetime/stage/CipherByteArray.java | 4 +-- src/main/java/teetime/stage/Clock.java | 4 +-- .../java/teetime/stage/CollectorSink.java | 4 +-- src/main/java/teetime/stage/Counter.java | 4 +-- .../stage/ElementDelayMeasuringStage.java | 4 +-- .../ElementThroughputMeasuringStage.java | 4 +-- .../teetime/stage/FileExtensionSwitch.java | 4 +-- .../teetime/stage/InitialElementProducer.java | 4 +-- .../java/teetime/stage/InstanceCounter.java | 4 +-- .../java/teetime/stage/InstanceOfFilter.java | 4 +-- .../java/teetime/stage/IterableProducer.java | 4 +-- src/main/java/teetime/stage/NoopFilter.java | 4 +-- .../java/teetime/stage/ObjectProducer.java | 4 +-- src/main/java/teetime/stage/Relay.java | 10 +++---- .../teetime/stage/StartTimestampFilter.java | 4 +-- .../teetime/stage/StopTimestampFilter.java | 4 +-- src/main/java/teetime/stage/Tokenizer.java | 4 +-- src/main/java/teetime/stage/ZipByteArray.java | 4 +-- src/main/java/teetime/stage/basic/Sink.java | 4 +-- .../stage/basic/distributor/Distributor.java | 4 +-- .../teetime/stage/io/AbstractTcpReader.java | 4 +-- .../teetime/stage/io/ByteArrayFileWriter.java | 4 +-- .../stage/io/Directory2FilesFilter.java | 4 +-- .../java/teetime/stage/io/File2ByteArray.java | 6 ++-- .../stage/io/File2TextLinesFilter.java | 4 +-- src/main/java/teetime/stage/io/Printer.java | 4 +-- .../stringBuffer/StringBufferFilter.java | 4 +-- src/main/java/util/BucketTimingsReader.java | 28 +++++++++--------- src/main/java/util/MooBenchStarter.java | 2 +- ...AbstractProfiledPerformanceAssertion.java} | 2 +- .../java/util/test/MeasurementRepository.java | 2 ++ .../PerformanceCheckProfileRepository.java | 10 +++---- .../java/util/test/PerformanceResult.java | 4 ++- src/main/java/util/test/StatisticsUtil.java | 8 ++--- .../ChwHomeComparisonMethodcallWithPorts.java | 4 +-- .../ChwWorkComparisonMethodcallWithPorts.java | 4 +-- .../ComparisonMethodcallWithPorts.java | 4 +-- .../NieWorkComparisonMethodcallWithPorts.java | 4 +-- .../experiment01/ChwHomePerformanceCheck.java | 4 +-- .../experiment01/ChwWorkPerformanceCheck.java | 4 +-- ...odCallThoughputTimestampAnalysis1Test.java | 4 +-- .../AbstractPerformanceCheck.java | 4 +-- ...odCallThoughputTimestampAnalysis9Test.java | 4 +-- .../MethodCallThroughputAnalysis9.java | 4 +-- .../AbstractPerformanceCheck.java | 4 +-- ...dCallThoughputTimestampAnalysis10Test.java | 4 +-- .../experiment11/ChwHomePerformanceCheck.java | 4 +-- .../experiment11/ChwWorkPerformanceCheck.java | 4 +-- ...dCallThoughputTimestampAnalysis11Test.java | 4 +-- .../MethodCallThroughputAnalysis11.java | 4 +-- .../AbstractPerformanceCheck.java | 4 +-- ...dCallThoughputTimestampAnalysis14Test.java | 4 +-- .../MethodCallThroughputAnalysis14.java | 4 +-- .../MethodCallThroughputAnalysis15.java | 4 +-- .../experiment16/ChwHomePerformanceCheck.java | 4 +-- .../experiment16/ChwWorkPerformanceCheck.java | 4 +-- ...dCallThoughputTimestampAnalysis16Test.java | 4 +-- .../MethodCallThroughputAnalysis17.java | 4 +-- .../teetime/examples/loopStage/Countdown.java | 4 +-- .../teetime/framework/OldHeadPipeline.java | 2 +- .../java/teetime/framework/OldPipeline.java | 6 ++-- .../examples/cipher/CipherConfiguration.java | 18 ++++++------ .../teetime/examples/cipher/CipherTest.java | 6 ++-- .../tokenizer/TokenizerConfiguration.java | 16 +++++----- .../examples/tokenizer/TokenizerTest.java | 12 ++++---- .../teetime/framework/FileSearcherTest.java | 14 +++++---- .../teetime/framework/pipe/DummyFactory.java | 4 +++ .../framework/pipe/PipeFactoryLoaderTest.java | 29 ++++++++++--------- .../teetime/framework/pipe/SpScPipeTest.java | 2 +- 102 files changed, 319 insertions(+), 280 deletions(-) rename src/main/java/teetime/framework/{ConsumerStage.java => AbstractConsumerStage.java} (70%) rename src/main/java/teetime/framework/{ProducerStage.java => AbstractProducerStage.java} (86%) rename src/main/java/teetime/framework/{Stage.java => IStage.java} (78%) rename src/main/java/teetime/framework/{Terminable.java => ITerminable.java} (84%) rename src/main/java/teetime/framework/pipe/{InterThreadPipe.java => AbstractInterThreadPipe.java} (84%) rename src/main/java/teetime/framework/pipe/{IntraThreadPipe.java => AbstractIntraThreadPipe.java} (74%) rename src/main/java/util/test/{ProfiledPerformanceAssertion.java => AbstractProfiledPerformanceAssertion.java} (65%) diff --git a/src/main/java/teetime/framework/ConsumerStage.java b/src/main/java/teetime/framework/AbstractConsumerStage.java similarity index 70% rename from src/main/java/teetime/framework/ConsumerStage.java rename to src/main/java/teetime/framework/AbstractConsumerStage.java index 60db33da..66333405 100644 --- a/src/main/java/teetime/framework/ConsumerStage.java +++ b/src/main/java/teetime/framework/AbstractConsumerStage.java @@ -1,6 +1,6 @@ package teetime.framework; -public abstract class ConsumerStage<I> extends AbstractStage { +public abstract class AbstractConsumerStage<I> extends AbstractStage { protected final InputPort<I> inputPort = this.createInputPort(); @@ -10,7 +10,7 @@ public abstract class ConsumerStage<I> extends AbstractStage { @Override public void executeWithPorts() { - I element = this.getInputPort().receive(); + final I element = this.getInputPort().receive(); this.execute(element); } diff --git a/src/main/java/teetime/framework/ProducerStage.java b/src/main/java/teetime/framework/AbstractProducerStage.java similarity index 86% rename from src/main/java/teetime/framework/ProducerStage.java rename to src/main/java/teetime/framework/AbstractProducerStage.java index 02348cd9..7918c922 100644 --- a/src/main/java/teetime/framework/ProducerStage.java +++ b/src/main/java/teetime/framework/AbstractProducerStage.java @@ -9,7 +9,7 @@ package teetime.framework; * the type of the default output port * */ -public abstract class ProducerStage<O> extends AbstractStage implements Stage { +public abstract class AbstractProducerStage<O> extends AbstractStage implements IStage { protected final OutputPort<O> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/framework/AbstractStage.java b/src/main/java/teetime/framework/AbstractStage.java index 5b8a5d84..941261cd 100644 --- a/src/main/java/teetime/framework/AbstractStage.java +++ b/src/main/java/teetime/framework/AbstractStage.java @@ -14,7 +14,7 @@ import teetime.framework.pipe.IPipe; import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; -public abstract class AbstractStage implements Stage { +public abstract class AbstractStage implements IStage { private final String id; /** @@ -22,7 +22,7 @@ public abstract class AbstractStage implements Stage { */ protected final Logger logger; // NOPMD - private Stage parentStage; + private IStage parentStage; private final List<InputPort<?>> inputPortList = new ArrayList<InputPort<?>>(); private final List<OutputPort<?>> outputPortList = new ArrayList<OutputPort<?>>(); @@ -75,12 +75,12 @@ public abstract class AbstractStage implements Stage { } @Override - public Stage getParentStage() { + public IStage getParentStage() { return this.parentStage; } @Override - public void setParentStage(final Stage parentStage, final int index) { + public void setParentStage(final IStage parentStage, final int index) { this.parentStage = parentStage; } @@ -126,18 +126,18 @@ public abstract class AbstractStage implements Stage { } public void onTerminating() throws Exception { - terminate(); + this.terminate(); } protected <T> InputPort<T> createInputPort() { - InputPort<T> inputPort = new InputPort<T>(this); + final InputPort<T> inputPort = new InputPort<T>(this); // inputPort.setType(portType); this.inputPortList.add(inputPort); return inputPort; } protected <T> OutputPort<T> createOutputPort() { - OutputPort<T> outputPort = new OutputPort<T>(); + final OutputPort<T> outputPort = new OutputPort<T>(); // outputPort.setType(portType); this.outputPortList.add(outputPort); return outputPort; @@ -146,12 +146,12 @@ public abstract class AbstractStage implements Stage { @Override public void validateOutputPorts(final List<InvalidPortConnection> invalidPortConnections) { for (OutputPort<?> outputPort : this.getOutputPorts()) { - IPipe pipe = outputPort.getPipe(); + final IPipe pipe = outputPort.getPipe(); if (null != pipe) { // if output port is connected with another one - Class<?> sourcePortType = outputPort.getType(); - Class<?> targetPortType = pipe.getTargetPort().getType(); + final Class<?> sourcePortType = outputPort.getType(); + final Class<?> targetPortType = pipe.getTargetPort().getType(); if (null == sourcePortType || !sourcePortType.equals(targetPortType)) { - InvalidPortConnection invalidPortConnection = new InvalidPortConnection(outputPort, pipe.getTargetPort()); + final InvalidPortConnection invalidPortConnection = new InvalidPortConnection(outputPort, pipe.getTargetPort()); invalidPortConnections.add(invalidPortConnection); } } diff --git a/src/main/java/teetime/framework/Analysis.java b/src/main/java/teetime/framework/Analysis.java index 7ff41daa..2e115cdc 100644 --- a/src/main/java/teetime/framework/Analysis.java +++ b/src/main/java/teetime/framework/Analysis.java @@ -28,9 +28,9 @@ public class Analysis implements UncaughtExceptionHandler { } public void init() { - List<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs(); - for (Stage stage : threadableStageJobs) { - Thread thread = new Thread(new RunnableStage(stage)); + final List<IStage> threadableStageJobs = this.configuration.getThreadableStageJobs(); + for (IStage stage : threadableStageJobs) { + final Thread thread = new Thread(new RunnableStage(stage)); switch (stage.getTerminationStrategy()) { case BY_SIGNAL: this.consumerThreads.add(thread); @@ -41,6 +41,8 @@ public class Analysis implements UncaughtExceptionHandler { case BY_INTERRUPT: this.infiniteProducerThreads.add(thread); break; + default: + break; } } diff --git a/src/main/java/teetime/framework/AnalysisConfiguration.java b/src/main/java/teetime/framework/AnalysisConfiguration.java index f9d194e8..3850987e 100644 --- a/src/main/java/teetime/framework/AnalysisConfiguration.java +++ b/src/main/java/teetime/framework/AnalysisConfiguration.java @@ -8,15 +8,16 @@ import teetime.framework.pipe.PipeFactoryRegistry; public class AnalysisConfiguration { protected static final PipeFactoryRegistry PIPE_FACTORY_REGISTRY = PipeFactoryRegistry.INSTANCE; + private final List<IStage> threadableStageJobs = new LinkedList<IStage>(); - private final List<Stage> threadableStageJobs = new LinkedList<Stage>(); + public AnalysisConfiguration() {} - List<Stage> getThreadableStageJobs() { - return threadableStageJobs; + List<IStage> getThreadableStageJobs() { + return this.threadableStageJobs; } - public void addThreadableStage(final Stage stage) { - threadableStageJobs.add(stage); + public void addThreadableStage(final IStage stage) { + this.threadableStageJobs.add(stage); } } diff --git a/src/main/java/teetime/framework/Stage.java b/src/main/java/teetime/framework/IStage.java similarity index 78% rename from src/main/java/teetime/framework/Stage.java rename to src/main/java/teetime/framework/IStage.java index 55d676b9..91fd7393 100644 --- a/src/main/java/teetime/framework/Stage.java +++ b/src/main/java/teetime/framework/IStage.java @@ -5,15 +5,15 @@ import java.util.List; import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; -public interface Stage extends Terminable { +public interface IStage extends ITerminable { String getId(); void executeWithPorts(); - Stage getParentStage(); + IStage getParentStage(); - void setParentStage(Stage parentStage, int index); + void setParentStage(IStage parentStage, int index); void onSignal(ISignal signal, InputPort<?> inputPort); diff --git a/src/main/java/teetime/framework/Terminable.java b/src/main/java/teetime/framework/ITerminable.java similarity index 84% rename from src/main/java/teetime/framework/Terminable.java rename to src/main/java/teetime/framework/ITerminable.java index fd606b2f..175db539 100644 --- a/src/main/java/teetime/framework/Terminable.java +++ b/src/main/java/teetime/framework/ITerminable.java @@ -1,6 +1,6 @@ package teetime.framework; -interface Terminable { +interface ITerminable { TerminationStrategy getTerminationStrategy(); diff --git a/src/main/java/teetime/framework/InputPort.java b/src/main/java/teetime/framework/InputPort.java index 7f8050c2..ccdd19d9 100644 --- a/src/main/java/teetime/framework/InputPort.java +++ b/src/main/java/teetime/framework/InputPort.java @@ -4,22 +4,22 @@ import teetime.framework.pipe.IPipe; public class InputPort<T> extends AbstractPort<T> { - private final Stage owningStage; + private final IStage owningStage; - InputPort(final Stage owningStage) { + InputPort(final IStage owningStage) { super(); this.owningStage = owningStage; } public T receive() { @SuppressWarnings("unchecked") - T element = (T) this.pipe.removeLast(); + final T element = (T) this.pipe.removeLast(); return element; } public T read() { @SuppressWarnings("unchecked") - T element = (T) this.pipe.readLast(); + final T element = (T) this.pipe.readLast(); return element; } @@ -33,7 +33,7 @@ public class InputPort<T> extends AbstractPort<T> { this.pipe = pipe; } - public Stage getOwningStage() { + public IStage getOwningStage() { return this.owningStage; } diff --git a/src/main/java/teetime/framework/RunnableStage.java b/src/main/java/teetime/framework/RunnableStage.java index 8103bd7e..b0d234bf 100644 --- a/src/main/java/teetime/framework/RunnableStage.java +++ b/src/main/java/teetime/framework/RunnableStage.java @@ -11,11 +11,11 @@ import teetime.framework.validation.AnalysisNotValidException; @SuppressWarnings("PMD.BeanMembersShouldSerialize") public class RunnableStage implements Runnable { - private final Stage stage; + private final IStage stage; private final Logger logger; // NOPMD private boolean validationEnabled; - public RunnableStage(final Stage stage) { + public RunnableStage(final IStage stage) { this.stage = stage; this.logger = LoggerFactory.getLogger(stage.getClass()); } @@ -25,7 +25,7 @@ public class RunnableStage implements Runnable { this.logger.debug("Executing runnable stage..."); if (this.validationEnabled) { - ValidatingSignal validatingSignal = new ValidatingSignal(); + final ValidatingSignal validatingSignal = new ValidatingSignal(); this.stage.onSignal(validatingSignal, null); if (validatingSignal.getInvalidPortConnections().size() > 0) { throw new AnalysisNotValidException(validatingSignal.getInvalidPortConnections()); @@ -33,23 +33,23 @@ public class RunnableStage implements Runnable { } try { - StartingSignal startingSignal = new StartingSignal(); + final StartingSignal startingSignal = new StartingSignal(); this.stage.onSignal(startingSignal, null); do { this.stage.executeWithPorts(); } while (!this.stage.shouldBeTerminated()); - TerminatingSignal terminatingSignal = new TerminatingSignal(); + final TerminatingSignal terminatingSignal = new TerminatingSignal(); this.stage.onSignal(terminatingSignal, null); } catch (Error e) { this.logger.error("Terminating thread due to the following exception: ", e); throw e; - } catch (RuntimeException e) { - this.logger.error("Terminating thread due to the following exception: ", e); - throw e; - } + } // catch (RuntimeException e) { + // this.logger.error("Terminating thread due to the following exception: ", e); + // throw e; + // } this.logger.debug("Finished runnable stage. (" + this.stage.getId() + ")"); } diff --git a/src/main/java/teetime/framework/pipe/InterThreadPipe.java b/src/main/java/teetime/framework/pipe/AbstractInterThreadPipe.java similarity index 84% rename from src/main/java/teetime/framework/pipe/InterThreadPipe.java rename to src/main/java/teetime/framework/pipe/AbstractInterThreadPipe.java index 7554ffa0..e1504baa 100644 --- a/src/main/java/teetime/framework/pipe/InterThreadPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractInterThreadPipe.java @@ -11,11 +11,11 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.framework.signal.ISignal; -public abstract class InterThreadPipe extends AbstractPipe { +public abstract class AbstractInterThreadPipe extends AbstractPipe { private final Queue<ISignal> signalQueue = QueueFactory.newQueue(new ConcurrentQueueSpec(1, 1, 0, Ordering.FIFO, Preference.THROUGHPUT)); - <T> InterThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { + <T> AbstractInterThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { super(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/IntraThreadPipe.java b/src/main/java/teetime/framework/pipe/AbstractIntraThreadPipe.java similarity index 74% rename from src/main/java/teetime/framework/pipe/IntraThreadPipe.java rename to src/main/java/teetime/framework/pipe/AbstractIntraThreadPipe.java index 42257bc9..b593b105 100644 --- a/src/main/java/teetime/framework/pipe/IntraThreadPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractIntraThreadPipe.java @@ -4,9 +4,10 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.framework.signal.ISignal; -public abstract class IntraThreadPipe extends AbstractPipe { +public abstract class AbstractIntraThreadPipe extends AbstractPipe { - <T> IntraThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { + + <T> AbstractIntraThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { super(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/AbstractPipe.java b/src/main/java/teetime/framework/pipe/AbstractPipe.java index d59c660b..d3382dbc 100644 --- a/src/main/java/teetime/framework/pipe/AbstractPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractPipe.java @@ -1,13 +1,11 @@ package teetime.framework.pipe; +import teetime.framework.IStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -import teetime.framework.Stage; public abstract class AbstractPipe implements IPipe { - private InputPort<?> targetPort; - /** * Performance cache: Avoids the following method chain * @@ -15,7 +13,9 @@ public abstract class AbstractPipe implements IPipe { * this.getPipe().getTargetPort().getOwningStage() * </pre> */ - protected Stage cachedTargetStage; + protected IStage cachedTargetStage; + + private InputPort<?> targetPort; protected <T> AbstractPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { this.targetPort = targetPort; diff --git a/src/main/java/teetime/framework/pipe/CommittablePipe.java b/src/main/java/teetime/framework/pipe/CommittablePipe.java index fddb53c6..41cea941 100644 --- a/src/main/java/teetime/framework/pipe/CommittablePipe.java +++ b/src/main/java/teetime/framework/pipe/CommittablePipe.java @@ -4,7 +4,7 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.util.list.CommittableResizableArrayQueue; -public final class CommittablePipe extends IntraThreadPipe { +public final class CommittablePipe extends AbstractIntraThreadPipe { private final CommittableResizableArrayQueue<Object> elements = new CommittableResizableArrayQueue<Object>(null, 4); @@ -14,13 +14,13 @@ public final class CommittablePipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new CommittablePipe(null, null); + final IPipe pipe = new CommittablePipe(null, null); pipe.connectPorts(sourcePort, targetPort); } /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#add(T) */ @Override @@ -32,19 +32,19 @@ public final class CommittablePipe extends IntraThreadPipe { /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#removeLast() */ @Override public Object removeLast() { - Object element = this.elements.removeFromHeadUncommitted(); + final Object element = this.elements.removeFromHeadUncommitted(); this.elements.commit(); return element; } /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#isEmpty() */ @Override @@ -54,7 +54,7 @@ public final class CommittablePipe extends IntraThreadPipe { /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#readLast() */ @Override diff --git a/src/main/java/teetime/framework/pipe/DummyPipe.java b/src/main/java/teetime/framework/pipe/DummyPipe.java index 716046dc..d3ec0afa 100644 --- a/src/main/java/teetime/framework/pipe/DummyPipe.java +++ b/src/main/java/teetime/framework/pipe/DummyPipe.java @@ -13,6 +13,8 @@ import teetime.framework.signal.ISignal; @SuppressWarnings("rawtypes") public final class DummyPipe implements IPipe { + public DummyPipe() {} + @Override public boolean add(final Object element) { return false; diff --git a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java index 5ee042d0..eefa35be 100644 --- a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java @@ -4,7 +4,7 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.util.concurrent.workstealing.CircularArray; -public final class OrderedGrowableArrayPipe extends IntraThreadPipe { +public final class OrderedGrowableArrayPipe extends AbstractIntraThreadPipe { private final CircularArray<Object> elements; private int head; @@ -17,7 +17,7 @@ public final class OrderedGrowableArrayPipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new OrderedGrowableArrayPipe(sourcePort, targetPort, 4); + final IPipe pipe = new OrderedGrowableArrayPipe(sourcePort, targetPort, 4); pipe.connectPorts(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java index ce5c89d8..b67d7f0f 100644 --- a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class OrderedGrowableArrayPipeFactory implements IPipeFactory { + public OrderedGrowableArrayPipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 4); + return this.create(sourcePort, targetPort, 4); } @Override diff --git a/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java b/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java index 0163ba6a..23b3d43f 100644 --- a/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java @@ -5,7 +5,7 @@ import java.util.LinkedList; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public class OrderedGrowablePipe extends IntraThreadPipe { +public class OrderedGrowablePipe extends AbstractIntraThreadPipe { private final LinkedList<Object> elements; @@ -16,7 +16,7 @@ public class OrderedGrowablePipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new OrderedGrowablePipe(null, null, 100000); + final IPipe pipe = new OrderedGrowablePipe(null, null, 100000); pipe.connectPorts(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java b/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java index 6e564014..e58d6008 100644 --- a/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java +++ b/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java @@ -23,18 +23,18 @@ public final class PipeFactoryLoader { } public static List<IPipeFactory> loadFromStream(final InputStream stream) throws IOException { - List<IPipeFactory> pipeFactories = new LinkedList<IPipeFactory>(); + final List<IPipeFactory> pipeFactories = new LinkedList<IPipeFactory>(); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); + final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); try { String line; while (null != (line = bufferedReader.readLine())) { try { line = line.trim(); if (!line.isEmpty()) { - Class<?> clazz = Class.forName(line); - Class<? extends IPipeFactory> pipeFactoryClass = clazz.asSubclass(IPipeFactory.class); - IPipeFactory pipeFactory = pipeFactoryClass.newInstance(); + final Class<?> clazz = Class.forName(line); + final Class<? extends IPipeFactory> pipeFactoryClass = clazz.asSubclass(IPipeFactory.class); + final IPipeFactory pipeFactory = pipeFactoryClass.newInstance(); pipeFactories.add(pipeFactory); } } catch (ClassNotFoundException e) { @@ -65,10 +65,10 @@ public final class PipeFactoryLoader { } public static List<IPipeFactory> mergeFiles(final List<URL> files) { - ArrayList<IPipeFactory> list = new ArrayList<IPipeFactory>(); + final List<IPipeFactory> list = new ArrayList<IPipeFactory>(); for (URL url : files) { try { - InputStream is = url.openStream(); + final InputStream is = url.openStream(); list.addAll(loadFromStream(is)); is.close(); } catch (IOException e) { diff --git a/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java b/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java index 42538d19..a2c454d3 100644 --- a/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java +++ b/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java @@ -48,7 +48,7 @@ public final class PipeFactoryRegistry { public static final PipeFactoryRegistry INSTANCE = new PipeFactoryRegistry("pipe-factories.conf"); private PipeFactoryRegistry(final String configFileName) { - List<IPipeFactory> pipeFactories = PipeFactoryLoader.loadPipeFactoriesFromClasspath(configFileName); + final List<IPipeFactory> pipeFactories = PipeFactoryLoader.loadPipeFactoriesFromClasspath(configFileName); for (IPipeFactory pipeFactory : pipeFactories) { this.register(pipeFactory); } @@ -67,8 +67,8 @@ public final class PipeFactoryRegistry { * A PipeFactory, which provides suitable pipes. */ public IPipeFactory getPipeFactory(final ThreadCommunication tc, final PipeOrdering ordering, final boolean growable) { - String key = this.buildKey(tc, ordering, growable); - IPipeFactory pipeFactory = this.pipeFactories.get(key); + final String key = this.buildKey(tc, ordering, growable); + final IPipeFactory pipeFactory = this.pipeFactories.get(key); if (null == pipeFactory) { throw new CouldNotFindPipeImplException(key); } @@ -84,7 +84,7 @@ public final class PipeFactoryRegistry { * A PipeFactory which will be added to the registry */ public void register(final IPipeFactory pipeFactory) { - String key = this.buildKey(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); + final String key = this.buildKey(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); this.pipeFactories.put(key, pipeFactory); LOGGER.info("Registered pipe factory: " + pipeFactory.getClass().getCanonicalName()); } diff --git a/src/main/java/teetime/framework/pipe/RelayTestPipe.java b/src/main/java/teetime/framework/pipe/RelayTestPipe.java index 9950af66..3a7bc13c 100644 --- a/src/main/java/teetime/framework/pipe/RelayTestPipe.java +++ b/src/main/java/teetime/framework/pipe/RelayTestPipe.java @@ -2,7 +2,7 @@ package teetime.framework.pipe; import teetime.util.ConstructorClosure; -public final class RelayTestPipe<T> extends InterThreadPipe { +public final class RelayTestPipe<T> extends AbstractInterThreadPipe { private int numInputObjects; private final ConstructorClosure<T> inputObjectCreator; diff --git a/src/main/java/teetime/framework/pipe/SingleElementPipe.java b/src/main/java/teetime/framework/pipe/SingleElementPipe.java index bccc7c9c..f71d3957 100644 --- a/src/main/java/teetime/framework/pipe/SingleElementPipe.java +++ b/src/main/java/teetime/framework/pipe/SingleElementPipe.java @@ -3,7 +3,7 @@ package teetime.framework.pipe; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public final class SingleElementPipe extends IntraThreadPipe { +public final class SingleElementPipe extends AbstractIntraThreadPipe { private Object element; @@ -13,7 +13,7 @@ public final class SingleElementPipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new SingleElementPipe(null, null); + final IPipe pipe = new SingleElementPipe(null, null); pipe.connectPorts(sourcePort, targetPort); } @@ -25,7 +25,7 @@ public final class SingleElementPipe extends IntraThreadPipe { @Override public Object removeLast() { - Object temp = this.element; + final Object temp = this.element; this.element = null; return temp; } diff --git a/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java b/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java index 7a76c744..d888e4c0 100644 --- a/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class SingleElementPipeFactory implements IPipeFactory { + public SingleElementPipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 1); + return this.create(sourcePort, targetPort, 1); } /** diff --git a/src/main/java/teetime/framework/pipe/SpScPipe.java b/src/main/java/teetime/framework/pipe/SpScPipe.java index 329e4cff..4941e4a7 100644 --- a/src/main/java/teetime/framework/pipe/SpScPipe.java +++ b/src/main/java/teetime/framework/pipe/SpScPipe.java @@ -10,7 +10,7 @@ import org.jctools.queues.spec.Preference; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public final class SpScPipe extends InterThreadPipe { +public final class SpScPipe extends AbstractInterThreadPipe { private final Queue<Object> queue; // statistics @@ -23,7 +23,7 @@ public final class SpScPipe extends InterThreadPipe { @Deprecated public static <T> SpScPipe connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) { - SpScPipe pipe = new SpScPipe(sourcePort, targetPort, capacity); + final SpScPipe pipe = new SpScPipe(sourcePort, targetPort, capacity); pipe.connectPorts(sourcePort, targetPort); return pipe; } diff --git a/src/main/java/teetime/framework/pipe/SpScPipeFactory.java b/src/main/java/teetime/framework/pipe/SpScPipeFactory.java index 88e4d59b..e5e76c57 100644 --- a/src/main/java/teetime/framework/pipe/SpScPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/SpScPipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class SpScPipeFactory implements IPipeFactory { + public SpScPipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 4); + return this.create(sourcePort, targetPort, 4); } @Override diff --git a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java index be8c1545..76075d7c 100644 --- a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java +++ b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java @@ -3,7 +3,7 @@ package teetime.framework.pipe; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public final class UnorderedGrowablePipe extends IntraThreadPipe { +public final class UnorderedGrowablePipe extends AbstractIntraThreadPipe { private Object[] elements; // private final ArrayWrapper2<T> elements = new ArrayWrapper2<T>(2); @@ -16,7 +16,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new UnorderedGrowablePipe(null, null, 4); + final IPipe pipe = new UnorderedGrowablePipe(null, null, 4); pipe.connectPorts(sourcePort, targetPort); } @@ -36,7 +36,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { // if (this.lastFreeIndex == 0) { // return null; // } - Object element = this.elements[--this.lastFreeIndex]; + final Object element = this.elements[--this.lastFreeIndex]; this.elements[this.lastFreeIndex] = null; // T element = this.elements.get(--this.lastFreeIndex); return element; @@ -59,7 +59,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { } private Object[] grow() { - int newSize = this.elements.length * 2; + final int newSize = this.elements.length * 2; // System.out.println("growing to " + newSize); return this.newArray(newSize); } @@ -71,7 +71,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { // } private Object[] newArray(final int newSize) { - Object[] newElements = new Object[newSize]; + final Object[] newElements = new Object[newSize]; System.arraycopy(this.elements, 0, newElements, 0, this.elements.length); diff --git a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java index 7809347a..38e1d669 100644 --- a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java +++ b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class UnorderedGrowablePipeFactory implements IPipeFactory { + public UnorderedGrowablePipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 4); + return this.create(sourcePort, targetPort, 4); } @Override diff --git a/src/main/java/teetime/framework/signal/StartingSignal.java b/src/main/java/teetime/framework/signal/StartingSignal.java index af78c4e1..da156138 100644 --- a/src/main/java/teetime/framework/signal/StartingSignal.java +++ b/src/main/java/teetime/framework/signal/StartingSignal.java @@ -13,19 +13,21 @@ public class StartingSignal implements ISignal { private static final Logger LOGGER = LoggerFactory.getLogger(StartingSignal.class); private final List<Exception> catchedExceptions = new LinkedList<Exception>(); + public StartingSignal() {} + @Override public void trigger(final AbstractStage stage) { try { stage.onStarting(); LOGGER.info(stage + " started."); - } catch (Exception e) { - catchedExceptions.add(e); + } catch (Exception e) { // NOCS (Stages can throw any arbitrary Exception) + this.catchedExceptions.add(e); LOGGER.error("Exception while sending the start signal", e); } } public List<Exception> getCatchedExceptions() { - return catchedExceptions; + return this.catchedExceptions; } } diff --git a/src/main/java/teetime/framework/signal/TerminatingSignal.java b/src/main/java/teetime/framework/signal/TerminatingSignal.java index 1dbea815..c50fde35 100644 --- a/src/main/java/teetime/framework/signal/TerminatingSignal.java +++ b/src/main/java/teetime/framework/signal/TerminatingSignal.java @@ -13,18 +13,20 @@ public class TerminatingSignal implements ISignal { private static final Logger LOGGER = LoggerFactory.getLogger(TerminatingSignal.class); private final List<Exception> catchedExceptions = new LinkedList<Exception>(); + public TerminatingSignal() {} + @Override public void trigger(final AbstractStage stage) { try { stage.onTerminating(); - } catch (Exception e) { - catchedExceptions.add(e); + } catch (Exception e) { // NOCS (Stages can throw any arbitrary Exception) + this.catchedExceptions.add(e); LOGGER.error("Exception while sending the termination signal", e); } } public List<Exception> getCatchedExceptions() { - return catchedExceptions; + return this.catchedExceptions; } } diff --git a/src/main/java/teetime/framework/signal/ValidatingSignal.java b/src/main/java/teetime/framework/signal/ValidatingSignal.java index 2b4858ca..1ae6cc0e 100644 --- a/src/main/java/teetime/framework/signal/ValidatingSignal.java +++ b/src/main/java/teetime/framework/signal/ValidatingSignal.java @@ -10,13 +10,15 @@ public class ValidatingSignal implements ISignal { private final List<InvalidPortConnection> invalidPortConnections = new LinkedList<InvalidPortConnection>(); + public ValidatingSignal() {} + @Override public void trigger(final AbstractStage stage) { stage.onValidating(this.invalidPortConnections); } public List<InvalidPortConnection> getInvalidPortConnections() { - return invalidPortConnections; + return this.invalidPortConnections; } } diff --git a/src/main/java/teetime/framework/validation/AnalysisNotValidException.java b/src/main/java/teetime/framework/validation/AnalysisNotValidException.java index a827d7f1..9b2099fd 100644 --- a/src/main/java/teetime/framework/validation/AnalysisNotValidException.java +++ b/src/main/java/teetime/framework/validation/AnalysisNotValidException.java @@ -18,7 +18,7 @@ public class AnalysisNotValidException extends RuntimeException { @Override public String getMessage() { - StringBuilder builder = new StringBuilder(this.invalidPortConnections.size() * 40); + final StringBuilder builder = new StringBuilder(this.invalidPortConnections.size() * 40); builder.append(this.invalidPortConnections.size()); builder.append(" invalid port connections were detected.\n"); Joiner.on("\n").appendTo(builder, this.invalidPortConnections); diff --git a/src/main/java/teetime/framework/validation/InvalidPortConnection.java b/src/main/java/teetime/framework/validation/InvalidPortConnection.java index 183f3700..dbe36d53 100644 --- a/src/main/java/teetime/framework/validation/InvalidPortConnection.java +++ b/src/main/java/teetime/framework/validation/InvalidPortConnection.java @@ -24,8 +24,8 @@ public class InvalidPortConnection { @Override public String toString() { - String sourcePortTypeName = (this.sourcePort.getType() == null) ? null : this.sourcePort.getType().getName(); - String targetPortTypeName = (this.targetPort.getType() == null) ? null : this.targetPort.getType().getName(); + final String sourcePortTypeName = (this.sourcePort.getType() == null) ? null : this.sourcePort.getType().getName(); + final String targetPortTypeName = (this.targetPort.getType() == null) ? null : this.targetPort.getType().getName(); return sourcePortTypeName + " != " + targetPortTypeName; } diff --git a/src/main/java/teetime/stage/ByteArray2String.java b/src/main/java/teetime/stage/ByteArray2String.java index 8eed70b8..eb27f89b 100644 --- a/src/main/java/teetime/stage/ByteArray2String.java +++ b/src/main/java/teetime/stage/ByteArray2String.java @@ -2,10 +2,10 @@ package teetime.stage; import java.nio.charset.Charset; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class ByteArray2String extends ConsumerStage<byte[]> { +public class ByteArray2String extends AbstractConsumerStage<byte[]> { private final OutputPort<String> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/Cache.java b/src/main/java/teetime/stage/Cache.java index 6fb6f4b7..df63a623 100644 --- a/src/main/java/teetime/stage/Cache.java +++ b/src/main/java/teetime/stage/Cache.java @@ -4,11 +4,11 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.util.StopWatch; -public class Cache<T> extends ConsumerStage<T> { +public class Cache<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/CipherByteArray.java b/src/main/java/teetime/stage/CipherByteArray.java index e260f9ab..62d8db99 100644 --- a/src/main/java/teetime/stage/CipherByteArray.java +++ b/src/main/java/teetime/stage/CipherByteArray.java @@ -12,10 +12,10 @@ import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class CipherByteArray extends ConsumerStage<byte[]> { +public class CipherByteArray extends AbstractConsumerStage<byte[]> { private final OutputPort<byte[]> outputPort = this.createOutputPort(); private Cipher cipher = null; diff --git a/src/main/java/teetime/stage/Clock.java b/src/main/java/teetime/stage/Clock.java index 5cf53750..a536bc90 100644 --- a/src/main/java/teetime/stage/Clock.java +++ b/src/main/java/teetime/stage/Clock.java @@ -1,9 +1,9 @@ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; import teetime.framework.TerminationStrategy; -public class Clock extends ProducerStage<Long> { +public class Clock extends AbstractProducerStage<Long> { private boolean initialDelayExceeded = false; diff --git a/src/main/java/teetime/stage/CollectorSink.java b/src/main/java/teetime/stage/CollectorSink.java index 39a2c8f8..6797fbde 100644 --- a/src/main/java/teetime/stage/CollectorSink.java +++ b/src/main/java/teetime/stage/CollectorSink.java @@ -17,14 +17,14 @@ package teetime.stage; import java.util.List; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; /** * @author Christian Wulf * * @since 1.10 */ -public class CollectorSink<T> extends ConsumerStage<T> { +public class CollectorSink<T> extends AbstractConsumerStage<T> { // private final InputPort<T> inputPort = this.createInputPort(); // diff --git a/src/main/java/teetime/stage/Counter.java b/src/main/java/teetime/stage/Counter.java index 7d3d8c95..1dc0ccd2 100644 --- a/src/main/java/teetime/stage/Counter.java +++ b/src/main/java/teetime/stage/Counter.java @@ -1,9 +1,9 @@ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class Counter<T> extends ConsumerStage<T> { +public class Counter<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/ElementDelayMeasuringStage.java b/src/main/java/teetime/stage/ElementDelayMeasuringStage.java index 2f963dbe..16ae6374 100644 --- a/src/main/java/teetime/stage/ElementDelayMeasuringStage.java +++ b/src/main/java/teetime/stage/ElementDelayMeasuringStage.java @@ -3,11 +3,11 @@ package teetime.stage; import java.util.LinkedList; import java.util.List; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public class ElementDelayMeasuringStage<T> extends ConsumerStage<T> { +public class ElementDelayMeasuringStage<T> extends AbstractConsumerStage<T> { private final InputPort<Long> triggerInputPort = this.createInputPort(); private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java b/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java index ed4626c5..de5958b1 100644 --- a/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java +++ b/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java @@ -4,11 +4,11 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public class ElementThroughputMeasuringStage<T> extends ConsumerStage<T> { +public class ElementThroughputMeasuringStage<T> extends AbstractConsumerStage<T> { private final InputPort<Long> triggerInputPort = this.createInputPort(); private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/FileExtensionSwitch.java b/src/main/java/teetime/stage/FileExtensionSwitch.java index da609993..1ab666f2 100644 --- a/src/main/java/teetime/stage/FileExtensionSwitch.java +++ b/src/main/java/teetime/stage/FileExtensionSwitch.java @@ -4,12 +4,12 @@ import java.io.File; import java.util.HashMap; import java.util.Map; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import com.google.common.io.Files; -public class FileExtensionSwitch extends ConsumerStage<File> { +public class FileExtensionSwitch extends AbstractConsumerStage<File> { private final Map<String, OutputPort<File>> fileExtensions = new HashMap<String, OutputPort<File>>(); diff --git a/src/main/java/teetime/stage/InitialElementProducer.java b/src/main/java/teetime/stage/InitialElementProducer.java index a5084ce6..1b167e48 100644 --- a/src/main/java/teetime/stage/InitialElementProducer.java +++ b/src/main/java/teetime/stage/InitialElementProducer.java @@ -1,8 +1,8 @@ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public class InitialElementProducer<T> extends ProducerStage<T> { +public class InitialElementProducer<T> extends AbstractProducerStage<T> { private final T[] elements; diff --git a/src/main/java/teetime/stage/InstanceCounter.java b/src/main/java/teetime/stage/InstanceCounter.java index 30df6693..9db60208 100644 --- a/src/main/java/teetime/stage/InstanceCounter.java +++ b/src/main/java/teetime/stage/InstanceCounter.java @@ -1,9 +1,9 @@ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class InstanceCounter<T, C extends T> extends ConsumerStage<T> { +public class InstanceCounter<T, C extends T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/InstanceOfFilter.java b/src/main/java/teetime/stage/InstanceOfFilter.java index 042febae..d2e381c0 100644 --- a/src/main/java/teetime/stage/InstanceOfFilter.java +++ b/src/main/java/teetime/stage/InstanceOfFilter.java @@ -1,13 +1,13 @@ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** * @author Jan Waller, Nils Christian Ehmke, Christian Wulf * */ -public class InstanceOfFilter<I, O> extends ConsumerStage<I> { +public class InstanceOfFilter<I, O> extends AbstractConsumerStage<I> { private final OutputPort<O> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/IterableProducer.java b/src/main/java/teetime/stage/IterableProducer.java index 7d9eadde..398d6e61 100644 --- a/src/main/java/teetime/stage/IterableProducer.java +++ b/src/main/java/teetime/stage/IterableProducer.java @@ -1,8 +1,8 @@ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public class IterableProducer<O extends Iterable<T>, T> extends ProducerStage<T> { +public class IterableProducer<O extends Iterable<T>, T> extends AbstractProducerStage<T> { private O iter = null; diff --git a/src/main/java/teetime/stage/NoopFilter.java b/src/main/java/teetime/stage/NoopFilter.java index aaef5e79..a023df02 100644 --- a/src/main/java/teetime/stage/NoopFilter.java +++ b/src/main/java/teetime/stage/NoopFilter.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -23,7 +23,7 @@ import teetime.framework.OutputPort; * * @since 1.10 */ -public class NoopFilter<T> extends ConsumerStage<T> { +public class NoopFilter<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/ObjectProducer.java b/src/main/java/teetime/stage/ObjectProducer.java index f3787ac6..7b9b76d5 100644 --- a/src/main/java/teetime/stage/ObjectProducer.java +++ b/src/main/java/teetime/stage/ObjectProducer.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; import teetime.util.ConstructorClosure; /** @@ -23,7 +23,7 @@ import teetime.util.ConstructorClosure; * * @since 1.10 */ -public class ObjectProducer<T> extends ProducerStage<T> { +public class ObjectProducer<T> extends AbstractProducerStage<T> { private long numInputObjects; private ConstructorClosure<T> inputObjectCreator; diff --git a/src/main/java/teetime/stage/Relay.java b/src/main/java/teetime/stage/Relay.java index b5c82fae..0d898b3d 100644 --- a/src/main/java/teetime/stage/Relay.java +++ b/src/main/java/teetime/stage/Relay.java @@ -1,15 +1,15 @@ package teetime.stage; import teetime.framework.InputPort; -import teetime.framework.ProducerStage; -import teetime.framework.pipe.InterThreadPipe; +import teetime.framework.AbstractProducerStage; +import teetime.framework.pipe.AbstractInterThreadPipe; import teetime.framework.signal.TerminatingSignal; -public class Relay<T> extends ProducerStage<T> { +public class Relay<T> extends AbstractProducerStage<T> { private final InputPort<T> inputPort = this.createInputPort(); - private InterThreadPipe cachedCastedInputPipe; + private AbstractInterThreadPipe cachedCastedInputPipe; @Override public void execute() { @@ -27,7 +27,7 @@ public class Relay<T> extends ProducerStage<T> { @Override public void onStarting() throws Exception { super.onStarting(); - this.cachedCastedInputPipe = (InterThreadPipe) this.inputPort.getPipe(); + this.cachedCastedInputPipe = (AbstractInterThreadPipe) this.inputPort.getPipe(); } public InputPort<T> getInputPort() { diff --git a/src/main/java/teetime/stage/StartTimestampFilter.java b/src/main/java/teetime/stage/StartTimestampFilter.java index b3ecfe3c..4f5b50ea 100644 --- a/src/main/java/teetime/stage/StartTimestampFilter.java +++ b/src/main/java/teetime/stage/StartTimestampFilter.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.util.TimestampObject; @@ -24,7 +24,7 @@ import teetime.util.TimestampObject; * * @since 1.10 */ -public class StartTimestampFilter extends ConsumerStage<TimestampObject> { +public class StartTimestampFilter extends AbstractConsumerStage<TimestampObject> { private final OutputPort<TimestampObject> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/StopTimestampFilter.java b/src/main/java/teetime/stage/StopTimestampFilter.java index 9dff2cf0..49385bf2 100644 --- a/src/main/java/teetime/stage/StopTimestampFilter.java +++ b/src/main/java/teetime/stage/StopTimestampFilter.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.util.TimestampObject; @@ -24,7 +24,7 @@ import teetime.util.TimestampObject; * * @since 1.10 */ -public class StopTimestampFilter extends ConsumerStage<TimestampObject> { +public class StopTimestampFilter extends AbstractConsumerStage<TimestampObject> { private final OutputPort<TimestampObject> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/Tokenizer.java b/src/main/java/teetime/stage/Tokenizer.java index 24314cbe..96064e6e 100644 --- a/src/main/java/teetime/stage/Tokenizer.java +++ b/src/main/java/teetime/stage/Tokenizer.java @@ -2,10 +2,10 @@ package teetime.stage; import java.util.StringTokenizer; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class Tokenizer extends ConsumerStage<String> { +public class Tokenizer extends AbstractConsumerStage<String> { private final OutputPort<String> outputPort = this.createOutputPort(); private final String regex; diff --git a/src/main/java/teetime/stage/ZipByteArray.java b/src/main/java/teetime/stage/ZipByteArray.java index ca61720c..36dc9dbe 100644 --- a/src/main/java/teetime/stage/ZipByteArray.java +++ b/src/main/java/teetime/stage/ZipByteArray.java @@ -6,7 +6,7 @@ import java.util.zip.DataFormatException; import java.util.zip.Deflater; import java.util.zip.Inflater; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -15,7 +15,7 @@ import teetime.framework.OutputPort; * @author Nelson Tavares de Sousa * */ -public class ZipByteArray extends ConsumerStage<byte[]> { +public class ZipByteArray extends AbstractConsumerStage<byte[]> { private final OutputPort<byte[]> outputPort = this.createOutputPort(); private final ZipMode mode; diff --git a/src/main/java/teetime/stage/basic/Sink.java b/src/main/java/teetime/stage/basic/Sink.java index e5c5d722..1b790990 100644 --- a/src/main/java/teetime/stage/basic/Sink.java +++ b/src/main/java/teetime/stage/basic/Sink.java @@ -1,8 +1,8 @@ package teetime.stage.basic; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; -public class Sink<T> extends ConsumerStage<T> { +public class Sink<T> extends AbstractConsumerStage<T> { // PERFORMANCE let the sink remove all available input at once by using a new method receiveAll() that clears the pipe's buffer diff --git a/src/main/java/teetime/stage/basic/distributor/Distributor.java b/src/main/java/teetime/stage/basic/distributor/Distributor.java index 3e4b59bd..1f2ed53e 100644 --- a/src/main/java/teetime/stage/basic/distributor/Distributor.java +++ b/src/main/java/teetime/stage/basic/distributor/Distributor.java @@ -16,7 +16,7 @@ package teetime.stage.basic.distributor; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -27,7 +27,7 @@ import teetime.framework.OutputPort; * @param T * the type of the input port and the output ports */ -public class Distributor<T> extends ConsumerStage<T> { +public class Distributor<T> extends AbstractConsumerStage<T> { private IDistributorStrategy<T> strategy = new RoundRobinStrategy<T>(); diff --git a/src/main/java/teetime/stage/io/AbstractTcpReader.java b/src/main/java/teetime/stage/io/AbstractTcpReader.java index daf0a31d..c7b4e372 100644 --- a/src/main/java/teetime/stage/io/AbstractTcpReader.java +++ b/src/main/java/teetime/stage/io/AbstractTcpReader.java @@ -7,9 +7,9 @@ import java.nio.ByteBuffer; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public abstract class AbstractTcpReader<T> extends ProducerStage<T> { +public abstract class AbstractTcpReader<T> extends AbstractProducerStage<T> { private final int port; private final int bufferCapacity; diff --git a/src/main/java/teetime/stage/io/ByteArrayFileWriter.java b/src/main/java/teetime/stage/io/ByteArrayFileWriter.java index 5af9644c..50cbd0c2 100644 --- a/src/main/java/teetime/stage/io/ByteArrayFileWriter.java +++ b/src/main/java/teetime/stage/io/ByteArrayFileWriter.java @@ -4,11 +4,11 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import com.google.common.io.Files; -public class ByteArrayFileWriter extends ConsumerStage<byte[]> { +public class ByteArrayFileWriter extends AbstractConsumerStage<byte[]> { private final File file; private FileOutputStream fo; diff --git a/src/main/java/teetime/stage/io/Directory2FilesFilter.java b/src/main/java/teetime/stage/io/Directory2FilesFilter.java index cd45fc7b..426cad8c 100644 --- a/src/main/java/teetime/stage/io/Directory2FilesFilter.java +++ b/src/main/java/teetime/stage/io/Directory2FilesFilter.java @@ -21,7 +21,7 @@ import java.io.FileFilter; import java.util.Arrays; import java.util.Comparator; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -29,7 +29,7 @@ import teetime.framework.OutputPort; * * @since 1.10 */ -public class Directory2FilesFilter extends ConsumerStage<File> { +public class Directory2FilesFilter extends AbstractConsumerStage<File> { private final OutputPort<File> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/io/File2ByteArray.java b/src/main/java/teetime/stage/io/File2ByteArray.java index aa337687..647b42ae 100644 --- a/src/main/java/teetime/stage/io/File2ByteArray.java +++ b/src/main/java/teetime/stage/io/File2ByteArray.java @@ -3,13 +3,13 @@ package teetime.stage.io; import java.io.File; import java.io.IOException; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -import teetime.framework.Stage; +import teetime.framework.IStage; import com.google.common.io.Files; -public class File2ByteArray extends ConsumerStage<File> implements Stage { +public class File2ByteArray extends AbstractConsumerStage<File> implements IStage { private final OutputPort<byte[]> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/io/File2TextLinesFilter.java b/src/main/java/teetime/stage/io/File2TextLinesFilter.java index 48005fd7..7acd02c9 100644 --- a/src/main/java/teetime/stage/io/File2TextLinesFilter.java +++ b/src/main/java/teetime/stage/io/File2TextLinesFilter.java @@ -23,7 +23,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.stage.util.TextLine; @@ -31,7 +31,7 @@ import teetime.stage.util.TextLine; * @author Christian Wulf * */ -public class File2TextLinesFilter extends ConsumerStage<File> { +public class File2TextLinesFilter extends AbstractConsumerStage<File> { private final OutputPort<TextLine> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/io/Printer.java b/src/main/java/teetime/stage/io/Printer.java index 21936fbc..7b8a74a1 100644 --- a/src/main/java/teetime/stage/io/Printer.java +++ b/src/main/java/teetime/stage/io/Printer.java @@ -20,7 +20,7 @@ import java.io.FileOutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; /** * A filter to print objects to a configured stream @@ -29,7 +29,7 @@ import teetime.framework.ConsumerStage; * * @since 1.10 */ -public class Printer<T> extends ConsumerStage<T> { +public class Printer<T> extends AbstractConsumerStage<T> { public static final String STREAM_STDOUT = "STDOUT"; public static final String STREAM_STDERR = "STDERR"; diff --git a/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java b/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java index 6e2d9ac4..73a8e99c 100644 --- a/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java +++ b/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java @@ -18,7 +18,7 @@ package teetime.stage.stringBuffer; import java.util.Collection; import java.util.LinkedList; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.stage.stringBuffer.handler.AbstractDataTypeHandler; import teetime.stage.stringBuffer.util.KiekerHashMap; @@ -28,7 +28,7 @@ import teetime.stage.stringBuffer.util.KiekerHashMap; * * @since 1.10 */ -public class StringBufferFilter<T> extends ConsumerStage<T> { +public class StringBufferFilter<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/util/BucketTimingsReader.java b/src/main/java/util/BucketTimingsReader.java index 911c997b..0efdfe65 100644 --- a/src/main/java/util/BucketTimingsReader.java +++ b/src/main/java/util/BucketTimingsReader.java @@ -17,29 +17,31 @@ import com.google.common.base.Charsets; import com.google.common.io.CharSource; import com.google.common.io.Files; -public class BucketTimingsReader { +public final class BucketTimingsReader { - private final static Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class); + + private BucketTimingsReader() {} public static void main(final String[] args) throws IOException { - String fileName = args[0]; + final String fileName = args[0]; - Long[] currentTimings = new Long[10000]; + final Long[] currentTimings = new Long[10000]; int processedLines = 0; - List<Long> buckets = new LinkedList<Long>(); + final List<Long> buckets = new LinkedList<Long>(); LOGGER.trace("Reading " + fileName); - CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8); - BufferedReader bufferedStream = charSource.openBufferedStream(); + final CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8); + final BufferedReader bufferedStream = charSource.openBufferedStream(); String line; while (null != (line = bufferedStream.readLine())) { - String[] strings = line.split(";"); - Long timing = new Long(strings[1]); + final String[] strings = line.split(";"); + final Long timing = new Long(strings[1]); currentTimings[processedLines] = timing; processedLines++; if (currentTimings.length == processedLines) { // Long aggregatedTimings = StatisticsUtil.calculateQuintiles(Arrays.asList(currentTimings)).get(0.5); - Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings)); + final Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings)); buckets.add(aggregatedTimings); processedLines = 0; } @@ -47,13 +49,13 @@ public class BucketTimingsReader { LOGGER.trace("#buckets: " + buckets.size()); - List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size()); + final List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size()); LOGGER.trace("Calculating quantiles..."); - Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs); + final Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs); LOGGER.info(StatisticsUtil.getQuantilesString(quintiles)); - long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs); + final long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs); LOGGER.info("Confidence width: " + confidenceWidth); } } diff --git a/src/main/java/util/MooBenchStarter.java b/src/main/java/util/MooBenchStarter.java index 6a5a42eb..6d225302 100644 --- a/src/main/java/util/MooBenchStarter.java +++ b/src/main/java/util/MooBenchStarter.java @@ -15,7 +15,7 @@ public class MooBenchStarter { } public void start(final int runs, final long calls) throws IOException { - List<String> command = new LinkedList<String>(); + final List<String> command = new LinkedList<String>(); command.add("cmd"); command.add("/c"); command.add("start"); diff --git a/src/main/java/util/test/ProfiledPerformanceAssertion.java b/src/main/java/util/test/AbstractProfiledPerformanceAssertion.java similarity index 65% rename from src/main/java/util/test/ProfiledPerformanceAssertion.java rename to src/main/java/util/test/AbstractProfiledPerformanceAssertion.java index 9e9bb488..581dd775 100644 --- a/src/main/java/util/test/ProfiledPerformanceAssertion.java +++ b/src/main/java/util/test/AbstractProfiledPerformanceAssertion.java @@ -1,6 +1,6 @@ package util.test; -public abstract class ProfiledPerformanceAssertion { +public abstract class AbstractProfiledPerformanceAssertion { public abstract String getCorrespondingPerformanceProfile(); diff --git a/src/main/java/util/test/MeasurementRepository.java b/src/main/java/util/test/MeasurementRepository.java index 99843106..026bb2a4 100644 --- a/src/main/java/util/test/MeasurementRepository.java +++ b/src/main/java/util/test/MeasurementRepository.java @@ -7,6 +7,8 @@ public class MeasurementRepository { public final Map<String, PerformanceResult> performanceResults = new HashMap<String, PerformanceResult>(); + public MeasurementRepository() {} + public static final String buildTestMethodIdentifier(final Class<?> testClass, final String methodName) { return testClass.getName() + "(" + methodName + ")"; } diff --git a/src/main/java/util/test/PerformanceCheckProfileRepository.java b/src/main/java/util/test/PerformanceCheckProfileRepository.java index 74b8ad37..d16171a6 100644 --- a/src/main/java/util/test/PerformanceCheckProfileRepository.java +++ b/src/main/java/util/test/PerformanceCheckProfileRepository.java @@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory; public class PerformanceCheckProfileRepository { - private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceCheckProfileRepository.class); - public static final PerformanceCheckProfileRepository INSTANCE = new PerformanceCheckProfileRepository(); - private final Map<Class<?>, ProfiledPerformanceAssertion> performanceCheckProfiles = new HashMap<Class<?>, ProfiledPerformanceAssertion>(); + private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceCheckProfileRepository.class); + + private final Map<Class<?>, AbstractProfiledPerformanceAssertion> performanceCheckProfiles = new HashMap<Class<?>, AbstractProfiledPerformanceAssertion>(); private String currentProfile; @@ -29,13 +29,13 @@ public class PerformanceCheckProfileRepository { return this.currentProfile; } - public void register(final Class<?> testClass, final ProfiledPerformanceAssertion profile) { + public void register(final Class<?> testClass, final AbstractProfiledPerformanceAssertion profile) { if (profile.getCorrespondingPerformanceProfile().equals(this.currentProfile)) { this.performanceCheckProfiles.put(testClass, profile); } } - public ProfiledPerformanceAssertion get(final Class<?> clazz) { + public AbstractProfiledPerformanceAssertion get(final Class<?> clazz) { return this.performanceCheckProfiles.get(clazz); } } diff --git a/src/main/java/util/test/PerformanceResult.java b/src/main/java/util/test/PerformanceResult.java index 22cf87e3..d6d77a6c 100644 --- a/src/main/java/util/test/PerformanceResult.java +++ b/src/main/java/util/test/PerformanceResult.java @@ -10,9 +10,11 @@ public class PerformanceResult { public long avgDurInNs; public long confidenceWidthInNs; + public PerformanceResult() {} + @Override public String toString() { - StringBuilder stringBuilder = new StringBuilder(); + final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("overallDurationInNs: "); stringBuilder.append(this.overallDurationInNs); stringBuilder.append("\n"); diff --git a/src/main/java/util/test/StatisticsUtil.java b/src/main/java/util/test/StatisticsUtil.java index f3314529..26a9bc35 100644 --- a/src/main/java/util/test/StatisticsUtil.java +++ b/src/main/java/util/test/StatisticsUtil.java @@ -42,7 +42,7 @@ public final class StatisticsUtil { } public static PerformanceResult computeStatistics(final long overallDurationInNs, final List<TimestampObject> timestampObjects) { - PerformanceResult performanceResult = new PerformanceResult(); + final PerformanceResult performanceResult = new PerformanceResult(); performanceResult.overallDurationInNs = overallDurationInNs; @@ -71,9 +71,9 @@ public final class StatisticsUtil { } public static String getQuantilesString(final Map<Double, Long> quantilesValues) { - StringBuilder builder = new StringBuilder(); + final StringBuilder builder = new StringBuilder(); for (final Entry<Double, Long> entry : quantilesValues.entrySet()) { - String quantile = (entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toNanos(entry.getValue()) + " ns"; + final String quantile = (entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toNanos(entry.getValue()) + " ns"; builder.append(quantile); builder.append("\n"); } @@ -113,7 +113,7 @@ public final class StatisticsUtil { } public static void removeLeadingZeroThroughputs(final List<Long> throughputs) { - Iterator<Long> iterator = throughputs.iterator(); + final Iterator<Long> iterator = throughputs.iterator(); while (iterator.hasNext()) { if (iterator.next() == 0) { iterator.remove(); diff --git a/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java index 96b58dcd..3c078b84 100644 --- a/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java @@ -7,9 +7,9 @@ import java.util.Map.Entry; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -public class ChwHomeComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { +public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java index 93fbd19d..553fad83 100644 --- a/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java @@ -7,9 +7,9 @@ import java.util.Map.Entry; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -public class ChwWorkComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { +public class ChwWorkComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java index 26a91394..b7e1ed78 100644 --- a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java @@ -16,7 +16,7 @@ import teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test; import teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test; import teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test; import util.test.PerformanceCheckProfileRepository; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; @RunWith(Suite.class) @SuiteClasses({ @@ -42,7 +42,7 @@ public class ComparisonMethodcallWithPorts { @AfterClass public static void compareResults() { - ProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(ComparisonMethodcallWithPorts.class); + AbstractProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(ComparisonMethodcallWithPorts.class); pcp.check(); } diff --git a/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java index ea8e30a4..fc57df9b 100644 --- a/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java @@ -7,9 +7,9 @@ import java.util.Map.Entry; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -public class NieWorkComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { +public class NieWorkComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java index 3493118d..4d336fd2 100644 --- a/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { +class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java index 07bdf509..63ccd721 100644 --- a/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { +class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java b/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java index 6577d3a3..8099d569 100644 --- a/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java +++ b/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java @@ -23,7 +23,7 @@ import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceCheckProfileRepository; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -40,7 +40,7 @@ public class MethodCallThoughputTimestampAnalysis1Test extends PerformanceTest { @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java index 784024b9..66bccb2b 100644 --- a/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java @@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; import util.test.MeasurementRepository; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { protected PerformanceResult test01; protected PerformanceResult test09; diff --git a/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java b/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java index 2fe74dff..a8072963 100644 --- a/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java +++ b/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java b/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java index 785ef39d..dfdbfbd6 100644 --- a/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java +++ b/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.CommittablePipe; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; @@ -43,7 +43,7 @@ public class MethodCallThroughputAnalysis9 { private Runnable runnable; public void init() { - Stage pipeline = this.buildPipeline(); + IStage pipeline = this.buildPipeline(); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java index 495b74ca..972d5608 100644 --- a/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java @@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; import util.test.MeasurementRepository; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { protected PerformanceResult test01; protected PerformanceResult test10; diff --git a/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java index f73409d3..aac62e41 100644 --- a/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java +++ b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis10Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java index 99f8fc66..0aa9e619 100644 --- a/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment11; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { +class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java index 8dcfd608..d2145d8e 100644 --- a/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment11; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { +class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java index 80e22ff0..22440925 100644 --- a/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis11Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis11Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis11Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java index 31e7dfbd..d95d9f92 100644 --- a/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.UnorderedGrowablePipe; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; @@ -43,7 +43,7 @@ public class MethodCallThroughputAnalysis11 { private Runnable runnable; public void init() { - Stage pipeline = this.buildPipeline(this.numInputObjects, this.inputObjectCreator); + IStage pipeline = this.buildPipeline(this.numInputObjects, this.inputObjectCreator); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java index 7976d166..b3dfc404 100644 --- a/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java @@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; import util.test.MeasurementRepository; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { protected PerformanceResult test01; protected PerformanceResult test14; diff --git a/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java index 3d743f81..75e7df4e 100644 --- a/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java +++ b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis14Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis14Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis14Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java index f744ee4a..31f374d8 100644 --- a/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java +++ b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.PipeFactoryRegistry; import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; @@ -47,7 +47,7 @@ public class MethodCallThroughputAnalysis14 { private final PipeFactoryRegistry pipeFactory = PipeFactoryRegistry.INSTANCE; public void init() { - Stage pipeline = this.buildPipeline(); + IStage pipeline = this.buildPipeline(); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java index df9e7a4f..738579aa 100644 --- a/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java +++ b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.OrderedGrowableArrayPipe; import teetime.framework.pipe.SingleElementPipe; import teetime.framework.pipe.SpScPipe; @@ -58,7 +58,7 @@ public class MethodCallThroughputAnalysis15 { OldHeadPipeline<Clock, Sink<Long>> clockPipeline = this.buildClockPipeline(); this.clockRunnable = new RunnableStage(clockPipeline); - Stage pipeline = this.buildPipeline(this.clock); + IStage pipeline = this.buildPipeline(this.clock); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java index f09cd1e0..8333ae8c 100644 --- a/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { +class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java index 6a61017a..c95c13d1 100644 --- a/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { +class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public void check() { diff --git a/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java b/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java index 7dd7ea2b..2963e807 100644 --- a/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java +++ b/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java @@ -26,7 +26,7 @@ import teetime.util.ListUtil; import teetime.util.TimestampObject; import util.test.PerformanceCheckProfileRepository; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -46,7 +46,7 @@ public class MethodCallThoughputTimestampAnalysis16Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis16Test.class); + AbstractProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis16Test.class); pcp.check(); } diff --git a/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java b/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java index 3496e46c..503e8b83 100644 --- a/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java +++ b/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java @@ -21,7 +21,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.DummyPipe; import teetime.framework.pipe.IPipe; import teetime.framework.pipe.PipeFactoryRegistry; @@ -133,7 +133,7 @@ public class MethodCallThroughputAnalysis17 { * @param numNoopFilters * @since 1.10 */ - private OldHeadPipeline<Relay<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final Stage previousStage, + private OldHeadPipeline<Relay<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final IStage previousStage, final List<TimestampObject> timestampObjects) { // create stages Relay<TimestampObject> relay = new Relay<TimestampObject>(); diff --git a/src/performancetest/java/teetime/examples/loopStage/Countdown.java b/src/performancetest/java/teetime/examples/loopStage/Countdown.java index adbbeff6..bf045270 100644 --- a/src/performancetest/java/teetime/examples/loopStage/Countdown.java +++ b/src/performancetest/java/teetime/examples/loopStage/Countdown.java @@ -2,9 +2,9 @@ package teetime.examples.loopStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public class Countdown extends ProducerStage<Void> { +public class Countdown extends AbstractProducerStage<Void> { private final InputPort<Integer> countdownInputPort = this.createInputPort(); diff --git a/src/performancetest/java/teetime/framework/OldHeadPipeline.java b/src/performancetest/java/teetime/framework/OldHeadPipeline.java index 4d166117..8f341848 100644 --- a/src/performancetest/java/teetime/framework/OldHeadPipeline.java +++ b/src/performancetest/java/teetime/framework/OldHeadPipeline.java @@ -1,7 +1,7 @@ package teetime.framework; @Deprecated -public class OldHeadPipeline<FirstStage extends Stage, LastStage extends Stage> extends OldPipeline<FirstStage, LastStage> implements Stage { +public class OldHeadPipeline<FirstStage extends IStage, LastStage extends IStage> extends OldPipeline<FirstStage, LastStage> implements IStage { public OldHeadPipeline() {} diff --git a/src/performancetest/java/teetime/framework/OldPipeline.java b/src/performancetest/java/teetime/framework/OldPipeline.java index e6c8244b..98f846d6 100644 --- a/src/performancetest/java/teetime/framework/OldPipeline.java +++ b/src/performancetest/java/teetime/framework/OldPipeline.java @@ -6,7 +6,7 @@ import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; @Deprecated -public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> implements Stage { +public class OldPipeline<FirstStage extends IStage, LastStage extends IStage> implements IStage { protected FirstStage firstStage; protected LastStage lastStage; @@ -38,12 +38,12 @@ public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> impl } @Override - public Stage getParentStage() { + public IStage getParentStage() { return this.firstStage.getParentStage(); } @Override - public void setParentStage(final Stage parentStage, final int index) { + public void setParentStage(final IStage parentStage, final int index) { this.firstStage.setParentStage(parentStage, index); } diff --git a/src/test/java/teetime/examples/cipher/CipherConfiguration.java b/src/test/java/teetime/examples/cipher/CipherConfiguration.java index e34fc99b..0798d8c3 100644 --- a/src/test/java/teetime/examples/cipher/CipherConfiguration.java +++ b/src/test/java/teetime/examples/cipher/CipherConfiguration.java @@ -20,15 +20,15 @@ public class CipherConfiguration extends AnalysisConfiguration { final File input = new File(inputFile); final File output = new File(outputFile); - InitialElementProducer<File> init = new InitialElementProducer<File>(input); - File2ByteArray f2b = new File2ByteArray(); - CipherByteArray enc = new CipherByteArray(password, CipherMode.ENCRYPT); - ZipByteArray comp = new ZipByteArray(ZipMode.COMP); - ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); - CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); - ByteArrayFileWriter writer = new ByteArrayFileWriter(output); - - IPipeFactory factory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); + final InitialElementProducer<File> init = new InitialElementProducer<File>(input); + final File2ByteArray f2b = new File2ByteArray(); + final CipherByteArray enc = new CipherByteArray(password, CipherMode.ENCRYPT); + final ZipByteArray comp = new ZipByteArray(ZipMode.COMP); + final ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); + 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()); diff --git a/src/test/java/teetime/examples/cipher/CipherTest.java b/src/test/java/teetime/examples/cipher/CipherTest.java index 20f54007..50f54e8f 100644 --- a/src/test/java/teetime/examples/cipher/CipherTest.java +++ b/src/test/java/teetime/examples/cipher/CipherTest.java @@ -20,14 +20,16 @@ import com.google.common.io.Files; */ public class CipherTest { + public CipherTest() {} + @Test public void executeTest() throws IOException { final String inputFile = "src/test/resources/data/input.txt"; final String outputFile = "src/test/resources/data/output.txt"; final String password = "Password"; - AnalysisConfiguration configuration = new CipherConfiguration(inputFile, outputFile, password); - Analysis analysis = new Analysis(configuration); + final AnalysisConfiguration configuration = new CipherConfiguration(inputFile, outputFile, password); + final Analysis analysis = new Analysis(configuration); analysis.init(); analysis.start(); diff --git a/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java b/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java index af0b7ed7..d8c344e3 100644 --- a/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java +++ b/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java @@ -22,13 +22,13 @@ public class TokenizerConfiguration extends AnalysisConfiguration { public TokenizerConfiguration(final String inputFile, final String password) { final File input = new File(inputFile); - InitialElementProducer<File> init = new InitialElementProducer<File>(input); - File2ByteArray f2b = new File2ByteArray(); - ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); - CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); - ByteArray2String b2s = new ByteArray2String(); - Tokenizer tokenizer = new Tokenizer(" "); - counter = new Counter<String>(); + final InitialElementProducer<File> init = new InitialElementProducer<File>(input); + final File2ByteArray f2b = new File2ByteArray(); + final ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); + final CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); + final ByteArray2String b2s = new ByteArray2String(); + final Tokenizer tokenizer = new Tokenizer(" "); + this.counter = new Counter<String>(); PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( init.getOutputPort(), f2b.getInputPort()); @@ -41,7 +41,7 @@ public class TokenizerConfiguration extends AnalysisConfiguration { PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( b2s.getOutputPort(), tokenizer.getInputPort()); PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( - tokenizer.getOutputPort(), counter.getInputPort()); + tokenizer.getOutputPort(), this.counter.getInputPort()); // this.getFiniteProducerStages().add(init); this.addThreadableStage(init); diff --git a/src/test/java/teetime/examples/tokenizer/TokenizerTest.java b/src/test/java/teetime/examples/tokenizer/TokenizerTest.java index 2a9b2ac9..d3cb076e 100644 --- a/src/test/java/teetime/examples/tokenizer/TokenizerTest.java +++ b/src/test/java/teetime/examples/tokenizer/TokenizerTest.java @@ -19,18 +19,20 @@ import com.google.common.io.Files; */ public class TokenizerTest { + public TokenizerTest() {} + @Test public void executeTest() throws IOException { // Encrypted lorem ipsum - String inputFile = "src/test/resources/data/cipherInput.txt"; - String password = "Password"; + final String inputFile = "src/test/resources/data/cipherInput.txt"; + final String password = "Password"; - TokenizerConfiguration configuration = new TokenizerConfiguration(inputFile, password); - Analysis analysis = new Analysis(configuration); + final TokenizerConfiguration configuration = new TokenizerConfiguration(inputFile, password); + final Analysis analysis = new Analysis(configuration); analysis.init(); analysis.start(); - String string = Files.toString(new File("src/test/resources/data/input.txt"), Charset.forName("UTF-8")); + final String string = Files.toString(new File("src/test/resources/data/input.txt"), Charset.forName("UTF-8")); Assert.assertEquals(string.split(" ").length, configuration.getTokenCount()); } diff --git a/src/test/java/teetime/framework/FileSearcherTest.java b/src/test/java/teetime/framework/FileSearcherTest.java index 69e43e9b..0b7085b4 100644 --- a/src/test/java/teetime/framework/FileSearcherTest.java +++ b/src/test/java/teetime/framework/FileSearcherTest.java @@ -9,22 +9,24 @@ import org.junit.Test; public class FileSearcherTest { + public FileSearcherTest() {} + @Test public void fileInClasspath() throws IOException { - List<URL> list = FileSearcher.loadResources("pipe-factories.conf"); - Assert.assertEquals(false, list.isEmpty());// NOPMD + final List<URL> list = FileSearcher.loadResources("pipe-factories.conf"); + Assert.assertEquals(false, list.isEmpty()); // NOPMD } @Test public void multipleFiles() throws IOException { - List<URL> list = FileSearcher.loadResources("LICENSE.txt"); - Assert.assertEquals(true, list.size() > 1);// NOPMD + final List<URL> list = FileSearcher.loadResources("LICENSE.txt"); + Assert.assertEquals(true, list.size() > 1); // NOPMD } @Test public void missingFile() throws IOException { - List<URL> list = FileSearcher.loadResources("filethatdoesnotexistinanyproject.nope"); - Assert.assertEquals(true, list.isEmpty());// NOPMD + final List<URL> list = FileSearcher.loadResources("filethatdoesnotexistinanyproject.nope"); + Assert.assertEquals(true, list.isEmpty()); // NOPMD } } diff --git a/src/test/java/teetime/framework/pipe/DummyFactory.java b/src/test/java/teetime/framework/pipe/DummyFactory.java index e4a40def..73f3e9f7 100644 --- a/src/test/java/teetime/framework/pipe/DummyFactory.java +++ b/src/test/java/teetime/framework/pipe/DummyFactory.java @@ -2,4 +2,8 @@ package teetime.framework.pipe; public class DummyFactory extends SpScPipeFactory { + public DummyFactory() { + super(); + } + } diff --git a/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java b/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java index e7beafb3..16b56a0a 100644 --- a/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java +++ b/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java @@ -16,29 +16,31 @@ import com.google.common.io.Files; public class PipeFactoryLoaderTest { + public PipeFactoryLoaderTest() {} + @Test public void emptyConfig() throws IOException { - List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("data/empty-test.conf"); + final List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("data/empty-test.conf"); Assert.assertEquals(true, list.isEmpty()); } @Test public void singleConfig() throws IOException { - List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("pipe-factories.conf"); - int lines = Files.readLines(new File("target/classes/pipe-factories.conf"), Charsets.UTF_8).size(); + final List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("pipe-factories.conf"); + final int lines = Files.readLines(new File("target/classes/pipe-factories.conf"), Charsets.UTF_8).size(); Assert.assertEquals(lines, list.size()); } @Test public void multipleConfigs() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { - List<URL> files = new ArrayList<URL>(); - File pipeConfig = new File("target/classes/pipe-factories.conf"); - File testConfig = new File("target/test-classes/data/normal-test.conf"); + final List<URL> files = new ArrayList<URL>(); + final File pipeConfig = new File("target/classes/pipe-factories.conf"); + final File testConfig = new File("target/test-classes/data/normal-test.conf"); files.add(testConfig.toURI().toURL()); files.add(pipeConfig.toURI().toURL()); - List<IPipeFactory> pipeFactories = PipeFactoryLoader.mergeFiles(files); + final List<IPipeFactory> pipeFactories = PipeFactoryLoader.mergeFiles(files); - List<String> contents = Files.readLines(pipeConfig, Charsets.UTF_8); + final List<String> contents = Files.readLines(pipeConfig, Charsets.UTF_8); contents.addAll(Files.readLines(testConfig, Charsets.UTF_8)); // Check if all read factories are contained in one of the files @@ -47,18 +49,19 @@ public class PipeFactoryLoaderTest { } // Second part of the test: PipeFactoryRegistry - PipeFactoryRegistry pipeRegistry = PipeFactoryRegistry.INSTANCE; - ClassForNameResolver<IPipeFactory> classResolver = new ClassForNameResolver<IPipeFactory>(IPipeFactory.class); + final PipeFactoryRegistry pipeRegistry = PipeFactoryRegistry.INSTANCE; + final ClassForNameResolver<IPipeFactory> classResolver = new ClassForNameResolver<IPipeFactory>(IPipeFactory.class); // Look for the "normal" pipes for (String className : Files.readLines(pipeConfig, Charsets.UTF_8)) { - IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); - IPipeFactory returnedFactory = pipeRegistry.getPipeFactory(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); + final IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); + final IPipeFactory returnedFactory = pipeRegistry.getPipeFactory(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), + pipeFactory.isGrowable()); Assert.assertEquals(pipeFactory.getClass().getCanonicalName(), returnedFactory.getClass().getCanonicalName()); } // Second "and a half" part for (String className : Files.readLines(testConfig, Charsets.UTF_8)) { - IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); + final IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); // Still old factory IPipeFactory returnedFactory = pipeRegistry.getPipeFactory(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); Assert.assertNotEquals(pipeFactory.getClass().getCanonicalName(), returnedFactory.getClass().getCanonicalName()); diff --git a/src/test/java/teetime/framework/pipe/SpScPipeTest.java b/src/test/java/teetime/framework/pipe/SpScPipeTest.java index 1a937afc..b5f7a128 100644 --- a/src/test/java/teetime/framework/pipe/SpScPipeTest.java +++ b/src/test/java/teetime/framework/pipe/SpScPipeTest.java @@ -19,7 +19,7 @@ public class SpScPipeTest { public void testSignalOrdering() throws Exception { OutputPort<? extends Object> sourcePort = null; InputPort<Object> targetPort = null; - InterThreadPipe pipe = new SpScPipe(sourcePort, targetPort, 1); // IPipe does not provide getSignal method + AbstractInterThreadPipe pipe = new SpScPipe(sourcePort, targetPort, 1); // IPipe does not provide getSignal method List<ISignal> list = new ArrayList<ISignal>(); list.add(new StartingSignal()); -- GitLab