use of org.iobserve.planning.systemadaptation.SystemAdaptation in project iobserve-analysis by research-iobserve.
the class ComposedActionComputationTest method testDereplicationRule.
/**
* Test de-replication.
*
* @throws Exception
* on internal errors
*/
@Test
public void testDereplicationRule() throws Exception {
final AdaptationData adaptationData;
final ComponentNode runtimeNode;
final SystemAdaptation actualOutput;
final DereplicateAction actualAction;
final DereplicateAction expectedAction;
// Perform dereplication (simulated by replicating a component in the runtime model)
this.runtimeModel.replicateCompBToRc2();
adaptationData = this.createAdaptationData();
// Create expected output
runtimeNode = this.findComponentNodeByID(this.runtimeModel.getAlcxtBRc2().getId(), adaptationData.getRuntimeGraph().getComponents());
expectedAction = AssemblyContextActionFactory.generateDereplicateAction(runtimeNode);
// Execute stage
actualOutput = this.executeStage(adaptationData);
Assert.assertThat(actualOutput.getActions().size(), Matchers.is(1));
Assert.assertTrue(actualOutput.getActions().get(0) instanceof DereplicateAction);
actualAction = (DereplicateAction) 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()));
}
use of org.iobserve.planning.systemadaptation.SystemAdaptation 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);
}
use of org.iobserve.planning.systemadaptation.SystemAdaptation in project iobserve-analysis by research-iobserve.
the class AtomicActionComputationTest method testAllocateAction2AtomicActions.
/**
* allocate action conversion to atomic actions.
*
* @throws Exception
* on internal errors
*/
@Test
public void testAllocateAction2AtomicActions() throws Exception {
final SystemAdaptation systemAdaptationModel = SystemadaptationFactory.eINSTANCE.createSystemAdaptation();
final ExecutionPlan executionPlan;
final DeploymentNode redeploymentNode;
final AllocateAction allocateAction;
// Allocation specific setup
this.redeploymentModel.allocateResourceContainerR3();
this.initializeModelGraphs();
redeploymentNode = this.findDeploymentNodeByID(this.redeploymentModel.getRc3().getId(), this.redeploymentModelGraph.getServers());
allocateAction = ResourceContainerActionFactory.createAllocateAction(redeploymentNode);
systemAdaptationModel.getActions().add(allocateAction);
// Execute stage
executionPlan = this.executeStage(systemAdaptationModel);
// Basic verification
Assert.assertThat(executionPlan.getActions().size(), Matchers.is(2));
Assert.assertTrue(executionPlan.getActions().get(0) instanceof AllocateNodeAction);
Assert.assertTrue(executionPlan.getActions().get(1) instanceof ConnectNodeAction);
}
use of org.iobserve.planning.systemadaptation.SystemAdaptation in project iobserve-analysis by research-iobserve.
the class AtomicActionComputationTest method testChangeComponent2AtomicActions.
/**
* Replace component action conversion to atomic actions.
*
* @throws Exception
* on internal errors
*/
@Test
public void testChangeComponent2AtomicActions() throws Exception {
final SystemAdaptation systemAdaptationModel = SystemadaptationFactory.eINSTANCE.createSystemAdaptation();
final ExecutionPlan executionPlan;
final ComponentNode runtimeNode;
final ComponentNode redeploymentNode;
final ChangeRepositoryComponentAction changeComponentAction;
// Change component specific setup
this.redeploymentModel.changeRepositoryCompBxToCompBy();
this.initializeModelGraphs();
runtimeNode = this.findComponentNodeByID(this.runtimeModel.getAlcxtBRc1().getId(), this.runtimeModelGraph.getComponents());
redeploymentNode = this.findComponentNodeByID(this.redeploymentModel.getAlcxtBRc1().getId(), this.redeploymentModelGraph.getComponents());
changeComponentAction = AssemblyContextActionFactory.generateChangeRepositoryComponentAction(runtimeNode, redeploymentNode);
systemAdaptationModel.getActions().add(changeComponentAction);
// Execute stage
executionPlan = this.executeStage(systemAdaptationModel);
// Basic verification
Assert.assertThat(executionPlan.getActions().size(), Matchers.is(7));
Assert.assertTrue(executionPlan.getActions().get(0) instanceof DeployComponentAction);
Assert.assertTrue(executionPlan.getActions().get(1) instanceof MigrateComponentStateAction);
Assert.assertTrue(executionPlan.getActions().get(2) instanceof ConnectComponentAction);
Assert.assertTrue(executionPlan.getActions().get(3) instanceof BlockRequestsToComponentAction);
Assert.assertTrue(executionPlan.getActions().get(4) instanceof FinishComponentAction);
Assert.assertTrue(executionPlan.getActions().get(5) instanceof DisconnectComponentAction);
Assert.assertTrue(executionPlan.getActions().get(6) instanceof UndeployComponentAction);
}
use of org.iobserve.planning.systemadaptation.SystemAdaptation in project iobserve-analysis by research-iobserve.
the class AtomicActionComputationTest method testMigrateAction2AtomicActions.
/**
* migrate action conversion to atomic actions.
*
* @throws Exception
* on internal errors
*/
@Test
public void testMigrateAction2AtomicActions() throws Exception {
final SystemAdaptation systemAdaptationModel = SystemadaptationFactory.eINSTANCE.createSystemAdaptation();
final ExecutionPlan executionPlan;
final ComponentNode runtimeNode;
final ComponentNode redeploymentNode;
final MigrateAction migrateAction;
// Migration specific setup
this.redeploymentModel.migrateCompBToRc2();
this.initializeModelGraphs();
runtimeNode = this.findComponentNodeByID(this.runtimeModel.getAlcxtBRc1().getId(), this.runtimeModelGraph.getComponents());
redeploymentNode = this.findComponentNodeByID(this.redeploymentModel.getAlcxtBRc1().getId(), this.redeploymentModelGraph.getComponents());
migrateAction = AssemblyContextActionFactory.generateMigrateAction(runtimeNode, redeploymentNode);
systemAdaptationModel.getActions().add(migrateAction);
// Execute stage
executionPlan = this.executeStage(systemAdaptationModel);
// Basic verification
Assert.assertThat(executionPlan.getActions().size(), Matchers.is(7));
Assert.assertTrue(executionPlan.getActions().get(0) instanceof DeployComponentAction);
Assert.assertTrue(executionPlan.getActions().get(1) instanceof MigrateComponentStateAction);
Assert.assertTrue(executionPlan.getActions().get(2) instanceof ConnectComponentAction);
Assert.assertTrue(executionPlan.getActions().get(3) instanceof BlockRequestsToComponentAction);
Assert.assertTrue(executionPlan.getActions().get(4) instanceof FinishComponentAction);
Assert.assertTrue(executionPlan.getActions().get(5) instanceof DisconnectComponentAction);
Assert.assertTrue(executionPlan.getActions().get(6) instanceof UndeployComponentAction);
}
Aggregations