use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ActionConverter method visit.
@Override
public JSONObject visit(ShutdownVM a) {
JSONObject o = makeActionSkeleton(a);
o.put(ACTION_ID_LABEL, "shutdownVM");
o.put(VM_LABEL, elementToJSON(a.getVM()));
o.put(ON_LABEL, elementToJSON(a.getNode()));
return o;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ActionConverter method visit.
@Override
public JSONObject visit(MigrateVM a) {
JSONObject o = makeActionSkeleton(a);
o.put(ACTION_ID_LABEL, "migrateVM");
o.put(VM_LABEL, elementToJSON(a.getVM()));
o.put(VM_DESTINATION_LABEL, elementToJSON(a.getDestinationNode()));
o.put(VM_LOCATION_LABEL, elementToJSON(a.getSourceNode()));
o.put(BANDWIDTH, a.getBandwidth());
return o;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ActionConverter method visit.
@Override
public JSONObject visit(ResumeVM a) {
JSONObject o = makeActionSkeleton(a);
o.put(ACTION_ID_LABEL, "resumeVM");
o.put(VM_LABEL, elementToJSON(a.getVM()));
o.put(VM_DESTINATION_LABEL, elementToJSON(a.getDestinationNode()));
o.put(VM_LOCATION_LABEL, elementToJSON(a.getSourceNode()));
return o;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ActionConverter method visit.
@Override
public JSONObject visit(KillVM a) {
JSONObject o = makeActionSkeleton(a);
o.put(ACTION_ID_LABEL, "killVM");
o.put(VM_LABEL, elementToJSON(a.getVM()));
o.put(ON_LABEL, elementToJSON(a.getNode()));
return o;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ActionConverterTest method testBootNode.
@Test
public void testBootNode() throws JSONConverterException {
BootNode a = new BootNode(n1, 3, 5);
JSONObject o = ac.toJSON(a);
System.out.println(o);
Assert.assertEquals(a, ac.fromJSON(o));
}
Aggregations