Examples of AtmosphereTester


Examples of org.apache.wicket.atmosphere.tester.AtmosphereTester

        super.receiveMessage(target, message);
        receiveMessageCalled.set(true);
      }
    };

    AtmosphereTester waTester = new AtmosphereTester(tester, page);

    assertThat(updateTimeCalled.get(), is(false));
    assertThat(receiveMessageCalled.get(), is(false));

    Date payload = new Date();
    waTester.post(payload);

    assertThat(updateTimeCalled.get(), is(true));
    assertThat(receiveMessageCalled.get(), is(false));

    tester.assertContains(updateTimeIsExecuted);

    final FormTester form = tester.newFormTester("form");

    form.setValue("input", "Atmosphere rocks!");

    form.submit("send");

    assertThat(updateTimeCalled.get(), is(true));
    assertThat(receiveMessageCalled.get(), is(true));

    // get the the collected so far content of the suspended response
    // Note: it may contain several <ajax-response>s.
    // use waTester.resetResponse() to remove the collected data
    String atmosphereResponse = waTester.getPushedResponse();
//    System.out.println("RES:" + atmosphereResponse);

    // assert
    assertThat(atmosphereResponse,
        is(not(equalTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ajax-response></ajax-response>"))));

    waTester.switchOnTestMode();
    // now the assertions are against the Atmosphere's suspended response data
    tester.assertComponentOnAjaxResponse("message");
    waTester.switchOffTestMode();
    // now the assertions will be the real last response

    tester.assertLabel("message", "Atmosphere rocks!");

    tester.destroy();
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.