@Ignore("TODO")
  @Test
  public void thenCollections() throws Exception {

    // when
    final Response jaxrsResponse = domainObjectResource.object("PRMV", "29");
    final RestfulResponse<DomainObjectRepresentation> restfulResponse =
        RestfulResponse.ofT(jaxrsResponse);
    assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));

    // then

    domainObjectRepr = restfulResponse.getEntity();
    assertThat(domainObjectRepr, is(not(nullValue())));

    // then collections

  }
예제 #2
0
  @Ignore("to get working again")
  @Test
  public void actionPrompt() throws Exception {

    // when
    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(RestfulHttpMethod.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(RestfulHttpMethod.GET));

    // type
    final LinkRepresentation type = actionPromptRepr.getLink("type");
    assertThat(type.getRel(), is("type"));
    assertThat(type.getHref(), matches(".+vnd\\.list\\+json"));
    assertThat(type.getHttpMethod(), is(RestfulHttpMethod.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(RestfulHttpMethod.POST));
    assertThat(invokeLink.getArguments(), is(not(nullValue())));
    assertThat(invokeLink.getArguments().isArray(), is(true));
    assertThat(invokeLink.getArguments().size(), is(0));
  }