use of org.btrplace.model.Model in project scheduler by btrplace.
the class ReadyTest method testReady.
@Test
public void testReady() {
Model mo = new DefaultModel();
List<VM> vms = Util.newVMs(mo, 5);
List<Ready> c = Ready.newReady(vms);
Assert.assertEquals(vms.size(), c.size());
c.stream().forEach((q) -> {
Assert.assertTrue(vms.containsAll(q.getInvolvedVMs()));
Assert.assertFalse(q.isContinuous());
});
}
use of org.btrplace.model.Model in project scheduler by btrplace.
the class ReadyTest method testEquals.
@Test
public void testEquals() {
Model mo = new DefaultModel();
VM v = mo.newVM();
Ready s = new Ready(v);
Assert.assertTrue(s.equals(s));
Assert.assertTrue(new Ready(v).equals(s));
Assert.assertEquals(new Ready(v).hashCode(), s.hashCode());
Assert.assertFalse(new Ready(mo.newVM()).equals(s));
}
use of org.btrplace.model.Model in project scheduler by btrplace.
the class RootTest method testRoots.
@Test
public void testRoots() {
Model mo = new DefaultModel();
List<VM> vms = Util.newVMs(mo, 5);
List<Root> rs = Root.newRoots(vms);
Assert.assertEquals(rs.size(), vms.size());
rs.stream().forEach((q) -> {
Assert.assertTrue(vms.containsAll(q.getInvolvedVMs()));
Assert.assertTrue(q.isContinuous());
});
}
use of org.btrplace.model.Model in project scheduler by btrplace.
the class RootTest method testInstantiation.
@Test
public void testInstantiation() {
Model mo = new DefaultModel();
VM v = mo.newVM();
Root s = new Root(v);
Assert.assertNotNull(s.getChecker());
Assert.assertEquals(s.getInvolvedVMs().iterator().next(), v);
Assert.assertTrue(s.getInvolvedNodes().isEmpty());
Assert.assertNotNull(s.toString());
System.out.println(s);
Assert.assertTrue(s.isContinuous());
Assert.assertFalse(s.setContinuous(false));
Assert.assertTrue(s.isContinuous());
Assert.assertTrue(s.setContinuous(true));
Assert.assertTrue(s.isContinuous());
}
use of org.btrplace.model.Model in project scheduler by btrplace.
the class RunningTest method testIsSatisfied.
@Test
public void testIsSatisfied() {
Model i = new DefaultModel();
VM vm = i.newVM();
List<Node> ns = Util.newNodes(i, 2);
Mapping c = i.getMapping();
c.addOnlineNode(ns.get(0));
c.addRunningVM(vm, ns.get(0));
Running d = new Running(vm);
Assert.assertEquals(d.isSatisfied(i), true);
c.addReadyVM(vm);
Assert.assertEquals(d.isSatisfied(i), false);
c.addSleepingVM(vm, ns.get(0));
Assert.assertEquals(d.isSatisfied(i), false);
c.remove(vm);
Assert.assertEquals(d.isSatisfied(i), false);
}
Aggregations