Search in sources :

Example 1 with DeallocateNodeAction

use of org.iobserve.adaptation.executionplan.DeallocateNodeAction in project iobserve-analysis by research-iobserve.

the class AtomicActionComputationTest method testDeallocateAction2AtomicActions.

/**
 * deallocate action conversion to atomic actions.
 *
 * @throws Exception
 *             on internal errors
 */
@Test
public void testDeallocateAction2AtomicActions() throws Exception {
    final SystemAdaptation systemAdaptationModel = SystemadaptationFactory.eINSTANCE.createSystemAdaptation();
    final ExecutionPlan executionPlan;
    final DeploymentNode runtimeNode;
    final DeallocateAction deallocateAction;
    // Deallocation specific setup ((simulated by an allocation in the runtime model)
    this.runtimeModel.allocateResourceContainerR3();
    this.initializeModelGraphs();
    runtimeNode = this.findDeploymentNodeByID(this.runtimeModel.getRc3().getId(), this.runtimeModelGraph.getServers());
    deallocateAction = ResourceContainerActionFactory.createDeallocateAction(runtimeNode);
    systemAdaptationModel.getActions().add(deallocateAction);
    // Execute stage
    executionPlan = this.executeStage(systemAdaptationModel);
    // Basic verification
    Assert.assertThat(executionPlan.getActions().size(), Matchers.is(2));
    Assert.assertTrue(executionPlan.getActions().get(0) instanceof DisconnectNodeAction);
    Assert.assertTrue(executionPlan.getActions().get(1) instanceof DeallocateNodeAction);
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) ExecutionPlan(org.iobserve.adaptation.executionplan.ExecutionPlan) DeallocateNodeAction(org.iobserve.adaptation.executionplan.DeallocateNodeAction) DeploymentNode(org.iobserve.adaptation.data.graph.DeploymentNode) DeallocateAction(org.iobserve.planning.systemadaptation.DeallocateAction) DisconnectNodeAction(org.iobserve.adaptation.executionplan.DisconnectNodeAction) Test(org.junit.Test)

Aggregations

DeploymentNode (org.iobserve.adaptation.data.graph.DeploymentNode)1 DeallocateNodeAction (org.iobserve.adaptation.executionplan.DeallocateNodeAction)1 DisconnectNodeAction (org.iobserve.adaptation.executionplan.DisconnectNodeAction)1 ExecutionPlan (org.iobserve.adaptation.executionplan.ExecutionPlan)1 DeallocateAction (org.iobserve.planning.systemadaptation.DeallocateAction)1 SystemAdaptation (org.iobserve.planning.systemadaptation.SystemAdaptation)1 Test (org.junit.Test)1