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

Added legacystages to re-enable test execution

parent fab277f8
No related branches found
No related tags found
No related merge requests found
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
......@@ -20,7 +20,7 @@ import teetime.framework.OutputPort;
/**
* @author Christian Wulf
*
*
* @since 1.10
*/
public class NoopFilter<T> extends ConsumerStage<T> {
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package teetime.examples.experiment01;
import java.util.List;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class LegacyCollectorSink<T> {
// private final InputPort<T> inputPort = this.createInputPort();
//
// public final InputPort<T> getInputPort() {
// return this.inputPort;
// }
private final List<T> elements;
private final int threshold;
public LegacyCollectorSink(final List<T> list, final int threshold) {
this.elements = list;
this.threshold = threshold;
}
public LegacyCollectorSink(final List<T> list) {
this(list, 100000);
}
public void onIsPipelineHead() {
System.out.println("size: " + this.elements.size());
}
protected void execute(final T element) {
this.elements.add(element);
if ((this.elements.size() % this.threshold) == 0) {
System.out.println("size: " + this.elements.size());
}
// if (this.elements.size() > 90000) {
// // System.out.println("size > 90000: " + this.elements.size());
// }
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package teetime.examples.experiment01;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class LegacyNoopFilter<T> {
protected T execute(final T element) {
return element;
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package teetime.examples.experiment01;
import teetime.util.ConstructorClosure;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class LegacyObjectProducer<T> {
private long numInputObjects;
private ConstructorClosure<T> inputObjectCreator;
/**
* @since 1.10
*/
public LegacyObjectProducer(final long numInputObjects, final ConstructorClosure<T> inputObjectCreator) {
this.numInputObjects = numInputObjects;
this.inputObjectCreator = inputObjectCreator;
}
public long getNumInputObjects() {
return this.numInputObjects;
}
public void setNumInputObjects(final long numInputObjects) {
this.numInputObjects = numInputObjects;
}
public ConstructorClosure<T> getInputObjectCreator() {
return this.inputObjectCreator;
}
public void setInputObjectCreator(final ConstructorClosure<T> inputObjectCreator) {
this.inputObjectCreator = inputObjectCreator;
}
protected T execute() {
T newObject = this.inputObjectCreator.create();
this.numInputObjects--;
return newObject;
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package teetime.examples.experiment01;
import teetime.util.TimestampObject;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class LegacyStartTimestampFilter {
protected TimestampObject execute(final TimestampObject element) {
element.setStartTimestamp(System.nanoTime());
return element;
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package teetime.examples.experiment01;
import teetime.util.TimestampObject;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class LegacyStopTimestampFilter {
protected TimestampObject execute(final TimestampObject element) {
element.setStopTimestamp(System.nanoTime());
return element;
}
}
......@@ -37,45 +37,45 @@ public class MethodCallThroughputAnalysis1 extends OldAnalysis {
@Override
public void init() {
super.init();
// this.runnable = this.buildPipeline();
this.runnable = this.buildPipeline();
}
/**
* @param numNoopFilters
* @since 1.10
*/
// private Runnable buildPipeline() {
// @SuppressWarnings("unchecked")
// final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters];
// // create stages
// final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator);
// final StartTimestampFilter startTimestampFilter = new StartTimestampFilter();
// for (int i = 0; i < noopFilters.length; i++) {
// noopFilters[i] = new NoopFilter<TimestampObject>();
// }
// final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter();
// final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects);
//
// final Runnable runnable = new Runnable() {
// @Override
// public void run() {
// while (true) {
// TimestampObject object = objectProducer.execute(null);
// if (object == null) {
// return;
// }
//
// object = startTimestampFilter.execute(object);
// for (final NoopFilter<TimestampObject> noopFilter : noopFilters) {
// object = noopFilter.execute(object);
// }
// object = stopTimestampFilter.execute(object);
// collectorSink.execute(object);
// }
// }
// };
// return runnable;
// }
private Runnable buildPipeline() {
@SuppressWarnings("unchecked")
final LegacyNoopFilter<TimestampObject>[] noopFilters = new LegacyNoopFilter[this.numNoopFilters];
// create stages
final LegacyObjectProducer<TimestampObject> objectProducer = new LegacyObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator);
final LegacyStartTimestampFilter startTimestampFilter = new LegacyStartTimestampFilter();
for (int i = 0; i < noopFilters.length; i++) {
noopFilters[i] = new LegacyNoopFilter<TimestampObject>();
}
final LegacyStopTimestampFilter stopTimestampFilter = new LegacyStopTimestampFilter();
final LegacyCollectorSink<TimestampObject> collectorSink = new LegacyCollectorSink<TimestampObject>(this.timestampObjects);
final Runnable runnable = new Runnable() {
@Override
public void run() {
while (true) {
TimestampObject object = objectProducer.execute();
if (object == null) {
return;
}
object = startTimestampFilter.execute(object);
for (final LegacyNoopFilter<TimestampObject> noopFilter : noopFilters) {
object = noopFilter.execute(object);
}
object = stopTimestampFilter.execute(object);
collectorSink.execute(object);
}
}
};
return runnable;
}
@Override
public void start() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment