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));
}
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));
}
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));
}
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));
}
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);
}
Aggregations