Package org.auraframework.util.json

Examples of org.auraframework.util.json.JsonReader


    }

    @SuppressWarnings("unchecked")
    @Override
    public Collection<ComponentDefRef> readCollection(Reader in) throws IOException, DefinitionNotFoundException {
        List<?> cdrs = (List<?>) new JsonReader().read(in);
        List<ComponentDefRef> ret = Lists.newArrayList();
        for (Object cmp : cdrs) {
            ComponentDefRefImpl.Builder builder = new ComponentDefRefImpl.Builder();
            Map<?, ?> map = (Map<?, ?>) cmp;
            Map<?, ?> componentDef = (Map<?, ?>) map.get("componentDef");
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    @Override
    public Message read(Reader in) throws IOException, QuickFixException {
        Map<?, ?> message = (Map<?, ?>) new JsonReader().read(in);

        List<?> actions = (List<?>) message.get("actions");
        List<Action> actionList = Lists.newArrayList();
        if (actions != null) {
            for (Object action : actions) {
View Full Code Here

        this.offset = offset;
        this.line = line;
        Object parsedLine = null;
        if (line != null) {
            try {
                parsedLine = new JsonReader().read(line);
            } catch (JsonParseException e) {
                // Parsing will fail if the line is not json, which is ok if
                // it's a simple directive.
                parsedLine = null;
            }
View Full Code Here

                ComponentDef.class);
        ComponentDef def = d.getDef();
        // Convert the definition to a format that is used by the client
        String defInJson = Json.serialize(def, false, true);
        // Convert back to the object, just like the client does in javascript
        Object defObj = new JsonReader().read(defInJson);
        assertTrue(defObj instanceof Map);
        assertNull("Component definitions of components which use java renderers should not have a renderer def",
                ((Map<?, ?>) defObj).get("rendererDef"));
    }
View Full Code Here

        Component component = Aura.getInstanceService().getInstance("test:test_SimpleJavaRenderer", ComponentDef.class,
                null);
        // Convert the instance to a format that is used by the client
        String defInJson = Json.serialize(component, false, true);
        // Convert back to the object, just like the client does in javascript
        Object defObj = new JsonReader().read(defInJson);
        assertTrue(defObj instanceof Map);
        assertNotNull("Component Instance of components which use java renderers should have a rendering section",
                ((Map<?, ?>) ((Map<?, ?>) defObj).get("value")).get("rendering"));
        assertEquals("Component markup seen in Component instance does not match the markup in Java Renderer",
                TestSimpleRenderer.htmlOutput, ((Map<?, ?>) ((Map<?, ?>) defObj).get("value")).get("rendering"));
View Full Code Here

        // Obtain a component which uses preloading namespaces
        String componentInJson = response.substring(AuraBaseServlet.CSRF_PROTECT.length());
        Map<String, Object> outerMap;
        try {
            outerMap = (Map<String, Object>) new JsonReader().read(componentInJson);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse: "+componentInJson, e);
        }
        List<Object> actions = (List<Object>) outerMap.get("actions");
        Map<String, Object> action = (Map<String, Object>) actions.get(0);
View Full Code Here

        // Grab the preloads attached to the context
        String componentInJson = response.substring(AuraBaseServlet.CSRF_PROTECT.length());
        Map<String, Object> outerMap;
        try {
            outerMap = (Map<String, Object>) new JsonReader().read(componentInJson);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse: "+componentInJson, e);
        }
        Map<String, Object> context = (Map<String, Object>) outerMap.get("context");
        ArrayList<String> preloads = (ArrayList<String>) context.get("preloads");
View Full Code Here

    public void testDynamicNamespace() throws Exception {
      String response = obtainResponseCheckStatusDN();
      String componentInJson = response.substring(AuraBaseServlet.CSRF_PROTECT.length());
        Map<String, Object> outerMap;
        try {
            outerMap = (Map<String, Object>) new JsonReader().read(componentInJson);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse: "+componentInJson, e);
        }
        Map<String,Object> context = (Map<String,Object>) outerMap.get("context");
        List<Object> componentDefs = (List<Object>) context.get("componentDefs");
View Full Code Here

        List<Map<String, ?>> errors = null;

        try {
            // remote starting: while(1);
            response = response.substring(response.indexOf('{'));
            Map<String, ?> json = (Map<String, ?>) new JsonReader().read(response);
            Map<String, ?> value = (Map<String, ?>) ((Map<String, ?>) ((Map<String, ?>) ((ArrayList<?>) json
                    .get("actions"))
                    .get(0))
                    .get("returnValue"))
                    .get("value");
View Full Code Here

        File file = type.getFile(goldFileName);

        if (file.exists()) {
            logger.info(String.format("Reading Performance metrics from file: %s", file.getAbsolutePath()));

            return new JsonReader().read(new FileReader(file));
        }
        throw new AuraHandledException(String.format("Performance metrics File: %s not found", file.getAbsolutePath()));
    }
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.