/** Test method for {@link svn.client.SVNClient#doCheckOut(java.util.Date)}. */ @Test public void testGetWCInfo() { try { SVNWCClient wcCln = svnCln.getSVNWCClient(); SVNInfo svnInfo = wcCln.doInfo(new File(this.wcPath), SVNRevision.HEAD); String lastCommitter = svnInfo.getAuthor(); assertEquals("thach", lastCommitter); Date lastDateCommit = svnInfo.getCommittedDate(); LOG.debug("lastDateCommit=" + lastDateCommit); assertNotNull(lastDateCommit); long lastRev = svnInfo.getRevision().getNumber(); assertEquals(99, lastRev); // Get SVNUrl LOG.debug("getChangelistName=" + svnInfo.getChangelistName()); String svnUrl = svnInfo.getRepositoryRootURL().toDecodedString(); assertEquals("http://svn.mkss.vn/svnobserver", svnUrl); analyzeFolder(new File(wcPath)); } catch (SVNException ex) { ex.printStackTrace(); fail(ex.getMessage()); } }
private void analyzeFolder(File file) { try { LOG.debug("File:" + file.getPath()); SVNInfo svnInfo = svnCln.getInfo(file); String lastCommitter = svnInfo.getAuthor(); Date lastDateCommit = svnInfo.getCommittedDate(); LOG.debug("lastDateCommit=" + lastDateCommit); long lastRev = svnInfo.getRevision().getNumber(); assertEquals(99, lastRev); // Get SVNUrl LOG.debug("getChangelistName=" + svnInfo.getChangelistName()); String svnUrl = svnInfo.getRepositoryRootURL().toDecodedString(); assertEquals("http://svn.mkss.vn/svnobserver", svnUrl); scanFolder(new File(wcPath)); } catch (SVNException ex) { // TODO Auto-generated catch block ex.printStackTrace(); } }
@Test public void testGetInfo2() { DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true); SVNClientManager clientManager = SVNClientManager.newInstance(options, "", ""); SVNWCClient wcClient = clientManager.getWCClient(); /* * For using over http:// and https:// */ DAVRepositoryFactory.setup(); // Create configuration file in current folder File configFile = new File(".rockysvn"); String username = "******"; String password = "******"; ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(configFile, username, password); // String url = "https://open-ones.googlecode.com/svn/trunk/ProjectList/RockySVN"; String url = "https://hcm-svn.fsoft.fpt.vn/svn/F15-HCAM/trunk"; SVNRevision revision = SVNRevision.HEAD; File path = new File("D:/Project/MyProject/Open-Ones/RockySVN"); try { SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); repository.setAuthenticationManager(authManager); repository.getDatedRevision(new Date()); long latestRev = repository.getLatestRevision(); assertEquals(634, latestRev); SVNInfo svnInfo = wcClient.doInfo(path, revision); assertEquals("ThachLN", svnInfo.getAuthor()); assertEquals(123, svnInfo.getRevision().getID()); assertEquals(new Date(), svnInfo.getRevision().getDate()); } catch (SVNException ex) { ex.printStackTrace(); fail(ex.getMessage()); } }