Package ch.ralscha.extdirectspring.bean

Examples of ch.ralscha.extdirectspring.bean.ExtDirectPollResponse


  public void pollCookieWithConversion() throws Exception {
    List<Cookie> cookies = new ArrayList<Cookie>();
    cookies.add(new Cookie("intCookie", "2"));
    cookies.add(new Cookie("booleanCookie", "true"));

    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "messageCookieValue6", "messageCookieValue6", null, null,
        cookies);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("messageCookieValue6");
    assertThat(resp.getData()).isEqualTo("theHeader;2;true");
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();

  }
View Full Code Here


  }

  @Test
  public void pollBeanDoesNotExists() throws Exception {

    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProviderXY", "handleMessage1", "message1", null, null);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("exception");
    assertThat(resp.getName()).isEqualTo("message1");
    assertThat(resp.getData()).isNull();
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isEqualTo("Server Error");
  }
View Full Code Here

    assertThat(resp.getMessage()).isEqualTo("Server Error");
  }

  @Test
  public void pollNoArguments() throws Exception {
    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage1", "message1", null, null);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("message1");
    assertThat((String) resp.getData()).startsWith("Successfully polled at: ");
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();
  }
View Full Code Here

    assertThat(resp.getMessage()).isNull();
  }

  @Test
  public void pollSupportedArguments() throws Exception {
    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage2", "message2", null, null);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("message2");
    assertThat((String) resp.getData()).startsWith("Successfully polled at: ");
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();
  }
View Full Code Here

  @Test
  public void pollRequiredArgument() throws Exception {
    Map<String, String> params = new LinkedHashMap<String, String>();
    params.put("id", "2");

    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage3", "message3", params, null);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("message3");
    assertThat(resp.getData()).isEqualTo("Result: 2");
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();
  }
View Full Code Here

  }

  @Test
  public void pollRequiredArgumentNoRequestParameter() throws Exception {

    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage3", "message3", null, null);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("exception");
    assertThat(resp.getName()).isEqualTo("message3");
    assertThat(resp.getData()).isNull();
    assertThat(resp.getMessage()).isEqualTo("Server Error");
    assertThat(resp.getWhere()).isNull();
  }
View Full Code Here

    callMethod("pollMethodService", "overrideSubclassNoView", noView());
  }

  @SuppressWarnings("unchecked")
  private void callMethod(String bean, String method, MapEntry... expectedEntries) {
    ExtDirectPollResponse response;
    try {
      response = ControllerUtil.performPollRequest(mockMvc, bean, method,
          "theEvent", null, null);
      Map<String, Object> data = (Map<String, Object>) response.getData();
      assertThat(data).hasSize(expectedEntries.length);
      assertThat(data).contains(expectedEntries);
    }
    catch (Exception e) {
      fail("call poll method: " + e.getMessage());
View Full Code Here

  @Test
  public void pollDefaultValueArgumentWithRequestParameter() throws Exception {
    Map<String, String> params = new LinkedHashMap<String, String>();
    params.put("id", "7");

    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage4", "message4", params, null);
    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("message4");
    assertThat(resp.getData()).isEqualTo(Integer.valueOf(14));
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();
  }
View Full Code Here

    assertThat(resp.getMessage()).isNull();
  }

  @Test
  public void pollDefaultValueArgumentWithoutRequestParameter() throws Exception {
    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage4", "message4", null, null, null, true);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("message4");
    assertThat(resp.getData()).isEqualTo(Integer.valueOf(2));
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();
  }
View Full Code Here

  @Test
  public void pollNotRequiredArgumentWithRequestParameter() throws Exception {
    Map<String, String> params = new LinkedHashMap<String, String>();
    params.put("id", "3");

    ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
        "pollProvider", "handleMessage5", "message5", params, null);

    assertThat(resp).isNotNull();
    assertThat(resp.getType()).isEqualTo("event");
    assertThat(resp.getName()).isEqualTo("message5");
    assertThat(resp.getData()).isEqualTo(Integer.valueOf(6));
    assertThat(resp.getWhere()).isNull();
    assertThat(resp.getMessage()).isNull();
  }
View Full Code Here

TOP

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

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.