Search in sources :

Example 66 with JSONObject

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

Example 67 with JSONObject

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

Example 68 with JSONObject

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

Example 69 with JSONObject

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

Example 70 with JSONObject

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

Aggregations

JSONObject (net.minidev.json.JSONObject)257 JSONArray (net.minidev.json.JSONArray)51 Test (org.junit.Test)39 Test (org.testng.annotations.Test)38 JSONParser (net.minidev.json.parser.JSONParser)26 HashMap (java.util.HashMap)22 MockFlowFile (org.apache.nifi.util.MockFlowFile)16 JWTClaimsSet (com.nimbusds.jwt.JWTClaimsSet)14 ParseException (net.minidev.json.parser.ParseException)14 Test (org.junit.jupiter.api.Test)14 Map (java.util.Map)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 ArrayList (java.util.ArrayList)10 AuthenticationContext (org.wso2.carbon.apimgt.gateway.handlers.security.AuthenticationContext)10 OpenAPI (io.swagger.v3.oas.models.OpenAPI)9