use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class ResourceCapacityBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodResources")
public void testGoodSignatures(String str, int nbNodes, String rcId, int capa, boolean c) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
ResourceCapacity x = (ResourceCapacity) b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str).getConstraints().iterator().next();
Assert.assertEquals(x.getInvolvedNodes().size(), nbNodes);
Assert.assertEquals(x.getResource(), rcId);
Assert.assertEquals(x.getAmount(), capa);
Assert.assertEquals(x.isContinuous(), c);
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class RunningBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodRunnings")
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 Running);
Assert.assertTrue(vms.addAll(x.getInvolvedVMs()));
Assert.assertEquals(x.isContinuous(), c);
}
}
Aggregations