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