com.meterware.httpunit.HttpInternalErrorException Java Examples

The following examples show how to use com.meterware.httpunit.HttpInternalErrorException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeneralActionTest.java    From ontopia with Apache License 2.0 5 votes vote down vote up
public void testFormUnregister() throws Exception {
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/General/testFormUnregister.jsp");
  WebForm form = resp.getForms()[0];
  Button button = form.getButtonWithID("testFormUnregister");
  
  String requestId = form.getParameterValue(Constants.RP_REQUEST_ID);
  wc.getResponse(webedTestLocation + "/unregister?requestid=" + requestId);
  
  try {
    button.click();
    fail("Failed to unregister form action data.");
  } catch (HttpInternalErrorException e) {
  }
}
 
Example #2
Source File: GeneralActionTest.java    From ontopia with Apache License 2.0 5 votes vote down vote up
public void testTimedExpiryOfActionData() throws Exception {
  WebResponse resp1, resp2;
  WebForm form1, form2;
  
  // Set expiry age low.
  wc.getResponse(webedTestLocation
      + "/test/General/setBundleExpiryAge.jsp?bundleExpiryAge=0");

  // Test that form action data are expired after a short time.
  resp1 = wc.getResponse(webedTestLocation
      + "/test/General/testTimedExpiryOfActionData.jsp");
  form1 = resp1.getForms()[0];
  resp2 = wc.getResponse(webedTestLocation
      + "/test/General/testTimedExpiryOfActionData.jsp");
  form2 = resp2.getForms()[0];
  form2.submit();
  try {
    form1.submit();
    fail("Failed to expire form action data after set expiry time.");
  } catch (HttpInternalErrorException e) {
  }
  
  // Reset expiry.
  wc.getResponse(webedTestLocation
      + "/test/General/setBundleExpiryAge.jsp");

  // Test that form action data are _not_ expired after a short time.
  resp1 = wc.getResponse(webedTestLocation
      + "/test/General/testTimedExpiryOfActionData.jsp");
  form1 = resp1.getForms()[0];
  resp2 = wc.getResponse(webedTestLocation
      + "/test/General/testTimedExpiryOfActionData.jsp");
  form2 = resp2.getForms()[0];
  form2.submit();
  form1.submit();
}