Package net.sourceforge.cruisecontrol.sourcecontrols.accurev

Examples of net.sourceforge.cruisecontrol.sourcecontrols.accurev.AccurevCommandline


   *          the current date and time
   * @return the List of all detected modifications
   */
  public List getModifications(Date lastBuild, Date now) {
    LOG.info("Accurev: getting modifications for " + stream);
    AccurevCommandline hist = AccurevCommand.HIST.create();
    if (runner != null) {
      hist.setRunner(runner);
    }
    hist.setVerbose(verbose);
    hist.setInputParser(this);
    hist.setStream(stream);
    hist.setTransactionRange(new DateTimespec(lastBuild), new DateTimespec(now));
    hist.run();
    return modifications;
  }
View Full Code Here


  }
  /**
   * Tests common "accurev hist" commandline configurations
   */
  public void testCommandLineHist() {
    AccurevCommandline hist;
    fake("accurev_hist_now.txt", 0);
    fake("accurev_hist_now_highest.txt", 0);
    fake("accurev_blank.txt", 1);
    fake("accurev_blank.txt", 1);
    fake("accurev_hist_highest.txt", 0);
    fake("accurev_hist_1-now.txt", 0);
    fake("accurev_syntax_error.txt", 0);
    hist = AccurevCommand.HIST.create(getMockRunner());
    hist.setTransactionRange(DateTimespec.NOW);
    hist.run();
    assertTrue(hist.isSuccess());
    hist = AccurevCommand.HIST.create(getMockRunner());
    hist.setTransactionRange(DateTimespec.NOW, TransactionNumberTimespec.HIGHEST);
    hist.run();
    assertTrue(hist.isSuccess());
    hist = AccurevCommand.HIST.create(getMockRunner());
    hist.setTransactionRange(new TransactionNumberTimespec(0), DateTimespec.NOW);
    hist.run();
    assertFalse(hist.isSuccess());
    hist = AccurevCommand.HIST.create(getMockRunner());
    hist.setTransactionRange(new TransactionNumberTimespec(0));
    hist.run();
    assertFalse(hist.isSuccess());
    hist = AccurevCommand.HIST.create(getMockRunner());
    hist.setTransactionRange(TransactionNumberTimespec.HIGHEST);
    hist.run();
    assertTrue(hist.isSuccess());
    hist = AccurevCommand.HIST.create(getMockRunner());
    hist.setTransactionRange(new TransactionNumberTimespec(1), DateTimespec.NOW);
    hist.run();
    assertTrue(hist.isSuccess());
    try {
      AccurevCommand.HIST.create().setWorkspaceLocalPath("ThisDirectoryIsNotSupposedToExist");
      fail("setWorkspace should throw an exception when the workspace is not valid");
    } catch (CruiseControlException e) {
      // An exception must be thrown.
    }
    hist = AccurevCommand.HIST.create(getMockRunner());
    assertFalse(hist.isSuccess());
    AccurevCommand.HIST.create(getMockRunner());
    hist.addArgument("--thisoptiondoesnotexist");
    hist.run();
    assertFalse(hist.isSuccess());
  }
View Full Code Here

   * Checks the command line is built as expected
   */
  public void testCommandLineBuild() {
    Timespec d1 = new DateTimespec(-24);
    Timespec d2 = new DateTimespec(0);
    AccurevCommandline cmdKeep = AccurevCommand.KEEP.create();
    cmdKeep.selectModified();
    cmdKeep.setTransactionRange(d1, d2);
    cmdKeep.setComment("Automatic keep");
    assertEquals("accurev keep -m -t \"" + d1.toString() + "-" + d2.toString() + "\" -c \"Automatic keep\"",
        cmdKeep.toString());
    AccurevCommandline cmdHist = AccurevCommand.HIST.create();
    cmdHist.setTransactionRange(d1, d2);
    assertEquals("accurev hist -t \"" + d1.toString() + "-" + d2.toString() + "\"", cmdHist.toString());
    Commandline cmdUpdate = AccurevCommand.UPDATE.create();
    assertEquals("accurev update", cmdUpdate.toString());
    Commandline cmdSynctime = AccurevCommand.SYNCTIME.create();
    assertEquals("accurev synctime", cmdSynctime.toString());
  }
View Full Code Here

   * Tests common "accurev keep" commandline configuration
   */
  public void testCommandLineKeep() {
    fake("accurev_keep_nofiles.txt", 0);
    fake("accurev_keep.txt", 0);
    AccurevCommandline keep;
    keep = AccurevCommand.KEEP.create(getMockRunner());
    assertFalse(keep.isSuccess());
    keep = AccurevCommand.KEEP.create(getMockRunner());
    keep.selectModified();
    keep.setComment("Automatic keep");
    keep.setVerbose(true);
    keep.run();
    assertTrue(keep.isSuccess());
    keep = AccurevCommand.KEEP.create(getMockRunner());
    keep.selectModified();
    keep.setComment("Automatic keep");
    keep.setVerbose(true);
    keep.run();
    assertTrue(keep.isSuccess());
  }
View Full Code Here

   * Runs "accurev help" and looks for the support@accurev.com string. parseStream is defined as the
   * parsing callback
   */
  public void testCommandLineParse() {
    fake("accurev_help.txt", 0);
    AccurevCommandline help = AccurevCommand.HELP.create(getMockRunner());
    help.setInputParser(this);
    help.run();
    assertTrue(help.isSuccess());
  }
View Full Code Here

   * Runs "accurev synctime"
   */
  public void testCommandLineSynctime() {
    fake("accurev_synctime.txt", 0);
    // you only have success after run
    AccurevCommandline synctime;
    synctime = AccurevCommand.SYNCTIME.create(getMockRunner());
    assertFalse(synctime.isSuccess());
    synctime = AccurevCommand.SYNCTIME.create(getMockRunner());
    synctime.run();
    assertTrue(synctime.isSuccess());
  }
View Full Code Here

  /**
   * Runs "accurev update" in the default workspace
   */
  public void testCommandLineUpdate() {
    fake("accurev_update.txt", 0);
    AccurevCommandline update;
    update = AccurevCommand.UPDATE.create(getMockRunner());
    assertFalse(update.isSuccess());
    update = AccurevCommand.UPDATE.create(getMockRunner());
    update.run();
    assertTrue(update.isSuccess());
  }
View Full Code Here

  /**
   * Picks the last stream name from a list of streams
   */
  private String getTestStreamName() {
    LineCollector collector = new LineCollector();
    AccurevCommandline show = AccurevCommand.SHOW.create(getMockRunner());
    show.addArgument("wspaces");
    show.setInputParser(collector);
    show.run();
    assertNotNull(collector.lines);
    assertTrue(collector.lines.size() > 1);
    return collector.lines.get(collector.lines.size() - 1).toString().split("[ \t]")[0];
  }
View Full Code Here

  public void bootstrap() throws CruiseControlException {
    if (synctime) {
      runAccurev(AccurevCommand.SYNCTIME.create());
    }
    if (keep) {
      AccurevCommandline cmdKeep = AccurevCommand.KEEP.create();
      cmdKeep.selectModified();
      cmdKeep.setComment("CruiseControl automatic keep");
      runAccurev(cmdKeep);
    }
    runAccurev(AccurevCommand.UPDATE.create());
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.sourcecontrols.accurev.AccurevCommandline

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.