@Override
  public void perform(WsdlTestSuite testSuite, Object param) {

    if (IntegrationUtils.forceSaveProject(testSuite.getProject())) {

      if (!StartLoadUI.testCajoConnection()) {
        if (UISupport.confirm(
            StartLoadUI.LOADUI_LAUNCH_QUESTION, StartLoadUI.LOADUI_LAUNCH_TITLE)) {
          StartLoadUI.launchLoadUI();
        }
        return;
      }

      XFormDialog dialog = ADialogBuilder.buildDialog(TestSuiteForm.class);

      dialog.setOptions(TestSuiteForm.LOADUIPROJECT, IntegrationUtils.getAvailableProjects());
      if (!StringUtils.isNullOrEmpty(IntegrationUtils.getOpenedProjectName())) {
        dialog.setValue(TestSuiteForm.LOADUIPROJECT, IntegrationUtils.getOpenedProjectName());
      } else {
        dialog.setValue(TestSuiteForm.LOADUIPROJECT, IntegrationUtils.CREATE_NEW_OPTION);
      }
      List<String> testSuiteLoadTests = new ArrayList<String>();
      for (TestCase testCase : testSuite.getTestCaseList()) {
        for (LoadTest loadTest : testCase.getLoadTestList()) {
          testSuiteLoadTests.add(testCase.getName() + " - " + loadTest.getName());
        }
      }
      String[] names = new String[testSuiteLoadTests.size()];
      for (int c = 0; c < names.length; c++) {
        names[c] = testSuiteLoadTests.get(c);
      }
      dialog.setOptions(TestSuiteForm.LOADTESTS, names);
      if (dialog.show()) {
        if (dialog.getReturnValue() == XFormDialog.OK_OPTION) {
          String loadUIProject = dialog.getValue(TestSuiteForm.LOADUIPROJECT);
          String openedProjectName = IntegrationUtils.getOpenedProjectName();
          if (!StringUtils.isNullOrEmpty(openedProjectName)
              && !loadUIProject.equals(openedProjectName)
              && IntegrationUtils.checkOpenedLoadUIProjectForClose()) {
            return;
          }
          String[] soapuiLoadTests =
              StringUtils.toStringArray(
                  ((XFormMultiSelectList) dialog.getFormField(TestSuiteForm.LOADTESTS))
                      .getSelectedOptions());
          if (soapuiLoadTests.length == 0) {
            UISupport.showErrorMessage("No LoadTests selected.");
            return;
          }
          try {
            IntegrationUtils.exportMultipleLoadTestToLoadUI(
                testSuite, soapuiLoadTests, loadUIProject);
          } catch (IOException e) {
            UISupport.showInfoMessage("Error while opening selected loadUI project");
            return;
          }
        }
      }
    }
  }
Пример #2
0
 private void unmonitorLoadTest(LoadTest loadTest) {
   loadTest.removeLoadTestRunListener(loadTestRunListener);
 }
Пример #3
0
 private void monitorLoadTest(LoadTest loadTest) {
   loadTest.addLoadTestRunListener(loadTestRunListener);
 }