Search in sources :

Example 1 with ExecutionPlan

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

the class AtomicActionComputationTest method executeStage.

private ExecutionPlan executeStage(final SystemAdaptation systemAdaptationModel) {
    final InitialElementProducer<SystemAdaptation> producer = new InitialElementProducer<>(systemAdaptationModel);
    final AtomicActionComputation atomicActionComputation = new AtomicActionComputation();
    final CollectorSink<ExecutionPlan> collector = new CollectorSink<>();
    final AtomicActionComputationTestConfig configuration = new AtomicActionComputationTestConfig(producer, atomicActionComputation, collector);
    final Execution<AtomicActionComputationTestConfig> execution = new Execution<>(configuration);
    execution.executeBlocking();
    return collector.getElements().get(0);
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) InitialElementProducer(teetime.stage.InitialElementProducer) ExecutionPlan(org.iobserve.adaptation.executionplan.ExecutionPlan) Execution(teetime.framework.Execution) CollectorSink(teetime.stage.CollectorSink) AtomicActionComputation(org.iobserve.adaptation.stages.AtomicActionComputation)

Example 2 with ExecutionPlan

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

the class AtomicActionComputationTest method testReplicateAction2AtomicActions.

/**
 * replicate action conversion to atomic actions.
 *
 * @throws Exception
 *             on internal errors
 */
@Test
public void testReplicateAction2AtomicActions() throws Exception {
    final SystemAdaptation systemAdaptationModel = SystemadaptationFactory.eINSTANCE.createSystemAdaptation();
    final ExecutionPlan executionPlan;
    final ComponentNode runtimeNode;
    final ComponentNode redeploymentNode;
    final ReplicateAction replicateAction;
    // Replication specific setup
    this.redeploymentModel.replicateCompBToRc2();
    this.initializeModelGraphs();
    runtimeNode = this.findComponentNodeByID(this.runtimeModel.getAlcxtBRc1().getId(), this.runtimeModelGraph.getComponents());
    redeploymentNode = this.findComponentNodeByID(this.redeploymentModel.getAlcxtBRc2().getId(), this.redeploymentModelGraph.getComponents());
    replicateAction = AssemblyContextActionFactory.generateReplicateAction(runtimeNode, redeploymentNode);
    systemAdaptationModel.getActions().add(replicateAction);
    // Execute stage
    executionPlan = this.executeStage(systemAdaptationModel);
    // Basic verification
    Assert.assertThat(executionPlan.getActions().size(), Matchers.is(3));
    Assert.assertTrue(executionPlan.getActions().get(0) instanceof DeployComponentAction);
    Assert.assertTrue(executionPlan.getActions().get(1) instanceof MigrateComponentStateAction);
    Assert.assertTrue(executionPlan.getActions().get(2) instanceof ConnectComponentAction);
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) ExecutionPlan(org.iobserve.adaptation.executionplan.ExecutionPlan) MigrateComponentStateAction(org.iobserve.adaptation.executionplan.MigrateComponentStateAction) ConnectComponentAction(org.iobserve.adaptation.executionplan.ConnectComponentAction) ComponentNode(org.iobserve.adaptation.data.graph.ComponentNode) ReplicateAction(org.iobserve.planning.systemadaptation.ReplicateAction) DeployComponentAction(org.iobserve.adaptation.executionplan.DeployComponentAction) Test(org.junit.Test)

Example 3 with ExecutionPlan

use of org.iobserve.adaptation.executionplan.ExecutionPlan 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)

Example 4 with ExecutionPlan

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

the class ExecutionPlanDeserialization method execute.

@Override
protected void execute(final File executionPlanFile) throws Exception {
    final ExecutionPlan executionPlan = new FileModelHandler<ExecutionPlan>(this.resouceSet, ExecutionplanPackage.eINSTANCE).load(URI.createFileURI(executionPlanFile.getAbsolutePath()));
    this.outputPort.send(executionPlan);
}
Also used : ExecutionPlan(org.iobserve.adaptation.executionplan.ExecutionPlan)

Example 5 with ExecutionPlan

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

the class AtomicActionComputationTest method testDereplicateAction2AtomicActions.

/**
 * dereplicate action conversion to atomic actions.
 *
 * @throws Exception
 *             on internal errors
 */
@Test
public void testDereplicateAction2AtomicActions() throws Exception {
    final SystemAdaptation systemAdaptationModel = SystemadaptationFactory.eINSTANCE.createSystemAdaptation();
    final ExecutionPlan executionPlan;
    final ComponentNode runtimeNode;
    final DereplicateAction dereplicateAction;
    // Dereplication specific setup (simulated by replicating a component in the runtime model)
    this.runtimeModel.replicateCompBToRc2();
    this.initializeModelGraphs();
    runtimeNode = this.findComponentNodeByID(this.runtimeModel.getAlcxtBRc1().getId(), this.runtimeModelGraph.getComponents());
    dereplicateAction = AssemblyContextActionFactory.generateDereplicateAction(runtimeNode);
    systemAdaptationModel.getActions().add(dereplicateAction);
    // Execute stage
    executionPlan = this.executeStage(systemAdaptationModel);
    // Basic verification
    Assert.assertThat(executionPlan.getActions().size(), Matchers.is(4));
    Assert.assertTrue(executionPlan.getActions().get(0) instanceof BlockRequestsToComponentAction);
    Assert.assertTrue(executionPlan.getActions().get(1) instanceof FinishComponentAction);
    Assert.assertTrue(executionPlan.getActions().get(2) instanceof DisconnectComponentAction);
    Assert.assertTrue(executionPlan.getActions().get(3) instanceof UndeployComponentAction);
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) ExecutionPlan(org.iobserve.adaptation.executionplan.ExecutionPlan) UndeployComponentAction(org.iobserve.adaptation.executionplan.UndeployComponentAction) DereplicateAction(org.iobserve.planning.systemadaptation.DereplicateAction) BlockRequestsToComponentAction(org.iobserve.adaptation.executionplan.BlockRequestsToComponentAction) FinishComponentAction(org.iobserve.adaptation.executionplan.FinishComponentAction) DisconnectComponentAction(org.iobserve.adaptation.executionplan.DisconnectComponentAction) ComponentNode(org.iobserve.adaptation.data.graph.ComponentNode) Test(org.junit.Test)

Aggregations

ExecutionPlan (org.iobserve.adaptation.executionplan.ExecutionPlan)8 SystemAdaptation (org.iobserve.planning.systemadaptation.SystemAdaptation)7 Test (org.junit.Test)6 ComponentNode (org.iobserve.adaptation.data.graph.ComponentNode)4 BlockRequestsToComponentAction (org.iobserve.adaptation.executionplan.BlockRequestsToComponentAction)3 ConnectComponentAction (org.iobserve.adaptation.executionplan.ConnectComponentAction)3 DeployComponentAction (org.iobserve.adaptation.executionplan.DeployComponentAction)3 DisconnectComponentAction (org.iobserve.adaptation.executionplan.DisconnectComponentAction)3 FinishComponentAction (org.iobserve.adaptation.executionplan.FinishComponentAction)3 MigrateComponentStateAction (org.iobserve.adaptation.executionplan.MigrateComponentStateAction)3 UndeployComponentAction (org.iobserve.adaptation.executionplan.UndeployComponentAction)3 DeploymentNode (org.iobserve.adaptation.data.graph.DeploymentNode)2 AllocateNodeAction (org.iobserve.adaptation.executionplan.AllocateNodeAction)1 ConnectNodeAction (org.iobserve.adaptation.executionplan.ConnectNodeAction)1 DeallocateNodeAction (org.iobserve.adaptation.executionplan.DeallocateNodeAction)1 DisconnectNodeAction (org.iobserve.adaptation.executionplan.DisconnectNodeAction)1 AtomicActionComputation (org.iobserve.adaptation.stages.AtomicActionComputation)1 AllocateAction (org.iobserve.planning.systemadaptation.AllocateAction)1 ChangeRepositoryComponentAction (org.iobserve.planning.systemadaptation.ChangeRepositoryComponentAction)1 DeallocateAction (org.iobserve.planning.systemadaptation.DeallocateAction)1