use of org.iobserve.planning.systemadaptation.SystemAdaptation 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.planning.systemadaptation.SystemAdaptation 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.planning.systemadaptation.SystemAdaptation 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.planning.systemadaptation.SystemAdaptation in project iobserve-analysis by research-iobserve.
the class ComposedActionComputationTest method testChangeRepositoryRule.
/**
* Test change repository rule.
*
* @throws Exception
* on internal errors.
*/
@Test
public void testChangeRepositoryRule() throws Exception {
final AdaptationData adaptationData;
final ComponentNode runtimeNode;
final ComponentNode redeploymentNode;
final SystemAdaptation actualOutput;
final ChangeRepositoryComponentAction actualAction;
final ChangeRepositoryComponentAction expectedAction;
// Perform change of component
this.redeploymentModel.changeRepositoryCompBxToCompBy();
adaptationData = this.createAdaptationData();
// Create expected output
runtimeNode = this.findComponentNodeByID(this.runtimeModel.getAlcxtBRc1().getId(), adaptationData.getRuntimeGraph().getComponents());
redeploymentNode = this.findComponentNodeByID(this.redeploymentModel.getAlcxtBRc1().getId(), adaptationData.getReDeploymentGraph().getComponents());
expectedAction = AssemblyContextActionFactory.generateChangeRepositoryComponentAction(runtimeNode, redeploymentNode);
// Execute stage
actualOutput = this.executeStage(adaptationData);
Assert.assertThat(actualOutput.getActions().size(), Matchers.is(1));
Assert.assertTrue(actualOutput.getActions().get(0) instanceof ChangeRepositoryComponentAction);
actualAction = (ChangeRepositoryComponentAction) actualOutput.getActions().get(0);
Assert.assertThat(actualAction.getTargetAllocationContext(), Matchers.is(expectedAction.getTargetAllocationContext()));
Assert.assertThat(actualAction.getTargetProvidingAllocationContexts(), Matchers.is(expectedAction.getTargetProvidingAllocationContexts()));
Assert.assertThat(actualAction.getTargetRequiringAllocationContexts(), Matchers.is(expectedAction.getTargetRequiringAllocationContexts()));
Assert.assertThat(actualAction.getSourceAllocationContext(), Matchers.is(expectedAction.getSourceAllocationContext()));
}
use of org.iobserve.planning.systemadaptation.SystemAdaptation in project iobserve-analysis by research-iobserve.
the class ComposedActionComputationTest method testDeallocateRule.
/**
* Test whether the de-allocation rule succeeds.
*
* @throws Exception
* on internal errors
*/
@Test
public void testDeallocateRule() throws Exception {
final AdaptationData adaptationData;
final DeploymentNode runtimeNode;
final SystemAdaptation actualOutput;
final DeallocateAction actualAction;
final DeallocateAction expectedAction;
// Perform deallocation (simulated by an allocation in the runtime model)
this.runtimeModel.allocateResourceContainerR3();
adaptationData = this.createAdaptationData();
// Create expected output
runtimeNode = this.findDeploymentNodeByID(this.runtimeModel.getRc3().getId(), adaptationData.getRuntimeGraph().getServers());
expectedAction = ResourceContainerActionFactory.createDeallocateAction(runtimeNode);
// Execute stage
actualOutput = this.executeStage(adaptationData);
Assert.assertThat(actualOutput.getActions().size(), Matchers.is(1));
Assert.assertTrue(actualOutput.getActions().get(0) instanceof DeallocateAction);
actualAction = (DeallocateAction) actualOutput.getActions().get(0);
Assert.assertThat(actualAction.getTargetResourceContainer(), Matchers.is(expectedAction.getTargetResourceContainer()));
Assert.assertThat(actualAction.getTargetLinkingResources(), Matchers.is(expectedAction.getTargetLinkingResources()));
}
Aggregations