use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class SerializeConverter method toJSON.
@Override
public JSONObject toJSON(Serialize serialize) {
JSONObject c = new JSONObject();
c.put("id", getJSONId());
c.put("vms", vmsToJSON(serialize.getInvolvedVMs()));
c.put("continuous", serialize.isContinuous());
return c;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class JSONsTest method testValidRequiredDouble.
@Test
public void testValidRequiredDouble() throws JSONConverterException {
JSONObject o = new JSONObject();
o.put("id", 1.3d);
Assert.assertEquals(JSONs.requiredDouble(o, "id"), 1.3d);
o.put("id", 145);
Assert.assertEquals(JSONs.requiredDouble(o, "id"), 145d);
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class JSONsTest method testInValidRequiredInt.
@Test(expectedExceptions = { JSONConverterException.class }, dataProvider = "getInvalidInts")
public void testInValidRequiredInt(String storeKey, String readKey, Object o) throws JSONConverterException {
JSONObject obj = new JSONObject();
obj.put(storeKey, o);
JSONs.requiredInt(obj, readKey);
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ConstraintConverterTest method testCheckId.
@Test
public void testCheckId() throws JSONConverterException {
ConstraintConverter<?> c = new Mock<>("foo");
JSONObject o = new JSONObject();
o.put("id", "foo");
c.checkId(o);
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ConstraintConverterTest method testBadCheckIdNoId.
@Test(expectedExceptions = { JSONConverterException.class })
public void testBadCheckIdNoId() throws JSONConverterException {
ConstraintConverter<?> c = new Mock<>("foo");
JSONObject o = new JSONObject();
c.checkId(o);
}
Aggregations