harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r547247 - in /harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang: ./ reflect/
Date Thu, 14 Jun 2007 13:28:15 GMT
Author: gshimansky
Date: Thu Jun 14 06:28:14 2007
New Revision: 547247

URL: http://svn.apache.org/viewvc?view=rev&rev=547247
Log:
Applied HARMONY-1834
[drlvm][test][kernel] a number of test cases for java.lang kernel classes should be actualized
for tests run


Added:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/AuxiliaryClass.java   (with
props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/PackageTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/ConstructorTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/FieldTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTest.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java Thu Jun 14
06:28:14 2007
@@ -1,10 +1,9 @@
 /*
- *  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
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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
  *
@@ -609,6 +608,9 @@
                 if (nm.endsWith("IIOImage")) {
                     return defineClass(b, 0, b.length); // ALL RIGHT
                 }
+                if (nm.endsWith("TemplateSet")) {
+                    return defineClass(b, 0, b.length); // ALL RIGHT
+                }
                 return null;
             }
 
@@ -641,31 +643,25 @@
             tcl.loadClass("#org.apache.harmony.lang.generics.TemplateSet");
             assertTrue("Error1", tcl.findLoadedClass("org.apache.harmony.lang.generics.TemplateSet")
                     .getName().equals("org.apache.harmony.lang.generics.TemplateSet"));
-            //tcl.loadClass("#javax.imageio.IIOImage");
-            //assertTrue("Error1", tcl.findLoadedClass("javax.imageio.IIOImage")
-            //        .getName().equals("javax.imageio.IIOImage"));
-        } catch (ClassNotFoundException _) {
         } catch (Throwable e) {
             fail("Error2: " + e.toString());
         }
 
         // TEST CASE #2:
         try {
-            assertTrue("Error1", cl.findLoadedClass(null) == null);
-        } catch (NullPointerException _) {
+            assertTrue("Error3", cl.findLoadedClass(null) == null);
         } catch (Throwable e) {
             fail("Error4: " + e.toString());
         }
         try {
-            assertTrue("Error1", tcl.findLoadedClass(null) == null);
-        } catch (NullPointerException _) {
+            assertTrue("Error33", tcl.findLoadedClass(null) == null);
         } catch (Throwable e) {
-            fail("Error4: " + e.toString());
+            fail("Error44: " + e.toString());
         }
 
         // TEST CASE #3:
         try {
-            if (cl.findLoadedClass("java.lang.Object") != null) // XXX: Here we
+        	if (cl.findLoadedClass("java.lang.Object") != null) // XXX: Here we
                                                                 // differ of others. Is it
                                                                 // absolutely
                                                                 // acceptible
@@ -736,7 +732,7 @@
             ClassLoader ld = TestResources.getLoader();
             Class c = Class.forName("[Lorg.apache.harmony.lang.generics.TemplateSet;", true,
ld);
             assertTrue("Error7_1", ld
-                    .findLoadedClass("[Lorg.apache.harmony.test.TestResources;") == null);
// according the deligate loading model
+                    .findLoadedClass("[Lorg.apache.harmony.test.TestResources;") == null);
// according the delegate loading model
         } catch (Throwable e) {
             fail("Error12_1: " + e.toString());
         }
@@ -920,7 +916,6 @@
         //new a3().main(new String[] { "" });
     }
 
-    
     /**
      *  
      */
@@ -990,6 +985,13 @@
         } catch (Exception _) {
             fail("Error3");
         }
+        
+        try {
+            tcl.findResources(null);
+        } catch (NullPointerException _) {
+            fail("Error5");
+        } catch (java.io.IOException _) {
+        }
     }
 
     /**
@@ -1277,12 +1279,11 @@
         ClassLoader cl = ClassLoader.getSystemClassLoader();
 
         // TEST CASE #1:
-// Commented because of the drlvm issue.
-//        try {
-//            cl.getResource(null);
-//            fail("Error1: NullPointerException is not thrown for null argument");
-//        } catch (NullPointerException _) {
-//        }
+        try {
+            cl.getResource(null);
+            fail("Error1: NullPointerException is not thrown for null argument");
+        } catch (NullPointerException _) {
+        }
 
         // TEST CASE #2:
         assertTrue("Error1: unexpected:"
@@ -1337,12 +1338,11 @@
         ClassLoader cl = ClassLoader.getSystemClassLoader();
 
         // TEST CASE #1:
-// Commented because of the drlvm issue.
-//        try {
-//            cl.getResourceAsStream(null);
-//            fail("Error1: NullPointerException is not thrown for null argument");
-//        } catch (NullPointerException _) {
-//        }
+        try {
+            cl.getResourceAsStream(null);
+            fail("Error1: NullPointerException is not thrown for null argument");
+        } catch (NullPointerException _) {
+        }
 
         // TEST CASE #2:
         byte magic[] = new byte[4];
@@ -1522,12 +1522,11 @@
         ClassLoader.getSystemClassLoader();
 
         // TEST CASE #1:
-// Commented because of the drlvm issue.
-//        try {
-//            ClassLoader.getSystemResource(null);
-//            fail("Error1: NullPointerException is not thrown for null argument");
-//        } catch (NullPointerException _) {
-//        }
+        try {
+            ClassLoader.getSystemResource(null);
+            fail("Error1: NullPointerException is not thrown for null argument");
+        } catch (NullPointerException _) {
+        }
 
         // TEST CASE #2:
         assertTrue("Error1: unexpected:"
@@ -1584,12 +1583,11 @@
         ClassLoader.getSystemClassLoader();
 
         // TEST CASE #1:
-// Commented because of the drlvm issue.
-//        try {
-//            ClassLoader.getSystemResourceAsStream(null);
-//            fail("Error1: NullPointerException is not thrown for null argument");
-//        } catch (NullPointerException _) {
-//        }
+        try {
+            ClassLoader.getSystemResourceAsStream(null);
+            fail("Error1: NullPointerException is not thrown for null argument");
+        } catch (NullPointerException _) {
+        }
 
         // TEST CASE #2:
         byte magic[] = new byte[4];
@@ -2242,10 +2240,10 @@
             //expected 
         } 
     }
+    
     private class CL extends ClassLoader { 
         public Class defineKlass(byte[] a, int i1, int i2) throws ClassFormatError { 
             return super.defineClass(a, i1, i2); 
         } 
     } 
-
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java Thu Jun
14 06:28:14 2007
@@ -67,10 +67,6 @@
      * in java.ext.dirs.
      */
     public void test3() {
-        //System.out.println(System.getProperties());
-        if (vendor.equals("Intel DRL")) {// to test for others
-            // -Djava.ext.dirs=<some non-empty path list> argument should be
-            // passed for ij.exe for real check
             String as[] = System.getProperty("java.ext.dirs").split(
                     System.getProperty("path.separator"));
             for (int i = 0; i < as.length; i++) {
@@ -79,31 +75,32 @@
                     String afn[] = dir.list();
                     File aff[] = dir.listFiles();
                     for (int j = 0; j < aff.length; j++) {
-                        if (aff[j].isFile()) {
-                            /**/System.out.println("test3 "+afn[j]);
+                        if (aff[j].isFile() && aff[j].getName().endsWith(".jar"))
{
+                            aff[j].getName();
                             try {
-                                assertTrue("Error1",
-                                    Void.class.getResource("/" + afn[j])
-                                            .toString().indexOf(afn[j]) != -1);
-							    return;
-                            }catch(Throwable e){
-								 System.out.println(e.toString());
-    			    }
+                                java.util.jar.JarFile jf = new java.util.jar.JarFile(aff[j]);
+                                for (java.util.Enumeration e = jf.entries(); e
+                                        .hasMoreElements();) {
+                                    String s = e.nextElement().toString();
+                                    if (s.endsWith(".class")) {
+                                    	String resource = Void.class.getResource("/" + s).toString();
+                                        assertTrue("Error1", (resource.indexOf(s) != -1)
&& (resource.indexOf("jar:file:") != -1));
+                                        return;
+                                    }
+                                }
+                            } catch (java.io.IOException e) {
+                            	fail("Unexpected Exception " + e);
+                            }
                         }
                     }
                 }
             }
-        }
     }
 
     /**
      * in java.class.path.
      */
     public void test4() {
-        if (vendor.equals("Intel DRL")) {// to test for others
-            // -cp <some non-empty path list> or -Djava.class.path=<some
-            // non-empty path list> arguments should be passed for ij.exe for
-            // real check
             String as[] = System.getProperty("java.class.path").split(
                     System.getProperty("path.separator"));
             for (int i = 0; i < as.length; i++) {
@@ -113,10 +110,8 @@
                     File aff[] = f.listFiles();
                     for (int j = 0; j < aff.length; j++) {
                         if (aff[j].isFile()) {
-                            //System.out.println("test4 "+afn[j]);
-                            assertTrue("Error1",
-                                    Void.class.getResource("/" + afn[j])
-                                            .toString().indexOf(afn[j]) != -1);
+                        	String resource = Void.class.getResource("/" + afn[j]).toString();
+                            assertTrue("Error1", (resource.toString().indexOf(afn[j]) !=
-1) && (resource.toString().indexOf("file:") != -1));
                             return;
                         }
                     }
@@ -128,31 +123,24 @@
                                 .hasMoreElements();) {
                             String s = e.nextElement().toString();
                             if (s.endsWith(".class")) {
-                                //System.out.println("test4 "+s);
-                                assertTrue("Error1", Void.class.getResource(
-                                        "/" + s).toString().indexOf(s) != -1);
+                            	String resource = Void.class.getResource("/" + s).toString();
+                                assertTrue("Error2", (resource.indexOf(s) != -1) &&
(resource.indexOf("jar:file:") != -1));
                                 return;
                             }
                         }
-                    } catch (java.io.IOException _) {
+                    } catch (java.io.IOException e) {
+                    	fail("Unexpected Exception " + e);
                     }
                 }
             }
-        }
     }
 
     /**
      * via -Xbootclasspath (vm.boot.class.path).
      */
     public void test5() {
-        //System.out.println("|"+System.getProperty("sun.boot.class.path")+"|");
-        //System.out.println("|"+System.getProperty("vm.boot.class.path")+"|");
-        if (vendor.equals("Intel DRL")) {// to test for others
-            // -Xbootclasspath[/a /p]:<some non-empty path list> or
-            // -D{vm/sun}.boot.class.path=<some non-empty path list> arguments
-            // should be passed for ij.exe for real check
             String as[] = System.getProperty(
-                    (vendor.equals("Intel DRL") ? "vm" : "sun")
+                    (vendor.equals("Apache Software Foundation") ? "vm" : "sun")
                             + ".boot.class.path").split(
                     System.getProperty("path.separator"));
             for (int i = 0; i < as.length; i++) {
@@ -164,39 +152,35 @@
                                 .hasMoreElements();) {
                             String s = e.nextElement().toString();
                             if (s.endsWith(".class")) {
-                                //System.out.println("test5 "+s);
-                                assertTrue("Error1", Void.class.getResource(
-                                        "/" + s).toString().indexOf(s) != -1);
+                            	String resource = Void.class.getResource("/" + s).toString();
+                                assertTrue("Error1", (resource.indexOf(s) != -1) &&
(resource.indexOf("jar:file:") != -1));
                                 return;
                             }
                         }
-                    } catch (java.io.IOException _) {
+                    } catch (java.io.IOException e) {
+                    	fail("Unexpected Exception " + e);
                     }
-                } else if (f.exists() && f.isDirectory() && false) {
+                } else if (f.exists() && f.isDirectory()) {
                     String afn[] = f.list();
                     File aff[] = f.listFiles();
                     for (int j = 0; j < aff.length; j++) {
                         if (aff[j].isFile()) {
-                            //System.out.println("test5 "+afn[j]);
-                            assertTrue("Error1",
-                                    Void.class.getResource("/" + afn[j])
-                                            .toString().indexOf(afn[j]) != -1);
+                        	String resource = Void.class.getResource("/" + afn[j]).toString();
+                            assertTrue("Error2", (resource.indexOf(afn[j]) != -1) &&
(resource.indexOf("file") != -1));
                             return;
                         }
                     }
                 }
             }
-        }
     }
 
     /**
      * The method throws NullPointerException if argument is null
      */
-//Commented because 6793 bug isn't fixed
-    public void te_st6() {
+    public void test6() {
         try {
             Void.class.getResource(null);
-        	fail("Error1: NullPointerException is not thrown for null argument"); // #6793
+        	fail("Error1: NullPointerException is not thrown for null argument");
         } catch (NullPointerException _) {           
         }
     }

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java
Thu Jun 14 06:28:14 2007
@@ -44,8 +44,7 @@
     /**
      * The method throws NullPointerException if argument is null
      */
-//Commented because 6793 bug isn't fixed
-    public void te_st1() {
+    public void test1() {
         try {
             Void.class.getResourceAsStream(null);
         	fail("Error1: NullPointerException is not thrown for null argument");
@@ -62,7 +61,9 @@
             Void.class.getResourceAsStream("Class.class").read(magic);
             //System.out.println(Integer.toString(0xff&magic[0], 16));
             assertTrue("Error1", new String(magic).equals(new String(new byte[]{(byte)0xCA,
(byte)0xFE, (byte)0xBA, (byte)0xBE})));
-        } catch (java.io.IOException _) {}
+        } catch (java.io.IOException e) {
+        	fail("Unexpected Exception " + e);
+        }
     }
 
     /**
@@ -75,17 +76,15 @@
                     + Class.class.getPackage().getName().replace(
                             '.', '/') + "/Class.class").read(magic);
             assertTrue("Error1", new String(magic).equals(new String(new byte[]{(byte)0xCA,
(byte)0xFE, (byte)0xBA, (byte)0xBE})));
-        } catch (java.io.IOException _) {}
+        } catch (java.io.IOException e) {
+        	fail("Unexpected Exception " + e);
+        }
    }
 
     /**
      * in java.ext.dirs.
      */
     public void test4() {
-        //System.out.println(System.getProperties());
-        if (vendor.equals("Intel DRL")) {// to test for others
-            // -Djava.ext.dirs=<some non-empty path list> argument should be
-            // passed for ij.exe for real check
             String as[] = System.getProperty("java.ext.dirs").split(
                     System.getProperty("path.separator"));
             for (int i = 0; i < as.length; i++) {
@@ -94,33 +93,32 @@
                     String afn[] = dir.list();
                     File aff[] = dir.listFiles();
                     for (int j = 0; j < aff.length; j++) {
-                        if (aff[j].isFile()) {
-                            //System.out.println("test4 "+afn[j]);
+                        if (aff[j].isFile() && aff[j].getName().endsWith(".jar"))
{
                             try {
-                                assertTrue("Error1",
-                                    Void.class.getResourceAsStream("/" + afn[j])
-                                            .available() >= 0);
-                                return;
-                            }catch(java.io.IOException _){
-                            }catch(Throwable e){
-								 System.out.println(e.toString());
-							}
-                            //return;
+                                java.util.jar.JarFile jf = new java.util.jar.JarFile(aff[j]);
+                                for (java.util.Enumeration e = jf.entries(); e
+                                        .hasMoreElements();) {
+                                    String s = e.nextElement().toString();
+                                    if (s.endsWith(".class")) {
+                                        assertTrue("Error1",
+                                            Void.class.getResourceAsStream("/" + s)
+                                                .available() >= 0);
+                                        return;
+                                    }
+                                }
+                            } catch (java.io.IOException e) {
+                            	fail("Unexpected Exception " + e);
+                            }
                         }
                     }
                 }
             }
-        }
     }
 
     /**
      * in java.class.path.
      */
     public void test5() {
-        if (vendor.equals("Intel DRL")) {// to test for others
-            // -cp <some non-empty path list> or -Djava.class.path=<some
-            // non-empty path list> arguments should be passed for ij.exe for
-            // real check
             String as[] = System.getProperty("java.class.path").split(
                     System.getProperty("path.separator"));
             for (int i = 0; i < as.length; i++) {
@@ -130,51 +128,47 @@
                     File aff[] = f.listFiles();
                     for (int j = 0; j < aff.length; j++) {
                         if (aff[j].isFile()) {
-                            /**/System.out.println("test5 "+afn[j]);
                             try {
                                 assertTrue("Error1",
                                     Void.class.getResourceAsStream("/" + afn[j])
                                     .available() >= 0);
-                            }catch(java.io.IOException _){}
+                            } catch(java.io.IOException e1) {
+                            	fail("Unexpected Exception 1 " + e1);
+                            }
                             return;
                         }
                     }
                 } else if (f.exists() && f.isFile()
                         && f.getName().endsWith(".jar")) {
                     try {
-                        java.util.jar.JarFile jf = new java.util.jar.JarFile(f);
+                        java.util.jar.JarFile jf = new java.util.jar.JarFile(f);	
                         for (java.util.Enumeration e = jf.entries(); e
                                 .hasMoreElements();) {
                             String s = e.nextElement().toString();
                             if (s.endsWith(".class")) {
-                                //System.out.println("test4 "+s);
                                 byte magic[] = new byte[4];
                                 try {
                                     Void.class.getResourceAsStream("/" + s).read(magic);
-                                    assertTrue("Error1", new String(magic).equals(new String(new
byte[]{(byte)0xCA, (byte)0xFE, (byte)0xBA, (byte)0xBE})));
-                                } catch (java.io.IOException _) {}
+                                    assertTrue("Error2", new String(magic).equals(new String(new
byte[]{(byte)0xCA, (byte)0xFE, (byte)0xBA, (byte)0xBE})));
+                                } catch (java.io.IOException e2) {
+                                	fail("Unexpected Exception 2 " + e2);
+                                }
                                 return;
                             }
                         }
-                    } catch (java.io.IOException _) {
+                    } catch (java.io.IOException e) {
+                    	fail("Unexpected Exception 3 " + e);
                     }
                 }
             }
-        }
     }
 
     /**
      * via -Xbootclasspath (vm.boot.class.path).
      */
     public void test6() {
-        //System.out.println("|"+System.getProperty("sun.boot.class.path")+"|");
-        //System.out.println("|"+System.getProperty("vm.boot.class.path")+"|");
-        if (vendor.equals("Intel DRL")) {// to test for others
-            // -Xbootclasspath[/a /p]:<some non-empty path list> or
-            // -D{vm/sun}.boot.class.path=<some non-empty path list> arguments
-            // should be passed for ij.exe for real check
             String as[] = System.getProperty(
-                    (vendor.equals("Intel DRL") ? "vm" : "sun")
+                    (vendor.equals("Apache Software Foundation") ? "vm" : "sun")
                             + ".boot.class.path").split(
                     System.getProperty("path.separator"));
             for (int i = 0; i < as.length; i++) {
@@ -186,33 +180,35 @@
                                 .hasMoreElements();) {
                             String s = e.nextElement().toString();
                             if (s.endsWith(".class")) {
-                                //System.out.println("test5 "+s);
                                 byte magic[] = new byte[4];
                                 try {
                                     Void.class.getResourceAsStream("/" + s).read(magic);
                                     assertTrue("Error1", new String(magic).equals(new String(new
byte[]{(byte)0xCA, (byte)0xFE, (byte)0xBA, (byte)0xBE})));
-                                } catch (java.io.IOException _) {}
+                                } catch (java.io.IOException e1) {
+                                	fail("Unexpected Exception 1 " + e1);
+                                }
                                 return;
                             }
                         }
-                    } catch (java.io.IOException _) {
+                    } catch (java.io.IOException e2) {
+                    	fail("Unexpected Exception 2 " + e2);
                     }
-                } else if (f.exists() && f.isDirectory() && false) {
+                } else if (f.exists() && f.isDirectory()) {
                     String afn[] = f.list();
                     File aff[] = f.listFiles();
                     for (int j = 0; j < aff.length; j++) {
                         if (aff[j].isFile()) {
-                            //System.out.println("test5 "+afn[j]);
                             try {
-                                assertTrue("Error1",
+                                assertTrue("Error2",
                                     Void.class.getResourceAsStream("/" + afn[j])
                                     .available() >= 0);
-                            }catch(java.io.IOException _){}
+                            } catch(java.io.IOException e){
+                            	fail("Unexpected Exception 3 " + e);
+                            }
                             return;
                         }
                     }
                 }
             }
-        }
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/PackageTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/PackageTest.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/PackageTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/PackageTest.java Thu Jun 14 06:28:14
2007
@@ -52,7 +52,7 @@
                          "Java Runtime Environment", s);
         } else if (vendor.equals("BEA Systems, Inc.")) {
             assertEquals("Error2: unexpected title:", "...", s);
-        } else if (vendor.equals("Intel DRL")) {
+        } else if (vendor.equals("Apache Software Foundation")) {
             assertEquals("Error3: unexpected title:", "Apache Harmony", s);
         }
     }
@@ -64,7 +64,7 @@
         //System.out.println("test_getImplementationVendor_V");
         Package p = java.lang.Character.class.getPackage();
         if (p == null)
-            return;
+        	return;
         String s = p.getImplementationVendor();
         if (s == null)
             return; // XXX:It's not explained by spec
@@ -73,7 +73,7 @@
                          "Sun Microsystems, Inc.", s);
         } else if (vendor.equals("BEA Systems, Inc.")) {
             assertEquals("Error2: unexpected vendor:", "...", s);
-        } else if (vendor.equals("Intel DRL")) {
+        } else if (vendor.equals("Apache Software Foundation")) {
             assertEquals("Error3: unexpected vendor:", "The Apache Software Foundation",
s);
         }
     }
@@ -191,6 +191,7 @@
         if (p == null)
             return;
         String s = p.getSpecificationVersion();
+        assertNotNull("spec version is null", s);
         if (s == null)
             return;
         assertTrue("unexpected specification version: " + s,
@@ -212,8 +213,7 @@
     /**
      *  
      */
-// Commented because of the drvm issue.
-    public void te_st_isCompatibleWith_Str_1() {
+    public void test_isCompatibleWith_Str_1() {
         //System.out.println("test_isCompatibleWith_Str_1");
         Package p = Package.getPackage("java.lang");
         if (p == null)
@@ -278,8 +278,7 @@
     /**
      *  
      */
-// Commented because of the drvm issue.
-    public void te_st_isSealed_URL_2() {
+    public void test_isSealed_URL_2() {
         //System.out.println("test_isSealed_URL_2");
         try {
             Package p = Package.getPackage("java.lang");

Added: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/AuxiliaryClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/AuxiliaryClass.java?view=auto&rev=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/AuxiliaryClass.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/AuxiliaryClass.java Thu
Jun 14 06:28:14 2007
@@ -0,0 +1,39 @@
+/*
+ *  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.
+ */
+
+/**
+ * @author Serguei S.Zapreyev
+ * @version $Revision$
+ */
+
+package java.lang.reflect;
+
+import junit.framework.TestCase;
+/*
+ * Created on 10.12.2006
+ *
+ * This AuxiliaryClass class is used to support 
+ * MethodTest.test_invoke_Obj_Obj_2() test case
+ */
+
+public class AuxiliaryClass {
+    public int get() throws Throwable {
+        int t1 = 1;
+        int t2 = 0;
+        return t1/t2;
+    }
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/AuxiliaryClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/ConstructorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/ConstructorTest.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/ConstructorTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/ConstructorTest.java Thu
Jun 14 06:28:14 2007
@@ -234,30 +234,28 @@
     /**
      *  
      */
-//Commented because of the drlvm issue
-/*
     public void test_newInstance_Obj() {
-        class X {
-            public X() {
+        class X1 {
+            public X1() {
                 return;
             }
 
-            public X(X a9) {
+            public X1(X1 a9) {
                 return;
             }
         }
-        X x = new X(new X());
+        X1 x = new X1(new X1());
         try {
-            Constructor m = X.class.getDeclaredConstructor(new Class[] {
-                    java.lang.reflect.ConstructorTest.class, X.class });
+            Constructor m = X1.class.getDeclaredConstructor(new Class[] {
+                    java.lang.reflect.ConstructorTest.class, X1.class });
             Object o = m.newInstance(new Object[] {
-                    new java.lang.reflect.ConstructorTest(), new X() });
-            assertTrue("Error1", o instanceof X);
+                    new java.lang.reflect.ConstructorTest(), new X1() });
+            assertTrue("Error1", o instanceof X1);
         } catch (Exception e) {
             fail("Error2: " + e.toString());
         }
     }
-*/
+
     /**
      *  
      */

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/FieldTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/FieldTest.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/FieldTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/FieldTest.java Thu Jun
14 06:28:14 2007
@@ -85,16 +85,14 @@
     /**
      *  
      */
-//Commented because of the drlvm issue
-/*
     public void test_get_Obj() {
-        class X {
+        class X1 {
             public int Xfld = 777;
         }
-        X x = new X();
+        X1 x = new X1();
         x.Xfld = 333;
         try {
-            Field f1 = X.class.getField("Xfld");
+            Field f1 = X1.class.getField("Xfld");
             assertTrue("Error1: x.Xfld should be equal 333", ((Integer) (f1
                     .get(x))).intValue() == 333);
         } catch (Exception e) {
@@ -102,7 +100,7 @@
             fail("Error2: " + e.toString());
         }
         try {
-            Field f1 = X.class.getField("Xfld");
+            Field f1 = X1.class.getField("Xfld");
             f1.get(null);
             fail("Error3: NullPointerException should be risen just above");
         } catch (NullPointerException _) {
@@ -111,7 +109,7 @@
             fail("Error4: " + e.toString());
         }
     }
-*/
+
     /**
      *  
      */
@@ -379,11 +377,9 @@
     /**
      *  
      */
-//Commented because of the drlvm issue
-/*
     public void test_set_Obj_Obj() {
-        class X {
-            X xx;
+        class X2 {
+            X2 xx;
 
             int Yfld = 777;
 
@@ -391,13 +387,13 @@
                 return Yfld;
             };
         }
-        X x = new X();
+        X2 x = new X2();
         try {
-            Field f1 = X.class.getDeclaredField("Yfld");
+            Field f1 = X2.class.getDeclaredField("Yfld");
             f1.set(x, new Integer(345));
             assertTrue("Error1", x.m() == 345);
 
-            f1 = X.class.getDeclaredField("xx");
+            f1 = X2.class.getDeclaredField("xx");
             f1.set(x, x);
             assertTrue("Error2", x.xx.Yfld == 345);
             assertTrue("Error3", x.xx.m() == 345);
@@ -411,7 +407,6 @@
             fail("Error6: " + e.toString());
         }
     }
-*/
     /**
      *  
      */

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTest.java?view=diff&rev=547247&r1=547246&r2=547247
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTest.java Thu Jun
14 06:28:14 2007
@@ -260,8 +260,6 @@
     /**
      *  
      */
-//Commented because of the drlvm issue
-/*
     public void test_invoke_Obj_Obj() {
 
         class X {
@@ -279,7 +277,39 @@
             fail("Error2: " + e.toString());
         }
     }
-*/
+
+    /**
+     *  
+     */
+    public void test_invoke_Obj_Obj_2() {
+        int sz = 500;
+        Object obj = null;
+        Class cls = null;
+        Method m;
+        try {         
+            cls = Class.forName("java.lang.reflect.AuxiliaryClass");
+            obj = cls.newInstance();
+        } catch (Throwable e) {
+            e.printStackTrace();
+            fail("Test failed during class creation: Unexpected error: " + e);
+        }       
+        int pp = 0;
+        for (int j = 0; j < sz; j++) {
+            try {
+                m = cls.getMethod("get", (Class[])null);
+                int ans = ((Integer) (m.invoke(obj, (Object[])null))).intValue();
+                fail("Expected InvocationTargetException was not thrown: ans = "
+                	+ ans + " step: " + j + " method name: "
+                    + m.getDeclaringClass().getName() + "." + m.getName());
+            } catch (InvocationTargetException e) {
+                // expected
+            } catch (Throwable e) {
+                e.printStackTrace();
+                fail("Test failed: Unexpected error: " + e);
+            }
+        }
+    }
+
     /**
      *  
      */
@@ -294,9 +324,9 @@
             Method m = X.class.getDeclaredMethod("first",
                     new Class[] { X.class });
             assertEquals("Error1 ",
-                    "public java.lang.reflect.MethodTest$9X " +
-                        "java.lang.reflect.MethodTest$9X.first(" +
-                        "java.lang.reflect.MethodTest$9X)",
+                    "public java.lang.reflect.MethodTest$10X " +
+                        "java.lang.reflect.MethodTest$10X.first(" +
+                        "java.lang.reflect.MethodTest$10X)",
                     m.toString());
         } catch (Exception e) {
             fail("Error2: " + e.toString());



Mime
View raw message