SVN implements SourceControl { Commandline buildHistoryCommand(String lastBuild, String checkTime) throws CruiseControlException { return buildHistoryCommand(lastBuild, checkTime, null); }  Map<String, String> getProperties(); void setProperty(String property); void setPropertyOnDelete(String propertyOnDelete); void setConfigDir(String configDir); void setCheckExternals(boolean value); void setRepositoryLocation(String repositoryLocation); void setLocalWorkingCopy(String localWorkingCopy); void setUsername(String userName); void setPassword(String password); void validate(); List<Modification> getModifications(final Date lastBuild, final Date now); static DateFormat getOutDateFormatter(); void setUseLocalRevision(boolean useLocalRevision);  }
@Test public void testBuildHistoryCommand() throws CruiseControlException { svn.setLocalWorkingCopy("."); Date checkTime = new Date(); long tenMinutes = 10 * 60 * 1000; Date lastBuild = new Date(checkTime.getTime() - tenMinutes); String[] expectedCmd = new String[] { "svn", "log", "--non-interactive", "--xml", "-v", "-r", SVN.formatSVNDate(lastBuild, false) + ":" + SVN.formatSVNDate(checkTime, false) }; String[] actualCmd = svn.buildHistoryCommand(SVN.formatSVNDate(lastBuild, false), SVN.formatSVNDate(checkTime, false)).getCommandline(); assertThat(actualCmd, equalTo(expectedCmd)); expectedCmd = new String[] { "svn", "log", "--non-interactive", "--xml", "-v", "-r", SVN.formatSVNDate(lastBuild, false) + ":" + SVN.formatSVNDate(checkTime, false), "external/path" }; actualCmd = svn.buildHistoryCommand(SVN.formatSVNDate(lastBuild, false), SVN.formatSVNDate(checkTime, false), "external/path").getCommandline(); assertThat(actualCmd, equalTo(expectedCmd)); svn.setRepositoryLocation("http: expectedCmd = new String[] { "svn", "log", "--non-interactive", "--xml", "-v", "-r", SVN.formatSVNDate(lastBuild, false) + ":" + SVN.formatSVNDate(checkTime, false), "http: actualCmd = svn.buildHistoryCommand(SVN.formatSVNDate(lastBuild, false), SVN.formatSVNDate(checkTime, false)) .getCommandline(); assertThat(actualCmd, equalTo(expectedCmd)); expectedCmd = new String[] { "svn", "log", "--non-interactive", "--xml", "-v", "-r", SVN.formatSVNDate(lastBuild, false) + ":" + SVN.formatSVNDate(checkTime, false), "http: actualCmd = svn.buildHistoryCommand(SVN.formatSVNDate(lastBuild, false), SVN.formatSVNDate(checkTime, false), "http: assertThat(actualCmd, equalTo(expectedCmd)); svn.setUsername("lee"); svn.setPassword("secret"); expectedCmd = new String[] { "svn", "log", "--non-interactive", "--xml", "-v", "-r", SVN.formatSVNDate(lastBuild, false) + ":" + SVN.formatSVNDate(checkTime, false), "--no-auth-cache", "--username", "lee", "--password", "secret", "http: actualCmd = svn.buildHistoryCommand(SVN.formatSVNDate(lastBuild, false), SVN.formatSVNDate(checkTime, false)) .getCommandline(); assertThat(actualCmd, equalTo(expectedCmd)); svn.setUsername(null); svn.setPassword(null); final String testConfDir = "myConfigDir"; svn.setConfigDir(testConfDir); expectedCmd = new String[] { "svn", "log", "--non-interactive", "--xml", "-v", "-r", SVN.formatSVNDate(lastBuild, false) + ":" + SVN.formatSVNDate(checkTime, false), "--config-dir", testConfDir, "http: actualCmd = svn.buildHistoryCommand(SVN.formatSVNDate(lastBuild, false), SVN.formatSVNDate(checkTime, false)) .getCommandline(); assertThat(actualCmd, equalTo(expectedCmd)); }