Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.ObjectNode


        String authenticate = (String) Helpers.header("WWW-Authenticate", proxy.getResult());
        Assert.assertNotNull(authenticate);
        Assert.assertTrue(authenticate.contains("OAuth"));

        ObjectNode obj = getJSON(proxy);
        Assert.assertEquals("auth", obj.get("result").asText());
        Assert.assertFalse(StringUtils.isBlank(obj.get("reason").asText()));
    }
View Full Code Here


    protected void assertResultForbidden(ActionProxy proxy) throws Exception {
        // status code should be 403
        Assert.assertEquals(403, Helpers.status(proxy.getResult()));
        expectBehaveAsApi(proxy.getResult());

        ObjectNode obj = getJSON(proxy);
        Assert.assertEquals("forbidden", obj.get("result").asText());
        Assert.assertFalse(StringUtils.isBlank(obj.get("reason").asText()));
    }
View Full Code Here

        assert ec.getStatusCode() == 403;
        // status code should be 403
        Assert.assertEquals(403, Helpers.status(proxy.getResult()));
        expectBehaveAsApi(proxy.getResult());

        ObjectNode obj = getJSON(proxy);
        Assert.assertEquals("forbidden", obj.get("result").asText());
        Assert.assertFalse(StringUtils.isBlank(obj.get("reason").asText()));
        // TODO: Check errorCode here.
    }
View Full Code Here

    protected void assertResultError(ActionProxy proxy, ServerErrorCode ec) throws Exception {
        Assert.assertEquals(500, Helpers.status(proxy.getResult()));
        expectBehaveAsApi(proxy.getResult());

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

        ActionProxy proxy = getActionProxy(GET, "/api/user/get?userId=" + DEFAULT_USER_ID);

        proxy.execute();
        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("id").asText(), is(DEFAULT_USER_ID));
        // These values should not be public.
        assertThat(obj.get("twitterId"), is(nullValue()));
        assertThat(obj.get("lastLoginAt"), is(nullValue()));
        assertThat(obj.get("calendarId"), is(nullValue()));
        JsonNode twitter = obj.get("twitter");
        assertThat(twitter, is(notNullValue()));
        assertThat(twitter.get("screenName").asText(), is(DEFAULT_TWITTER_SCREENNAME));
        assertThat(twitter.get("profileImageURL").asText(), is("http://www.example.com/"));
        // These values should not be public.
        assertThat(twitter.get("accessToken"), is(nullValue()));
        assertThat(twitter.get("accessTokenSecret"), is(nullValue()));

        // We don't expose OpenID Linkage.
        assertThat(obj.get("openIDLinakge"), is(nullValue()));
    }
View Full Code Here

        ActionProxy proxy = getActionProxy(GET, "/api/user/tickets?userId=" + DEFAULT_USER_ID + "&limit=10");

        proxy.execute();
        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("totalTicketCount").asInt(), is(20));

        JsonNode array = obj.get("ticketStatuses");
        assertThat(array.size(), is(5));
        for (int i = 0; i < 5; ++i) {
            assertThat(array.get(i).get("ticket").get("id").asText(), is(ids.get(i * 2).getFirst().toString()));
            assertThat(array.get(i).get("status").asText(), is("enrolled"));
        }
View Full Code Here

    public void testToGetEventsForOwner() throws Exception {
        ActionProxy proxy = getActionProxy(GET, "/api/user/events?userId=" + EVENT_OWNER_ID + "&queryType=owner");
        proxy.execute();
        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("totalEventCount").asInt(), is(N - 6));
        assertThat(obj.path("eventStatuses"), is(not(nullValue())));
        JsonNode array = obj.get("eventStatuses");
        assertThat(array.size(), is(10));

        int pos = N - 1;
        for (int i = 0; i < array.size(); ++i) {
            while (pos % 8 == 0 || pos % 8 == 1)
View Full Code Here

    public void testToGetEventsForEditor() throws Exception {
        ActionProxy proxy = getActionProxy(GET, "/api/user/events?userId=" + EVENT_EDITOR_ID + "&queryType=editor");
        proxy.execute();
        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);
        assertThat(obj.get("totalEventCount").asInt(), is(N - 6));
        assertThat(obj.path("eventStatuses"), is(not(nullValue())));
        JsonNode array = obj.get("eventStatuses");
        assertThat(array.size(), is(10));

        int pos = N - 1;
        for (int i = 0; i < array.size(); ++i) {
            while (pos % 8 == 0 || pos % 8 == 1)
View Full Code Here

        proxy.execute();

        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);

        assertThat(obj.get("count").asInt(), is(10));
        JsonNode ids = obj.get("imageIds");
        for (int i = 0; i < ids.size(); ++i)
            assertThat(ids.get(i).asText(), is(TestDataProvider.IMAGE_OWNED_BY_DEFAULT_USER_ID[i]));
    }
View Full Code Here

        loginAs(proxy, TestDataProvider.DEFAULT_USER_ID);
        proxy.execute();

        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);

        assertThat(obj.get("count").asInt(), is(10));
        JsonNode ids = obj.get("imageIds");
        for (int i = 0; i < ids.size(); ++i)
            assertThat(ids.get(i).asText(), is(TestDataProvider.IMAGE_OWNED_BY_DEFAULT_USER_ID[i]));
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.node.ObjectNode

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.