Package org.codehaus.jettison.json

Examples of org.codehaus.jettison.json.JSONArray.optJSONObject()


                Assert.assertEquals(2, results.length());

                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the next two elements
                graphResponse = doGraphGet(testGraph, "vertices", "rexster.offset.start=2&rexster.offset.end=4");

                Assert.assertNotNull(graphResponse);
View Full Code Here


                Assert.assertNotNull(vertexJson);

                results = vertexJson.optJSONArray(Tokens.RESULTS);
                Assert.assertEquals(2, results.length());

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));
View Full Code Here

                results = vertexJson.optJSONArray(Tokens.RESULTS);
                Assert.assertEquals(2, results.length());

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the final two elements
View Full Code Here

                Assert.assertEquals(2, results.length());

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the final two elements
                graphResponse = doGraphGet(testGraph, "vertices", "rexster.offset.start=4&rexster.offset.end=6");
View Full Code Here

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the final two elements
                graphResponse = doGraphGet(testGraph, "vertices", "rexster.offset.start=4&rexster.offset.end=6");

                Assert.assertNotNull(graphResponse);
View Full Code Here

                Assert.assertNotNull(vertexJson);

                results = vertexJson.optJSONArray(Tokens.RESULTS);
                Assert.assertEquals(2, results.length());

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));
View Full Code Here

                results = vertexJson.optJSONArray(Tokens.RESULTS);
                Assert.assertEquals(2, results.length());

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the final two elements without specifying the end parameter
View Full Code Here

                Assert.assertEquals(2, results.length());

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the final two elements without specifying the end parameter
                graphResponse = doGraphGet(testGraph, "vertices", "rexster.offset.start=4");
View Full Code Here

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(0).optString(Tokens._ID));

                Assert.assertFalse(uniqueIds.contains(results.optJSONObject(1).optString(Tokens._ID)));
                uniqueIds.add(results.optJSONObject(1).optString(Tokens._ID));

                // get the final two elements without specifying the end parameter
                graphResponse = doGraphGet(testGraph, "vertices", "rexster.offset.start=4");

                Assert.assertNotNull(graphResponse);
View Full Code Here

            for (GraphTestHolder testGraph : this.testGraphs) {
                ClientResponse response = doGraphGet(testGraph, "vertices");
                JSONObject verticesJson = response.getEntity(JSONObject.class);
                JSONArray verticesToDelete = verticesJson.optJSONArray(Tokens.RESULTS);
                for (int ix = 0; ix < verticesToDelete.length(); ix++) {
                    this.client.handle(ClientRequest.create().build(createUri("/" + testGraph.getGraphName() + "/vertices/" + encode(verticesToDelete.optJSONObject(ix).optString(Tokens._ID))), "DELETE"));
                }

                if (testGraph.getFeatures().supportsIndices) {
                    response = doGraphGet(testGraph, "indices");
                    JSONObject indicesJson = response.getEntity(JSONObject.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.