Search in sources :

Example 56 with DefaultModel

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

the class GatherConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model mo = new DefaultModel();
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new GatherConverter());
    Gather d = new Gather(Arrays.asList(mo.newVM(), mo.newVM()), false);
    Gather c = new Gather(Arrays.asList(mo.newVM(), mo.newVM()), 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) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Gather(org.btrplace.model.constraint.Gather) Test(org.testng.annotations.Test)

Example 57 with DefaultModel

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

the class MinMigrationsConverterTest method test.

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

Example 58 with DefaultModel

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

the class MinMttrConverterTest method test.

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

Example 59 with DefaultModel

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

the class OfflineConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model mo = new DefaultModel();
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new OfflineConverter());
    Offline d = new Offline(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) Offline(org.btrplace.model.constraint.Offline) Test(org.testng.annotations.Test)

Example 60 with DefaultModel

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

the class OnlineConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model mo = new DefaultModel();
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new OnlineConverter());
    Online d = new Online(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) Online(org.btrplace.model.constraint.Online) 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