protected void createTransfer(StringToStringMap values) {
    String propertyTransfer = values.get(TRANSFER_STEP);

    WsdlTestCase testCase = (WsdlTestCase) request.getTestCase();
    TransferResponseValuesTestStep transferStep =
        (TransferResponseValuesTestStep) testCase.getTestStepByName(propertyTransfer);

    if (transferStep == null) {
      int index = testCase.getIndexOfTestStep(request.getRequestStep());
      transferStep =
          (TransferResponseValuesTestStep)
              testCase.insertTestStep(
                  TransferValuesStepFactory.TRANSFER_TYPE, propertyTransfer, index);
    }

    if (transferStep == null) {
      UISupport.showErrorMessage("Missing transfer step [" + propertyTransfer + "]");
      return;
    }

    PropertyTransfer transfer = transferStep.getTransferByName(values.get(TRANSFER_NAME));
    if (transfer == null) transfer = transferStep.addTransfer(values.get(TRANSFER_NAME));

    transfer.setTargetStepName(request.getRequestStep().getName());
    transfer.setTargetPropertyName("Request");
    transfer.setTargetPath(values.get(TARGET_XPATH));

    String sourceStepName = values.get(SOURCE_STEP);
    transfer.setSourceStepName(sourceStepName);

    TestStep sourceStep = testCase.getTestStepByName(sourceStepName);
    if (sourceStep == null) {
      sourceStep =
          (WsdlPropertiesTestStep)
              testCase.insertTestStep(PropertiesStepFactory.PROPERTIES_TYPE, sourceStepName, 0);
    }

    String sourcePropertyName = values.get(SOURCE_PROPERTY);

    if (sourceStep.getProperty(sourcePropertyName) == null
        && sourceStep instanceof WsdlPropertiesTestStep) {
      ((WsdlPropertiesTestStep) sourceStep).addProperty(sourcePropertyName);
    }

    transfer.setSourcePropertyName(sourcePropertyName);

    if (values.getBoolean(OPEN_EDITOR)) {
      TransferResponseValuesDesktopPanel panel =
          (TransferResponseValuesDesktopPanel) UISupport.showDesktopPanel(transferStep);

      panel.selectTransfer(transfer);
    }
  }
Exemplo n.º 2
0
 private void updateRequestProperty(TestStep testStep, String propertyName, String propertyValue) {
   testStep.getProperty(propertyName).setValue(propertyValue);
 }