コード例 #1
0
 private ActionHelper createActionHelper(String forwardName) throws Exception {
   ActionHelper result = new ActionHelper();
   result.setUpAction(action, forwardName);
   result.getForm().setFormName("probeEditForm");
   result.getRequest().setupAddParameter(ProbeDetailsAction.PROBEID, probe.getId().toString());
   String id = probeSuite.getId().toString();
   result.getRequest().setupAddParameter(RequestContext.SUITE_ID, id);
   result.getRequest().setupAddParameter(RequestContext.SUITE_ID, id);
   return result;
 }
コード例 #2
0
  public void testSubmitExecute() throws Exception {

    ActionHelper ah = createActionHelper("success");
    ah.getForm().set(ProbeEditAction.SUBMITTED, new Boolean(true));
    ah.getForm().set("description", probe.getDescription());
    ah.getForm().set("notification", new Boolean(true));
    Long intv = new Long(probe.getCheckIntervalMinutes().longValue());
    ah.getForm().set("check_interval_min", intv);
    ah.getForm().set("notification_interval_min", probe.getNotificationIntervalMinutes());

    MonitoringTestUtils.setupParamValues(ah, probe.getCommand(), 3);

    ActionForward af = ah.executeAction();
    assertEquals("success", af.getName());

    Probe edited = (Probe) reload(probe);
    assertTrue(edited.isNotifyCritical().booleanValue());
    MonitoringTestUtils.verifyParameters(edited, probe.getCommand());
    assertEquals(intv, edited.getCheckIntervalMinutes());
  }