use of org.btrplace.model.DefaultModel in project scheduler by btrplace.
the class PreserveBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodPreserves")
public void testGoodSignatures(String str, int nbVMs, String rcId, int a) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str).getConstraints();
Assert.assertEquals(cstrs.size(), nbVMs);
Set<VM> vms = new HashSet<>();
for (SatConstraint x : cstrs) {
Assert.assertTrue(x instanceof Preserve);
Assert.assertTrue(vms.addAll(x.getInvolvedVMs()));
Assert.assertEquals(x.isContinuous(), false);
Assert.assertEquals(((Preserve) x).getResource(), rcId);
Assert.assertEquals(((Preserve) x).getAmount(), a);
}
}
use of org.btrplace.model.DefaultModel in project scheduler by btrplace.
the class QuarantineBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodQuarantines")
public void testGoodSignatures(String str, int nbNodes) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str).getConstraints();
Assert.assertEquals(cstrs.size(), nbNodes);
Set<Node> nodes = new HashSet<>();
for (SatConstraint x : cstrs) {
Assert.assertTrue(x instanceof Quarantine);
Assert.assertTrue(nodes.addAll(x.getInvolvedNodes()));
}
}
use of org.btrplace.model.DefaultModel in project scheduler by btrplace.
the class ReadyBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodReadys")
public void testGoodSignatures(String str, int nbVMs, boolean c) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;" + str).getConstraints();
Assert.assertEquals(cstrs.size(), nbVMs);
Set<VM> vms = new HashSet<>();
for (SatConstraint x : cstrs) {
Assert.assertTrue(x instanceof Ready);
Assert.assertTrue(vms.addAll(x.getInvolvedVMs()));
Assert.assertEquals(x.isContinuous(), c);
}
}
use of org.btrplace.model.DefaultModel in project scheduler by btrplace.
the class SeqBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodseqs")
public void testGoodSignatures(String str, int nbVMs) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Seq x = (Seq) b.build("namespace test; VM[1..10] : tiny;\n" + str).getConstraints().iterator().next();
Assert.assertEquals(x.getInvolvedVMs().size(), nbVMs);
Assert.assertEquals(x.isContinuous(), true);
}
use of org.btrplace.model.DefaultModel in project scheduler by btrplace.
the class SleepingBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodsleepings")
public void testGoodSignatures(String str, int nbVMs, boolean c) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;" + str).getConstraints();
Set<VM> vms = new HashSet<>();
Assert.assertEquals(cstrs.size(), nbVMs);
for (SatConstraint x : cstrs) {
Assert.assertTrue(x instanceof Sleeping);
Assert.assertTrue(vms.addAll(x.getInvolvedVMs()));
Assert.assertEquals(x.isContinuous(), c);
}
}
Aggregations