1 4 package net.sourceforge.cvsgrab; 5 6 import java.io.File ; 7 8 9 10 public class LiveTest extends AbstractTestCase { 11 12 private File tmpDir; 13 14 public LiveTest(String name) { 15 super(name); 16 } 17 18 protected void setUp() throws Exception { 19 super.setUp(); 20 tmpDir = new File (getTestFile("tmp")); 21 tmpDir.mkdir(); 22 } 23 24 protected void tearDown() throws Exception { 25 super.tearDown(); 26 cleanDir(tmpDir); 27 } 28 29 32 public void testEclipse() throws Exception { 33 grab("http://dev.eclipse.org/viewcvs/index.cgi/equinox-home/services/?cvsroot=Technology_Project"); 34 assertContainsFile("index.html"); 35 } 36 37 40 public void testSourceforge() throws Exception { 41 grab("http://cvs.sourceforge.net/viewcvs.py/cvsgrab/cvsgrab/etc/script"); 42 assertContainsFile("cvsgrab.bat"); 43 } 44 45 48 public void testApache() throws Exception { 49 grab("http://cvs.apache.org/viewcvs.cgi/ws-fx/wss4j/interop/keys/"); 50 assertContainsFile("README.txt"); 51 } 52 53 56 public void testSavannah() throws Exception { 57 grab("http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/faq/?cvsroot=Web"); 58 assertContainsFile("faq.html"); 59 } 60 61 64 public void testNetbeans() throws Exception { 65 grab("http://www.netbeans.org/source/browse/javacvs/src/org/netbeans/modules/javacvs/util/"); 66 assertContainsFile("Debug.java"); 67 } 68 69 72 public void testDevJava() throws Exception { 73 grab("https://swingfx.dev.java.net/source/browse/swingfx/src/net/java/swingfx/common/"); 74 assertContainsFile("package.html"); 75 } 76 77 80 public void testW3() throws Exception { 81 grab("http://dev.w3.org/cvsweb/Amaya/templates/conf/"); 82 assertContainsFile("templates.conf"); 83 } 84 85 88 public void testHelixCommunity() throws Exception { 89 grab("https://helixcommunity.org/viewcvs/cgi/viewcvs.cgi/xiph/www/", "ViewCvs1_0"); 90 assertContainsFile("LICENSE.txt"); 91 } 92 93 96 public void testOpenoffice() throws Exception { 97 grab("http://lingucomponent.openoffice.org/source/browse/lingucomponent/source/lingutil/"); 98 assertContainsFile("makefile.mk"); 99 } 100 101 104 public void testPhpNet() throws Exception { 105 grab("http://cvs.php.net/smarty/docs/scripts/"); 106 assertContainsFile(".cvsignore"); 107 } 108 109 private void assertContainsFile(String name) { 110 File f = new File (tmpDir, "test/" + name); 111 assertTrue(name + " not found", f.exists()); 112 } 113 114 private void grab(String url) { 115 CVSGrab.main(new String [] {"-url", url, "-packageDir", "test", "-destDir", tmpDir.getName()}); 116 } 117 118 private void grab(String url, String webInterface) { 119 CVSGrab.main(new String [] {"-url", url, "-packageDir", "test", "-destDir", tmpDir.getName(), "-webInterface", webInterface}); 120 } 121 122 private void cleanDir(File dir) { 123 File [] files = dir.listFiles(); 124 for (int i = 0; i < files.length; i++) { 125 if (files[i].isDirectory()) { 126 cleanDir(files[i]); 127 } else { 128 files[i].delete(); 129 } 130 } 131 dir.delete(); 132 } 133 134 } 135 | Popular Tags |