Package org.richfaces.demo.poll

Examples of org.richfaces.demo.poll.PollBean


    JSFClientSession client = jsfSession.getJSFClientSession();
    RichFacesClient ajaxClient = new RichFacesClient(client);
    JSFServerSession server = jsfSession.getJSFServerSession();

    // Get the backing bean to check activity
    PollBean pb = (PollBean)server.getManagedBeanValue(_POLLBEAN);
    assertNotNull("Can't find PollBean",pb);
    // Make sure polling is enabled
    assertTrue("Polling is not enabled in the PollBean",pb.getPollEnabled());
   
    // Get poll control to check status
    UIPoll poll = (UIPoll)server.findComponent(_POLL_ID);
    assertNotNull("Can't find server side poll component",poll);
    int interval = poll.getInterval();
    // Make sure polling is enabled
    assertTrue("Polling is not enabled in the component",poll.isEnabled());
   
    // Make sure the date is updating
    Date startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    Date endDate = pb.getLasttime();
    assertFalse("Date is not being updated in the PollBean",startDate.equals(endDate));
   
    // Get control button and disable polling
    HtmlButtonInput button = (HtmlButtonInput)client.getElement(_BUTTON_ID);
    assertNotNull("Can't find polling control button ["+_BUTTON_ID+"]",button);
    button.click();

    // Wait for polling state to change
    Thread.sleep(interval*2);   
   
    // Make sure we're no longer polling
    assertFalse("Polling should be disabled in the PollBean",pb.getPollEnabled());
    // Check the server-side control also (TBD: This causes IllegalStateException)
//    poll = (UIPoll)server.findComponent(_POLL_ID);
//    assertFalse("Polling should be disabled in the component",poll.isEnabled());
    // Make sure the date is NOT updating
    startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    endDate = pb.getLasttime();
    assertTrue("Date should not be updating in the PollBean",startDate.equals(endDate));
   
    // Turn polling back on (page was updated, therefore we MUST re-get the control)
    button = (HtmlButtonInput)client.getElement(_BUTTON_ID)
    button.click();

    // Wait for polling state to change
    Thread.sleep(interval*2);   
   
    // Make sure we're polling again
    assertTrue("Polling is not enabled in the PollBean",pb.getPollEnabled());
    // Check the server-side control also (TBD: This causes IllegalStateException)   
//    poll = (UIPoll)server.findComponent(_POLL_ID);
//    assertTrue("Polling is not enabled in the component",poll.isEnabled());
    // Make sure the date is updating
    startDate = pb.getLasttime();
    Thread.sleep(interval*4);
    endDate = pb.getLasttime();
    assertFalse("Date is not being updated in the PollBean",startDate.equals(endDate));

  }
View Full Code Here


    JSFClientSession client = jsfSession.getJSFClientSession();
    RichFacesClient ajaxClient = new RichFacesClient(client);
    JSFServerSession server = jsfSession.getJSFServerSession();
   
    // Get the backing bean to check activity
    PollBean pb = (PollBean)server.getManagedBeanValue(_POLLBEAN);
    assertNotNull("Can't find PollBean",pb);
    // Make sure the date is NOT updating
    Date startDate = pb.getLasttime();
    Thread.sleep(_EXPECTED_POLLING_INTERVAL*4)
    Date endDate = pb.getLasttime();
    assertTrue("Date should not be updating in the PollBean",startDate == endDate || startDate.equals(endDate));   
  }
View Full Code Here

TOP

Related Classes of org.richfaces.demo.poll.PollBean

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.