Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper


        Field fl = Field.parseField(value);
    }

    @Test
    public void testMultiFieldParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("multi_field.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("tweet", fl.name());
        assertEquals(1, fl.properties().length);
        Field nested = fl.properties()[0];
        assertEquals("name", nested.name());
View Full Code Here


        assertEquals(FieldType.STRING, nested.type());
    }

    @Test
    public void testMultiFieldWithoutDefaultFieldParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("multi_field_no_default.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("tweet", fl.name());
        assertEquals(1, fl.properties().length);
        Field nested = fl.properties()[0];
        assertEquals("name", nested.name());
View Full Code Here

        assertEquals(FieldType.STRING, nested.type());
    }

    @Test(expected = EsHadoopIllegalArgumentException.class)
    public void testMultiFieldWithoutDefaultFieldAndMultiTypesParsing() throws Exception {
        Map value = new ObjectMapper().readValue(
                getClass().getResourceAsStream("multi_field_no_default_multi_types.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("tweet", fl.name());
        assertEquals(1, fl.properties().length);
        Field nested = fl.properties()[0];
View Full Code Here

        assertEquals(FieldType.STRING, nested.type());
    }

    @Test
    public void testCompletionParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("completion.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("song", fl.name());
        Field[] props = fl.properties();
        assertEquals(1, props.length);
        assertEquals("name", props[0].name());
View Full Code Here

        assertEquals("name", props[0].name());
    }

    @Test
    public void testGeolocationParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("geo.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals(1, fl.properties().length);
    }
View Full Code Here

        assertEquals(1, fl.properties().length);
    }

    @Test
    public void testIpParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("ip.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals(1, fl.properties().length);
    }
View Full Code Here

        assertEquals(1, fl.properties().length);
    }

    @Test
    public void testUnsupportedParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("attachment.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("person", fl.name());
        assertEquals(0, fl.properties().length);
    }
View Full Code Here

        assertEquals(0, fl.properties().length);
    }

    @Test
    public void testFieldValidation() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("nested.json"), Map.class);
        Field fl = Field.parseField(value);

        List<String>[] findFixes = MappingUtils.findTypos(Collections.singletonList("nam"), fl);
        assertThat(findFixes[1], contains("name"));
View Full Code Here

*/
public abstract class JsonUtils {

    @SuppressWarnings("unchecked")
    public static Map<String, Object> mapFromJson(String location) throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        InputStream jsonStream = JsonUtils.class.getResourceAsStream(location);
        assertNotNull("no resource found at " + location, jsonStream);
        return mapper.readValue(jsonStream, Map.class);
    }
View Full Code Here

    @RequestMapping(value = "group/{groupId}", method = RequestMethod.GET)
    public String editGroup(Model model, @PathVariable int groupId) throws Exception {
        model.addAttribute("groupName",
                pathOverrideService.getGroupNameFromId(groupId));
        model.addAttribute("groupId", groupId);
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writeValueAsString(pluginManager.getMethodsNotInGroup(groupId));
        model.addAttribute("methodsNotInGroup",
                json);

        return "editGroup";
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.ObjectMapper

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.