コード例 #1
0
  public PropertiesStepDesktopPanel(WsdlPropertiesTestStep testStep) {
    super(testStep);
    this.testStep = testStep;
    componentEnabler = new TestRunComponentEnabler(testStep.getTestCase());
    buildUI();

    testStep.addPropertyChangeListener(this);
  }
コード例 #2
0
  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);
    }
  }
コード例 #3
0
  private void buildUI() {
    propertiesTable = createPropertyHolderTable();
    add(propertiesTable, BorderLayout.CENTER);

    JXToolBar toolbar = propertiesTable.getToolbar();

    toolbar.addRelatedGap();
    JButton reloadButton = UISupport.createToolbarButton(new ReloadPropertiesFromSourceAction());
    toolbar.add(reloadButton);

    toolbar.addSeparator();
    toolbar.add(new JLabel("Load from:"));
    sourceField =
        new JTextField(testStep.getSource(), 20) {
          @Override
          public String getToolTipText(MouseEvent event) {
            return testStep.getSource(true);
          }
        };
    sourceField.setToolTipText(
        "The filename/url or referring system-property to load properties from");
    sourceField
        .getDocument()
        .addDocumentListener(
            new DocumentListenerAdapter() {
              public void update(Document document) {
                if (updatingSource) {
                  return;
                }

                updatingSource = true;
                testStep.setSource(sourceField.getText());
                updatingSource = false;
              }
            });

    toolbar.addRelatedGap();
    toolbar.addFixed(sourceField);
    JButton setSourceButton = UISupport.createToolbarButton(new SetPropertiesSourceAction());
    toolbar.addRelatedGap();
    toolbar.add(setSourceButton);

    toolbar.addSeparator();
    toolbar.add(new JLabel("Save to:"));
    targetField =
        new JTextField(testStep.getTarget(), 20) {
          @Override
          public String getToolTipText(MouseEvent event) {
            return testStep.getTarget(true);
          }
        };

    targetField.setToolTipText(
        "The filename/url or referring system-property to save properties to");
    targetField
        .getDocument()
        .addDocumentListener(
            new DocumentListenerAdapter() {
              public void update(Document document) {
                if (updatingTarget) {
                  return;
                }

                updatingTarget = true;
                testStep.setTarget(targetField.getText());
                updatingTarget = false;
              }
            });

    toolbar.addRelatedGap();
    toolbar.addFixed(targetField);
    JButton setTargetButton = UISupport.createToolbarButton(new SetPropertiesTargetAction());
    toolbar.addRelatedGap();
    toolbar.add(setTargetButton);

    toolbar.add(Box.createHorizontalGlue());
    toolbar.addSeparator();
    toolbar.add(
        UISupport.createToolbarButton(
            new ShowOnlineHelpAction(HelpUrls.PROPERTIESSTEPEDITOR_HELP_URL)));

    componentEnabler.add(sourceField);
    componentEnabler.add(targetField);
    componentEnabler.add(setTargetButton);
    componentEnabler.add(setSourceButton);
    componentEnabler.add(propertiesTable);

    setPreferredSize(new Dimension(600, 400));
  }
コード例 #4
0
 @Override
 protected boolean release() {
   testStep.removePropertyChangeListener(this);
   return super.release();
 }
コード例 #5
0
 public boolean dependsOn(ModelItem modelItem) {
   return modelItem == testStep
       || modelItem == testStep.getTestCase()
       || modelItem == testStep.getTestCase().getTestSuite()
       || modelItem == testStep.getTestCase().getTestSuite().getProject();
 }