Examples of DomainObjectRepresentation


Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

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

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

        // property ('name')
        final JsonRepresentation properties = domainObjectRepr.getProperties();
        final JsonRepresentation nameProperty = properties.getRepresentation("name");
        assertThat(nameProperty.getString("disabledReason"), is(not(nullValue())));
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

        final Response domainObjectResp = domainObjectResource.object(domainType, instanceId);
        final RestfulResponse<DomainObjectRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
        return domainObjectRepr;
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

    @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);
        final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

        final RestfulResponse<ActionResultRepresentation> response = request.executeT();
        final ActionResultRepresentation actionResultRepr = response.getEntity();
        assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
        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

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

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

        // 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

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

        final Response domainObjectResp = domainObjectResource.object(domainType, instanceId);
        final RestfulResponse<DomainObjectRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
        return domainObjectRepr;
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

    @Test
    public void domainObjectWithDisabledMembers() throws Exception {

        // given, when
        final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("BSRL","75");

        // property ('visibleButNotEditableProperty')
        final JsonRepresentation properties = domainObjectRepr.getProperties();
        final JsonRepresentation nameProperty = properties.getRepresentation("visibleButNotEditableProperty");
        assertThat(nameProperty.getString("disabledReason"), is("Always disabled"));
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

    @Test
    public void domainObjectWithHiddenMembers() throws Exception {

        // given, when
        final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("BSRL","74");

        // property ('invisibleProperty')
        final JsonRepresentation properties = domainObjectRepr.getProperties();
        final JsonRepresentation nameProperty = properties.getRepresentation("invisibleProperty");
        assertThat(nameProperty, is(nullValue()));
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

    public void followLink() throws Exception {

        // 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);
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation

        final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);

        // then
        assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));

        final DomainObjectRepresentation repr = jsonResp.getEntity();

        assertThat(repr, isMap());

        assertThat(repr.getTitle(), matches("JdkValuedEntities"));
       
        assertThat(repr.getDomainType(), is(nullValue()));
        assertThat(repr.getInstanceId(), is(nullValue()));
       
        assertThat(repr.getServiceId(), is("JdkValuedEntities"));
       
        assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET).build());
       
        assertThat(repr.getMembers(), isMap());
        assertThat(repr.getMembers().size(), is(2));
        DomainObjectMemberRepresentation listMemberRepr = repr.getAction("list");
       
        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()));
       
        assertThat(repr.getExtensions(), isMap());
        assertThat(repr.getOid(), matches("JdkValuedEntities:28"));
    }
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.