public void actionPerformed(ActionEvent e) {
   String root = ModelSupport.getResourceRoot(testStep);
   File file =
       UISupport.getFileDialogs()
           .open(
               this,
               "Set properties source",
               "properties",
               "Properties Files (*.properties)",
               root);
   if (file != null) {
     updatingSource = true;
     testStep.setSource(file.getAbsolutePath());
     sourceField.setText(testStep.getSource());
     updatingSource = false;
     try {
       boolean createMissing =
           UISupport.confirm("Create missing properties?", "Set Properties Source");
       int cnt = testStep.loadProperties(createMissing);
       UISupport.showInfoMessage(
           "Loaded " + cnt + " properties from [" + testStep.getSource() + "]");
     } catch (IOException e1) {
       UISupport.showErrorMessage(
           "Failed to load properties from [" + testStep.getSource() + "]; " + e1);
     }
   }
 }
    public void actionPerformed(ActionEvent e) {
      String root = ModelSupport.getResourceRoot(testStep);
      File file =
          UISupport.getFileDialogs()
              .saveAs(
                  this,
                  "Set properties target",
                  "properties",
                  "Properties Files (*.properties)",
                  new File(root));
      if (file != null) {
        updatingTarget = true;
        testStep.setTarget(file.getAbsolutePath());
        targetField.setText(testStep.getTarget());
        updatingTarget = false;

        try {
          int cnt = testStep.saveProperties();
          UISupport.showInfoMessage(
              "Saved " + cnt + " properties to [" + testStep.getTarget() + "]");
        } catch (IOException e1) {
          UISupport.showErrorMessage(
              "Failed to save properties to [" + testStep.getTarget() + "]; " + e1);
        }
      }
    }
Example #3
0
 public AddAssertionPanel(Assertable assertable) {
   super(
       "Add Assertion",
       "Select the source property and which assertion to apply below ",
       HelpUrls.ADD_ASSERTION_PANEL);
   this.assertable = assertable;
   assertionEntryRenderer.setAssertable(assertable);
   categoriesListRenderer.setAssertable(assertable);
   selectionListener = new InternalListSelectionListener();
   categoriesAssertionsMap =
       AssertionCategoryMapping.getCategoriesAssertionsMap(assertable, recentAssertionHandler);
   // load interfaces or have a issue with table and cell renderer
   WsdlProject project = (WsdlProject) ModelSupport.getModelItemProject(assertable.getModelItem());
   for (Interface inf : project.getInterfaceList()) {
     try {
       // There seems to be no good reason to load the definitions for rest interfaces
       // hence that call has been removed for the time being.
       if (inf instanceof WsdlInterface) {
         ((WsdlInterface) inf).getWsdlContext().loadIfNecessary();
       }
     } catch (Exception e) {
       // TODO Improve this
       e.printStackTrace();
     }
   }
 }
Example #4
0
  public void perform(WsdlTestCase testCase, Object param) {
    if (dialog == null) {
      dialog = ADialogBuilder.buildDialog(Form.class);
      dialog
          .getFormField(Form.PROJECT)
          .addFormFieldListener(
              new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                  if (newValue.equals(CREATE_NEW_OPTION))
                    dialog.setOptions(Form.TESTSUITE, new String[] {CREATE_NEW_OPTION});
                  else {
                    Project project = SoapUI.getWorkspace().getProjectByName(newValue);
                    dialog.setOptions(
                        Form.TESTSUITE,
                        ModelSupport.getNames(
                            project.getTestSuiteList(), new String[] {CREATE_NEW_OPTION}));
                  }
                }
              });
      dialog
          .getFormField(Form.CLONE_DESCRIPTION)
          .addFormFieldListener(
              new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                  if (dialog.getBooleanValue(Form.CLONE_DESCRIPTION)) {
                    dialog.getFormField(Form.DESCRIPTION).setEnabled(false);
                  } else {
                    dialog.getFormField(Form.DESCRIPTION).setEnabled(true);
                  }
                }
              });
    }

    dialog.setBooleanValue(Form.MOVE, false);
    dialog.setBooleanValue(Form.CLONE_DESCRIPTION, true);
    dialog.getFormField(Form.DESCRIPTION).setEnabled(false);
    dialog.setValue(Form.DESCRIPTION, testCase.getDescription());
    dialog.setValue(Form.NAME, "Copy of " + testCase.getName());
    WorkspaceImpl workspace = testCase.getTestSuite().getProject().getWorkspace();
    dialog.setOptions(
        Form.PROJECT,
        ModelSupport.getNames(workspace.getOpenProjectList(), new String[] {CREATE_NEW_OPTION}));

    dialog.setValue(Form.PROJECT, testCase.getTestSuite().getProject().getName());

    dialog.setOptions(
        Form.TESTSUITE,
        ModelSupport.getNames(
            testCase.getTestSuite().getProject().getTestSuiteList(),
            new String[] {CREATE_NEW_OPTION}));

    dialog.setValue(Form.TESTSUITE, testCase.getTestSuite().getName());
    boolean hasLoadTests = testCase.getLoadTestCount() > 0;
    dialog.setBooleanValue(Form.CLONE_LOADTESTS, hasLoadTests);
    dialog.getFormField(Form.CLONE_LOADTESTS).setEnabled(hasLoadTests);

    if (dialog.show()) {
      String targetProjectName = dialog.getValue(Form.PROJECT);
      String targetTestSuiteName = dialog.getValue(Form.TESTSUITE);
      String name = dialog.getValue(Form.NAME);

      WsdlProject project = testCase.getTestSuite().getProject();
      WsdlTestSuite targetTestSuite = null;
      Set<Interface> requiredInterfaces = new HashSet<Interface>();

      // to another project project?
      if (!targetProjectName.equals(project.getName())) {
        // get required interfaces
        for (int y = 0; y < testCase.getTestStepCount(); y++) {
          WsdlTestStep testStep = testCase.getTestStepAt(y);
          requiredInterfaces.addAll(testStep.getRequiredInterfaces());
        }

        project = (WsdlProject) workspace.getProjectByName(targetProjectName);
        if (project == null) {
          targetProjectName = UISupport.prompt("Enter name for new Project", "Clone TestCase", "");
          if (targetProjectName == null) return;

          try {
            project = workspace.createProject(targetProjectName, null);
          } catch (SoapUIException e) {
            UISupport.showErrorMessage(e);
          }

          if (project == null) return;
        }

        if (requiredInterfaces.size() > 0 && project.getInterfaceCount() > 0) {
          Map<String, Interface> bindings = new HashMap<String, Interface>();
          for (Interface iface : requiredInterfaces) {
            bindings.put(iface.getTechnicalId(), iface);
          }

          for (Interface iface : project.getInterfaceList()) {
            bindings.remove(iface.getTechnicalId());
          }

          requiredInterfaces.retainAll(bindings.values());
        }

        if (requiredInterfaces.size() > 0) {
          String msg =
              "Target project [" + targetProjectName + "] is missing required Interfaces;\r\n\r\n";
          for (Interface iface : requiredInterfaces) {
            msg += iface.getName() + " [" + iface.getTechnicalId() + "]\r\n";
          }
          msg += "\r\nThese will be cloned to the targetProject as well";

          if (!UISupport.confirm(msg, "Clone TestCase")) return;

          for (Interface iface : requiredInterfaces) {
            project.importInterface((AbstractInterface<?>) iface, true, true);
          }
        }
      }

      targetTestSuite = project.getTestSuiteByName(targetTestSuiteName);
      if (targetTestSuite == null) {
        targetTestSuiteName =
            UISupport.prompt(
                "Specify name for new TestSuite",
                "Clone TestCase",
                "Copy of " + testCase.getTestSuite().getName());
        if (targetTestSuiteName == null) return;

        targetTestSuite = project.addNewTestSuite(targetTestSuiteName);
      }

      boolean move = dialog.getBooleanValue(Form.MOVE);
      WsdlTestCase newTestCase =
          targetTestSuite.importTestCase(
              testCase, name, -1, dialog.getBooleanValue(Form.CLONE_LOADTESTS), !move);
      UISupport.select(newTestCase);

      if (move) {
        testCase.getTestSuite().removeTestCase(testCase);
      }
      boolean cloneDescription = dialog.getBooleanValue(Form.CLONE_DESCRIPTION);
      if (!cloneDescription) {
        newTestCase.setDescription(dialog.getValue(Form.DESCRIPTION));
      }
    }
  }
    public void actionPerformed(ActionEvent e) {
      if (dialog == null) {
        dialog = ADialogBuilder.buildDialog(LoadOptionsForm.class);
      }

      Project project = ModelSupport.getModelItemProject(holder.getModelItem());
      if (project != null) {
        FileFormField fileFormField = (FileFormField) dialog.getFormField(LoadOptionsForm.FILE);
        String currentDirectory = extractFileChooserPathForProject(project);
        fileFormField.setCurrentDirectory(currentDirectory);
      }

      dialog
          .getFormField(LoadOptionsForm.DELETEREMAINING)
          .setEnabled(holder instanceof MutableTestPropertyHolder);
      dialog
          .getFormField(LoadOptionsForm.CREATEMISSING)
          .setEnabled(holder instanceof MutableTestPropertyHolder);

      if (dialog.show()) {
        try {
          BufferedReader reader =
              new BufferedReader(new FileReader(dialog.getValue(LoadOptionsForm.FILE)));

          String line = reader.readLine();
          int count = 0;

          Set<String> names = new HashSet<String>(Arrays.asList(holder.getPropertyNames()));

          while (line != null) {
            if (line.trim().length() > 0 && !(line.charAt(0) == '#')) {
              int ix = line.indexOf('=');
              if (ix > 0) {
                String name = line.substring(0, ix).trim();
                String value = line.length() > ix ? line.substring(ix + 1) : "";

                // read multiline value
                if (value.endsWith("\\")) {
                  value = value.substring(0, value.length() - 1);

                  String ln = reader.readLine();
                  while (ln != null && ln.endsWith("\\")) {
                    value += ln.substring(0, ln.length() - 1);
                    ln = reader.readLine();
                  }

                  if (ln != null) {
                    value += ln;
                  }
                  if (ln == null) {
                    break;
                  }
                }

                if (holder.hasProperty(name)) {
                  count++;
                  holder.getProperty(name).setValue(value);
                  holder.setPropertyValue(name, value);
                } else if (dialog.getBooleanValue(LoadOptionsForm.CREATEMISSING)
                    && holder instanceof MutableTestPropertyHolder) {
                  TestProperty prop = ((MutableTestPropertyHolder) holder).addProperty(name);
                  if (!prop.isReadOnly()) {
                    prop.setValue(value);
                    if (prop instanceof RestParameter) {
                      ((RestParameter) prop).setDefaultValue(value);
                    }
                  }
                  count++;
                }

                names.remove(name);
              }
            }

            line = reader.readLine();
          }

          if (dialog.getBooleanValue(LoadOptionsForm.DELETEREMAINING)
              && holder instanceof MutableTestPropertyHolder) {
            for (String name : names) {
              ((MutableTestPropertyHolder) holder).removeProperty(name);
            }
          }

          reader.close();
          UISupport.showInfoMessage("Added/Updated " + count + " properties from file");
        } catch (Exception ex) {
          UISupport.showErrorMessage(ex);
        }
      }
    }
    public void actionPerformed(ActionEvent e) {
      if (optionsDialog == null) {
        optionsDialog = ADialogBuilder.buildDialog(OptionsForm.class);
        optionsDialog
            .getFormField(OptionsForm.TESTSUITE)
            .addFormFieldListener(
                new XFormFieldListener() {

                  public void valueChanged(
                      XFormField sourceField, String newValue, String oldValue) {
                    List<TestCase> testCaseList =
                        project.getTestSuiteByName(newValue).getTestCaseList();
                    testCaseList.remove(getModelItem().getTestCase());
                    optionsDialog.setOptions(
                        OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList));

                    if (testCaseList.size() > 0) {
                      WsdlTestCase testCase = project.getTestSuiteByName(newValue).getTestCaseAt(0);
                      optionsDialog.setOptions(
                          OptionsForm.RETURN_PROPERTIES, testCase.getPropertyNames());
                      ((XFormMultiSelectList)
                              optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
                          .setSelectedOptions(getModelItem().getReturnProperties().toStringArray());
                    }
                  }
                });
        optionsDialog
            .getFormField(OptionsForm.TESTCASE)
            .addFormFieldListener(
                new XFormFieldListener() {

                  public void valueChanged(
                      XFormField sourceField, String newValue, String oldValue) {
                    WsdlTestSuite testSuite =
                        project.getTestSuiteByName(optionsDialog.getValue(OptionsForm.TESTSUITE));
                    WsdlTestCase testCase = testSuite.getTestCaseByName(newValue);
                    optionsDialog.setOptions(
                        OptionsForm.RETURN_PROPERTIES, testCase.getPropertyNames());
                    ((XFormMultiSelectList)
                            optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
                        .setSelectedOptions(getModelItem().getReturnProperties().toStringArray());
                  }
                });
      }

      WsdlTestCase targetTestCase = getModelItem().getTargetTestCase();

      optionsDialog.setOptions(
          OptionsForm.TESTSUITE, ModelSupport.getNames(project.getTestSuiteList()));
      if (targetTestCase != null) {
        optionsDialog.setValue(OptionsForm.TESTSUITE, targetTestCase.getTestSuite().getName());

        List<TestCase> testCaseList = targetTestCase.getTestSuite().getTestCaseList();
        testCaseList.remove(getModelItem().getTestCase());

        optionsDialog.setOptions(OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList));
        optionsDialog.setValue(OptionsForm.TESTCASE, targetTestCase.getName());

        optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, targetTestCase.getPropertyNames());
        ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
            .setSelectedOptions(getModelItem().getReturnProperties().toStringArray());
      } else {
        if (project.getTestSuiteCount() == 0) {
          optionsDialog.setOptions(OptionsForm.TESTCASE, new String[0]);
          optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, new String[0]);
        } else {
          List<TestCase> testCaseList = project.getTestSuiteAt(0).getTestCaseList();
          testCaseList.remove(getModelItem().getTestCase());
          optionsDialog.setOptions(OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList));

          if (testCaseList.isEmpty())
            optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, new String[0]);
          else
            optionsDialog.setOptions(
                OptionsForm.RETURN_PROPERTIES, testCaseList.get(0).getPropertyNames());
        }
      }

      switch (getModelItem().getRunMode().intValue()) {
        case RunTestCaseRunModeTypeConfig.INT_PARALLELL:
          optionsDialog.setValue(
              OptionsForm.RUN_MODE, OptionsForm.CREATE_ISOLATED_COPY_FOR_EACH_RUN);
          break;
        case RunTestCaseRunModeTypeConfig.INT_SINGLETON_AND_FAIL:
          optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.RUN_PRIMARY_TEST_CASE);
          break;
        case RunTestCaseRunModeTypeConfig.INT_SINGLETON_AND_WAIT:
          optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.RUN_SYNCHRONIZED_TESTCASE);
          break;
      }

      optionsDialog.setBooleanValue(
          OptionsForm.COPY_HTTP_SESSION, getModelItem().isCopyHttpSession());
      optionsDialog.setBooleanValue(
          OptionsForm.COPY_LOADTEST_PROPERTIES, getModelItem().isCopyLoadTestProperties());
      optionsDialog.setBooleanValue(
          OptionsForm.IGNORE_EMPTY_PROPERTIES, getModelItem().isIgnoreEmptyProperties());

      if (optionsDialog.show()) {
        WsdlTestSuite testSuite =
            project.getTestSuiteByName(optionsDialog.getValue(OptionsForm.TESTSUITE));
        getModelItem()
            .setTargetTestCase(
                testSuite == null
                    ? null
                    : testSuite.getTestCaseByName(optionsDialog.getValue(OptionsForm.TESTCASE)));
        getModelItem()
            .setReturnProperties(
                new StringList(
                    ((XFormMultiSelectList)
                            optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
                        .getSelectedOptions()));

        switch (optionsDialog.getValueIndex(OptionsForm.RUN_MODE)) {
          case 0:
            getModelItem().setRunMode(RunTestCaseRunModeTypeConfig.PARALLELL);
            break;
          case 1:
            getModelItem().setRunMode(RunTestCaseRunModeTypeConfig.SINGLETON_AND_FAIL);
            break;
          case 2:
            getModelItem().setRunMode(RunTestCaseRunModeTypeConfig.SINGLETON_AND_WAIT);
            break;
        }

        getModelItem()
            .setCopyHttpSession(optionsDialog.getBooleanValue(OptionsForm.COPY_HTTP_SESSION));
        getModelItem()
            .setCopyLoadTestProperties(
                optionsDialog.getBooleanValue(OptionsForm.COPY_LOADTEST_PROPERTIES));
        getModelItem()
            .setIgnoreEmptyProperties(
                optionsDialog.getBooleanValue(OptionsForm.IGNORE_EMPTY_PROPERTIES));

        titledBorder.setTitle(createTitleForBorder());
      }
    }
 private WsdlTestCase findTargetTestCase() {
   return ModelSupport.findModelItemById(
       getTestCaseId(), getTestCase().getTestSuite().getProject());
 }
  @Override
  public void afterStep(
      TestCaseRunner testRunner, TestCaseRunContext runContext, TestStepResult result) {
    super.afterStep(testRunner, runContext, result);
    TestStep currentStep = runContext.getCurrentStep();

    if (currentStep instanceof Assertable) {
      Assertable requestStep = (Assertable) currentStep;
      for (int c = 0; c < requestStep.getAssertionCount(); c++) {
        TestAssertion assertion = requestStep.getAssertionAt(c);
        log.info("Assertion [" + assertion.getName() + "] has status " + assertion.getStatus());
        if (assertion.getStatus() == AssertionStatus.FAILED) {
          for (AssertionError error : assertion.getErrors()) {
            log.error("ASSERTION FAILED -> " + error.getMessage());
          }

          assertions.add(assertion);
          assertionResults.put(assertion, (WsdlTestStepResult) result);
        }

        testAssertionCount++;
      }
    }

    String countPropertyName = currentStep.getName() + " run count";
    Long count = (Long) runContext.getProperty(countPropertyName);
    if (count == null) {
      count = new Long(0);
    }

    runContext.setProperty(countPropertyName, new Long(count.longValue() + 1));

    if (result.getStatus() == TestStepStatus.FAILED || exportAll) {
      try {
        String exportSeparator = System.getProperty(SOAPUI_EXPORT_SEPARATOR, "-");

        TestCase tc = currentStep.getTestCase();
        String nameBase =
            StringUtils.createFileName(tc.getTestSuite().getName(), '_')
                + exportSeparator
                + StringUtils.createFileName(tc.getName(), '_')
                + exportSeparator
                + StringUtils.createFileName(currentStep.getName(), '_')
                + "-"
                + count.longValue()
                + "-"
                + result.getStatus();

        WsdlTestCaseRunner callingTestCaseRunner =
            (WsdlTestCaseRunner) runContext.getProperty("#CallingTestCaseRunner#");

        if (callingTestCaseRunner != null) {
          WsdlTestCase ctc = callingTestCaseRunner.getTestCase();
          WsdlRunTestCaseTestStep runTestCaseTestStep =
              (WsdlRunTestCaseTestStep) runContext.getProperty("#CallingRunTestCaseStep#");

          nameBase =
              StringUtils.createFileName(ctc.getTestSuite().getName(), '_')
                  + exportSeparator
                  + StringUtils.createFileName(ctc.getName(), '_')
                  + exportSeparator
                  + StringUtils.createFileName(runTestCaseTestStep.getName(), '_')
                  + exportSeparator
                  + StringUtils.createFileName(tc.getTestSuite().getName(), '_')
                  + exportSeparator
                  + StringUtils.createFileName(tc.getName(), '_')
                  + exportSeparator
                  + StringUtils.createFileName(currentStep.getName(), '_')
                  + "-"
                  + count.longValue()
                  + "-"
                  + result.getStatus();
        }

        String absoluteOutputFolder = getAbsoluteOutputFolder(ModelSupport.getModelItemProject(tc));
        String fileName = absoluteOutputFolder + File.separator + nameBase + ".txt";

        if (result.getStatus() == TestStepStatus.FAILED) {
          log.error(currentStep.getName() + " failed, exporting to [" + fileName + "]");
        }

        new File(fileName).getParentFile().mkdirs();

        PrintWriter writer = new PrintWriter(fileName);
        result.writeTo(writer);
        writer.close();

        // write attachments
        if (result instanceof MessageExchange) {
          Attachment[] attachments = ((MessageExchange) result).getResponseAttachments();
          if (attachments != null && attachments.length > 0) {
            for (int c = 0; c < attachments.length; c++) {
              fileName = nameBase + "-attachment-" + (c + 1) + ".";

              Attachment attachment = attachments[c];
              String contentType = attachment.getContentType();
              if (!"application/octet-stream".equals(contentType)
                  && contentType != null
                  && contentType.indexOf('/') != -1) {
                fileName += contentType.substring(contentType.lastIndexOf('/') + 1);
              } else {
                fileName += "dat";
              }

              fileName = absoluteOutputFolder + File.separator + fileName;

              FileOutputStream outFile = new FileOutputStream(fileName);
              Tools.writeAll(outFile, attachment.getInputStream());
              outFile.close();
            }
          }
        }

        exportCount++;
      } catch (Exception e) {
        log.error("Error saving failed result: " + e, e);
      }
    }

    testStepCount++;
  }
Example #9
0
 public boolean dependsOn(ModelItem modelItem) {
   return ModelSupport.dependsOn(this, modelItem);
 }
Example #10
0
  public String getId() {
    if (!config.isSetId()) config.setId(ModelSupport.generateModelItemID());

    return config.getId();
  }
  public Response sendRequest(SubmitContext submitContext, Request request) throws Exception {
    AbstractHttpRequestInterface<?> httpRequest = (AbstractHttpRequestInterface<?>) request;

    HttpClient httpClient = HttpClientSupport.getHttpClient();
    ExtendedHttpMethod httpMethod = createHttpMethod(httpRequest);
    boolean createdState = false;

    HttpState httpState = (HttpState) submitContext.getProperty(SubmitContext.HTTP_STATE_PROPERTY);
    if (httpState == null) {
      httpState = new HttpState();
      submitContext.setProperty(SubmitContext.HTTP_STATE_PROPERTY, httpState);
      createdState = true;
    }

    HostConfiguration hostConfiguration = new HostConfiguration();

    String localAddress = System.getProperty("soapui.bind.address", httpRequest.getBindAddress());
    if (localAddress == null || localAddress.trim().length() == 0)
      localAddress = SoapUI.getSettings().getString(HttpSettings.BIND_ADDRESS, null);

    if (localAddress != null && localAddress.trim().length() > 0) {
      try {
        hostConfiguration.setLocalAddress(InetAddress.getByName(localAddress));
      } catch (Exception e) {
        SoapUI.logError(e);
      }
    }

    submitContext.removeProperty(RESPONSE);
    submitContext.setProperty(HTTP_METHOD, httpMethod);
    submitContext.setProperty(POST_METHOD, httpMethod);
    submitContext.setProperty(HTTP_CLIENT, httpClient);
    submitContext.setProperty(REQUEST_CONTENT, httpRequest.getRequestContent());
    submitContext.setProperty(HOST_CONFIGURATION, hostConfiguration);
    submitContext.setProperty(WSDL_REQUEST, httpRequest);
    submitContext.setProperty(RESPONSE_PROPERTIES, new StringToStringMap());

    for (RequestFilter filter : filters) {
      filter.filterRequest(submitContext, httpRequest);
    }

    try {
      Settings settings = httpRequest.getSettings();

      // custom http headers last so they can be overridden
      StringToStringMap headers = httpRequest.getRequestHeaders();
      for (String header : headers.keySet()) {
        String headerValue = headers.get(header);
        headerValue = PropertyExpander.expandProperties(submitContext, headerValue);
        httpMethod.setRequestHeader(header, headerValue);
      }

      // do request
      WsdlProject project = (WsdlProject) ModelSupport.getModelItemProject(httpRequest);
      WssCrypto crypto = null;
      if (project != null) {
        crypto =
            project
                .getWssContainer()
                .getCryptoByName(
                    PropertyExpander.expandProperties(submitContext, httpRequest.getSslKeystore()));
      }

      if (crypto != null && WssCrypto.STATUS_OK.equals(crypto.getStatus())) {
        hostConfiguration
            .getParams()
            .setParameter(
                SoapUIHostConfiguration.SOAPUI_SSL_CONFIG,
                crypto.getSource() + " " + crypto.getPassword());
      }

      // dump file?
      httpMethod.setDumpFile(
          PathUtils.expandPath(
              httpRequest.getDumpFile(), (AbstractWsdlModelItem<?>) httpRequest, submitContext));

      // include request time?
      if (settings.getBoolean(HttpSettings.INCLUDE_REQUEST_IN_TIME_TAKEN))
        httpMethod.initStartTime();

      // submit!
      httpClient.executeMethod(hostConfiguration, httpMethod, httpState);
      httpMethod.getTimeTaken();
    } catch (Throwable t) {
      httpMethod.setFailed(t);

      if (t instanceof Exception) throw (Exception) t;

      SoapUI.logError(t);
      throw new Exception(t);
    } finally {
      for (int c = filters.size() - 1; c >= 0; c--) {
        filters.get(c).afterRequest(submitContext, httpRequest);
      }

      if (!submitContext.hasProperty(RESPONSE)) {
        createDefaultResponse(submitContext, httpRequest, httpMethod);
      }

      Response response = (Response) submitContext.getProperty(BaseHttpRequestTransport.RESPONSE);
      StringToStringMap responseProperties =
          (StringToStringMap)
              submitContext.getProperty(BaseHttpRequestTransport.RESPONSE_PROPERTIES);

      for (String key : responseProperties.keySet()) {
        response.setProperty(key, responseProperties.get(key));
      }

      if (httpMethod != null) {
        httpMethod.releaseConnection();
      } else log.error("PostMethod is null");

      if (createdState) {
        submitContext.setProperty(SubmitContext.HTTP_STATE_PROPERTY, null);
      }
    }

    return (Response) submitContext.getProperty(BaseHttpRequestTransport.RESPONSE);
  }
  public void perform(WsdlTestRequestStep target, Object param) {
    this.testStep = target;

    if (dialog == null) {
      dialog = ADialogBuilder.buildDialog(Form.class);
      dialog
          .getFormField(Form.INTERFACE)
          .addFormFieldListener(
              new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                  WsdlProject project = testStep.getTestCase().getTestSuite().getProject();
                  dialog.setOptions(
                      Form.OPERATION,
                      ModelSupport.getNames(
                          project.getInterfaceByName(newValue).getOperationList()));
                  dialog.setValue(Form.OPERATION, testStep.getOperationName());
                }
              });

      dialog
          .getFormField(Form.RECREATE_REQUEST)
          .addFormFieldListener(
              new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                  boolean enabled = Boolean.parseBoolean(newValue);

                  dialog.getFormField(Form.CREATE_OPTIONAL).setEnabled(enabled);
                  dialog.getFormField(Form.KEEP_EXISTING).setEnabled(enabled);
                }
              });

      dialog.getFormField(Form.CREATE_OPTIONAL).setEnabled(false);
      dialog.getFormField(Form.KEEP_EXISTING).setEnabled(false);
    }

    WsdlProject project = target.getTestCase().getTestSuite().getProject();
    dialog.setOptions(
        Form.INTERFACE,
        ModelSupport.getNames(
            project.getInterfaceList(),
            new ModelSupport.InterfaceTypeFilter(WsdlInterfaceFactory.WSDL_TYPE)));
    dialog.setValue(Form.INTERFACE, target.getInterfaceName());

    dialog.setOptions(
        Form.OPERATION,
        ModelSupport.getNames(
            project.getInterfaceByName(target.getInterfaceName()).getOperationList()));
    dialog.setValue(Form.OPERATION, target.getOperationName());
    dialog.setValue(Form.NAME, target.getName());

    if (dialog.show()) {
      String ifaceName = dialog.getValue(Form.INTERFACE);
      String operationName = dialog.getValue(Form.OPERATION);

      WsdlInterface iface = (WsdlInterface) project.getInterfaceByName(ifaceName);
      WsdlOperation operation = iface.getOperationByName(operationName);
      target.setOperation(operation);

      String name = dialog.getValue(Form.NAME).trim();
      if (name.length() > 0 && !target.getName().equals(name)) target.setName(name);

      if (dialog.getBooleanValue(Form.RECREATE_REQUEST)) {
        String req = operation.createRequest(dialog.getBooleanValue(Form.CREATE_OPTIONAL));
        if (req == null) {
          UISupport.showErrorMessage("Request creation failed");
          return;
        }

        WsdlTestRequest request = target.getTestRequest();
        if (dialog.getBooleanValue(Form.KEEP_EXISTING)) {
          req = XmlUtils.transferValues(request.getRequestContent(), req);
        }

        request.setRequestContent(req);
      }
    }
  }