You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/11/18 21:14:18 UTC
svn commit: r596125 [2/2] - in
/harmony/enhanced/classlib/trunk/modules/pack200/src:
main/java/org/apache/harmony/pack200/
main/java/org/apache/harmony/pack200/bytecode/
test/java/org/apache/harmony/pack200/tests/
test/resources/org/apache/harmony/pack...
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java?rev=596125&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java Sun Nov 18 12:14:16 2007
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class LineNumberTableAttribute extends Attribute {
+
+ private int line_number_table_length;
+ private int[] start_pcs;
+ private int[] line_numbers;
+
+ public LineNumberTableAttribute(int line_number_table_length, int[] start_pcs, int[] line_numbers) {
+ super("LineNumberTable");
+ this.line_number_table_length = line_number_table_length;
+ this.start_pcs = start_pcs;
+ this.line_numbers = line_numbers;
+ }
+
+ protected int getLength() {
+ return 2 + (4 * line_number_table_length);
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(line_number_table_length);
+ for (int i = 0; i < line_number_table_length; i++) {
+ dos.writeShort(start_pcs[i]);
+ dos.writeShort(line_numbers[i]);
+ }
+ }
+
+ public String toString() {
+ return "LineNumberTable: " + line_number_table_length + " lines";
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LineNumberTableAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java?rev=596125&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java Sun Nov 18 12:14:16 2007
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class LocalVariableTableAttribute extends Attribute {
+
+
+ private int local_variable_table_length;
+ private int[] start_pcs;
+ private int[] lengths;
+ private int[] name_indexes;
+ private int[] descriptor_indexes;
+ private int[] indexes;
+ private CPUTF8[] names;
+ private CPUTF8[] descriptors;
+
+ public LocalVariableTableAttribute(int local_variable_table_length,
+ int[] start_pcs, int[] lengths, CPUTF8[] names,
+ CPUTF8[] descriptors, int[] indexes) {
+ super("LocalVariableTable");
+ this.local_variable_table_length = local_variable_table_length;
+ this.start_pcs = start_pcs;
+ this.lengths = lengths;
+ this.names = names;
+ this.descriptors = descriptors;
+ this.indexes = indexes;
+ }
+
+ protected int getLength() {
+ return 2 + (10 * local_variable_table_length);
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(local_variable_table_length);
+ for (int i = 0; i < local_variable_table_length; i++) {
+ dos.writeShort(start_pcs[i]);
+ dos.writeShort(lengths[i]);
+ dos.writeShort(name_indexes[i]);
+ dos.writeShort(descriptor_indexes[i]);
+ dos.writeShort(indexes[i]);
+ }
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ name_indexes = new int[local_variable_table_length];
+ descriptor_indexes = new int[local_variable_table_length];
+ for (int i = 0; i < local_variable_table_length; i++) {
+ names[i].resolve(pool);
+ descriptors[i].resolve(pool);
+ name_indexes[i] = pool.indexOf(names[i]);
+ descriptor_indexes[i] = pool.indexOf(descriptors[i]);
+ }
+ }
+
+ public String toString() {
+ return "LocalVariableTable: " + + local_variable_table_length + " varaibles";
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTableAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java?rev=596125&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java Sun Nov 18 12:14:16 2007
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class LocalVariableTypeTableAttribute extends Attribute {
+
+
+ private int local_variable_type_table_length;
+ private int[] start_pcs;
+ private int[] lengths;
+ private int[] name_indexes;
+ private int[] signature_indexes;
+ private int[] indexes;
+ private CPUTF8[] names;
+ private CPUTF8[] signatures;
+
+ public LocalVariableTypeTableAttribute(int local_variable_type_table_length,
+ int[] start_pcs, int[] lengths, CPUTF8[] names,
+ CPUTF8[] signatures, int[] indexes) {
+ super("LocalVariableTypeTable");
+ this.local_variable_type_table_length = local_variable_type_table_length;
+ this.start_pcs = start_pcs;
+ this.lengths = lengths;
+ this.names = names;
+ this.signatures = signatures;
+ this.indexes = indexes;
+ }
+
+ protected int getLength() {
+ return 2 + (10 * local_variable_type_table_length);
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(local_variable_type_table_length);
+ for (int i = 0; i < local_variable_type_table_length; i++) {
+ dos.writeShort(start_pcs[i]);
+ dos.writeShort(lengths[i]);
+ dos.writeShort(name_indexes[i]);
+ dos.writeShort(signature_indexes[i]);
+ dos.writeShort(indexes[i]);
+ }
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ name_indexes = new int[local_variable_type_table_length];
+ signature_indexes = new int[local_variable_type_table_length];
+ for (int i = 0; i < local_variable_type_table_length; i++) {
+ names[i].resolve(pool);
+ signatures[i].resolve(pool);
+ name_indexes[i] = pool.indexOf(names[i]);
+ signature_indexes[i] = pool.indexOf(signatures[i]);
+ }
+ }
+
+ public String toString() {
+ return "LocalVariableTypeTable: " + + local_variable_type_table_length + " varaibles";
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/LocalVariableTypeTableAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java?rev=596125&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java Sun Nov 18 12:14:16 2007
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class RuntimeVisibleorInvisibleAnnotationsAttribute extends AnnotationsAttribute {
+
+ private int num_annotations;
+ private Annotation[] annotations;
+ private String name;
+
+ public RuntimeVisibleorInvisibleAnnotationsAttribute(String name, Annotation[] annotations) {
+ super(name);
+ this.name = name;
+ this.num_annotations = annotations.length;
+ this.annotations = annotations;
+ }
+
+ protected int getLength() {
+ int length = 2;
+ for (int i = 0; i < num_annotations; i++) {
+ length += annotations[i].getLength();
+ }
+ return length;
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ for (int i = 0; i < annotations.length; i++) {
+ annotations[i].resolve(pool);
+ }
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(num_annotations);
+ for (int i = 0; i < num_annotations; i++) {
+ annotations[i].writeBody(dos);
+ }
+ }
+
+ public String toString() {
+ return name + ": " + num_annotations + " annotations";
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java?rev=596125&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java Sun Nov 18 12:14:16 2007
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class RuntimeVisibleorInvisibleParameterAnnotationsAttribute extends AnnotationsAttribute {
+
+ private int num_parameters;
+ private ParameterAnnotation[] parameter_annotations;
+ private String name;
+
+ public RuntimeVisibleorInvisibleParameterAnnotationsAttribute(String name, ParameterAnnotation[] parameter_annotations) {
+ super(name);
+ this.name = name;
+ this.num_parameters = parameter_annotations.length;
+ this.parameter_annotations = parameter_annotations;
+ }
+
+ protected int getLength() {
+ int length = 1;
+ for (int i = 0; i < num_parameters; i++) {
+ length += parameter_annotations[i].getLength();
+ }
+ return length;
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ for (int i = 0; i < parameter_annotations.length; i++) {
+ parameter_annotations[i].resolve(pool);
+ }
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeByte(num_parameters);
+ for (int i = 0; i < num_parameters; i++) {
+ parameter_annotations[i].writeBody(dos);
+ }
+ }
+
+ public String toString() {
+ return name + ": " + num_parameters + " parameter annotations";
+ }
+
+
+ public static class ParameterAnnotation {
+
+ private Annotation[] annotations;
+ private int num_annotations;
+
+ public ParameterAnnotation(Annotation[] annotations) {
+ this.num_annotations = annotations.length;
+ this.annotations = annotations;
+ }
+
+ public void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(num_annotations);
+ for (int i = 0; i < annotations.length; i++) {
+ annotations[i].writeBody(dos);
+ }
+ }
+
+ public void resolve(ClassConstantPool pool) {
+ for (int i = 0; i < annotations.length; i++) {
+ annotations[i].resolve(pool);
+ }
+ }
+
+ public int getLength() {
+ int length = 2;
+ for (int i = 0; i < annotations.length; i++) {
+ length += annotations[i].getLength();
+ }
+ return length;
+ }
+
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java?rev=596125&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java Sun Nov 18 12:14:16 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class SignatureAttribute extends Attribute {
+
+ private int signature_index;
+ private CPUTF8 signature;
+
+ public SignatureAttribute(CPUTF8 value) {
+ super("Signature");
+ this.signature = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.harmony.pack200.bytecode.Attribute#getLength()
+ */
+ protected int getLength() {
+ return 2;
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ signature.resolve(pool);
+ signature_index = pool.indexOf(signature);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.harmony.pack200.bytecode.Attribute#writeBody(java.io.DataOutputStream)
+ */
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(signature_index);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.harmony.pack200.bytecode.ClassFileEntry#toString()
+ */
+ public String toString() {
+ // TODO Auto-generated method stub
+ return "Signature: " + signature;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SignatureAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java?rev=596125&r1=596124&r2=596125&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java Sun Nov 18 12:14:16 2007
@@ -32,6 +32,7 @@
private String[] cpClasses;
private String[] cpDescriptor;
+ private String[] cpUTF8;
public class MockCpBands extends CpBands {
@@ -46,14 +47,36 @@
public String[] getCpDescriptor() {
return cpDescriptor;
}
-
+
+ public String[] getCpUTF8() {
+ return cpUTF8;
+ }
+
+ public int[] getCpInt() {
+ return new int[0];
+ }
+
+ public double[] getCpDouble() {
+ return new double[0];
+ }
+
+ public long[] getCpLong() {
+ return new long[0];
+ }
+
+ public float[] getCpFloat() {
+ return new float[0];
+ }
+
+ public String[] getCpSignature() {
+ return new String[0];
+ }
}
public class MockSegment extends AbstractBandsTestCase.MockSegment {
protected CpBands getCpBands() {
return new MockCpBands(this);
- }
-
+ }
}
@@ -63,6 +86,7 @@
public void testSimple() throws IOException, Pack200Exception {
cpClasses = new String[] { "Class1", "Class2", "Class3", "Interface1", "Interface2" };
cpDescriptor = new String[0];
+ cpUTF8 = new String[0];
byte[] classThis = Codec.DELTA5.encode(1, 0);
byte[] classSuper = Codec.DELTA5.encode(2, 0);
byte[] classInterfaceCount = Codec.DELTA5.encode(2, 0);
@@ -99,6 +123,7 @@
public void testWithMethods() throws Pack200Exception, IOException {
cpClasses = new String[] { "Class1", "Class2", "Class3" };
cpDescriptor = new String[] {"method1", "method2", "method3"};
+ cpUTF8 = new String[0];
byte[] classThis = Codec.DELTA5.encode(1, 0);
byte[] classSuper = Codec.DELTA5.encode(2, 0);
byte[] classInterfaceCount = Codec.DELTA5.encode(0, 0);
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=596125&r1=596124&r2=596125&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 Sun Nov 18 12:14:16 2007
@@ -31,8 +31,11 @@
public class SegmentTest extends TestCase {
public void testHelloWorld() throws Exception {
- assertNotNull(Segment.parse(Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack")));
+ InputStream in = Segment.class
+ .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
+ Segment segment = Segment.parse(in);
+ assertNotNull(segment);
+ segment.writeJar(new JarOutputStream(new FileOutputStream(File.createTempFile("Hello", "World.jar"))), in);
}
public void testJustResources() throws Exception {
@@ -78,6 +81,22 @@
assertNotNull(Segment
.parse(Segment.class
.getResourceAsStream("/org/apache/harmony/pack200/tests/pack200.pack.gz")));
+
+ }
+
+ // Test with an archive containing Harmony's JNDI module
+ public void testWithJNDIE1() throws Exception {
+ assertNotNull(Segment
+ .parse(Segment.class
+ .getResourceAsStream("/org/apache/harmony/pack200/tests/jndi-e1.pack.gz")));
+
+ }
+
+ // Test with an archive containing Annotations
+ public void testWithAnnotations() throws Exception {
+ assertNotNull(Segment
+ .parse(Segment.class
+ .getResourceAsStream("/org/apache/harmony/pack200/tests/annotations.pack.gz")));
}
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations.pack.gz
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations.pack.gz?rev=596125&view=auto
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations.pack.gz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/jndi-e1.pack.gz
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/jndi-e1.pack.gz?rev=596125&view=auto
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/jndi-e1.pack.gz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream