Package org.codehaus.jettison.json

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


            Assert.assertEquals(ClientResponse.Status.OK, graphResponse.getClientResponseStatus());

            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(3, json.optJSONArray(Tokens.RESULTS).length());
            Assert.assertEquals(Tokens.EDGE, json.optJSONArray(Tokens.RESULTS).optJSONObject(0).optString(Tokens._TYPE));

            // get out vertices filtered by label
            graphResponse = doGraphGet(testGraph, "vertices/" + encode(id) + "/out", "_label=[knows]");
View Full Code Here


            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(3, json.optJSONArray(Tokens.RESULTS).length());
            Assert.assertEquals(Tokens.EDGE, json.optJSONArray(Tokens.RESULTS).optJSONObject(0).optString(Tokens._TYPE));

            // get out vertices filtered by label
            graphResponse = doGraphGet(testGraph, "vertices/" + encode(id) + "/out", "_label=[knows]");

            Assert.assertNotNull(graphResponse);
View Full Code Here

            Assert.assertEquals(ClientResponse.Status.OK, graphResponse.getClientResponseStatus());

            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(2, json.optJSONArray(Tokens.RESULTS).length());
            Assert.assertEquals(Tokens.VERTEX, json.optJSONArray(Tokens.RESULTS).optJSONObject(0).optString(Tokens._TYPE));

            // get out vertices filtered by label and limited
            graphResponse = doGraphGet(testGraph, "vertices/" + encode(id) + "/out", "_label=[knows]&_take=1");
View Full Code Here

            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(2, json.optJSONArray(Tokens.RESULTS).length());
            Assert.assertEquals(Tokens.VERTEX, json.optJSONArray(Tokens.RESULTS).optJSONObject(0).optString(Tokens._TYPE));

            // get out vertices filtered by label and limited
            graphResponse = doGraphGet(testGraph, "vertices/" + encode(id) + "/out", "_label=[knows]&_take=1");

            Assert.assertNotNull(graphResponse);
View Full Code Here

            Assert.assertEquals(ClientResponse.Status.OK, graphResponse.getClientResponseStatus());

            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(1, json.optJSONArray(Tokens.RESULTS).length());

            // get out vertices filtered by label and filtered by property (we lose "float" in graph creation)
            graphResponse = doGraphGet(testGraph, "vertices/" + encode(id) + "/out", "_label=[knows]&_properties=[[weight,=,(d,1)]]");

            Assert.assertNotNull(graphResponse);
View Full Code Here

            Assert.assertEquals(ClientResponse.Status.OK, graphResponse.getClientResponseStatus());

            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(1, json.optJSONArray(Tokens.RESULTS).length());

            // get out count filtered by label counted
            graphResponse = doGraphGet(testGraph, "vertices/" + encode(id) + "/outCount", "_label=[knows]");

            Assert.assertNotNull(graphResponse);
View Full Code Here

            Assert.assertEquals(ClientResponse.Status.OK, graphResponse.getClientResponseStatus());

            json = graphResponse.getEntity(JSONObject.class);
            Assert.assertNotNull(json);

            Assert.assertEquals(1, json.optJSONArray(Tokens.RESULTS).length());

            final String thisGuy = testGraph.getVertexIdSet().get("4");
            Assert.assertEquals(thisGuy, json.optJSONArray(Tokens.RESULTS).optString(0));
        }
    }
View Full Code Here

        final JSONObject jsonKeys = json.optJSONObject(Tokens.RESULTS);
        Assert.assertTrue(jsonKeys.has(Tokens.VERTEX));
        Assert.assertTrue(jsonKeys.has(Tokens.EDGE));

        final JSONArray vertexKeys = jsonKeys.optJSONArray(Tokens.VERTEX);
        Assert.assertEquals(2, vertexKeys.length());

        final JSONArray edgeKeys = jsonKeys.optJSONArray(Tokens.EDGE);
        Assert.assertEquals(1, edgeKeys.length());
        Assert.assertEquals("weight", edgeKeys.optString(0));
View Full Code Here

            Assert.assertNotNull(json);

            Assert.assertEquals(1, json.optJSONArray(Tokens.RESULTS).length());

            final String thisGuy = testGraph.getVertexIdSet().get("4");
            Assert.assertEquals(thisGuy, json.optJSONArray(Tokens.RESULTS).optString(0));
        }
    }
}
View Full Code Here

        Assert.assertTrue(jsonKeys.has(Tokens.EDGE));

        final JSONArray vertexKeys = jsonKeys.optJSONArray(Tokens.VERTEX);
        Assert.assertEquals(2, vertexKeys.length());

        final JSONArray edgeKeys = jsonKeys.optJSONArray(Tokens.EDGE);
        Assert.assertEquals(1, edgeKeys.length());
        Assert.assertEquals("weight", edgeKeys.optString(0));
    }

    @Test(expected = WebApplicationException.class)
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.