Search in sources :

Example 6 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}.
 *
 * @throws NodeLookupException
 * @throws DBException
 */
@SuppressWarnings("unchecked")
@Before
public void stubMocksNoResourceContainer() throws NodeLookupException, DBException {
    /**
     * 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(Neo4JModelResource.class);
    this.allocationStage = new AllocationStage(AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider);
    Mockito.when(AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider.getModelRootNode(ResourceEnvironment.class, ResourceenvironmentPackage.Literals.RESOURCE_ENVIRONMENT)).thenReturn(AllocationNoResourceContainerTest.resourceEnvironment);
    Mockito.when(ResourceEnvironmentModelFactory.getResourceContainerByName(AllocationNoResourceContainerTest.resourceEnvironment, ImplementationLevelDataFactory.SERVICE)).thenReturn(AllocationNoResourceContainerTest.optTestNullResourceContainer);
    Mockito.when(ResourceEnvironmentModelFactory.createResourceContainer(AllocationNoResourceContainerTest.resourceEnvironment, ImplementationLevelDataFactory.SERVICE)).thenReturn(AllocationNoResourceContainerTest.resourceEnvironment.getResourceContainer_ResourceEnvironment().get(0));
    Mockito.doNothing().when(AllocationNoResourceContainerTest.mockedResourceEnvironmentModelGraphProvider).updatePartition(AllocationNoResourceContainerTest.resourceEnvironment);
}
Also used : Neo4JModelResource(org.iobserve.model.persistence.neo4j.Neo4JModelResource) 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