}
/**
* 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());
}