Examples of ObjectPropertyRepresentation


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

    private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }
View Full Code Here

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

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }

    private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
        return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
    }
View Full Code Here

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

    private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }
View Full Code Here

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

        final Response idPropertyResp = domainObjectResource.propertyDetails("org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity","58", "anInt");
        final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
        assertThat(idPropertyJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        // then
        final ObjectPropertyRepresentation propertyRepr = idPropertyJsonResp.getEntity();

        assertThat(propertyRepr.getString("memberType"), is("property"));

        // self link
        final LinkRepresentation selfLink = propertyRepr.getLinkWithRel(Rel.SELF);
        assertThat(selfLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58/properties/anInt"))
                                .returning(HttpStatusCode.OK));

        // up link
        final LinkRepresentation upLink = propertyRepr.getLinkWithRel(Rel.UP);
        assertThat(upLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58"))
                                .returning(HttpStatusCode.OK)
                                .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
                                .title("default-name"));

        //modify link
        final LinkRepresentation modifyLink = propertyRepr.getLinkWithRel(Rel.MODIFY);
        assertThat(modifyLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.PUT)
                                .type(RepresentationType.OBJECT_PROPERTY.getMediaType())
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58/properties/anInt")));

        assertThat(modifyLink.getArguments(), is(not(nullValue())));
        assertThat(modifyLink.getArguments().isArray(), is(false));
        assertThat(modifyLink.getArguments().size(), is(1));

        //clear link
        final LinkRepresentation clearLink = propertyRepr.getLinkWithRel(Rel.CLEAR);
        assertThat(clearLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.DELETE)
                                .type(RepresentationType.OBJECT_PROPERTY.getMediaType())
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58/properties/anInt")));

     // described by link
        final LinkRepresentation describedByLink = propertyRepr.getLinkWithRel(Rel.DESCRIBEDBY);
        assertThat(describedByLink, isLink(client)
                                .returning(HttpStatusCode.OK)
                                .responseEntityWithSelfHref(describedByLink.getHref()));

        assertThat(propertyRepr.getInt("value"), is(42));
        assertThat(propertyRepr.getString("format"),is("int"));
        assertThat(propertyRepr.getString("extensions.x-isis-format"), is("int"));
        assertThat(propertyRepr.getExtensions(), isMap());
        assertThat(propertyRepr.getExtensions().getArray("changed").isArray(), is(true));
        assertThat(propertyRepr.getExtensions().getArray("disposed").isArray(), is(true));
    }
View Full Code Here

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

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }

    private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
        return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
    }
View Full Code Here

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

    private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }
View Full Code Here

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

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }

    private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
        return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
    }
View Full Code Here

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

    public void representation() throws Exception {

        // given
        final Response idPropertyResp = domainObjectResource.propertyDetails("org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity","58", "anInt");
        final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
        final ObjectPropertyRepresentation propertyRepr = idPropertyJsonResp.getEntity();
        final LinkRepresentation selfLink = propertyRepr.getLinkWithRel(Rel.SELF);
        final LinkRepresentation postLink = selfLink.withMethod(RestfulHttpMethod.POST);

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

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

        final Response idPropertyResp = domainObjectResource.propertyDetails("org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity","58", "anInt");
        final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
        assertThat(idPropertyJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        // then
        final ObjectPropertyRepresentation propertyRepr = idPropertyJsonResp.getEntity();

        assertThat(propertyRepr.getString("memberType"), is("property"));

        // self link
        final LinkRepresentation selfLink = propertyRepr.getLinkWithRel(Rel.SELF);
        assertThat(selfLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58/properties/anInt"))
                                .returning(HttpStatusCode.OK)
                                .build());

        // up link
        final LinkRepresentation upLink = propertyRepr.getLinkWithRel(Rel.UP);
        assertThat(upLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58"))
                                .returning(HttpStatusCode.OK)
                                .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
                                .title("default-name")
                                .build());

        //modify link
        final LinkRepresentation modifyLink = propertyRepr.getLinkWithRel(Rel.MODIFY);
        assertThat(modifyLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.PUT)
                                .type(RepresentationType.OBJECT_PROPERTY.getMediaType())
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58/properties/anInt"))
                                .build());

        assertThat(modifyLink.getArguments(), is(not(nullValue())));
        assertThat(modifyLink.getArguments().isArray(), is(false));
        assertThat(modifyLink.getArguments().size(), is(1));

        //clear link
        final LinkRepresentation clearLink = propertyRepr.getLinkWithRel(Rel.CLEAR);
        assertThat(clearLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.DELETE)
                                .type(RepresentationType.OBJECT_PROPERTY.getMediaType())
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/58/properties/anInt"))
                                .build());

        // described by link
        final LinkRepresentation describedByLink = propertyRepr.getLinkWithRel(Rel.DESCRIBEDBY);
        assertThat(describedByLink, isLink(client)
                                .returning(HttpStatusCode.OK)
                                .responseEntityWithSelfHref(describedByLink.getHref())
                                .build());

        assertThat(propertyRepr.getInt("value"), is(42));
        assertThat(propertyRepr.getString("format"),is("int"));
        assertThat(propertyRepr.getString("extensions.x-isis-format"), is("int"));
        assertThat(propertyRepr.getExtensions(), isMap());
        assertThat(propertyRepr.getExtensions().getArray("changed").isArray(), is(true));
        assertThat(propertyRepr.getExtensions().getArray("disposed").isArray(), 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.