1 19 20 package org.netbeans.modules.java.source.parsing; 21 import java.util.jar.JarFile ; 22 import junit.extensions.TestSetup; 23 import junit.framework.*; 24 import java.io.File ; 25 import java.net.URL ; 26 import java.util.ArrayList ; 27 import java.util.LinkedList ; 28 import java.util.List ; 29 import java.util.zip.ZipFile ; 30 import javax.tools.JavaFileObject; 31 import org.netbeans.api.java.classpath.ClassPath; 32 import org.netbeans.modules.java.source.StopWatch; 33 import org.netbeans.modules.java.source.TestUtil; 34 import org.netbeans.modules.java.source.usages.IndexUtil; 35 import org.netbeans.modules.java.source.util.Factory; 36 import org.netbeans.spi.java.classpath.support.ClassPathSupport; 37 import org.openide.filesystems.FileUtil; 38 39 46 public class PerfBatchCompilationTest extends TestCase { 47 48 private static Setup setup; 49 private CachingArchiveProvider archiveProvider; 50 51 public PerfBatchCompilationTest(String testName) { 52 super(testName); 53 } 54 55 protected void setUp() throws Exception { 56 archiveProvider = new CachingArchiveProvider(); 57 } 58 59 protected void tearDown() throws Exception { 60 } 61 62 public static Test suite() { 63 setup = new Setup( new TestSuite( PerfBatchCompilationTest.class ) ); 66 return setup; 67 } 68 69 70 public void testJdkSourceCompilationAtOnce() throws Throwable { 71 72 fail( "Would throw OutOfMemory error anyway" ); 73 74 } 96 97 public void testJdkSourceCompilationFileByFile() throws Throwable { 98 99 fail( "Would throw OutOfMemory error anyway" ); 100 101 } 131 132 133 135 149 151 152 private static class Setup extends TestSetup { 153 154 public File workDir; 155 public File rtFile, srcFile; 156 public File rtFolder, srcFolder; 157 public File javacSrcFolder; 158 public CachingArchiveProvider archiveProvider; 159 160 public Setup( Test test ) { 161 super( test ); 162 } 163 164 protected void tearDown() throws Exception { 165 TestUtil.removeWorkFolder( workDir ); 166 super.tearDown(); 167 } 168 169 protected void setUp() throws Exception { 170 super.setUp(); 171 172 File retouche = TestUtil.getDataDir().getParentFile().getParentFile().getParentFile().getParentFile(); 173 File javac = new File ( retouche, "Jsr199" ); 174 175 workDir = TestUtil.createWorkFolder(); 176 System.out.println("Workdir " + workDir ); 177 TestUtil.copyFiles( TestUtil.getJdkDir(), workDir, TestUtil.RT_JAR ); 178 TestUtil.copyFiles( TestUtil.getJdkDir(), workDir, TestUtil.SRC_ZIP ); 179 180 rtFile = new File ( workDir, TestUtil.RT_JAR ); 181 JarFile rtJar = new JarFile ( rtFile ); 182 srcFile = new File ( workDir, TestUtil.SRC_ZIP ); 183 ZipFile srcZip = new ZipFile ( srcFile ); 184 185 186 187 190 srcFolder = new File ( workDir, "src" ); 191 TestUtil.unzip( srcZip, srcFolder ); 192 193 archiveProvider = CachingArchiveProvider.getDefault(); 195 196 File cacheDir = new File ( workDir, "cache" ); 198 cacheDir.mkdirs(); 199 IndexUtil.setCacheFolder( cacheDir ); 200 201 } 202 203 } 204 205 } 206 | Popular Tags |