Search in sources :

Example 51 with Model

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

the class BanConverterTest method testViables.

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

Example 52 with Model

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

the class FenceConverterTest method testViables.

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

Example 53 with Model

use of org.btrplace.model.Model 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 54 with Model

use of org.btrplace.model.Model 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 55 with Model

use of org.btrplace.model.Model 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)

Aggregations

Model (org.btrplace.model.Model)171 DefaultModel (org.btrplace.model.DefaultModel)157 Test (org.testng.annotations.Test)145 Node (org.btrplace.model.Node)91 VM (org.btrplace.model.VM)89 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)46 Mapping (org.btrplace.model.Mapping)41 HashSet (java.util.HashSet)39 ArrayList (java.util.ArrayList)30 SatConstraint (org.btrplace.model.constraint.SatConstraint)29 ShareableResource (org.btrplace.model.view.ShareableResource)27 Instance (org.btrplace.model.Instance)19 RelocatableVM (org.btrplace.scheduler.choco.transition.RelocatableVM)19 MigrateVM (org.btrplace.plan.event.MigrateVM)18 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)18 BootableNode (org.btrplace.scheduler.choco.transition.BootableNode)17 ShutdownableNode (org.btrplace.scheduler.choco.transition.ShutdownableNode)17 MinMTTR (org.btrplace.model.constraint.MinMTTR)16 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)16 BootVM (org.btrplace.scheduler.choco.transition.BootVM)16