Package ch.ralscha.extdirectspring.bean

Examples of ch.ralscha.extdirectspring.bean.ExtDirectResponse


    MvcResult result = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(result
        .getResponse().getContentAsByteArray());

    assertThat(responses).hasSize(1);
    ExtDirectResponse resp = responses.get(0);

    assertThat(resp.getAction()).isEqualTo("remoteProviderStoreRead");
    assertThat(resp.getMethod()).isEqualTo("method4");
    assertThat(resp.getType()).isEqualTo("rpc");
    assertThat(resp.getTid()).isEqualTo(1);
    assertThat(resp.getMessage()).isNull();
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getResult()).isNotNull();

    return ControllerUtil.convertValue(resp.getResult(),
        new TypeReference<ExtDirectStoreResult<Row>>() {/* nothing_here */
        });
  }
 
View Full Code Here


    MvcResult result = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(result
        .getResponse().getContentAsByteArray());

    assertThat(responses).hasSize(1);
    ExtDirectResponse resp = responses.get(0);

    assertThat(resp.getAction()).isEqualTo("remoteProviderStoreRead");
    assertThat(resp.getMethod()).isEqualTo("methodMetadata");
    assertThat(resp.getType()).isEqualTo("rpc");
    assertThat(resp.getTid()).isEqualTo(1);
    assertThat(resp.getMessage()).isNull();
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getResult()).isNotNull();

    Map<String, Object> response = (Map<String, Object>) resp.getResult();
    assertThat(((List<Object>) response.get("records")).size()).isEqualTo(50);
    assertThat((Integer) response.get("total")).isEqualTo(100);
    Map<String, Object> metadata = (Map<String, Object>) response.get("metaData");
    assertThat(metadata).isNotNull();
View Full Code Here

    MvcResult mvcResult = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(mvcResult
        .getResponse().getContentAsByteArray());

    assertThat(responses).hasSize(1);
    ExtDirectResponse resp = responses.get(0);
    assertThat(resp.getAction()).isEqualTo(action);
    assertThat(resp.getMethod()).isEqualTo(method);
    assertThat(resp.getType()).isEqualTo("rpc");
    assertThat(resp.getTid()).isEqualTo(1);
    assertThat(resp.getMessage()).isNull();
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getResult()).isNotNull();

    Object result = resp.getResult();
    if (result instanceof List) {
      List<Row> storeResponse = ControllerUtil.convertValue(result,
          new TypeReference<List<Row>>() {/* nothing_here */
          });
      assertThat(storeResponse).hasSize(1);
 
View Full Code Here

    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(resultMvc
        .getResponse().getContentAsByteArray());
    assertThat(responses).hasSize(1);

    ExtDirectResponse edsResponse = responses.get(0);

    assertThat(edsResponse.getAction()).isEqualTo("formInfoController3");
    assertThat(edsResponse.getMethod()).isEqualTo("updateInfoJsonDirect");
    assertThat(edsResponse.getTid()).isEqualTo(14);
    assertThat(edsResponse.getWhere()).isNull();
    assertThat(edsResponse.getType()).isEqualTo("rpc");
    assertThat(edsResponse.getMessage()).isNull();

    @SuppressWarnings("unchecked")
    Map<String, Object> result = (Map<String, Object>) edsResponse.getResult();
    assertThat(result).hasSize(6).contains(entry("name", "RALPH"), entry("age", 30),
        entry("admin", Boolean.FALSE), entry("salary", 1012.3),
        entry("result", "theResultRESULT"), entry("success", Boolean.TRUE));
  }
View Full Code Here

    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(resultMvc
        .getResponse().getContentAsByteArray());
    assertThat(responses).hasSize(1);

    ExtDirectResponse edsResponse = responses.get(0);

    assertThat(edsResponse.getAction()).isEqualTo("formInfoController3");
    assertThat(edsResponse.getMethod()).isEqualTo("updateInfoJsonDirectError");
    assertThat(edsResponse.getTid()).isEqualTo(14);
    assertThat(edsResponse.getWhere()).isNull();
    assertThat(edsResponse.getType()).isEqualTo("rpc");

    Map<String, Object> result = (Map<String, Object>) edsResponse.getResult();
    assertThat(result).hasSize(2).contains(entry("success", Boolean.FALSE));
    assertThat(result).hasSize(2).containsKey("errors");
    Map age = (Map) result.get("errors");
    assertThat(age).hasSize(1).containsKey("age");
    ArrayList value = (ArrayList) age.get("age");
View Full Code Here

    List<ExtDirectResponse> responses = readDirectResponses(result.getResponse()
        .getContentAsByteArray());
    assertThat(responses).hasSize(1);

    ExtDirectResponse edResponse = responses.get(0);

    assertThat(edResponse.getAction()).isEqualTo(bean);
    assertThat(edResponse.getMethod()).isEqualTo(method);
    assertThat(edResponse.getTid()).isEqualTo(tid);
    assertThat(edResponse.getWhere()).isNull();

    if (expectedResultOrType == null) {
      assertThat(edResponse.getType()).isEqualTo("exception");
      assertThat(edResponse.getResult()).isNull();
      assertThat(edResponse.getMessage()).isEqualTo("Server Error");
    }
    else {
      assertThat(edResponse.getType()).isEqualTo("rpc");
      assertThat(edResponse.getMessage()).isNull();
      if (expectedResultOrType == Void.TYPE) {
        assertThat(edResponse.getResult()).isNull();
      }
      else if (expectedResultOrType instanceof Class<?>) {
        return ControllerUtil.convertValue(edResponse.getResult(),
            (Class<?>) expectedResultOrType);
      }
      else if (expectedResultOrType instanceof TypeReference) {
        return ControllerUtil.convertValue(edResponse.getResult(),
            (TypeReference<?>) expectedResultOrType);
      }
      else {
        assertThat(edResponse.getResult()).isEqualTo(expectedResultOrType);
      }
    }

    return edResponse.getResult();

  }
View Full Code Here

    List<ExtDirectResponse> responses = readDirectResponses(result.getResponse()
        .getContentAsByteArray());
    assertThat(responses).hasSize(1);

    ExtDirectResponse edResponse = responses.get(0);

    assertThat(edResponse.getAction()).isEqualTo(bean);
    assertThat(edResponse.getMethod()).isEqualTo(method);
    assertThat(edResponse.getTid()).isEqualTo(tid);
    assertThat(edResponse.getWhere()).isNull();

    return edResponse.getResult();
  }
View Full Code Here

    MvcResult result = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(result
        .getResponse().getContentAsByteArray());

    assertThat(responses).hasSize(1);
    ExtDirectResponse resp = responses.get(0);
    assertResponse(resp, "readWithPaging");
    ExtDirectStoreResult<Book> storeResponse = ControllerUtil.convertValue(
        resp.getResult(), new TypeReference<ExtDirectStoreResult<Book>>() {/* nothing_here */
        });
    assertThat(storeResponse.getTotal()).isEqualTo(51L);
    assertThat(storeResponse.isSuccess()).isTrue();
    assertThat(storeResponse.getRecords().size()).isEqualTo(2);

    Iterator<Book> it = storeResponse.getRecords().iterator();

    Book aBook = it.next();
    assertThat(aBook.getId().intValue()).isEqualTo(1);
    assertThat(aBook.getTitle()).isEqualTo("Ext JS in Action");
    assertThat(aBook.getIsbn()).isEqualTo("1935182110");

    aBook = it.next();
    assertThat(aBook.getId().intValue()).isEqualTo(2);
    assertThat(aBook.getTitle()).isEqualTo("Learning Ext JS 3.2");
    assertThat(aBook.getIsbn()).isEqualTo("1849511209");

    edRequest = ControllerUtil.createEdsRequest(serviceName, "read", 1, null);
    result = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    responses = ControllerUtil.readDirectResponses(result.getResponse()
        .getContentAsByteArray());

    assertThat(responses).hasSize(1);
    resp = responses.get(0);
    assertResponse(resp, "read");
    Collection<Book> books = ControllerUtil.convertValue(resp.getResult(),
        new TypeReference<Collection<Book>>() {
          // nothing here
        });
    it = books.iterator();

View Full Code Here

    MvcResult result = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(result
        .getResponse().getContentAsByteArray());

    assertThat(responses).hasSize(1);
    ExtDirectResponse resp = responses.get(0);
    assertResponse(resp, "update3");
    assertUpdateResponse(resp, 1, 3);
  }
View Full Code Here

    MvcResult result = ControllerUtil.performRouterRequest(mockMvc, edRequest);
    List<ExtDirectResponse> responses = ControllerUtil.readDirectResponses(result
        .getResponse().getContentAsByteArray());

    assertThat(responses).hasSize(1);
    ExtDirectResponse resp = responses.get(0);
    assertResponse(resp, "update3");
    assertUpdateResponse(resp, 2, 3);
  }
View Full Code Here

TOP

Related Classes of ch.ralscha.extdirectspring.bean.ExtDirectResponse

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.