Examples of ObjectActionRepresentation


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

       
        LinkRepresentation firstEntityLink = subListRepr.getValue().arrayGet(0).asLink();

        // and given a representation of the 'contains' action accepting a entity href
        final JsonRepresentation containsAction = Util.givenAction(client, "ActionsEntities", "contains");
        final ObjectActionRepresentation containsActionRepr = containsAction.as(ObjectActionRepresentation.class);
       
        final LinkRepresentation invokeLink = containsActionRepr.getInvoke();
        final JsonRepresentation args = invokeLink.getArguments();
        assertThat(args.size(), is(3));
       
        // when query the 'contains' action passing in the entity
        // (for a range where the entity is contained in the range)
View Full Code Here

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

    }


    private ListRepresentation givenSublistActionInvoked(int from, int to) throws Exception {
        final JsonRepresentation givenSubListAction = Util.givenAction(client, "ActionsEntities", "subList");
        final ObjectActionRepresentation actionRepr = givenSubListAction.as(ObjectActionRepresentation.class);
       
        final LinkRepresentation invokeLink = actionRepr.getInvoke();
        final JsonRepresentation args = invokeLink.getArguments();
       
        // when
        args.mapPut("from.value", from);
        args.mapPut("to.value", to);
View Full Code Here

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

    @Test
    public void usingClientFollow_whenExplicitlySetToNull() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        assertThat(invokeLink, isLink(client)
                                    .rel(Rel.INVOKE)
                                    .httpMethod(RestfulHttpMethod.GET)
                                    .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
View Full Code Here

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

    @Test
    public void usingClientFollow_whenImplicitlySetToNull() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        assertThat(invokeLink, isLink(client)
                                    .rel(Rel.INVOKE)
                                    .httpMethod(RestfulHttpMethod.GET)
                                    .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
View Full Code Here

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

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        assertThat(invokeLink, isLink(client)
                                    .rel(Rel.INVOKE)
                                    .httpMethod(RestfulHttpMethod.GET)
                                    .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
View Full Code Here

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

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "findByIdIdempotent");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();
        final JsonRepresentation args =invokeLink.getArguments();
       
        // when
        args.mapPut("id.value", 1);
View Full Code Here

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

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        assertThat(invokeLink, isLink(client)
                                    .rel(Rel.INVOKE)
                                    .httpMethod(RestfulHttpMethod.GET)
                                    .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
View Full Code Here

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

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "findById");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();
        final JsonRepresentation args =invokeLink.getArguments();
       
        // when
        args.mapPut("id.value", 1);
View Full Code Here

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

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "findById");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();
        final JsonRepresentation args =invokeLink.getArguments();
       
        // when
        args.mapPut("id.value", 999);
View Full Code Here

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

        final Response actionPromptResp = domainObjectResource.actionPrompt("RTNE", "67", "contains");
        final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
        assertThat(actionPromptJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        // then
        final ObjectActionRepresentation actionPromptRepr = actionPromptJsonResp.getEntity();

        assertThat(actionPromptRepr.getString("memberType"), is("action"));

        // self link
        final LinkRepresentation selfLink = actionPromptRepr.getLinkWithRel(Rel.SELF);
        assertThat(selfLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/RTNE/67/actions/contains"))
                                .returning(HttpStatusCode.OK));

        // up link
        final LinkRepresentation upLink = actionPromptRepr.getLinkWithRel(Rel.UP);
        assertThat(upLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/RTNE/67"))
                                .returning(HttpStatusCode.OK)
                                .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
                                .title("Untitled Actions Entity"));

        //invoke link
        final LinkRepresentation invokeLink = actionPromptRepr.getLinkWithRel(Rel.INVOKE);
        assertThat(invokeLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/services/ActionsEntities/actions/contains/invoke")));

        assertThat(invokeLink.getArguments(), is(not(nullValue())));
        assertThat(invokeLink.getArguments().isArray(), is(false));
        assertThat(invokeLink.getArguments().size(), is(3));

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

        assertThat(actionPromptRepr.getExtensions().getString("actionType"), is("user"));
        assertThat(actionPromptRepr.getExtensions().getString("actionSemantics"), is("safe"));
        assertThat(actionPromptRepr.getArray("parameters").size(), is(3));
    }
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.