1 19 20 package org.netbeans.modules.java.source.parsing; 21 import com.sun.source.tree.CompilationUnitTree; 22 import java.io.File ; 23 import java.util.jar.JarFile ; 24 import junit.framework.*; 25 import org.netbeans.modules.java.source.StopWatch; 26 import org.netbeans.modules.java.source.TestUtil; 27 28 32 public class PerfZipJarOpenTest extends TestCase { 33 34 private File workDir; 35 private File rtJar; 36 37 public PerfZipJarOpenTest(String testName) { 38 super(testName); 39 } 40 41 protected void setUp() throws Exception { 42 workDir = TestUtil.createWorkFolder(); 43 TestUtil.copyFiles( TestUtil.getJdkDir(), workDir, TestUtil.RT_JAR ); 44 rtJar = new File ( workDir, TestUtil.RT_JAR ); 45 } 46 47 protected void tearDown() throws Exception { 48 TestUtil.removeWorkFolder( workDir ); 49 } 50 51 52 public void testOpenCloseJar() throws Exception { 53 54 StopWatch swatch = new StopWatch(); 55 JarFile jf; 56 57 for( int i = 0; i < 10; i++ ) { 58 59 swatch.start(); 60 jf = new JarFile ( rtJar ); 61 swatch.stop( "Create done" ); 62 63 swatch.start(); 64 jf.close(); 65 swatch.stop( "Close done" ); 66 67 72 } 73 74 } 75 76 77 } 78 | Popular Tags |