Search in sources :

Example 1 with CopyByReferenceStrategy

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));
}
Also used : CopyByReferenceStrategy(teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy) Test(org.junit.Test)

Example 2 with CopyByReferenceStrategy

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);
    }
}
Also used : Distributor(teetime.stage.basic.distributor.Distributor) TraceReconstructionCompositeStage(org.iobserve.analysis.traces.TraceReconstructionCompositeStage) EventBasedTrace(org.iobserve.stages.data.trace.EventBasedTrace) IFlowRecord(kieker.common.record.flow.IFlowRecord) IDistributorStrategy(teetime.stage.basic.distributor.strategy.IDistributorStrategy) ImplementsEventMatcher(org.iobserve.stages.general.ImplementsEventMatcher) CopyByReferenceStrategy(teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy)

Example 3 with CopyByReferenceStrategy

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.");
    }
}
Also used : IContainerManagementSinksStage(org.iobserve.analysis.feature.IContainerManagementSinksStage) Distributor(teetime.stage.basic.distributor.Distributor) CopyByReferenceStrategy(teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy)

Example 4 with CopyByReferenceStrategy

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);
    }
}
Also used : Distributor(teetime.stage.basic.distributor.Distributor) TraceReconstructionCompositeStage(org.iobserve.analysis.traces.TraceReconstructionCompositeStage) EventBasedTrace(teetime.stage.trace.traceReconstruction.EventBasedTrace) IFlowRecord(kieker.common.record.flow.IFlowRecord) IDistributorStrategy(teetime.stage.basic.distributor.strategy.IDistributorStrategy) CopyByReferenceStrategy(teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy)

Example 5 with CopyByReferenceStrategy

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));
}
Also used : CopyByReferenceStrategy(teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy) Test(org.junit.Test)

Aggregations

CopyByReferenceStrategy (teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy)6 Distributor (teetime.stage.basic.distributor.Distributor)4 IFlowRecord (kieker.common.record.flow.IFlowRecord)2 TraceReconstructionCompositeStage (org.iobserve.analysis.traces.TraceReconstructionCompositeStage)2 Test (org.junit.Test)2 IDistributorStrategy (teetime.stage.basic.distributor.strategy.IDistributorStrategy)2 IContainerManagementSinkStage (org.iobserve.analysis.feature.IContainerManagementSinkStage)1 IContainerManagementSinksStage (org.iobserve.analysis.feature.IContainerManagementSinksStage)1 EventBasedTrace (org.iobserve.stages.data.trace.EventBasedTrace)1 ImplementsEventMatcher (org.iobserve.stages.general.ImplementsEventMatcher)1 EventBasedTrace (teetime.stage.trace.traceReconstruction.EventBasedTrace)1