Search in sources :

Example 61 with DefaultModel

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

the class QuarantineConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model mo = new DefaultModel();
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new QuarantineConverter());
    Quarantine d = new Quarantine(mo.newNode());
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(d)), d);
    System.out.println(conv.toJSON(d));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Quarantine(org.btrplace.model.constraint.Quarantine) Test(org.testng.annotations.Test)

Example 62 with DefaultModel

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

the class ResourceCapacityConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new ResourceCapacityConverter());
    Model mo = new DefaultModel();
    ResourceCapacity d = new ResourceCapacity(new HashSet<>(Arrays.asList(mo.newNode(), mo.newNode(), mo.newNode())), "cpu", 5, false);
    ResourceCapacity c = new ResourceCapacity(new HashSet<>(Arrays.asList(mo.newNode(), mo.newNode())), "mem", 5, true);
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(d)), d);
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(c)), c);
    System.out.println(conv.toJSON(d));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) ResourceCapacity(org.btrplace.model.constraint.ResourceCapacity) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 63 with DefaultModel

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

the class RunningCapacityConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new RunningCapacityConverter());
    Model mo = new DefaultModel();
    RunningCapacity d = new RunningCapacity(new HashSet<>(Arrays.asList(mo.newNode(), mo.newNode(), mo.newNode())), 5, false);
    RunningCapacity c = new RunningCapacity(new HashSet<>(Arrays.asList(mo.newNode(), mo.newNode())), 5, true);
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(d)), d);
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(c)), c);
    System.out.println(conv.toJSON(d));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) RunningCapacity(org.btrplace.model.constraint.RunningCapacity) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 64 with DefaultModel

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

the class RunningConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model mo = new DefaultModel();
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new RunningConverter());
    Running d = new Running(mo.newVM());
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(d)), d);
    System.out.println(conv.toJSON(d));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Running(org.btrplace.model.constraint.Running) Test(org.testng.annotations.Test)

Example 65 with DefaultModel

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

the class SeqConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model mo = new DefaultModel();
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new SeqConverter());
    Seq d = new Seq(Arrays.asList(mo.newVM(), mo.newVM(), mo.newVM()));
    Seq c = new Seq(Arrays.asList(mo.newVM(), mo.newVM(), mo.newVM()));
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(d)), d);
    Assert.assertEquals(conv.fromJSON(mo, conv.toJSON(c)), c);
    System.out.println(conv.toJSON(d));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Seq(org.btrplace.model.constraint.Seq) 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