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);
}
Aggregations