KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > jtrac > svn > SvnTest


1 package info.jtrac.svn;
2
3 import java.util.Collection JavaDoc;
4 import java.util.Iterator JavaDoc;
5 import junit.framework.TestCase;
6 import org.tmatesoft.svn.core.SVNDirEntry;
7 import org.tmatesoft.svn.core.SVNException;
8 import org.tmatesoft.svn.core.SVNNodeKind;
9 import org.tmatesoft.svn.core.SVNURL;
10 import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
11 import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
12 import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
13 import org.tmatesoft.svn.core.io.SVNRepository;
14 import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
15 import org.tmatesoft.svn.core.wc.SVNWCUtil;
16
17 public class SvnTest extends TestCase {
18     
19     public void testNothing() {
20         
21     }
22     
23     /*
24     public void testSvn() throws Exception {
25         String url = "https://adms.satyam.com/svn/jtrac/trunk/jtrac";
26         String name = "pt34469";
27         String password = "";
28         DAVRepositoryFactory.setup();
29         SVNRepositoryFactoryImpl.setup();
30         SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
31         ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password);
32         repository.setAuthenticationManager(authManager);
33         SVNNodeKind nodeKind = repository.checkPath("", -1);
34         if (nodeKind == SVNNodeKind.NONE) {
35             System.err.println("There is no entry at '" + url + "'.");
36             System.exit(1);
37         } else if (nodeKind == SVNNodeKind.FILE) {
38             System.err.println("The entry at '" + url + "' is a file while a directory was expected.");
39             System.exit(1);
40         }
41         System.out.println("Repository Root: " + repository.getRepositoryRoot(true));
42         System.out.println("Repository UUID: " + repository.getRepositoryUUID());
43         listEntries(repository, "");
44         long latestRevision = repository.getLatestRevision();
45         System.out.println("Repository latest revision: " + latestRevision);
46         System.exit(0);
47     }
48     
49     private static void listEntries(SVNRepository repository, String path) throws SVNException {
50         
51         Collection entries = repository.getDir(path, -1, null, (Collection) null);
52         Iterator iterator = entries.iterator();
53         while (iterator.hasNext()) {
54             SVNDirEntry entry = (SVNDirEntry) iterator.next();
55             System.out.println("/" + (path.equals("") ? "" : path + "/")
56             + entry.getName() + " (author:" + entry.getAuthor()
57             + "; revision:" + entry.getRevision() + ")");
58             if (entry.getKind() == SVNNodeKind.DIR) {
59                 listEntries(repository, (path.equals("")) ? entry.getName()
60                 : path + "/" + entry.getName());
61             }
62         }
63     }
64      */

65     
66 }
67
Popular Tags