Package org.apache.isis.viewer.restfulobjects.applib

Examples of org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation


    @Test
    public void usingClientFollow() throws Exception {

        // when
        final LinkRepresentation link = Util.serviceActionListInvokeFirstReference(client, "PrimitiveValuedEntities");
        final DomainObjectRepresentation objRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
        final String domainType = objRepr.getDomainType();
        final String instanceId = objRepr.getInstanceId();
       
        final Response jaxrsResponse = domainObjectResource.object(domainType,instanceId);
View Full Code Here


        assertThat(actionResultRepr.getResult(), is(not(nullValue())));

        final DomainObjectRepresentation domainObjectRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);

        // then
        final LinkRepresentation self = domainObjectRepr.getSelf();
        assertThat(self, is(nullValue()));

        assertThat(domainObjectRepr.getOid(), is(nullValue()));
    }
View Full Code Here

        // given, when
        final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","xxx");

        // icon
        final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
        assertThat(selfIcon, isLink().href(matches(".+" + "/images/" + "null\\.png")).httpMethod(RestfulHttpMethod.GET));

    }
View Full Code Here

    @Test
    public void thenTitle_andExtensions_andLinks() throws Exception {

        // when
        final LinkRepresentation link = Util.serviceActionListInvokeFirstReference(client, "PrimitiveValuedEntities");
        domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);

        // then has domain type, instanceId, title
        assertThat(domainObjectRepr, is(not(nullValue())));

        assertThat(domainObjectRepr.getTitle(), is("Primitive Valued Entity #0")); // running in-memory
        assertThat(domainObjectRepr.getDomainType(), is("PRMV"));
        assertThat(domainObjectRepr.getInstanceId(), is(not(nullValue())));
       
        // and then extensions
        assertThat(domainObjectRepr.getExtensions().getString("oid"), IsisMatchers.startsWith("PRMV:" + domainObjectRepr.getInstanceId()));
        assertThat(domainObjectRepr.getExtensions().getBoolean("isService"), is(false));
        assertThat(domainObjectRepr.getExtensions().getBoolean("isPersistent"), is(true));

        // and then has links
        final LinkRepresentation self = domainObjectRepr.getSelf();
        assertThat(self, isLink()
                            .rel(Rel.SELF)
                            .href(matches(".+\\/objects\\/PRMV\\/\\d+"))
                            .httpMethod(RestfulHttpMethod.GET)
                            .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
View Full Code Here

    @Ignore("TODO")
    @Test
    public void thenMembers() throws Exception {

        // when
        final LinkRepresentation link = Util.serviceActionListInvokeFirstReference(client, "ApplibValuedEntities");
        domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);

        // and then members (types)
        DomainObjectMemberRepresentation property;
        ScalarValueRepresentation scalarRepr;
View Full Code Here

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final LinkRepresentation link = Util.serviceActionListInvokeFirstReference(client, "PrimitiveValuedEntities");
        link.withHref("http://localhost:39393/objects/PRMV/nonExistent");
       
        // when
        final RestfulResponse<JsonRepresentation> restfulResp = client.follow(link);
       
        // then
View Full Code Here

        // given
        final Response serviceResp = homePageResource.homePage();
        final RestfulResponse<HomePageRepresentation> serviceJsonResp = RestfulResponse.ofT(serviceResp);
        final HomePageRepresentation serviceRepr = serviceJsonResp.getEntity();
        final LinkRepresentation selfLink = serviceRepr.getLinkWithRel(Rel.SELF);
        final LinkRepresentation postLink = selfLink.withMethod(RestfulHttpMethod.POST);

        // when
        final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(postLink);

        // then
View Full Code Here

        assertThat(listMemberRepr.getMemberType(), is("action"));
        assertThat(listMemberRepr.getDisabledReason(), is(nullValue()));
        assertThat(listMemberRepr.getLinks(), isArray());
        assertThat(listMemberRepr.getLinks().size(), is(1));
       
        LinkRepresentation listMemberReprDetailsLink = listMemberRepr.getLinkWithRel(Rel.DETAILS);
        assertThat(listMemberReprDetailsLink, isLink(client)
                                       .httpMethod(RestfulHttpMethod.GET)
                                       .href(endsWith("/services/JdkValuedEntities/actions/list"))
                                       .returning(HttpStatusCode.OK)
                                       .responseEntityWithSelfHref(listMemberReprDetailsLink.getHref()).build());
       
       
        assertThat(repr.getLinks(), isArray());
        assertThat(repr.getLinks().size(), is(3));
       
        // link to self (see above)
        // link to describedby
        LinkRepresentation describedByLink = repr.getLinkWithRel(Rel.DESCRIBEDBY);
        assertThat(describedByLink, isLink(client)
                                       .httpMethod(RestfulHttpMethod.GET)
                                       .href(endsWith("/domain-types/JdkValuedEntities")).build()
                                       );
        assertThat(describedByLink, isLink(client)
                .returning(HttpStatusCode.OK)
                .responseEntityWithSelfHref(describedByLink.getHref()).build());
       
        assertThat(repr.getLinkWithRel(Rel.PERSIST), is(nullValue()));
        assertThat(repr.getLinkWithRel(Rel.UPDATE), is(nullValue()));
        assertThat(repr.getLinkWithRel(Rel.DELETE), is(nullValue()));
       
View Full Code Here

        // given
        final Response serviceResp = domainServiceResource.service("ActionsEntities");
        final RestfulResponse<DomainObjectRepresentation> serviceJsonResp = RestfulResponse.ofT(serviceResp);
        final DomainObjectRepresentation serviceRepr = serviceJsonResp.getEntity();
        final LinkRepresentation upLink = serviceRepr.getLinkWithRel(Rel.UP);
        final LinkRepresentation postLink = upLink.withMethod(RestfulHttpMethod.POST);

        // when
        final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(postLink);

        // then
View Full Code Here

        final DomainObjectMemberRepresentation actionRepr = repr.getAction("visibleAndInvocableAction");
        assertThat(actionRepr, isMap());

        assertThat(actionRepr.getDisabledReason(), is(nullValue()));

        final LinkRepresentation actionDetailsLink = actionRepr.getLinkWithRel(Rel.DETAILS);
        assertThat(actionDetailsLink, isLink(this.client)
                                        .rel(Rel.DETAILS)
                                        .httpMethod(RestfulHttpMethod.GET)
                                        .href(Matchers.endsWith(":39393/services/BusinessRulesEntities/actions/visibleAndInvocableAction"))
                                        .returning(HttpStatusCode.OK).build());
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation

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.