Examples of LinkRepresentation


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

        // 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 putLink = selfLink.withMethod(RestfulHttpMethod.PUT);

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

        // then
View Full Code Here

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

        // 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.PUT);

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

        // then
View Full Code Here

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

    @Test
    public void followLink() throws Exception {

        // when
        final LinkRepresentation link = Util.serviceActionListInvokeFirstReference(client, "PrimitiveValuedEntities");
        final LinkRepresentation deleteLink = link.withMethod(RestfulHttpMethod.DELETE);
        final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);

        assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
        assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Deleting objects is not supported."));
View Full Code Here

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

    @Test
    public void thenMembers() throws Exception {

        // when
        final LinkRepresentation link = Util.serviceActionListInvokeFirstReference(client, "JdkValuedEntities");
        final RestfulResponse<JsonRepresentation> restResp = client.follow(link);
        final JsonRepresentation entityRepr = restResp.getEntity();
        domainObjectRepr = entityRepr.as(DomainObjectRepresentation.class);

        // and then members (types)
View Full Code Here

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

        final ObjectCollectionRepresentation collectionRepr = collectionJsonResp.getEntity();

        assertThat(collectionRepr.getString("memberType"), is("collection"));

        // self link
        final LinkRepresentation selfLink = collectionRepr.getLinkWithRel(Rel.SELF);
        assertThat(selfLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/BSRL/73/collections/visibleAndEditableCollection"))
                                .returning(HttpStatusCode.OK)
                                .build());

        // up link
        final LinkRepresentation upLink = collectionRepr.getLinkWithRel(Rel.UP);
        assertThat(upLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("http://localhost:39393/objects/BSRL/73"))
                                .returning(HttpStatusCode.OK)
                                .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
                                .title("Untitled Bus Rules Entity")
                                .build());

        //addto link
        final LinkRepresentation addtoLink = collectionRepr.getLinkWithRel(Rel.ADD_TO);
        assertThat(addtoLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.POST)
                                .type(RepresentationType.OBJECT_COLLECTION.getMediaType())
                                .href(endsWith("/objects/BSRL/73/collections/visibleAndEditableCollection"))
                                .build());

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

       //remove-from link
        final LinkRepresentation removeFromLink = collectionRepr.getLinkWithRel(Rel.REMOVE_FROM);
        assertThat(removeFromLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.DELETE)
                                .type(RepresentationType.OBJECT_COLLECTION.getMediaType())
                                .href(endsWith("/objects/BSRL/73/collections/visibleAndEditableCollection"))
                                .build());

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

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

        assertThat(collectionRepr.getArray("value").isArray(),is(true));

        assertThat(collectionRepr.getExtensions(), isMap());
View Full Code Here

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

    @Test
    public void thenMembers() throws Exception {

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


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

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

    @Test
    public void primitivePropertiesUpdated() throws Exception {
       
        final DomainObjectRepresentation domainObjectRepr = getObjectRepr("PRMV", "43");
       
        final LinkRepresentation updateLink = domainObjectRepr.getLinkWithRel(Rel.UPDATE);
       
        final JsonRepresentation argRepr = updateLink.getArguments();
       
        final byte b = (byte)99;
        final char c = 'b';
        final double d = 12345.678;
        final float f = 54321.123F;
View Full Code Here

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

    @Test
    public void jdkPropertiesUpdated() throws Exception {
       
        final DomainObjectRepresentation domainObjectRepr = getObjectRepr("JDKV", "38");
        final LinkRepresentation updateLink = domainObjectRepr.getLinkWithRel(Rel.UPDATE);
        final JsonRepresentation argRepr = updateLink.getArguments();

        final BigDecimal bd = new BigDecimal("12345678901234567.789");
        final BigInteger bi = new BigInteger("123456789012345678");
        final java.sql.Date sqld = new java.sql.Date(new DateTime(2014,5,1, 0,0, DateTimeZone.UTC).getMillis());
        final java.sql.Time sqlt = new java.sql.Time(13,0,0);
View Full Code Here

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

    @Test
    public void jodaPropertiesUpdated() throws Exception {
       
        final DomainObjectRepresentation domainObjectRepr = getObjectRepr("JODA", "83");
       
        final LinkRepresentation updateLink = domainObjectRepr.getLinkWithRel(Rel.UPDATE);
       
        final JsonRepresentation argRepr = updateLink.getArguments();
       
        final LocalDate ld = new LocalDate(2013,5,1);
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        final DateTime dt = new DateTime(2013,2,1,14,15,0, DateTimeZone.UTC);
        final String s = "New string";
View Full Code Here

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

        // given
        final Response serviceResp = userResource.user();
        final RestfulResponse<UserRepresentation> serviceJsonResp = RestfulResponse.ofT(serviceResp);
        final UserRepresentation serviceRepr = serviceJsonResp.getEntity();
        final LinkRepresentation selfLink = serviceRepr.getLinkWithRel(Rel.SELF);
        final LinkRepresentation putLink = selfLink.withMethod(RestfulHttpMethod.PUT);

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

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