예제 #1
0
  /**
   * Do actual dependency copying and update project's copy dependency path.
   *
   * @throws IOException
   */
  private boolean copyDependencies() throws IOException {
    boolean result = true;
    projectCopy.setResourceRoot("${projectDir}");
    List<ExternalDependency> dependencies = projectCopy.getExternalDependencies();
    for (ExternalDependency dependency : dependencies) {
      switch (dependency.getType()) {
        case FILE:
          File originalDependency = new File(dependency.getPath());
          if (originalDependency.exists()) {
            File targetDependency = new File(tmpDir, originalDependency.getName());
            FileUtils.copyFile(originalDependency, targetDependency);
            dependency.updatePath(targetDependency.getPath());
          } else {
            SoapUI.log.warn(
                "Do not exists on local file system [" + originalDependency.getPath() + "]");
          }
          break;
        case FOLDER:
          originalDependency = new File(dependency.getPath());
          File targetDependency = new File(tmpDir, originalDependency.getName());
          targetDependency.mkdir();
          FileUtils.copyDirectory(originalDependency, targetDependency, false);
          dependency.updatePath(targetDependency.getPath());
          break;
        default:
          break;
      }
    }

    return result;
  }
예제 #2
0
  /**
   * Creates packed project on given path
   *
   * @param exportPath
   * @return
   * @throws SoapUIException
   * @throws XmlException
   * @throws IOException
   */
  public boolean exportProject(String exportPath)
      throws IOException, XmlException, SoapUIException {

    boolean result = false;
    if ((tmpDir = createTemporaryDirectory()) != null) {
      if (createProjectCopy()) {
        if (copyDependencies()) {
          projectCopy.setResourceRoot("${projectDir}");
          projectCopy.save();
          if (packageAll(exportPath)) result = true;
        }
      }
      deleteDir(tmpDir);
    }
    return result;
  }