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

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


        Response response = serviceResource.invokeActionQueryOnly(repoName, actionName, null);
        RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);

        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();

        assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
        final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);

        assertThat(listRepr.getValue(), is(not(nullValue())));
        assertThat(listRepr.getValue().size(), is(IsisMatchers.greaterThan(idx + 1)));

        final LinkRepresentation domainObjectLinkRepr = listRepr.getValue().arrayGet(idx).as(LinkRepresentation.class);
View Full Code Here


    public void domainObjectRepresentationForTransient_hasNoSelf_andHasNoOid() throws Exception {

        // given, when
        final RestfulRequest request = this.client.createRequest(RestfulHttpMethod.POST, "services/simples/actions/newTransientEntity/invoke");
        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()));
View Full Code Here

        final Response response = serviceResource.invokeActionIdempotent("ActionsEntities", "concatenate", JsonNodeUtils.asInputStream(args));
        final RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
       
        // then
        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
        final ActionResultRepresentation entity = restfulResponse.getEntity();
        final ScalarValueRepresentation svr = entity.getResult().as(ScalarValueRepresentation.class);
        assertThat(svr.getValue().asString(), is("abc+defHOORAY"));
    }
View Full Code Here

        then(restfulResponse);
       
    }

    private void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws Exception {
        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
        assertThat(actionResultRepr.mapHas("links[rel=self]"), is(false));
    }
View Full Code Here

        then(restfulResponse);
    }

    private void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws Exception {
       
        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
       
        assertThat(actionResultRepr.getSelf(), isLink()
                .rel(Rel.SELF)
                .href(endsWith(":39393/services/ActionsEntities/actions/findById/invoke"))
                .httpMethod(RestfulHttpMethod.GET)
                .type(RepresentationType.ACTION_RESULT.getMediaType())
                );
View Full Code Here

    }

    private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
       
        assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasMediaTypeProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
       
        assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
        final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
        assertThat(listRepr.getValue().size(), is(5));
    }
View Full Code Here

        then(restfulResponse);
    }

    private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
        assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasMediaTypeProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
       
        assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
       
        final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);

        assertThat(listRepr.getValue().size(), is(2));
    }
View Full Code Here

        then(restfulResponse, "IVA VENDITE 21%AAA");
    }

    private void then(RestfulResponse<ActionResultRepresentation> restfulResponse, final String expected) throws Exception {
        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
        final ActionResultRepresentation entity = restfulResponse.getEntity();
        final ScalarValueRepresentation svr = entity.getResult().as(ScalarValueRepresentation.class);
        assertThat(svr.getValue().asString(), is(expected));
    }
View Full Code Here

    }

    private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
       
        assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasMediaTypeProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
       
        assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
        final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
        assertThat(listRepr.getValue().size(), is(5));
    }
View Full Code Here

        thenResponseIsScalarValueOf(restfulResponse, true);
    }

    private void thenResponseIsScalarValueOf(RestfulResponse<ActionResultRepresentation> restfulResponse, boolean value) throws JsonParseException, JsonMappingException, IOException {
        assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasMediaTypeProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
        ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
        assertThat(actionResultRepr.getResultType(), is(ResultType.SCALAR_VALUE));
        JsonRepresentation resultRepr = actionResultRepr.getResult();
        assertThat(resultRepr, is(not(nullValue())));
       
        ScalarValueRepresentation scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
       
        LinkRepresentation returnTypeLink = scalarValueRepr.getLinkWithRel(Rel.RETURN_TYPE);
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation

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.