Exemplo n.º 1
0
  public void perform(SecurityTest securityTest, Object param) {
    if (dialog == null) {
      XFormDialogBuilder builder = XFormFactory.createDialogBuilder("SecurityTest Options");
      form = builder.createForm("Basic");
      form.addCheckBox(FAIL_ON_ERROR, "Fail on error")
          .addFormFieldListener(
              new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                  form.getFormField(FAIL_SECURITYTEST_ON_ERROR)
                      .setEnabled(!Boolean.parseBoolean(newValue));
                }
              });
      form.addCheckBox(FAIL_SECURITYTEST_ON_ERROR, "Fail SecurityTest if it has failed TestSteps");

      dialog =
          builder.buildDialog(
              builder.buildOkCancelHelpActions(HelpUrls.SECURITYTESTEDITOR_HELP_URL),
              "Specify general options for this SecurityTest",
              UISupport.OPTIONS_ICON);
    }

    StringToStringMap values = new StringToStringMap();

    values.put(FAIL_ON_ERROR, String.valueOf(securityTest.getFailOnError()));
    values.put(
        FAIL_SECURITYTEST_ON_ERROR, String.valueOf(securityTest.getFailSecurityTestOnScanErrors()));
    values = dialog.show(values);

    if (dialog.getReturnValue() == XFormDialog.OK_OPTION) {
      try {
        securityTest.setFailOnError(Boolean.parseBoolean(values.get(FAIL_ON_ERROR)));
        securityTest.setFailSecurityTestOnScanErrors(
            Boolean.parseBoolean(values.get(FAIL_SECURITYTEST_ON_ERROR)));

      } catch (Exception e1) {
        UISupport.showErrorMessage(e1.getMessage());
      }
    }
  }