Search in sources :

Example 11 with JSONObject

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;
}
Also used : JSONObject(net.minidev.json.JSONObject)

Example 12 with JSONObject

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;
}
Also used : JSONObject(net.minidev.json.JSONObject)

Example 13 with JSONObject

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;
}
Also used : JSONObject(net.minidev.json.JSONObject)

Example 14 with JSONObject

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;
}
Also used : JSONObject(net.minidev.json.JSONObject)

Example 15 with JSONObject

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));
}
Also used : JSONObject(net.minidev.json.JSONObject) Test(org.testng.annotations.Test)

Aggregations

JSONObject (net.minidev.json.JSONObject)254 JSONArray (net.minidev.json.JSONArray)49 Test (org.junit.Test)39 Test (org.testng.annotations.Test)38 JSONParser (net.minidev.json.parser.JSONParser)23 HashMap (java.util.HashMap)22 MockFlowFile (org.apache.nifi.util.MockFlowFile)16 JWTClaimsSet (com.nimbusds.jwt.JWTClaimsSet)14 Test (org.junit.jupiter.api.Test)14 Map (java.util.Map)13 ParseException (net.minidev.json.parser.ParseException)13 JSONConverterException (org.btrplace.json.JSONConverterException)13 SignedJWT (com.nimbusds.jwt.SignedJWT)12 Node (org.btrplace.model.Node)12 VM (org.btrplace.model.VM)12 JWSHeader (com.nimbusds.jose.JWSHeader)10 RSASSASigner (com.nimbusds.jose.crypto.RSASSASigner)10 AuthenticationContext (org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext)10 OpenAPI (io.swagger.v3.oas.models.OpenAPI)9 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)9