harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r997618 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ clas...
Date Thu, 16 Sep 2010 07:03:58 GMT
Author: hindessm
Date: Thu Sep 16 07:03:58 2010
New Revision: 997618

URL: http://svn.apache.org/viewvc?rev=997618&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@997338:

  r997338 | sjanuary | 2010-09-15 14:58:20 +0100 (Wed, 15 Sep 2010) | 1 line
  
  Pack200 - more tests


Added:
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/p200WithUnknownAttributes.jar
      - copied unchanged from r997338, harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/p200WithUnknownAttributes.jar
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/p200WithUnknownAttributes2.jar
      - copied unchanged from r997338, harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/p200WithUnknownAttributes2.jar
Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PackingOptionsTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/SegmentTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations.jar
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotationsRI.jar
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotationsRI.pack.gz
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 16 07:03:58 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336
+/harmony/enhanced/java/trunk:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336,997338
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 16 07:03:58 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336
+/harmony/enhanced/java/trunk/classlib:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336,997338
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 16 07:03:58 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336,997338
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
Thu Sep 16 07:03:58 2010
@@ -19,6 +19,7 @@ package org.apache.harmony.pack200.tests
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -28,6 +29,7 @@ import java.net.URISyntaxException;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
 import java.util.jar.JarOutputStream;
 
 import junit.framework.TestCase;
@@ -125,7 +127,21 @@ public class ArchiveTest extends TestCas
         compareFiles(jarFile, jarFile2);
     }
 
-    public void testLargeClass() throws IOException, Pack200Exception, URISyntaxException
{
+    public void testAlternativeConstructor() throws FileNotFoundException,
+            IOException, URISyntaxException, Pack200Exception {
+        JarInputStream inStream = new JarInputStream(new FileInputStream(
+                new File(Archive.class.getResource(
+                        "/org/apache/harmony/pack200/tests/sqlUnpacked.jar").toURI())));
+        file = File.createTempFile("sql", ".pack.gz");
+        file.deleteOnExit();
+        out = new FileOutputStream(file);
+        new Archive(inStream, out, null).pack();
+        inStream.close();
+        out.close();
+    }
+
+    public void testLargeClass() throws IOException, Pack200Exception,
+            URISyntaxException {
         in = new JarFile(new File(Archive.class.getResource(
                 "/org/apache/harmony/pack200/tests/largeClassUnpacked.jar")
                 .toURI()));
@@ -217,7 +233,7 @@ public class ArchiveTest extends TestCas
         in = new JarFile(new File(Archive.class.getResource(
                 "/org/apache/harmony/pack200/tests/annotations.jar").toURI()));
         file = File.createTempFile("annotations", ".pack");
-//        file.deleteOnExit();
+        file.deleteOnExit();
         out = new FileOutputStream(file);
         PackingOptions options = new PackingOptions();
         options.setGzip(false);
@@ -228,7 +244,7 @@ public class ArchiveTest extends TestCas
         // now unpack
         InputStream in2 = new FileInputStream(file);
         File file2 = File.createTempFile("annotationsout", ".jar");
-//        file2.deleteOnExit();
+        file2.deleteOnExit();
         JarOutputStream out2 = new JarOutputStream(new FileOutputStream(file2));
         org.apache.harmony.unpack200.Archive archive = new org.apache.harmony.unpack200.Archive(
                 in2, out2);

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
Thu Sep 16 07:03:58 2010
@@ -26,7 +26,6 @@ import org.apache.harmony.pack200.BHSDCo
 import org.apache.harmony.pack200.CanonicalCodecFamilies;
 import org.apache.harmony.pack200.Codec;
 import org.apache.harmony.pack200.Pack200Exception;
-import org.apache.harmony.pack200.RunCodec;
 
 /**
  * 
@@ -205,6 +204,15 @@ public class CodecTest extends TestCase 
         checkAscendingCardinalities(CanonicalCodecFamilies.deltaUnsignedCodecs3);
         checkAscendingCardinalities(CanonicalCodecFamilies.deltaUnsignedCodecs4);
         checkAscendingCardinalities(CanonicalCodecFamilies.deltaUnsignedCodecs5);
+        checkAscendingCardinalities(CanonicalCodecFamilies.nonDeltaSignedCodecs1);
+        checkAscendingCardinalities(CanonicalCodecFamilies.nonDeltaSignedCodecs2);
+        checkAscendingCardinalities(CanonicalCodecFamilies.nonDeltaDoubleSignedCodecs1);
+        checkAscendingCardinalities(CanonicalCodecFamilies.deltaSignedCodecs1);
+        checkAscendingCardinalities(CanonicalCodecFamilies.deltaSignedCodecs2);
+        checkAscendingCardinalities(CanonicalCodecFamilies.deltaSignedCodecs3);
+        checkAscendingCardinalities(CanonicalCodecFamilies.deltaSignedCodecs4);
+        checkAscendingCardinalities(CanonicalCodecFamilies.deltaSignedCodecs5);
+        checkAscendingCardinalities(CanonicalCodecFamilies.deltaDoubleSignedCodecs1);
     }
 
     private void checkAscendingCardinalities(BHSDCodec[] family) {

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PackingOptionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PackingOptionsTest.java?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PackingOptionsTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PackingOptionsTest.java
Thu Sep 16 07:03:58 2010
@@ -504,6 +504,44 @@ public class PackingOptionsTest extends 
 //        compareFiles(jarFile, jarFile2);
     }
 
+    public void testNewAttributes2() throws Exception {
+        in = new JarFile(
+                new File(
+                        Archive.class
+                                .getResource(
+                                        "/org/apache/harmony/pack200/tests/p200WithUnknownAttributes.jar")
+                                .toURI()));
+        file = File.createTempFile("unknown", ".pack");
+        file.deleteOnExit();
+        out = new FileOutputStream(file);
+        PackingOptions options = new PackingOptions();
+        options.addFieldAttributeAction("Pack200", "I");
+        options.addMethodAttributeAction("Pack200", "I");
+        options.addCodeAttributeAction("Pack200", "I");
+        Archive ar = new Archive(in, out, options);
+        ar.pack();
+        in.close();
+        out.close();
+
+        // unpack and check this was done right
+        InputStream in2 = new FileInputStream(file);
+        File file2 = File.createTempFile("unknown", ".jar");
+        file2.deleteOnExit();
+        JarOutputStream out2 = new JarOutputStream(new FileOutputStream(file2));
+        org.apache.harmony.unpack200.Archive u2archive = new org.apache.harmony.unpack200.Archive(
+                in2, out2);
+        u2archive.unpack();
+
+        // compare with original
+        File compareFile = new File(Archive.class.getResource(
+                "/org/apache/harmony/pack200/tests/p200WithUnknownAttributes.jar").toURI());
+        JarFile jarFile = new JarFile(file2);
+
+        JarFile jarFile2 = new JarFile(compareFile);
+        assertEquals(jarFile2.size(), jarFile.size());
+        compareJarEntries(jarFile, jarFile2);
+    }
+
     public void testErrorAttributes() throws Exception {
         in = new JarFile(
                 new File(

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
Thu Sep 16 07:03:58 2010
@@ -16,8 +16,11 @@
  */
 package org.apache.harmony.unpack200.tests;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.IOException;
@@ -27,6 +30,7 @@ import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
+import java.util.zip.ZipEntry;
 
 import junit.framework.TestCase;
 
@@ -117,6 +121,16 @@ public class ArchiveTest extends TestCas
         }
     }
 
+    public void testAlternativeConstructor() throws Exception {
+        String inputFile = new File(Archive.class
+                .getResource("/org/apache/harmony/pack200/tests/sql.pack.gz").toURI()).getPath();
+        file = File.createTempFile("sql", ".jar");
+        file.deleteOnExit();
+        String outputFile = file.getPath();
+        Archive archive = new Archive(inputFile, outputFile);
+        archive.unpack();
+    }
+
     // Test with an archive containing Harmony's Pack200 module, packed with -E1
     public void testWithPack200E1() throws Exception {
         in = Archive.class
@@ -179,6 +193,58 @@ public class ArchiveTest extends TestCas
         archive.unpack();
     }
 
+
+    public void testRemovePackFile() throws Exception {
+        File original = new File(Archive.class.getResource(
+                "/org/apache/harmony/pack200/tests/sql.pack.gz").toURI());
+        File copy = File.createTempFile("sqlcopy", ".pack.gz");
+        BufferedInputStream inputStream = new BufferedInputStream(
+                new FileInputStream(original));
+        BufferedOutputStream outputStream = new BufferedOutputStream(
+                new FileOutputStream(copy));
+        byte[] bytes = new byte[256];
+        int read = inputStream.read(bytes);
+        while (read > 0) {
+            outputStream.write(bytes, 0, read);
+            read = inputStream.read(bytes);
+        }
+        inputStream.close();
+        outputStream.close();
+        String inputFile = copy.getPath();
+        file = File.createTempFile("sqlout", ".jar");
+        file.deleteOnExit();
+        String outputFile = file.getPath();
+        Archive archive = new Archive(inputFile, outputFile);
+        archive.setRemovePackFile(true);
+        archive.unpack();
+        assertFalse(copy.exists());
+    }
+    
+    public void testDeflateHint() throws Exception {
+        in = Archive.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/sql.pack.gz");
+        file = File.createTempFile("sql", ".jar");
+        file.deleteOnExit();
+        out = new JarOutputStream(new FileOutputStream(file));
+        Archive archive = new Archive(in, out);
+        archive.setDeflateHint(true);
+        archive.unpack();
+        JarFile jarFile = new JarFile(file);
+        assertEquals(ZipEntry.DEFLATED, jarFile.getEntry("bin/test/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.class").getMethod());
+        
+        in = Archive.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/sql.pack.gz");
+        file = File.createTempFile("sql", ".jar");
+        file.deleteOnExit();
+        out = new JarOutputStream(new FileOutputStream(file));
+        archive = new Archive(in, out);
+        archive.setDeflateHint(false);
+        archive.unpack();
+        jarFile = new JarFile(file);
+        assertEquals(ZipEntry.STORED, jarFile.getEntry("bin/test/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.class").getMethod());
+        
+    }
+
     protected void tearDown() throws Exception {
         super.tearDown();
         if (in != null) {
@@ -234,6 +300,29 @@ public class ArchiveTest extends TestCas
         reader = new FileReader(logFile);
         assertTrue(reader.ready());
         reader.close();
+        
+        // test append option
+        long length = logFile.length();
+        in = Archive.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/sql.pack.gz");
+        file = File.createTempFile("logtest", ".jar");
+        file.deleteOnExit();
+        out = new JarOutputStream(new FileOutputStream(file));
+        archive = new Archive(in, out);
+        archive.setLogFile(logFile.getPath(), true);
+        archive.setVerbose(true);
+        archive.unpack();
+        assertTrue(logFile.length() > length);
+        in = Archive.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/sql.pack.gz");
+        file = File.createTempFile("logtest", ".jar");
+        file.deleteOnExit();
+        out = new JarOutputStream(new FileOutputStream(file));
+        archive = new Archive(in, out);
+        archive.setLogFile(logFile.getPath(), false);
+        archive.setVerbose(true);
+        archive.unpack();
+        assertTrue(logFile.length() == length);
 
         // test setting quiet explicitly
         in = Archive.class

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/SegmentTest.java?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/SegmentTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/SegmentTest.java
Thu Sep 16 07:03:58 2010
@@ -80,13 +80,13 @@ public class SegmentTest extends TestCas
         in = Segment.class
                 .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
         file = File.createTempFile("hello", "world.jar");
+        file.deleteOnExit();
         out = new JarOutputStream(new FileOutputStream(file));
         Segment segment = new Segment();
         segment.unpack(in, out);
         out.close();
         out = null;
         JarFile jarFile = new JarFile(file);
-        file.deleteOnExit();
 
         JarEntry entry = jarFile
                 .getJarEntry("org/apache/harmony/archive/tests/internal/pack200/HelloWorld.class");

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations.jar
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations.jar?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
Binary files - no diff available.

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotationsRI.jar
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotationsRI.jar?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
Binary files - no diff available.

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotationsRI.pack.gz
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotationsRI.pack.gz?rev=997618&r1=997617&r2=997618&view=diff
==============================================================================
Binary files - no diff available.

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 16 07:03:58 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336
+/harmony/enhanced/java/trunk/drlvm:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336,997338
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 16 07:03:58 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336
+/harmony/enhanced/java/trunk/jdktools:929253-996210,996457,996567,996687,996798,996801,996806,996812,996814,996824,996904,996996,997081,997093,997116,997212,997267,997336,997338
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message