Package org.apache.wicket.util.tester.MockPageWithFormAndAjaxFormSubmitBehavior

Examples of org.apache.wicket.util.tester.MockPageWithFormAndAjaxFormSubmitBehavior.Pojo


    tester.startPage(MockPageWithFormAndAjaxFormSubmitBehavior.class);

    // Get the page
    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();

    Pojo pojo = page.getPojo();

    assertEquals("Mock name", pojo.getName());
    TextField<?> name = (TextField<?>)tester.getComponentFromLastRenderedPage("form:name");
    assertEquals("Mock name", name.getValue());

    assertFalse(page.isExecuted());

    tester.getRequest().getPostParameters().setParameterValue(name.getInputName(), "Mock name");

    // Execute the ajax event
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    assertTrue("AjaxFormSubmitBehavior.onSubmit() has not been executed in " +
      MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());

    assertEquals("Mock name",
      ((TextField<?>)tester.getComponentFromLastRenderedPage("form:name")).getValue());

    // The name of the pojo should still be the same. If the
    // executeAjaxEvent weren't submitting the form the name would have been
    // reset to null, because the form would have been updated but there
    // wouldn't be any data to update it with.
    assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName());
    assertEquals("Mock name", pojo.getName());
  }
View Full Code Here


    form.setValue("name", "New name");
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
        "onclick");

    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();
    Pojo pojo = page.getPojo();
    assertEquals("New name", pojo.getName());
  }
View Full Code Here

    tester.startPage(MockPageWithFormAndAjaxFormSubmitBehavior.class);

    // Get the page
    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();

    Pojo pojo = page.getPojo();

    assertEquals("Mock name", pojo.getName());
    TextField<?> name = (TextField<?>)tester.getComponentFromLastRenderedPage("form:name");
    assertEquals("Mock name", name.getValue());

    assertFalse(page.isExecuted());

    tester.getRequest().getPostParameters().setParameterValue(name.getInputName(), "Mock name");

    // Execute the ajax event
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    assertTrue("AjaxFormSubmitBehavior.onSubmit() has not been executed in " +
      MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());

    assertEquals("Mock name",
      ((TextField<?>)tester.getComponentFromLastRenderedPage("form:name")).getValue());

    // The name of the pojo should still be the same. If the
    // executeAjaxEvent weren't submitting the form the name would have been
    // reset to null, because the form would have been updated but there
    // wouldn't be any data to update it with.
    assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName());
    assertEquals("Mock name", pojo.getName());
  }
View Full Code Here

    form.setValue("name", "New name");
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();
    Pojo pojo = page.getPojo();
    assertEquals("New name", pojo.getName());
  }
View Full Code Here

    tester.startPage(MockPageWithFormAndAjaxFormSubmitBehavior.class);

    // Get the page
    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();

    Pojo pojo = page.getPojo();

    assertEquals("Mock name", pojo.getName());
    TextField<?> name = (TextField<?>)tester.getComponentFromLastRenderedPage("form:name");
    assertEquals("Mock name", name.getValue());

    assertFalse(page.isExecuted());

    tester.getRequest().getPostParameters().setParameterValue(name.getInputName(), "Mock name");

    // Execute the ajax event
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    assertTrue("AjaxFormSubmitBehavior.onSubmit() has not been executed in " +
      MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());

    assertEquals("Mock name",
      ((TextField<?>)tester.getComponentFromLastRenderedPage("form:name")).getValue());

    // The name of the pojo should still be the same. If the
    // executeAjaxEvent weren't submitting the form the name would have been
    // reset to null, because the form would have been updated but there
    // wouldn't be any data to update it with.
    assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName());
    assertEquals("Mock name", pojo.getName());
  }
View Full Code Here

    form.setValue("name", "New name");
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
        "onclick");

    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();
    Pojo pojo = page.getPojo();
    assertEquals("New name", pojo.getName());
  }
View Full Code Here

    tester.startPage(MockPageWithFormAndAjaxFormSubmitBehavior.class);

    // Get the page
    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();

    Pojo pojo = page.getPojo();

    assertEquals("Mock name", pojo.getName());
    TextField<?> name = (TextField<?>)tester.getComponentFromLastRenderedPage("form:name");
    assertEquals("Mock name", name.getValue());

    assertFalse(page.isExecuted());

    tester.getRequest().getPostParameters().setParameterValue(name.getInputName(), "Mock name");

    // Execute the ajax event
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    assertTrue("AjaxFormSubmitBehavior.onSubmit() has not been executed in " +
      MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());

    assertEquals("Mock name",
      ((TextField<?>)tester.getComponentFromLastRenderedPage("form:name")).getValue());

    // The name of the pojo should still be the same. If the
    // executeAjaxEvent weren't submitting the form the name would have been
    // reset to null, because the form would have been updated but there
    // wouldn't be any data to update it with.
    assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName());
    assertEquals("Mock name", pojo.getName());
  }
View Full Code Here

    form.setValue("name", "New name");
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();
    Pojo pojo = page.getPojo();
    assertEquals("New name", pojo.getName());
  }
View Full Code Here

    tester.startPage(MockPageWithFormAndAjaxFormSubmitBehavior.class);

    // Get the page
    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();

    Pojo pojo = page.getPojo();

    assertEquals("Mock name", pojo.getName());
    TextField<?> name = (TextField<?>)tester.getComponentFromLastRenderedPage("form:name");
    assertEquals("Mock name", name.getValue());

    assertFalse(page.isExecuted());

    tester.getRequest().getPostParameters().setParameterValue(name.getInputName(), "Mock name");

    // Execute the ajax event
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    assertTrue("AjaxFormSubmitBehavior.onSubmit() has not been executed in " +
      MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());

    assertEquals("Mock name",
      ((TextField<?>)tester.getComponentFromLastRenderedPage("form:name")).getValue());

    // The name of the pojo should still be the same. If the
    // executeAjaxEvent weren't submitting the form the name would have been
    // reset to null, because the form would have been updated but there
    // wouldn't be any data to update it with.
    assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName());
    assertEquals("Mock name", pojo.getName());
  }
View Full Code Here

    form.setValue("name", "New name");
    tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
      "onclick");

    MockPageWithFormAndAjaxFormSubmitBehavior page = (MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();
    Pojo pojo = page.getPojo();
    assertEquals("New name", pojo.getName());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.tester.MockPageWithFormAndAjaxFormSubmitBehavior.Pojo

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.