use of org.btrplace.plan.event.Action in project scheduler by btrplace.
the class ActionTest method testBasics.
@Test
public void testBasics() {
Action a1 = new MockAction(new VM(1), 1, 3);
Assert.assertEquals(1, a1.getStart());
Assert.assertEquals(3, a1.getEnd());
Assert.assertTrue(a1.getEvents(Action.Hook.PRE).isEmpty());
Assert.assertTrue(a1.getEvents(Action.Hook.POST).isEmpty());
}
use of org.btrplace.plan.event.Action in project scheduler by btrplace.
the class DefaultReconfigurationPlanTest method testDumb.
@Test
public void testDumb() {
Model mo = new DefaultModel();
VM v = mo.newVM();
Node n1 = mo.newNode();
Node n2 = mo.newNode();
mo.getMapping().addOnlineNode(n1);
mo.getMapping().addOnlineNode(n2);
mo.getMapping().addRunningVM(v, n1);
ReconfigurationPlan p1 = new DefaultReconfigurationPlan(mo);
Action a1 = new SuspendVM(v, n1, n1, 0, 1);
Action a2 = new ShutdownNode(n1, 1, 2);
Action a3 = new ShutdownNode(n2, 1, 2);
Assert.assertTrue(p1.add(a1));
Assert.assertTrue(p1.add(a2));
Assert.assertTrue(p1.add(a3));
Assert.assertTrue(p1.getActions().contains(a1));
Assert.assertTrue(p1.getActions().contains(a2));
Assert.assertTrue(p1.getActions().contains(a3));
}
use of org.btrplace.plan.event.Action in project scheduler by btrplace.
the class DependencyTest method testInstantiation.
@Test
public void testInstantiation() {
Action a = new MockAction(vm, 1, 4);
Set<Action> d = new HashSet<>();
d.add(new MockAction(vm, 2, 5));
d.add(new MockAction(vm, 3, 7));
Dependency dep = new Dependency(a, d);
Assert.assertEquals(dep.getAction(), a);
Assert.assertEquals(dep.getDependencies(), d);
Assert.assertFalse(dep.toString().contains("null"));
}
use of org.btrplace.plan.event.Action in project scheduler by btrplace.
the class TimedBasedActionComparatorTest method testOverlap1.
@Test
public void testOverlap1() {
Action a = new MockAction(vm, 0, 4);
Action b = new MockAction(vm, 2, 4);
Assert.assertTrue(startCmp.compare(a, b) < 0);
Assert.assertTrue(stopCmp.compare(a, b) < 0);
}
use of org.btrplace.plan.event.Action in project scheduler by btrplace.
the class DefaultReconfigurationPlan method toString.
@Override
public String toString() {
List<Action> l = new ArrayList<>(actions);
Collections.sort(l, sorter);
StringJoiner joiner = new StringJoiner("\n");
for (Action a : l) {
joiner.add(String.format("%d:%d %s", a.getStart(), a.getEnd(), a.toString()));
}
return joiner.toString();
}
Aggregations