Search in sources :

Example 66 with DefaultModel

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

the class SleepingConverterTest method testViables.

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

Example 67 with DefaultModel

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

the class DeadlineConverterTest method testViables.

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

Example 68 with DefaultModel

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

the class PrecedenceConverterTest method testViables.

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

Example 69 with DefaultModel

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

the class SyncConverterTest method testViables.

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

Example 70 with DefaultModel

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

the class NamingServiceConverterTest method test.

@Test
public void test() throws JSONConverterException {
    NamingService<VM> ns = NamingService.newVMNS();
    Model mo = new DefaultModel();
    for (int i = 0; i < 10; i++) {
        VM v = mo.newVM();
        ns.register(v, "VM " + i);
    }
    NamingServiceConverter nsc = new NamingServiceConverter();
    JSONObject o = nsc.toJSON(ns);
    System.out.println(o);
    @SuppressWarnings("unchecked") NamingService<VM> ns2 = (NamingService<VM>) nsc.fromJSON(mo, o);
    Assert.assertEquals(ns, ns2);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) JSONObject(net.minidev.json.JSONObject) NamingService(org.btrplace.model.view.NamingService) VM(org.btrplace.model.VM) 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