use of org.btrplace.btrpsl.ScriptBuilder 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.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class SplitAmongBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodSplitAmongs")
public void testGoodSignatures(String str, int nbVGrp, int nbVMs, int nbPGrp, int nbNodes) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
SplitAmong x = (SplitAmong) b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str).getConstraints().iterator().next();
Assert.assertEquals(x.getGroupsOfVMs().size(), nbVGrp);
Assert.assertEquals(x.getInvolvedVMs().size(), nbVMs);
Assert.assertEquals(x.getGroupsOfNodes().size(), nbPGrp);
Assert.assertEquals(x.getInvolvedNodes().size(), nbNodes);
Assert.assertEquals(x.isContinuous(), !str.startsWith(">>"));
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class SpreadBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodSpreads")
public void testGoodSignatures(String str, int nbVMs) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Spread x = (Spread) b.build("namespace test; VM[1..10] : tiny;\n" + str).getConstraints().iterator().next();
Assert.assertEquals(x.getInvolvedVMs().size(), nbVMs);
Assert.assertEquals(x.isContinuous(), !str.startsWith(">>"));
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class AmongBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodAmongs")
public void testGoodSignatures(String str, int nbVMs, int nbNs1, int nbNs2, boolean c) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n@N[1..10] : defaultNode;\n" + str).getConstraints();
Assert.assertEquals(cstrs.size(), 1);
Among x = (Among) cstrs.iterator().next();
Assert.assertEquals(x.getGroupsOfNodes().iterator().next().size(), nbNs1);
Assert.assertEquals(x.getInvolvedNodes().size(), nbNs1 + nbNs2);
Assert.assertEquals(x.getInvolvedVMs().size(), nbVMs);
Assert.assertEquals(x.isContinuous(), c);
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class FenceBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodFences")
public void testGoodSignatures(String str, int nbVMs, int nbNodes, 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;\n" + str).getConstraints();
Assert.assertEquals(cstrs.size(), nbVMs);
Set<VM> vms = new HashSet<>();
for (SatConstraint x : cstrs) {
Assert.assertTrue(x instanceof Fence);
Assert.assertEquals(x.getInvolvedNodes().size(), nbNodes);
Assert.assertTrue(vms.addAll(x.getInvolvedVMs()));
Assert.assertEquals(x.isContinuous(), c);
}
}
Aggregations