Search in sources :

Example 1 with AllocationStage

use of org.iobserve.analysis.deployment.AllocationStage in project iobserve-analysis by research-iobserve.

the class AnalysisConfiguration method containerManagement.

/**
 * Create all stages necessary for the container management.
 *
 * @param configuration
 *            potential configuration parameter for filters
 * @param resourceEnvironmentModelProvider
 * @param allocationModelProvider
 * @param systemModelProvider
 * @param correspondenceModelProvider
 * @throws ConfigurationException
 *             when configuration fails
 */
private void containerManagement(final kieker.common.configuration.Configuration configuration, final IModelProvider<ResourceEnvironment> resourceEnvironmentModelProvider, final IModelProvider<Allocation> allocationModelProvider, final IModelProvider<System> systemModelProvider, final ICorrespondence correspondenceModelProvider) throws ConfigurationException {
    if (configuration.getBooleanProperty(ConfigurationKeys.CONTAINER_MANAGEMENT, false)) {
        /**
         * allocation.
         */
        this.allocationStage = new AllocationStage(resourceEnvironmentModelProvider);
        /**
         * connect ports.
         */
        this.eventDispatcher.registerOutput(IAllocationEvent.class);
        this.connectPorts(this.eventDispatcher.getOutputPort(IAllocationEvent.class), this.allocationStage.getInputPort());
        /**
         * deallocation.
         */
        this.deallocationStage = new DeallocationStage(resourceEnvironmentModelProvider);
        /**
         * connect ports.
         */
        this.eventDispatcher.registerOutput(IDeallocationEvent.class);
        this.connectPorts(this.eventDispatcher.getOutputPort(IDeallocationEvent.class), this.deallocationStage.getInputPort());
        /**
         * deployment.
         */
        this.eventDispatcher.registerOutput(IDeployedEvent.class);
        this.deploymentStage = new DeploymentCompositeStage(resourceEnvironmentModelProvider, allocationModelProvider, systemModelProvider, correspondenceModelProvider);
        /**
         * connect ports.
         */
        this.connectPorts(this.eventDispatcher.getOutputPort(IDeployedEvent.class), this.deploymentStage.getDeployedInputPort());
        /**
         * undeployment.
         */
        this.eventDispatcher.registerOutput(IUndeployedEvent.class);
        this.undeploymentStage = new UndeploymentCompositeStage(resourceEnvironmentModelProvider, allocationModelProvider, systemModelProvider, correspondenceModelProvider);
        /**
         * connect ports.
         */
        this.connectPorts(this.eventDispatcher.getOutputPort(IUndeployedEvent.class), this.undeploymentStage.getUndeployedInputPort());
        /**
         * dependent features.
         */
        this.createContainerManagementSink(configuration);
    }
}
Also used : IDeallocationEvent(org.iobserve.common.record.IDeallocationEvent) UndeploymentCompositeStage(org.iobserve.analysis.deployment.UndeploymentCompositeStage) IUndeployedEvent(org.iobserve.common.record.IUndeployedEvent) AllocationStage(org.iobserve.analysis.deployment.AllocationStage) IAllocationEvent(org.iobserve.common.record.IAllocationEvent) DeploymentCompositeStage(org.iobserve.analysis.deployment.DeploymentCompositeStage) DeallocationStage(org.iobserve.analysis.deployment.DeallocationStage) IDeployedEvent(org.iobserve.common.record.IDeployedEvent)

Example 2 with AllocationStage

use of org.iobserve.analysis.deployment.AllocationStage in project iobserve-analysis by research-iobserve.

the class AnalysisConfiguration method containerManagement.

/**
 * Create all stages necessary for the container management.
 *
 * @param configuration
 *            potential configuration parameter for filters
 * @param resourceEnvironmentModelResource
 * @param systemModelResource
 * @param allocationModelResource
 * @param correspondenceModelResource
 *
 * @throws ConfigurationException
 *             when configuration fails
 */
private void containerManagement(final kieker.common.configuration.Configuration configuration, final Neo4JModelResource<ResourceEnvironment> resourceEnvironmentModelResource, final Neo4JModelResource<System> systemModelResource, final Neo4JModelResource<Allocation> allocationModelResource, final Neo4JModelResource<CorrespondenceModel> correspondenceModelResource) throws ConfigurationException {
    if (configuration.getBooleanProperty(ConfigurationKeys.CONTAINER_MANAGEMENT, false)) {
        /**
         * allocation.
         */
        this.allocationStage = new AllocationStage(resourceEnvironmentModelResource);
        final IEventMatcher<IAllocationEvent> allocationMatcher = new ImplementsEventMatcher<>(IAllocationEvent.class, null);
        /**
         * connect ports.
         */
        this.eventDispatcher.registerOutput(allocationMatcher);
        this.connectPorts(allocationMatcher.getOutputPort(), this.allocationStage.getInputPort());
        /**
         * deallocation.
         */
        this.deallocationStage = new DeallocationStage(resourceEnvironmentModelResource);
        /**
         * connect ports.
         */
        final IEventMatcher<IDeallocationEvent> deallocationMatcher = new ImplementsEventMatcher<>(IDeallocationEvent.class, null);
        this.eventDispatcher.registerOutput(deallocationMatcher);
        this.connectPorts(deallocationMatcher.getOutputPort(), this.deallocationStage.getInputPort());
        /**
         * deployment.
         */
        final IEventMatcher<IDeployedEvent> deployedEventMatcher = new ImplementsEventMatcher<>(IDeployedEvent.class, null);
        this.eventDispatcher.registerOutput(deployedEventMatcher);
        this.deploymentStage = new DeploymentCompositeStage(resourceEnvironmentModelResource, systemModelResource, allocationModelResource, correspondenceModelResource);
        /**
         * connect ports.
         */
        this.connectPorts(deployedEventMatcher.getOutputPort(), this.deploymentStage.getDeployedInputPort());
        /**
         * undeployment.
         */
        final IEventMatcher<IUndeployedEvent> undeployedEventMatcher = new ImplementsEventMatcher<>(IUndeployedEvent.class, null);
        this.eventDispatcher.registerOutput(undeployedEventMatcher);
        this.undeploymentStage = new UndeploymentCompositeStage(resourceEnvironmentModelResource, systemModelResource, allocationModelResource, correspondenceModelResource);
        /**
         * connect ports.
         */
        this.connectPorts(undeployedEventMatcher.getOutputPort(), this.undeploymentStage.getUndeployedInputPort());
        /**
         * dependent features.
         */
        this.createContainerManagementSink(configuration, resourceEnvironmentModelResource, systemModelResource, allocationModelResource);
    }
}
Also used : IDeallocationEvent(org.iobserve.common.record.IDeallocationEvent) ImplementsEventMatcher(org.iobserve.stages.general.ImplementsEventMatcher) IAllocationEvent(org.iobserve.common.record.IAllocationEvent) IDeployedEvent(org.iobserve.common.record.IDeployedEvent) IUndeployedEvent(org.iobserve.common.record.IUndeployedEvent) UndeploymentCompositeStage(org.iobserve.analysis.deployment.UndeploymentCompositeStage) AllocationStage(org.iobserve.analysis.deployment.AllocationStage) DeploymentCompositeStage(org.iobserve.analysis.deployment.DeploymentCompositeStage) DeallocationStage(org.iobserve.analysis.deployment.DeallocationStage)

Example 3 with AllocationStage

use of org.iobserve.analysis.deployment.AllocationStage in project iobserve-analysis by research-iobserve.

the class AllocationNoResourceContainerTest method stubMocksNoResourceContainer.

/**
 * Define the test situation in which a {@link ContainerAllocationEvent} is defined as input and
 * the specified {@link ResourceContainer} does not exist in the {@link ResourceEnvironment}.
 */
@SuppressWarnings("unchecked")
@Before
public void stubMocksNoResourceContainer() {
    /**
     * mock for ResourceEnvironmentModelBuilder
     */
    // use PowerMockito for calling static methods of this final class
    PowerMockito.mockStatic(ResourceEnvironmentModelFactory.class);
    /**
     * mock for new graph provider
     */
    AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider = Mockito.mock(ModelProvider.class);
    this.allocationStage = new AllocationStage(AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider);
    Mockito.when(AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider.readOnlyRootComponent(ResourceEnvironment.class)).thenReturn(ResourceEnvironmentDataFactory.RESOURCE_ENVIRONMENT);
    Mockito.when(ResourceEnvironmentModelFactory.getResourceContainerByName(ResourceEnvironmentDataFactory.RESOURCE_ENVIRONMENT, ImplementationLevelDataFactory.SERVICE)).thenReturn(AllocationNoResourceContainerTest.optTestNullResourceContainer);
    Mockito.when(ResourceEnvironmentModelFactory.createResourceContainer(ResourceEnvironmentDataFactory.RESOURCE_ENVIRONMENT, ImplementationLevelDataFactory.SERVICE)).thenReturn(ResourceEnvironmentDataFactory.RESOURCE_CONTAINER);
    Mockito.doNothing().when(AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider).updateComponent(ResourceEnvironment.class, ResourceEnvironmentDataFactory.RESOURCE_ENVIRONMENT);
}
Also used : ModelProvider(org.iobserve.model.provider.neo4j.ModelProvider) AllocationStage(org.iobserve.analysis.deployment.AllocationStage) Before(org.junit.Before)

Example 4 with AllocationStage

use of org.iobserve.analysis.deployment.AllocationStage in project iobserve-analysis by research-iobserve.

the class AllocationResourceContainerTest method stubMocksResourceContainer.

/**
 * Define the test situation in which a {@link ContainerAllocationEvent} is defined as input and
 * the specified {@link ResourceContainer} does exist in the {@link ResourceEnvironment}.
 */
@SuppressWarnings("unchecked")
@Before
public void stubMocksResourceContainer() {
    /**
     * mock for ResourceEnvironmentModelBuilder
     */
    // use PowerMockito for calling static methods of this final class
    PowerMockito.mockStatic(ResourceEnvironmentModelFactory.class);
    /**
     * mock for new graph provider
     */
    AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider = Mockito.mock(ModelProvider.class);
    this.allocationStage = new AllocationStage(AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider);
    Mockito.when(AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider.readOnlyRootComponent(ResourceEnvironment.class)).thenReturn(ResourceEnvironmentDataFactory.RESOURCE_ENVIRONMENT);
    Mockito.when(ResourceEnvironmentModelFactory.getResourceContainerByName(AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider.readOnlyRootComponent(ResourceEnvironment.class), ImplementationLevelDataFactory.SERVICE)).thenReturn(Optional.of(ResourceEnvironmentDataFactory.RESOURCE_CONTAINER));
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) ModelProvider(org.iobserve.model.provider.neo4j.ModelProvider) AllocationStage(org.iobserve.analysis.deployment.AllocationStage) Before(org.junit.Before)

Example 5 with AllocationStage

use of org.iobserve.analysis.deployment.AllocationStage in project iobserve-analysis by research-iobserve.

the class AllocationResourceContainerTest method stubMocksResourceContainer.

/**
 * Define the test situation in which a {@link ContainerAllocationEvent} is defined as input and
 * the specified {@link ResourceContainer} does exist in the {@link ResourceEnvironment}.
 *
 * @throws DBException
 */
@SuppressWarnings("unchecked")
@Before
public void stubMocksResourceContainer() throws DBException {
    /**
     * mock for ResourceEnvironmentModelBuilder
     */
    // use PowerMockito for calling static methods of this final class
    PowerMockito.mockStatic(ResourceEnvironmentModelFactory.class);
    /**
     * mock for new graph provider
     */
    AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider = Mockito.mock(Neo4JModelResource.class);
    this.allocationStage = new AllocationStage(AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider);
    Mockito.when(AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider.getModelRootNode(ResourceEnvironment.class, ResourceenvironmentPackage.Literals.RESOURCE_ENVIRONMENT)).thenReturn(AllocationResourceContainerTest.resourceEnvironment);
    Mockito.when(ResourceEnvironmentModelFactory.getResourceContainerByName(AllocationResourceContainerTest.mockedResourceEnvironmentModelGraphProvider.getModelRootNode(ResourceEnvironment.class, ResourceenvironmentPackage.Literals.RESOURCE_ENVIRONMENT), ImplementationLevelDataFactory.SERVICE)).thenReturn(Optional.of(AllocationResourceContainerTest.resourceEnvironment.getResourceContainer_ResourceEnvironment().get(0)));
}
Also used : Neo4JModelResource(org.iobserve.model.persistence.neo4j.Neo4JModelResource) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) AllocationStage(org.iobserve.analysis.deployment.AllocationStage) Before(org.junit.Before)

Aggregations

AllocationStage (org.iobserve.analysis.deployment.AllocationStage)6 Before (org.junit.Before)4 DeallocationStage (org.iobserve.analysis.deployment.DeallocationStage)2 DeploymentCompositeStage (org.iobserve.analysis.deployment.DeploymentCompositeStage)2 UndeploymentCompositeStage (org.iobserve.analysis.deployment.UndeploymentCompositeStage)2 IAllocationEvent (org.iobserve.common.record.IAllocationEvent)2 IDeallocationEvent (org.iobserve.common.record.IDeallocationEvent)2 IDeployedEvent (org.iobserve.common.record.IDeployedEvent)2 IUndeployedEvent (org.iobserve.common.record.IUndeployedEvent)2 Neo4JModelResource (org.iobserve.model.persistence.neo4j.Neo4JModelResource)2 ModelProvider (org.iobserve.model.provider.neo4j.ModelProvider)2 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)2 ImplementsEventMatcher (org.iobserve.stages.general.ImplementsEventMatcher)1