Search in sources :

Example 56 with Model

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

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

Example 58 with Model

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

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

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

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