use of teetime.stage.InitialElementProducer in project TeeTime by teetime-framework.
the class StageFactory method getProducerFromInputPort.
@SuppressWarnings("unchecked")
static <T> InitialElementProducer<T> getProducerFromInputPort(final InputPort<T> inputPort) {
OutputPort<?> sourcePort = inputPort.getPipe().getSourcePort();
AbstractStage owningStage = sourcePort.getOwningStage();
if (owningStage instanceof InitialElementProducer) {
return (InitialElementProducer<T>) owningStage;
}
String message = String.format("%s", owningStage);
throw new IllegalArgumentException(message);
}
use of teetime.stage.InitialElementProducer in project iobserve-analysis by research-iobserve.
the class AtomicActionComputationTest method executeStage.
private ExecutionPlan executeStage(final SystemAdaptation systemAdaptationModel) {
final InitialElementProducer<SystemAdaptation> producer = new InitialElementProducer<>(systemAdaptationModel);
final AtomicActionComputation atomicActionComputation = new AtomicActionComputation();
final CollectorSink<ExecutionPlan> collector = new CollectorSink<>();
final AtomicActionComputationTestConfig configuration = new AtomicActionComputationTestConfig(producer, atomicActionComputation, collector);
final Execution<AtomicActionComputationTestConfig> execution = new Execution<>(configuration);
execution.executeBlocking();
return collector.getElements().get(0);
}
use of teetime.stage.InitialElementProducer in project TeeTime by teetime-framework.
the class OneExecutionProducerIT method testRegularExecution.
void testRegularExecution(final List<String> expectedElements, final int numThreads) {
for (int numOfExecutions = 1; numOfExecutions < expectedElements.size() + 1; numOfExecutions++) {
List<String> actualElements = new ArrayList<>();
Configuration configuration = new Configuration().from(new InitialElementProducer<String>(expectedElements)).end(new CollectorSink<String>(actualElements));
GlobalTaskPoolScheduling scheduler = new GlobalTaskPoolScheduling(numThreads, configuration, numOfExecutions);
Execution<Configuration> execution = new Execution<>(configuration, true, scheduler);
execution.executeBlocking();
assertThat("failed with numOfExecutions=" + numOfExecutions, actualElements, is(equalTo(expectedElements)));
}
}
use of teetime.stage.InitialElementProducer in project iobserve-analysis by research-iobserve.
the class ComposedActionComputationTest method executeStage.
private SystemAdaptation executeStage(final AdaptationData adaptationData) {
final InitialElementProducer<AdaptationData> producer = new InitialElementProducer<>(adaptationData);
final ComposedActionComputation composedActionComputation = new ComposedActionComputation();
final CollectorSink<SystemAdaptation> collector = new CollectorSink<>();
final ComposedActionComputationTestConfig configuration = new ComposedActionComputationTestConfig(producer, this.actionFactoryInitializer, composedActionComputation, collector);
final Execution<ComposedActionComputationTestConfig> execution = new Execution<>(configuration);
execution.executeBlocking();
return collector.getElements().get(0);
}
Aggregations