1 19 20 package org.netbeans.modules.java.source.parsing; 21 22 import java.util.TreeSet ; 23 import java.util.jar.JarFile ; 24 import javax.tools.JavaFileObject; 25 import junit.extensions.TestSetup; 26 import junit.framework.*; 27 import java.io.File ; 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Collection ; 31 import java.util.Collections ; 32 import java.util.Enumeration ; 33 import java.util.HashMap ; 34 import java.util.Iterator ; 35 import java.util.LinkedList ; 36 import java.util.List ; 37 import java.util.Map ; 38 import java.util.Set ; 39 import java.util.zip.ZipEntry ; 40 import java.util.zip.ZipFile ; 41 import org.netbeans.modules.java.source.TestUtil; 42 43 47 public class CachingFolderArchiveTest extends TestCase { 48 49 protected static Setup setup; 50 private CachingArchiveProvider archiveProvider; 51 52 public CachingFolderArchiveTest(String testName) { 53 super(testName); 54 } 55 56 protected void setUp() throws Exception { 57 archiveProvider = new CachingArchiveProvider(); 58 } 59 60 protected void tearDown() throws Exception { 61 } 62 63 public static Test suite() { 64 setup = new Setup( new TestSuite( CachingFolderArchiveTest.class ) ); 65 return setup; 66 } 67 68 protected Archive createArchive() { 69 return new FolderArchive( setup.rtFolder ); 70 } 71 72 74 80 91 97 109 111 static class Setup extends TestSetup { 112 113 public File workDir; 114 public File rtFile; 115 public File rtFolder; 116 public CachingArchiveProvider archiveProvider; 117 118 public Setup( Test test ) { 119 super( test ); 120 } 121 122 protected void tearDown() throws Exception { 123 TestUtil.removeWorkFolder( workDir ); 124 super.tearDown(); 125 } 126 127 protected void setUp() throws Exception { 128 super.setUp(); 129 workDir = TestUtil.createWorkFolder(); 130 TestUtil.copyFiles( TestUtil.getJdkDir(), workDir, TestUtil.RT_JAR ); 131 rtFile = new File ( workDir, TestUtil.RT_JAR ); 132 JarFile rtJar = new JarFile ( rtFile ); 133 134 rtFolder = new File ( workDir, "rtFolder" ); 135 TestUtil.unzip( rtJar, rtFolder ); 136 137 archiveProvider = new CachingArchiveProvider(); 138 } 139 140 } 141 142 } 143 | Popular Tags |