Search in sources :

Example 1 with DeploymentNode

use of org.iobserve.adaptation.data.graph.DeploymentNode 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 2 with DeploymentNode

use of org.iobserve.adaptation.data.graph.DeploymentNode 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()));
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) DeploymentNode(org.iobserve.adaptation.data.graph.DeploymentNode) DeallocateAction(org.iobserve.planning.systemadaptation.DeallocateAction) AdaptationData(org.iobserve.adaptation.data.AdaptationData) Test(org.junit.Test)

Example 3 with DeploymentNode

use of org.iobserve.adaptation.data.graph.DeploymentNode in project iobserve-analysis by research-iobserve.

the class AdaptationCalculation method compareServers.

private void compareServers(final Set<DeploymentNode> servers) {
    for (final DeploymentNode reDeplServer : servers) {
        if (reDeplServer.getContainingComponents().size() == 0) {
            // If the server dosn't contain any components => IGNORE
            continue;
        }
        final DeploymentNode runServer = this.runtimeDeploymentNodes.get(reDeplServer.getResourceContainerID());
        if (runServer == null) {
            // It is an so far unused server!
            final AllocateAction action = ResourceContainerActionFactory.createAllocateAction(reDeplServer);
            this.rcActions.add(action);
        } else {
            // Server was and is still in use
            this.runtimeDeploymentNodes.remove(runServer.getResourceContainerID(), runServer);
        }
    }
    for (final DeploymentNode runServer : this.runtimeDeploymentNodes.values()) {
        // AssemblyContext does not exist anymore in redeployment model!
        final DeallocateAction action = ResourceContainerActionFactory.createDeallocateAction(runServer);
        this.rcActions.add(action);
    }
}
Also used : DeploymentNode(org.iobserve.adaptation.data.graph.DeploymentNode) DeallocateAction(org.iobserve.planning.systemadaptation.DeallocateAction) AllocateAction(org.iobserve.planning.systemadaptation.AllocateAction)

Example 4 with DeploymentNode

use of org.iobserve.adaptation.data.graph.DeploymentNode 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);
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) ExecutionPlan(org.iobserve.adaptation.executionplan.ExecutionPlan) AllocateNodeAction(org.iobserve.adaptation.executionplan.AllocateNodeAction) DeploymentNode(org.iobserve.adaptation.data.graph.DeploymentNode) ConnectNodeAction(org.iobserve.adaptation.executionplan.ConnectNodeAction) AllocateAction(org.iobserve.planning.systemadaptation.AllocateAction) Test(org.junit.Test)

Example 5 with DeploymentNode

use of org.iobserve.adaptation.data.graph.DeploymentNode in project iobserve-analysis by research-iobserve.

the class ComposedActionComputationTest method testAllocateRule.

/**
 * Test whether the allocation rule succeeds.
 *
 * @throws Exception
 *             on internal errors
 */
@Test
public void testAllocateRule() throws Exception {
    final AdaptationData adaptationData;
    final DeploymentNode redeploymentNode;
    final SystemAdaptation actualOutput;
    final AllocateAction actualAction;
    final AllocateAction expectedAction;
    // Perform allocation
    this.redeploymentModel.allocateResourceContainerR3();
    adaptationData = this.createAdaptationData();
    // Create expected output
    redeploymentNode = this.findDeploymentNodeByID(this.redeploymentModel.getRc3().getId(), adaptationData.getReDeploymentGraph().getServers());
    expectedAction = ResourceContainerActionFactory.createAllocateAction(redeploymentNode);
    // Execute stage
    actualOutput = this.executeStage(adaptationData);
    Assert.assertThat(actualOutput.getActions().size(), Matchers.is(1));
    Assert.assertTrue(actualOutput.getActions().get(0) instanceof AllocateAction);
    actualAction = (AllocateAction) actualOutput.getActions().get(0);
    Assert.assertThat(actualAction.getTargetResourceContainer(), Matchers.is(expectedAction.getTargetResourceContainer()));
    Assert.assertThat(actualAction.getTargetLinkingResources(), Matchers.is(expectedAction.getTargetLinkingResources()));
}
Also used : SystemAdaptation(org.iobserve.planning.systemadaptation.SystemAdaptation) DeploymentNode(org.iobserve.adaptation.data.graph.DeploymentNode) AllocateAction(org.iobserve.planning.systemadaptation.AllocateAction) AdaptationData(org.iobserve.adaptation.data.AdaptationData) Test(org.junit.Test)

Aggregations

DeploymentNode (org.iobserve.adaptation.data.graph.DeploymentNode)5 SystemAdaptation (org.iobserve.planning.systemadaptation.SystemAdaptation)4 Test (org.junit.Test)4 AllocateAction (org.iobserve.planning.systemadaptation.AllocateAction)3 DeallocateAction (org.iobserve.planning.systemadaptation.DeallocateAction)3 AdaptationData (org.iobserve.adaptation.data.AdaptationData)2 ExecutionPlan (org.iobserve.adaptation.executionplan.ExecutionPlan)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