Examples of toJSONString()


Examples of org.json.simple.JSONAware.toJSONString()

        } catch (Throwable exp) {
            JSONObject error = requestHandler.handleThrowable(
                    exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
            json = error;
        } finally {
            sendResponse(pExchange,parsedUri, json.toJSONString());
        }
    }

    private JSONAware executeGetRequest(ParsedUri parsedUri) {
        return requestHandler.handleGetRequest(parsedUri.getUri().toString(),parsedUri.getPathInfo(), parsedUri.getParameterMap());
View Full Code Here

Examples of org.json.simple.JSONObject.toJSONString()

    JSONObject jsonObject = (JSONObject) json;
    JSONArray features = (JSONArray) jsonObject.get("features");
    JSONObject feature = (JSONObject) features.get(0);
    JSONObject geometry = (JSONObject) feature.get("geometry");
    GeometryJSON g = new GeometryJSON(0);
    Geometry m = g.read(geometry.toJSONString());
    Envelope envelope = new Envelope(0, 1, 0, 1);
    Geometry orig = JTS.toGeometry(envelope);
    Geometry m2 = geoservice.transform(orig, "EPSG:4326", "EPSG:900913");
    // equality check on buffer, JTS equals does not do the trick !
    Assert.assertTrue(m.buffer(0.01).contains(m2));
View Full Code Here

Examples of org.json.simple.JSONObject.toJSONString()

        JSONObject obj = new JSONObject();
        for (String key : doc.keySet()) {
            Object value = doc.get(key);
            obj.put(key, value);
        }
        return obj.toJSONString();
    }

    private <T extends Document> T fromString(Collection<T> collection, String data) throws ParseException {
        T doc = collection.newDocument(this);
        Map<String, Object> obj = (Map<String, Object>) new JSONParser().parse(data);
View Full Code Here

Examples of org.json.simple.JSONObject.toJSONString()

    Object obj = parser.parse(new FileReader(TestData.TEST_ROOT_CERTS));
    JSONObject response = (JSONObject) obj;
   
    HttpInvoker mockInvoker = mock(HttpInvoker.class);
    when(mockInvoker.makeGetRequest(eq("http://ctlog/get-roots"))).thenReturn(
        response.toJSONString());

    HttpLogClient client = new HttpLogClient("http://ctlog/", mockInvoker);
    List<Certificate> rootCerts = client.getLogRoots();

    Assert.assertNotNull(rootCerts);
View Full Code Here

Examples of org.json.simple.JSONObject.toJSONString()

        result.put("code", code);
        result.put("objectId", objectId == null ? "" : objectId);
        result.put("exception", ex == null ? "" : ex);
        result.put("message", message == null ? "" : message);

        return result.toJSONString();
    }

    /**
     * Writes JSON to the servlet response and adds a callback wrapper if
     * requested.
 
View Full Code Here

Examples of org.json.simple.JSONObject.toJSONString()

        JSONObject obj = new JSONObject();
        for (String key : doc.keySet()) {
            Object value = doc.get(key);
            obj.put(key, value);
        }
        return obj.toJSONString();
    }

    private <T extends Document> T fromString(Collection<T> collection, String data) throws ParseException {
        T doc = collection.newDocument(this);
        Map<String, Object> obj = (Map<String, Object>) new JSONParser().parse(data);
View Full Code Here

Examples of org.voltdb.ClientResponseImpl.toJSONString()

            TableHelper.loadTable(client, t1);

            ClientResponseImpl response = (ClientResponseImpl) client.callProcedure(
                    "@UpdateApplicationCatalog", catBytes2, null);
            System.out.println(response.toJSONString());

            VoltTable t3 = client.callProcedure("@AdHoc", "select * from FOO").getResults()[0];
            t3 = TableHelper.sortTable(t3);

            // compute the migrated table entirely in Java for comparison purposes
View Full Code Here

Examples of org.voltdb.ParameterSet.toJSONString()

                }
                catch (final IOException exception) {
                    throw new RuntimeException("Error serializing parameters for SQL batch element: " +
                                               i + " with plan fragment ID: " + planFragmentIds[i] +
                                               " and with params: " +
                                               pset.toJSONString(), exception);
                }
            }
        }
        // checkMaxFsSize();
View Full Code Here

Examples of org.voltdb.VoltTable.toJSONString()

        voltclient.callProcedure("CreateItem", 1, 11);
        voltclient.callProcedure("CreateItem", 2, 12);

        // check that the query does the right thing
        VoltTable result = voltclient.callProcedure("GetItems",11,1,1).getResults()[0];
        System.out.println(result.toJSONString());
        if (result.getRowCount() != 1) {
            System.err.printf("Call failed with %d rows\n", result.getRowCount());
        }

        // clean up / shutdown
View Full Code Here

Examples of org.voltdb.expressions.AbstractExpression.toJSONString()

        assertFalse(exps.isEmpty());
        AbstractExpression exp = CollectionUtil.first(exps);
        assertNotNull(exp);
       
        // Clone the mofo and make sure equals() returns true!
        String json = exp.toJSONString();
        assertFalse(json.isEmpty());
        AbstractExpression clone = AbstractExpression.fromJSONObject(new JSONObject(json), catalog_db);
        assertNotNull(clone);
        assert(ExpressionUtil.equals(exp, clone));
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.