Search in sources :

Example 1 with ConstraintsConverter

use of org.btrplace.json.model.constraint.ConstraintsConverter 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 2 with ConstraintsConverter

use of org.btrplace.json.model.constraint.ConstraintsConverter 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 3 with ConstraintsConverter

use of org.btrplace.json.model.constraint.ConstraintsConverter 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 4 with ConstraintsConverter

use of org.btrplace.json.model.constraint.ConstraintsConverter in project scheduler by btrplace.

the class SerializeConverterTest method testViables.

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

Aggregations

ConstraintsConverter (org.btrplace.json.model.constraint.ConstraintsConverter)4 DefaultModel (org.btrplace.model.DefaultModel)4 Model (org.btrplace.model.Model)4 Test (org.testng.annotations.Test)4 Deadline (org.btrplace.model.constraint.migration.Deadline)1 Precedence (org.btrplace.model.constraint.migration.Precedence)1 Serialize (org.btrplace.model.constraint.migration.Serialize)1 Sync (org.btrplace.model.constraint.migration.Sync)1