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

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


    @Test
    public void invokeQueryOnly_noArg_usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = givenAction("simples", "list");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        assertThat(invokeLink, is(not(nullValue())));
        final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
        final ListRepresentation listRepr = restfulResponse.getEntity();
View Full Code Here


    @Test
    public void invokeIdempotent_withArgs_usingClientFollow() throws Exception {

        // given action
        final JsonRepresentation givenAction = givenAction("simples", "newPersistentEntity");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        assertThat(invokeLink, is(not(nullValue())));

        final JsonRepresentation args = invokeLink.getArguments();
View Full Code Here

    @Test
    public void invoke_returningScalar_withReferenceArgs_usingClientFollow() throws Exception {

        // given action
        final JsonRepresentation givenAction = givenAction("simples", "count");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        assertThat(invokeLink, is(not(nullValue())));
        final JsonRepresentation args = invokeLink.getArguments();
        assertThat(args.size(), is(0));
View Full Code Here

        final DomainObjectRepresentation simpleEntityBefore = restfulResponseBefore.getEntity();
        final Boolean before = simpleEntityBefore.getProperty("flag").getBoolean("value");

        // and given 'toggle' action on repo
        final JsonRepresentation givenAction = givenAction("simples", "toggle");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        assertThat(invokeLink, is(not(nullValue())));

        final JsonRepresentation args = invokeLink.getArguments();
View Full Code Here

        // given simple entity with 'flag' property set to true
        final LinkRepresentation linkToSimpleEntity = givenLinkToSimpleEntity(0);

        // given
        final JsonRepresentation givenAction = givenAction("simples", "update");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        assertThat(invokeLink, is(not(nullValue())));

        final JsonRepresentation args = invokeLink.getArguments();
View Full Code Here

        final Response actionPromptResp = domainObjectResource.actionPrompt("OID:1", "list");
        final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
        assertThat(actionPromptJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

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

        // _self.link
        final LinkRepresentation selfLink = actionPromptRepr.getLink("_self.link");
        assertThat(selfLink.getRel(), is("member"));
        assertThat(selfLink.getHref(), matches(".+objects/OID:1/actions/list"));
        assertThat(selfLink.getHttpMethod(), is(HttpMethod.GET));

        // _self.object
        final LinkRepresentation selfObject = actionPromptRepr.getLink("_self.object");
        assertThat(selfObject.getRel(), is("object"));
        assertThat(selfObject.getHref(), matches(".+objects/OID:1"));
        assertThat(selfObject.getHttpMethod(), is(HttpMethod.GET));

        // type
        final LinkRepresentation type = actionPromptRepr.getLink("type");
        assertThat(type.getRel(), is("type"));
        assertThat(type.getHref(), matches(".+vnd\\.list\\+json"));
        assertThat(type.getHttpMethod(), is(HttpMethod.GET));

        assertThat(actionPromptRepr.getString("memberType"), is("action"));
        assertThat(actionPromptRepr.getString("actionType"), is("USER"));
        assertThat(actionPromptRepr.getInt("numParameters"), is(0));
        assertThat(actionPromptRepr.getArray("parameters").size(), is(0));

        final LinkRepresentation invokeLink = actionPromptRepr.getLink("invoke");
        assertThat(invokeLink.getRel(), is("invoke"));
        assertThat(invokeLink.getHref(), matches(".+objects/OID:1/actions/list/invoke"));
        assertThat(invokeLink.getHttpMethod(), is(HttpMethod.POST));
        assertThat(invokeLink.getArguments(), is(not(nullValue())));
        assertThat(invokeLink.getArguments().isArray(), is(true));
View Full Code Here

    }

    private LinkRepresentation givenLinkToSimpleEntity(final int num) throws JsonParseException, JsonMappingException, IOException, Exception {
        // given
        final JsonRepresentation givenAction = givenAction("simples", "list");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        // when
        final LinkRepresentation invokeLink = actionRepr.getInvoke();

        // then
        final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
        final ListRepresentation listRepr = restfulResponse.getEntity();
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.json.applib.domainobjects.ObjectActionRepresentation

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.