use of teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy in project TeeTime by teetime-framework.
the class DistributorTest method singleElementCopyByReferenceShouldWork.
@Test
public void singleElementCopyByReferenceShouldWork() {
distributor.setStrategy(new CopyByReferenceStrategy());
test(distributor).and().send(1).to(distributor.getInputPort()).and().receive(firstIntegers).from(distributor.getNewOutputPort()).and().receive(secondIntegers).from(distributor.getNewOutputPort()).start();
assertThat(this.firstIntegers, contains(1));
assertThat(this.secondIntegers, contains(1));
}
use of teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy in project iobserve-analysis by research-iobserve.
the class AnalysisConfiguration method traceProcessing.
/**
* Create trace related filter chains.
*
* @param configuration
* filter configurations
* @throws ConfigurationException
* when configuration fails
*/
private void traceProcessing(final kieker.common.configuration.Configuration configuration) throws ConfigurationException {
if (configuration.getBooleanProperty(ConfigurationKeys.TRACES, false)) {
final TraceReconstructionCompositeStage traceReconstructionStage = new TraceReconstructionCompositeStage(configuration);
OutputPort<EventBasedTrace> behaviorClusteringEventBasedTracePort = traceReconstructionStage.getTraceValidOutputPort();
OutputPort<EventBasedTrace> dataFlowEventBasedTracePort = traceReconstructionStage.getTraceValidOutputPort();
/**
* Connect ports.
*/
final IEventMatcher<IFlowRecord> flowRecordMatcher = new ImplementsEventMatcher<>(IFlowRecord.class, null);
this.eventDispatcher.registerOutput(flowRecordMatcher);
this.connectPorts(flowRecordMatcher.getOutputPort(), traceReconstructionStage.getInputPort());
/**
* Include distributor to support tow simultaneous sinks.
*/
if (configuration.getBooleanProperty(ConfigurationKeys.DATA_FLOW, false) && !configuration.getStringProperty(ConfigurationKeys.BEHAVIOR_CLUSTERING).isEmpty()) {
final IDistributorStrategy strategy = new CopyByReferenceStrategy();
final Distributor<EventBasedTrace> distributor = new Distributor<>(strategy);
this.connectPorts(traceReconstructionStage.getTraceValidOutputPort(), distributor.getInputPort());
behaviorClusteringEventBasedTracePort = distributor.getNewOutputPort();
dataFlowEventBasedTracePort = distributor.getNewOutputPort();
}
/**
* Initialize depending features.
*/
this.behaviorClustering(configuration, behaviorClusteringEventBasedTracePort);
this.dataflow(configuration, dataFlowEventBasedTracePort);
}
}
use of teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy in project iobserve-analysis by research-iobserve.
the class AnalysisConfiguration method createContainerManagementSink.
/**
* Create sinks for container management visualization.
*
* @param configuration
* configuration object
* @throws ConfigurationException
* when configuration fails
*/
private void createContainerManagementSink(final kieker.common.configuration.Configuration configuration) throws ConfigurationException {
final String[] containerManagementSinks = configuration.getStringArrayProperty(ConfigurationKeys.CONTAINER_MANAGEMENT_SINK, AnalysisConfiguration.DELIMETER);
if (containerManagementSinks.length == 1) {
final IContainerManagementSinksStage containerManagementSinksStage = InstantiationFactory.createWithConfiguration(IContainerManagementSinksStage.class, containerManagementSinks[0], configuration);
/**
* connect ports.
*/
this.connectPorts(this.allocationStage.getAllocationNotifyOutputPort(), containerManagementSinksStage.getAllocationInputPort());
this.connectPorts(this.deallocationStage.getDeallocationNotifyOutputPort(), containerManagementSinksStage.getDeallocationInputPort());
this.connectPorts(this.deploymentStage.getDeployedOutputPort(), containerManagementSinksStage.getDeployedInputPort());
this.connectPorts(this.undeploymentStage.getUndeployedOutputPort(), containerManagementSinksStage.getUndeployedInputPort());
} else if (containerManagementSinks.length > 1) {
/**
* In case of multiple outputs, we require distributors.
*/
final Distributor<ResourceContainer> allocationDistributor = new Distributor<>(new CopyByReferenceStrategy());
final Distributor<ResourceContainer> deallocationDistributor = new Distributor<>(new CopyByReferenceStrategy());
final Distributor<PCMDeployedEvent> deploymentDistributor = new Distributor<>(new CopyByReferenceStrategy());
final Distributor<PCMUndeployedEvent> undeploymentDistributor = new Distributor<>(new CopyByReferenceStrategy());
/**
* link distributor to container management.
*/
this.connectPorts(this.allocationStage.getAllocationNotifyOutputPort(), allocationDistributor.getInputPort());
this.connectPorts(this.deallocationStage.getDeallocationNotifyOutputPort(), deallocationDistributor.getInputPort());
this.connectPorts(this.deploymentStage.getDeployedOutputPort(), deploymentDistributor.getInputPort());
this.connectPorts(this.undeploymentStage.getUndeployedOutputPort(), undeploymentDistributor.getInputPort());
/**
* Create and connect sinks.
*/
for (final String containerManagementSink : containerManagementSinks) {
final IContainerManagementSinksStage containerManagementSinksStage = InstantiationFactory.createWithConfiguration(IContainerManagementSinksStage.class, containerManagementSink, configuration);
/**
* connect ports.
*/
this.connectPorts(allocationDistributor.getNewOutputPort(), containerManagementSinksStage.getAllocationInputPort());
this.connectPorts(deallocationDistributor.getNewOutputPort(), containerManagementSinksStage.getDeallocationInputPort());
this.connectPorts(deploymentDistributor.getNewOutputPort(), containerManagementSinksStage.getDeployedInputPort());
this.connectPorts(undeploymentDistributor.getNewOutputPort(), containerManagementSinksStage.getUndeployedInputPort());
}
} else {
AnalysisConfiguration.LOGGER.warn("No container management sinks specified. Therefore, deployment and allocation changes will not be communicated.");
}
}
use of teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy in project iobserve-analysis by research-iobserve.
the class AnalysisConfiguration method traceProcessing.
/**
* Create trace related filter chains.
*
* @param configuration
* filter configurations
* @throws ConfigurationException
* when configuration fails
*/
private void traceProcessing(final kieker.common.configuration.Configuration configuration) throws ConfigurationException {
if (configuration.getBooleanProperty(ConfigurationKeys.TRACES, false)) {
final TraceReconstructionCompositeStage traceReconstructionStage = new TraceReconstructionCompositeStage(configuration);
OutputPort<EventBasedTrace> behaviorClusteringEventBasedTracePort = traceReconstructionStage.getTraceValidOutputPort();
OutputPort<EventBasedTrace> dataFlowEventBasedTracePort = traceReconstructionStage.getTraceValidOutputPort();
/**
* Connect ports.
*/
this.eventDispatcher.registerOutput(IFlowRecord.class);
this.connectPorts(this.eventDispatcher.getOutputPort(IFlowRecord.class), traceReconstructionStage.getInputPort());
/**
* Include distributor to support tow simultaneous sinks.
*/
if (configuration.getBooleanProperty(ConfigurationKeys.DATA_FLOW, false) && !configuration.getStringProperty(ConfigurationKeys.BEHAVIOR_CLUSTERING).isEmpty()) {
final IDistributorStrategy strategy = new CopyByReferenceStrategy();
final Distributor<EventBasedTrace> distributor = new Distributor<>(strategy);
this.connectPorts(traceReconstructionStage.getTraceValidOutputPort(), distributor.getInputPort());
behaviorClusteringEventBasedTracePort = distributor.getNewOutputPort();
dataFlowEventBasedTracePort = distributor.getNewOutputPort();
}
/**
* Initialize depending features.
*/
this.behaviorClustering(configuration, behaviorClusteringEventBasedTracePort);
this.dataflow(configuration, dataFlowEventBasedTracePort);
}
}
use of teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy in project TeeTime by teetime-framework.
the class DistributorTest method copyByReferenceShouldWork.
@Test
public void copyByReferenceShouldWork() {
distributor.setStrategy(new CopyByReferenceStrategy());
test(distributor).and().send(1, 2, 3, 4, 5).to(distributor.getInputPort()).and().receive(firstIntegers).from(distributor.getNewOutputPort()).and().receive(secondIntegers).from(distributor.getNewOutputPort()).start();
assertThat(this.firstIntegers, contains(1, 2, 3, 4, 5));
assertThat(this.secondIntegers, contains(1, 2, 3, 4, 5));
}
Aggregations