Ejemplo n.º 1
0
  /**
   * **************************************************
   *
   * <p>public boolean createWorkspace() throws IOException, InterruptedException {
   *
   * <p>Call <tt>scm create workspace</tt> command.
   *
   * <p>
   *
   * <p>Create the workspace.
   *
   * @return <tt>true</tt> on success
   * @throws IOException
   * @throws InterruptedException **************************************************
   */
  public boolean createWorkspace() throws IOException, InterruptedException {
    // output to console.
    PrintStream output = listener.getLogger();
    output.println("  RTC SCM - Jazz Client: Creating Workspace...");

    Command cmd = new CreateWorkspaceCommand(configuration);
    boolean result = joinWithPossibleTimeout(run(cmd.getArguments()), listener, null) == 0;
    return result;
  }
Ejemplo n.º 2
0
  /**
   * ************************************************** public boolean load() throws IOException,
   * InterruptedException {
   *
   * <p>Will load the workspace using the parameters defined.
   *
   * @return <tt>true</tt> on success
   * @throws IOException
   * @throws InterruptedException **************************************************
   */
  public boolean load() throws IOException, InterruptedException {
    // output to console.
    PrintStream output = listener.getLogger();
    output.println("  RTC SCM - Jazz Client: Loading Workspace.");

    Command cmd = new LoadCommand(configuration, listener, jazzExecutable);

    return joinWithPossibleTimeout(run(cmd.getArguments(), null), listener, null) == 0;
  }
Ejemplo n.º 3
0
  /**
   * **************************************************
   *
   * <p>public boolean workspaceExists() throws IOException, InterruptedException {
   *
   * <p>Call <tt>scm history</tt> command.
   *
   * <p>
   *
   * <p>Will check if the workspace exists.
   *
   * @return <tt>true</tt> on exists
   * @throws IOException
   * @throws InterruptedException **************************************************
   */
  public boolean workspaceExists(AbstractBuild build) throws IOException, InterruptedException {
    // output to console.
    PrintStream output = listener.getLogger();
    Command cmd = new HistoryCommand(configuration);
    output.println(
        "  RTC SCM - Jazz Client: Run History command to determine if workspace exists - it is OK if an error is returned below: (Problem running 'history')");

    // Get variables from system.
    String jobName = "";

    try {
      jobName = build.getEnvironment(null).get("JOB_NAME");
    } catch (Exception e) {
      listener.error("" + e);
    }
    // Add the abstract build to the configuration.
    // This call happens before the load and accept so we can set these items for later use.
    configuration.setBuild(build);
    configuration.setTaskListener(listener);
    configuration.setJobName(jobName);
    configuration.consoleOut("    -- Initializing build object --");

    StringBuffer strBuf = new StringBuffer();
    joinWithPossibleTimeout(run(cmd.getArguments()), listener, strBuf, build, null);
    boolean result = true;
    String stdOut = strBuf.toString();

    if (stdOut.contains("did not match any workspaces") || stdOut.contains("Unmatched workspace")) {
      listener.error("The workspace probably doesn't exist.");

      output.println("  RTC SCM - Jazz Client: Specified workspace does not exist...");

      result = false;
    } else {
      output.println("  RTC SCM - Jazz Client: Specified workspace already exists...");
    }
    return result;
  }