Package org.auraframework.util.json

Examples of org.auraframework.util.json.JsonReader


    }

    @Override
    public void assertDiff(String test, StringBuilder sb) throws SAXException, IOException,
            ParserConfigurationException {
        Object controlObj = new JsonReader().read(readGoldFile());
        Object testObj = new JsonReader().read(test);
        // for stuff that has ref support, the serIds may be different because
        // of ordering, so resolve them
        controlObj = Json.resolveRefs(controlObj);
        testObj = Json.resolveRefs(testObj);
        Assert.assertEquals(sb == null ? "Diff from " + getUrl() : sb.toString(), controlObj, testObj);
View Full Code Here


    /**
     * @return List of ValidationErrors parsed from the json input
     */
    public static List<ValidationError> parseJsonErrors(Reader input) {
        @SuppressWarnings("unchecked")
        List<Map<String, ?>> jsonErrors = (List<Map<String, ?>>) new JsonReader().read(input);
        List<ValidationError> errors = Lists.newArrayListWithCapacity(jsonErrors.size());
        for (Map<String, ?> jsonError : jsonErrors) {
            errors.add(deserialize(jsonError));
        }
        return errors;
View Full Code Here

        if (HttpStatus.SC_OK != statusCode) {
            fail(String.format("Unexpected status code <%s>, expected <%s>, response:%n%s", statusCode,
                    HttpStatus.SC_OK, response));
        }
        new JsonReader().read(response
                .substring(AuraBaseServlet.CSRF_PROTECT.length()));
    }
View Full Code Here

        assertTrue("response not wrapped with ERROR marker",
                response.startsWith(AuraBaseServlet.CSRF_PROTECT + "*/") && response.endsWith("/*ERROR*/"));
        response = response.substring(AuraBaseServlet.CSRF_PROTECT.length() + 2,
                response.length() - "/*ERROR*/".length());
        @SuppressWarnings("unchecked")
        Map<String, Object> json = (Map<String, Object>) new JsonReader().read(response);
        assertEquals(true, json.get("exceptionEvent"));
        @SuppressWarnings("unchecked")
        Map<String, Object> eventJson = (Map<String, Object>) json.get("event");
        assertEquals("markup://aura:clientOutOfSync", eventJson.get("descriptor"));
        Object f = json.get("defaultHandler");
View Full Code Here

            fail("respose should end with " + "/*ERROR*/");
        }

        String jsonString = "/*" + response;

        Map<String, Object> json = (Map<String, Object>) new JsonReader().read(jsonString);
        Map<String, Object> event = (Map<String, Object>) json.get("event");
        if (event != null) {
            String descriptor = (String) event.get("descriptor");
            if (descriptor != null && descriptor.equals("markup://aura:clientOutOfSync")) {
                return;
View Full Code Here

            fail("Should not be able to post to aura servlet without a valid CSRF token");
        }
        if (response.startsWith(AuraBaseServlet.CSRF_PROTECT)) {
            response = "/*" + response;
        }
        Map<String, Object> json = (Map<String, Object>) new JsonReader().read(response);
        assertEquals(true, json.get("exceptionEvent"));
        Map<String, Object> event = (Map<String, Object>) json.get("event");
        assertEquals("Expected to see a aura:systemError event", "markup://aura:systemError", event.get("descriptor"));
        assertEquals("Missing parameter value for aura.token",
                ((Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) (event.get("attributes")))
View Full Code Here

        Map<String, String> stats = Maps.newHashMap();
        String json = auraUITestingUtil.getEval("return $A.util.json.encode($A.Perf.toJson())").toString();
        json = json.substring(1, json.length() - 1);
        json = json.replace("\\\"", "\"");
        StringReader in = new StringReader(json);
        Map<?, ?> message = (Map<?, ?>) new JsonReader().read(in);
        @SuppressWarnings("unchecked")
        ArrayList<HashMap<?, ?>> measures = (ArrayList<HashMap<?, ?>>) message
                .get("measures");
        for (HashMap<?, ?> marks : measures) {
            if (!transactionsToGather.isEmpty()) {
View Full Code Here

                rawResponse = getResponseBody(response);
                assertEquals(
                        AuraBaseServlet.CSRF_PROTECT,
                        rawResponse.substring(0,
                                AuraBaseServlet.CSRF_PROTECT.length()));
                Map<String, Object> json = (Map<String, Object>) new JsonReader()
                        .read(rawResponse
                                .substring(AuraBaseServlet.CSRF_PROTECT
                                        .length()));
                ArrayList<Map<String,Object>> actions = (ArrayList<Map<String, Object>>) json.get("actions");
                for(Map<String,Object> action: actions) {
View Full Code Here

        return Action.class;
    }

    @Override
    public Collection<Action> readCollection(Reader in) throws IOException, QuickFixException {
        Map<?, ?> message = (Map<?, ?>) new JsonReader().read(in);
        List<?> actions = (List<?>) message.get("actions");
        List<Action> ret = Lists.newArrayList();
        for (Object action : actions) {
            Map<?, ?> map = (Map<?, ?>) action;
View Full Code Here

        return ret;
    }

    @Override
    public Action read(Reader in) throws IOException, QuickFixException {
        Map<?, ?> map = (Map<?, ?>) new JsonReader().read(in);
        @SuppressWarnings("unchecked")
        Map<String, Object> params = (Map<String, Object>) map.get("params");
        return (Action) Aura.getInstanceService().getInstance((String) map.get("descriptor"), ActionDef.class, params);
    }
View Full Code Here

TOP

Related Classes of org.auraframework.util.json.JsonReader

Copyright © 2018 www.massapicom. 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.