Search in sources :

Example 91 with DefaultModel

use of org.btrplace.model.DefaultModel 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(">>"));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) SplitAmong(org.btrplace.model.constraint.SplitAmong) ScriptBuilder(org.btrplace.btrpsl.ScriptBuilder) Test(org.testng.annotations.Test)

Example 92 with DefaultModel

use of org.btrplace.model.DefaultModel 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(">>"));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Spread(org.btrplace.model.constraint.Spread) ScriptBuilder(org.btrplace.btrpsl.ScriptBuilder) Test(org.testng.annotations.Test)

Example 93 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpNumberTest method testNonViableGt.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViableGt() {
    BtrpNumber i = new BtrpNumber(5, BtrpNumber.Base.BASE_16);
    Model mo = new DefaultModel();
    BtrpElement j = new BtrpElement(BtrpOperand.Type.VM, "foo", mo.newVM());
    i.gt(j);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 94 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpNumberTest method testNonViableDiv.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViableDiv() {
    BtrpNumber i = new BtrpNumber(5, BtrpNumber.Base.BASE_16);
    Model mo = new DefaultModel();
    BtrpElement j = new BtrpElement(BtrpOperand.Type.VM, "foo", mo.newVM());
    i.div(j);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 95 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpNumberTest method testNonViableAddition.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViableAddition() {
    BtrpNumber i = new BtrpNumber(5, BtrpNumber.Base.BASE_16);
    Model mo = new DefaultModel();
    BtrpElement j = new BtrpElement(BtrpOperand.Type.VM, "foo", mo.newVM());
    i.plus(j);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Aggregations

DefaultModel (org.btrplace.model.DefaultModel)201 Test (org.testng.annotations.Test)177 Model (org.btrplace.model.Model)157 Node (org.btrplace.model.Node)91 VM (org.btrplace.model.VM)91 HashSet (java.util.HashSet)48 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)43 SatConstraint (org.btrplace.model.constraint.SatConstraint)40 Mapping (org.btrplace.model.Mapping)39 ArrayList (java.util.ArrayList)26 ShareableResource (org.btrplace.model.view.ShareableResource)24 ScriptBuilder (org.btrplace.btrpsl.ScriptBuilder)22 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)18 BootableNode (org.btrplace.scheduler.choco.transition.BootableNode)17 ShutdownableNode (org.btrplace.scheduler.choco.transition.ShutdownableNode)17 MigrateVM (org.btrplace.plan.event.MigrateVM)16 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)16 BootVM (org.btrplace.scheduler.choco.transition.BootVM)16 ForgeVM (org.btrplace.scheduler.choco.transition.ForgeVM)16 KillVM (org.btrplace.scheduler.choco.transition.KillVM)16