harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r645422 - /harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
Date Mon, 07 Apr 2008 09:22:01 GMT
Author: sjanuary
Date: Mon Apr  7 02:22:00 2008
New Revision: 645422

URL: http://svn.apache.org/viewvc?rev=645422&view=rev
Log:
Pack200 - updated SegmentTest to compile correctly

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java?rev=645422&r1=645421&r2=645422&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
Mon Apr  7 02:22:00 2008
@@ -34,64 +34,64 @@
  */
 public class SegmentTest extends TestCase {
 
-    InputStream in;
-    JarOutputStream out;
-    File file;
+	InputStream in;
+	JarOutputStream out;
 
-    public void testHelloWorld() throws Exception {
-        in = Segment.class
-                .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
-        Segment segment = Segment.parse(in);
-        assertNotNull(segment);
-        file = File.createTempFile("HelloWorld", ".jar");
-        out = new JarOutputStream(new FileOutputStream(file));
-        segment.writeJar(out);
-        out.close();
-        out = null;
-        JarFile jarFile = new JarFile(file);
-        JarEntry entry = jarFile.getJarEntry("org/apache/harmony/archive/tests/internal/pack200/HelloWorld.class");
-        assertNotNull(entry);
-        Process process = Runtime.getRuntime().exec("java -cp " + file.getName() + " org.apache.harmony.archive.tests.internal.pack200.HelloWorld",
new String[] {}, file.getParentFile());
-        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
-        String line = reader.readLine();
-        assertEquals("Hello world", line);
-        file.deleteOnExit();
-    }
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		try {
+			if (in != null) {
+				in.close();
+			}
+		} finally {
+			if (out != null) {
+				out.close();
+			}
+		}
+	}
 
-    public void testJustResources() throws Exception {
-        in = Segment.class
-                .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack");
-        Segment segment = Segment.parse(in);
-        assertNotNull(segment);
-        file = File.createTempFile("JustResources", ".jar");
-        out = new JarOutputStream(new FileOutputStream(file));
-        segment.writeJar(out);
-    }
+	public void testJustResources() throws Exception {
+		in = Segment.class
+				.getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack");
+		out = new JarOutputStream(new FileOutputStream(File.createTempFile(
+				"just", "resources.jar")));
+		Segment segment = new Segment();
+		segment.unpack(in, out);
+	}
 
-     public void testInterfaceOnly() throws Exception {
-        in = Segment.class
-                .getResourceAsStream("/org/apache/harmony/pack200/tests/InterfaceOnly.pack");
-        Segment segment = Segment.parse(in);
-        assertNotNull(segment);
-        file = File.createTempFile("InterfaceOnly", ".jar");
-        out = new JarOutputStream(new FileOutputStream(file));
-        segment.writeJar(out);
-    }
+	public void testInterfaceOnly() throws Exception {
+		in = Segment.class
+				.getResourceAsStream("/org/apache/harmony/pack200/tests/InterfaceOnly.pack");
+		out = new JarOutputStream(new FileOutputStream(File.createTempFile(
+				"Interface", "Only.jar")));
+		Segment segment = new Segment();
+		segment.unpack(in, out);
+	}
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        try {
-            if (in != null) {
-                in.close();
-            }
-        } finally {
-            if (out != null) {
-                out.close();
-            }
-            if (file != null) {
-                file.delete();
-            }
-        }
-    }
+	public void testHelloWorld() throws Exception {
+		in = Segment.class
+				.getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
+		File file = File.createTempFile("hello", "world.jar");
+		out = new JarOutputStream(new FileOutputStream(file));
+		Segment segment = new Segment();
+		segment.unpack(in, out);
+		out.close();
+		out = null;
+		JarFile jarFile = new JarFile(file);
+		JarEntry entry = jarFile
+				.getJarEntry("org/apache/harmony/archive/tests/internal/pack200/HelloWorld.class");
+		assertNotNull(entry);
+		Process process = Runtime
+				.getRuntime()
+				.exec(
+						"java -cp "
+								+ file.getName()
+								+ " org.apache.harmony.archive.tests.internal.pack200.HelloWorld",
+						new String[] {}, file.getParentFile());
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				process.getInputStream()));
+		String line = reader.readLine();
+		assertEquals(line, "Hello world");
+	}
 
 }



Mime
View raw message