use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class RootBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodRoots")
public void testGoodSignatures(String str, int nbVMs) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n" + str).getConstraints();
Assert.assertEquals(cstrs.size(), nbVMs);
Set<VM> vms = new HashSet<>();
for (SatConstraint x : cstrs) {
Assert.assertTrue(x instanceof Root);
Assert.assertTrue(vms.addAll(x.getInvolvedVMs()));
Assert.assertEquals(x.isContinuous(), true);
}
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class RunningCapacityBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodCapacities")
public void testGoodSignatures(String str, int nbNodes, int capa, 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(), 1);
RunningCapacity x = (RunningCapacity) cstrs.iterator().next();
Assert.assertEquals(x.getInvolvedNodes().size(), nbNodes);
Assert.assertEquals(x.getAmount(), capa);
Assert.assertEquals(x.isContinuous(), c);
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class SplitBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodSplits")
public void testGoodSignatures(String str, int nbVMs1, int nbVMs2) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Split x = (Split) b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str).getConstraints().iterator().next();
Assert.assertEquals(x.getInvolvedVMs().size(), nbVMs2 + nbVMs1);
Assert.assertEquals(x.isContinuous(), !str.startsWith(">>"));
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class LonelyBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodLonelys")
public void testGoodSignatures(String str, int nbVMs, boolean c) throws Exception {
ScriptBuilder b = new ScriptBuilder(new DefaultModel());
Lonely x = (Lonely) b.build("namespace test; VM[1..10] : tiny;\n" + str).getConstraints().iterator().next();
Assert.assertEquals(x.getInvolvedVMs().size(), nbVMs);
Assert.assertEquals(x.isContinuous(), c);
}
use of org.btrplace.btrpsl.ScriptBuilder in project scheduler by btrplace.
the class OnlineBuilderTest method testGoodSignatures.
@Test(dataProvider = "goodOnlines")
public void testGoodSignatures(String str, 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(), nbNodes);
Set<Node> nodes = new HashSet<>();
for (SatConstraint x : cstrs) {
Assert.assertTrue(nodes.addAll(x.getInvolvedNodes()));
Assert.assertEquals(x.getInvolvedNodes().size(), 1);
Assert.assertEquals(x.isContinuous(), c);
}
}
Aggregations