Package org.codehaus.jettison.json

Examples of org.codehaus.jettison.json.JSONObject.optInt()


        JSONObject json = GraphSONUtility.jsonFromElement(v, null, GraphSONMode.EXTENDED);

        Assert.assertNotNull(json);
        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertEquals(1, json.optInt(GraphSONTokens._ID));
        Assert.assertTrue(json.has("keyList"));

        JSONObject listWithTypeAsJson = json.optJSONObject("keyList");
        Assert.assertNotNull(listWithTypeAsJson);
        Assert.assertTrue(listWithTypeAsJson.has(GraphSONTokens.TYPE));
View Full Code Here


            JSONObject valueAsJson = listAsJSON.optJSONObject(ix);
            Assert.assertNotNull(valueAsJson);
            Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
            Assert.assertEquals(GraphSONTokens.TYPE_INTEGER, valueAsJson.optString(GraphSONTokens.TYPE));
            Assert.assertTrue(valueAsJson.has(GraphSONTokens.VALUE));
            Assert.assertEquals(1, valueAsJson.optInt(GraphSONTokens.VALUE));
        }
    }

    @Test
    public void jsonFromElementVertexListOfListPropertiesNoKeysWithTypes() throws JSONException {
View Full Code Here

        JSONObject json = GraphSONUtility.jsonFromElement(v, null, GraphSONMode.EXTENDED);

        Assert.assertNotNull(json);
        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertEquals(1, json.optInt(GraphSONTokens._ID));
        Assert.assertTrue(json.has("keyList"));

        JSONObject listWithTypeAsJson = json.optJSONObject("keyList");
        Assert.assertNotNull(listWithTypeAsJson);
        Assert.assertTrue(listWithTypeAsJson.has(GraphSONTokens.TYPE));
View Full Code Here

            JSONObject valueAsJson = listAsJSON.optJSONObject(ix);
            Assert.assertNotNull(valueAsJson);
            Assert.assertTrue(valueAsJson.has(GraphSONTokens.TYPE));
            Assert.assertEquals(GraphSONTokens.TYPE_INTEGER, valueAsJson.optString(GraphSONTokens.TYPE));
            Assert.assertTrue(valueAsJson.has(GraphSONTokens.VALUE));
            Assert.assertEquals(1, valueAsJson.optInt(GraphSONTokens.VALUE));
        }
    }


    @Test
View Full Code Here

        JSONObject json = GraphSONUtility.jsonFromElement(v, null, GraphSONMode.EXTENDED);

        Assert.assertNotNull(json);
        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertEquals(1, json.optInt(GraphSONTokens._ID));
        Assert.assertTrue(json.has("keyMap"));

        JSONObject mapWithTypeAsJSON = json.optJSONObject("keyMap");
        Assert.assertNotNull(mapWithTypeAsJSON);
        Assert.assertTrue(mapWithTypeAsJSON.has(GraphSONTokens.TYPE));
View Full Code Here

        Assert.assertTrue(mapAsJSON.has("that"));
        JSONObject thatAsJson = mapAsJSON.optJSONObject("that");
        Assert.assertTrue(thatAsJson.has(GraphSONTokens.TYPE));
        Assert.assertEquals(GraphSONTokens.TYPE_INTEGER, thatAsJson.optString(GraphSONTokens.TYPE));
        Assert.assertTrue(thatAsJson.has(GraphSONTokens.VALUE));
        Assert.assertEquals(1, thatAsJson.optInt(GraphSONTokens.VALUE));
    }

    /**
     * This test is kinda weird since a Blueprints graph can't have properties set to null, howerver that does not
     * mean that a graph may never return null (https://github.com/tinkerpop/blueprints/issues/400).
View Full Code Here

    Schema308tube dao = new Schema308tube();
   
    try {
     
      JSONObject partsData = new JSONObject(incomingData); //we are using json objects to parse data
      pk = partsData.optInt("PC_PARTS_PK", 0);
      avail = partsData.optInt("PC_PARTS_AVAIL", 0);
     
      //call the correct sql method
      http_code = dao.updatePC_PARTS(pk, avail);
     
View Full Code Here

   
    try {
     
      JSONObject partsData = new JSONObject(incomingData); //we are using json objects to parse data
      pk = partsData.optInt("PC_PARTS_PK", 0);
      avail = partsData.optInt("PC_PARTS_AVAIL", 0);
     
      //call the correct sql method
      http_code = dao.updatePC_PARTS(pk, avail);
     
      if(http_code == 200) {
View Full Code Here

    Schema308tube dao = new Schema308tube();
   
    try {
     
      JSONObject partsData = new JSONObject(incomingData);
      pk = partsData.optInt("PC_PARTS_PK", 0);
     
      http_code = dao.deletePC_PARTS(pk);
     
      if(http_code == 200) {
        jsonObject.put("HTTP_CODE", "200");
View Full Code Here

        final Response r = response.getJerseyResponse();
        Assert.assertEquals(200, r.getStatus());

        final JSONObject json = (JSONObject) r.getEntity();
        Assert.assertNotNull(json);
        Assert.assertEquals(6, json.optInt("count"));
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.