Package org.apache.isis.viewer.json.applib.domainobjects

Examples of org.apache.isis.viewer.json.applib.domainobjects.ListRepresentation


        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
        final ListRepresentation listRepr = restfulResponse.getEntity();

        return listRepr.getValues().arrayGet(num).asLink();
    }
View Full Code Here


    @Test
    public void linksToDomainServiceResources() throws Exception {

        // given
        final ListRepresentation repr = givenRepresentation();

        // when
        final JsonRepresentation values = repr.getValues();

        // then
        for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
            final RestfulResponse<JsonRepresentation> followJsonResp = client.follow(link);
            assertThat(followJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
View Full Code Here

    }

    private String givenLinkToService() throws JsonParseException, JsonMappingException, IOException {
        final DomainServiceResource resource = client.getDomainServiceResource();
        final Response response = resource.services();
        final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();

        final String href = services.getRepresentation("values[id=%s]", "simples").asLink().getHref();
        return href;
    }
View Full Code Here

    @Test
    public void xrofollowLinks() throws Exception {

        RestfulRequest request;
        RestfulResponse<ListRepresentation> restfulResponse;
        ListRepresentation repr;

        request = client.createRequest(HttpMethod.GET, "services");
        restfulResponse = request.executeT();
        repr = restfulResponse.getEntity();

        assertThat(repr.getValues(), isArray());
        assertThat(repr.getValues().size(), is(greaterThan(0)));
        assertThat(repr.getValues().arrayGet(0), isLink().novalue());

        request = client.createRequest(HttpMethod.GET, "services").withArg(RequestParameter.FOLLOW_LINKS, "values");
        restfulResponse = request.executeT();
        repr = restfulResponse.getEntity();

        assertThat(repr.getValues().arrayGet(0), isLink().value(is(not(Matchers.<JsonRepresentation> nullValue()))));
        assertThat(repr.getValues().arrayGet(0).getRepresentation("value"), isMap());
    }
View Full Code Here

    }

    private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
        final DomainServiceResource resource = client.getDomainServiceResource();
        final Response response = resource.services();
        final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();

        return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
    }
View Full Code Here

        // then
        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));

        final ListRepresentation repr = restfulResponse.getEntity();

        assertThat(repr, isMap());

        assertThat(repr.getSelf(), isLink().httpMethod(HttpMethod.GET));

        assertThat(repr.getValues(), isArray());

        assertThat(repr.getLinks(), isArray());
        assertThat(repr.getExtensions(), isMap());
    }
View Full Code Here

        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        assertThat(invokeLink, is(not(nullValue())));
        final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
        final ListRepresentation listRepr = restfulResponse.getEntity();

        assertThat(listRepr.getValues().size(), is(5));
    }
View Full Code Here

    }

    private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
        final DomainServiceResource resource = client.getDomainServiceResource();
        final Response response = resource.services();
        final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();

        return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
    }
View Full Code Here

    }

    @Test
    public void self_isFollowable() throws Exception {
        // given
        final ListRepresentation repr = givenRepresentation();

        // when, then
        assertThat(repr, isFollowableLinkToSelf(client));
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.json.applib.domainobjects.ListRepresentation

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.