Examples of ObjectNode


Examples of org.codehaus.jackson.node.ObjectNode

        proxy.execute();
        assertResultOK(proxy);

        // Check JSON

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("id").asText(), is(TestDataProvider.DEFAULT_USER_ID));

        // TODO: Checks Twitter?

        // Checks UserPreference.
        JsonNode prefObj = obj.get("preference");
        UserPreference pref = UserPreference.getDefaultPreference(TestDataProvider.DEFAULT_USER_ID);
        Assert.assertEquals(pref.isProfilePublic(), prefObj.get("profilePublic").asBoolean());
        Assert.assertEquals(pref.isReceivingTwitterMessage(), prefObj.get("receivingTwitterMessage").asBoolean());
        Assert.assertEquals(pref.tweetsAttendanceAutomatically(), prefObj.get("tweetingAttendanceAutomatically").asBoolean());

        // Checks OpenIds
        JsonNode array = obj.get("openIds");
        List<String> openIds = new ArrayList<String>();
        for (int i = 0; i < array.size(); ++i)
            openIds.add(array.get(i).get("identifier").asText());

        assertThat(openIds, hasItem(TestDataProvider.DEFAULT_USER_OPENID_IDENTIFIER));
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

        addValidSessionTokenToParameter(proxy);

        proxy.execute();
        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);

        assertThat(obj.get("calendarId").asText(), is(not(currentCalendarId)));
        assertThat(obj.get("calendarId").asText(), is(loadCalendarIdFromUser(TestDataProvider.DEFAULT_USER_ID)));
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

        TimeZone defaultTimeZone = TimeZone.getDefault();
        TimeZone.setDefault(TimeZone.getTimeZone("Asia/Tokyo"));
        try {
            Event event = new Event();
            event.setBeginDate(new DateTime(0L));
            ObjectNode json = event.toSafeJSON();
            Assert.assertEquals("1970-01-01 09:00", json.get("beginDate").asText());
            Assert.assertFalse(json.has("endDate"));
        } finally {
            TimeZone.setDefault(defaultTimeZone);
        }
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

                this.value = value;
            }

            @Override
            public ObjectNode toJSON() {
                ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
                obj.put("value", value);
                return obj;
            }

            @Override
            public ObjectNode toSafeJSON() {
                ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
                obj.put("safe", value);
                return obj;
            }
        }

        List<X> xs = new ArrayList<X>();
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

    public void testToParseEnqueteAnswers() throws JsonParseException, JsonMappingException, IOException {
        UUID[] ids = new UUID[5];
        for (int i = 0; i < 5; ++i)
            ids[i] = new UUID(0, i);

        ObjectNode obj = new ObjectMapper().readValue("{ \""+ids[0].toString()+"\": [\"hoge\", \"fuga\"], " +
                "\""+ids[1].toString()+"\": [1, 2, 3], " +
                "\""+ids[2].toString()+"\": [], " +
                "\""+ids[3].toString()+"\": \"\", " +
                "\""+ids[4].toString()+"\": 3 " +
                "}", ObjectNode.class);
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

                this.value = value;
            }

            @Override
            public ObjectNode toJSON() {
                ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
                obj.put("value", value);
                return obj;
            }
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

                return obj;
            }

            @Override
            public ObjectNode toSafeJSON() {
                ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
                obj.put("safe", value);
                return obj;
            }
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

    protected void assertResultOK(ActionProxy proxy) throws Exception {
        Assert.assertEquals(200, Helpers.status(proxy.getResult()));
        expectBehaveAsApi(proxy.getResult());

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("result").asText(), is("ok"));
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

    protected void assertResultInvalid(ActionProxy proxy, UserErrorCode ec) throws Exception {
        Assert.assertEquals(400, Helpers.status(proxy.getResult()));
        expectBehaveAsApi(proxy.getResult());

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("result").asText(), is("invalid"));
        assertThat(obj.get("reason").asText(), is(ec.getReasonString()));
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ObjectNode

    protected void assertResultInvalid(ActionProxy proxy, UserErrorCode ec, String additional) throws Exception {
        Assert.assertEquals(400, Helpers.status(proxy.getResult()));
        expectBehaveAsApi(proxy.getResult());

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("result").asText(), is("invalid"));
        assertThat(obj.get("reason").asText(), is(ec.getReasonString()));

        JsonNode additionalObj = obj.get("additional");
        assertThat(additionalObj.has(additional), is(true));
    }
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.