harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r520813 - /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/UIDefaultsTest.java
Date Wed, 21 Mar 2007 09:08:48 GMT
Author: apetrenko
Date: Wed Mar 21 02:08:47 2007
New Revision: 520813

URL: http://svn.apache.org/viewvc?view=rev&rev=520813
Log:
Patch for HARMONY-3445 "[classlib][swing] UIDefaultsTest restructurized"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/UIDefaultsTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/UIDefaultsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/UIDefaultsTest.java?view=diff&rev=520813&r1=520812&r2=520813
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/UIDefaultsTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/UIDefaultsTest.java
Wed Mar 21 02:08:47 2007
@@ -180,47 +180,6 @@
     public void testProxyLazyValueWithThreadClassLoader() throws Exception {
         // Regression test for HARMONY-3420
 
-        class ArrayClassLoader extends ClassLoader {
-            byte[] bytesMyLabelUI= new byte[] {
-                    /*
-                     * public class MyLabelUI extends LabelUI {
-                     *     public static ComponentUI createUI(JComponent c) {
-                     *         return new MyLabelUI();
-                     *     }
-                     * }
-                     */
-                    -54, -2, -70, -66, 0, 0, 0, 49, 0, 16, 10, 0, 4, 0, 13, 7,
-                    0, 14, 10, 0, 2, 0, 13, 7, 0, 15, 1, 0, 6, 60, 105, 110,
-                    105, 116, 62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100,
-                    101, 1, 0, 15, 76, 105, 110, 101, 78, 117, 109, 98, 101,
-                    114, 84, 97, 98, 108, 101, 1, 0, 8, 99, 114, 101, 97, 116,
-                    101, 85, 73, 1, 0, 56, 40, 76, 106, 97, 118, 97, 120, 47,
-                    115, 119, 105, 110, 103, 47, 74, 67, 111, 109, 112, 111,
-                    110, 101, 110, 116, 59, 41, 76, 106, 97, 118, 97, 120, 47,
-                    115, 119, 105, 110, 103, 47, 112, 108, 97, 102, 47, 67,
-                    111, 109, 112, 111, 110, 101, 110, 116, 85, 73, 59, 1, 0,
-                    10, 83, 111, 117, 114, 99, 101, 70, 105, 108, 101, 1, 0,
-                    14, 77, 121, 76, 97, 98, 101, 108, 85, 73, 46, 106, 97,
-                    118, 97, 12, 0, 5, 0, 6, 1, 0, 9, 77, 121, 76, 97, 98, 101,
-                    108, 85, 73, 1, 0, 24, 106, 97, 118, 97, 120, 47, 115, 119,
-                    105, 110, 103, 47, 112, 108, 97, 102, 47, 76, 97, 98, 101,
-                    108, 85, 73, 0, 33, 0, 2, 0, 4, 0, 0, 0, 0, 0, 2, 0, 1, 0,
-                    5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 29, 0, 1, 0, 1, 0, 0, 0, 5,
-                    42, -73, 0, 1, -79, 0, 0, 0, 1, 0, 8, 0, 0, 0, 6, 0, 1, 0,
-                    0, 0, 5, 0, 9, 0, 9, 0, 10, 0, 1, 0, 7, 0, 0, 0, 32, 0, 2,
-                    0, 1, 0, 0, 0, 8, -69, 0, 2, 89, -73, 0, 3, -80, 0, 0, 0,
-                    1, 0, 8, 0, 0, 0, 6, 0, 1, 0, 0, 0, 7, 0, 1, 0, 11, 0, 0,
-                    0, 2, 0, 12
-            };
-
-            protected Class findClass(String name) throws ClassNotFoundException {
-                if ("MyLabelUI".equals(name)) {
-                    return defineClass(name, bytesMyLabelUI, 0, bytesMyLabelUI.length);
-                }
-                throw new ClassNotFoundException(name);
-            }
-        };
-
         final ClassLoader classLoader = new ArrayClassLoader();
 
         class ThreadGetUIClass extends Thread {
@@ -271,79 +230,6 @@
     public void testGetUIWithClassLoader() throws Exception {
         // Regression test for HARMONY-3385
 
-        class ArrayClassLoader extends ClassLoader {
-
-            private Hashtable<String, byte[]> table =
-                    new Hashtable<String, byte[]>();
-
-            ArrayClassLoader() {
-                table.put("MyJLabel", new byte[] {
-                    /*
-                     * public class MyJLabel extends JLabel {
-                     *     public String getUIClassID() {
-                     *         return "LabelUI";
-                     *     }
-                     * }
-                     */
-                    -54, -2, -70, -66, 0, 0, 0, 49, 0, 17, 10, 0, 4, 0, 13, 8,
-                    0, 14, 7, 0, 15, 7, 0, 16, 1, 0, 6, 60, 105, 110, 105, 116,
-                    62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100, 101, 1, 0,
-                    15, 76, 105, 110, 101, 78, 117, 109, 98, 101, 114, 84, 97,
-                    98, 108, 101, 1, 0, 12, 103, 101, 116, 85, 73, 67, 108, 97,
-                    115, 115, 73, 68, 1, 0, 20, 40, 41, 76, 106, 97, 118, 97,
-                    47, 108, 97, 110, 103, 47, 83, 116, 114, 105, 110, 103, 59,
-                    1, 0, 10, 83, 111, 117, 114, 99, 101, 70, 105, 108, 101, 1,
-                    0, 13, 77, 121, 74, 76, 97, 98, 101, 108, 46, 106, 97, 118,
-                    97, 12, 0, 5, 0, 6, 1, 0, 7, 76, 97, 98, 101, 108, 85, 73,
-                    1, 0, 8, 77, 121, 74, 76, 97, 98, 101, 108, 1, 0, 18, 106,
-                    97, 118, 97, 120, 47, 115, 119, 105, 110, 103, 47, 74, 76,
-                    97, 98, 101, 108, 0, 33, 0, 3, 0, 4, 0, 0, 0, 0, 0, 2, 0,
-                    1, 0, 5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 29, 0, 1, 0, 1, 0, 0,
-                    0, 5, 42, -73, 0, 1, -79, 0, 0, 0, 1, 0, 8, 0, 0, 0, 6, 0,
-                    1, 0, 0, 0, 3, 0, 1, 0, 9, 0, 10, 0, 1, 0, 7, 0, 0, 0, 27,
-                    0, 1, 0, 1, 0, 0, 0, 3, 18, 2, -80, 0, 0, 0, 1, 0, 8, 0, 0,
-                    0, 6, 0, 1, 0, 0, 0, 5, 0, 1, 0, 11, 0, 0, 0, 2, 0, 12 });
-                table.put("MyLabelUI", new byte[] {
-                    /*
-                     * public class MyLabelUI extends LabelUI {
-                     *     public static ComponentUI createUI(JComponent c) {
-                     *         return new MyLabelUI();
-                     *     }
-                     * }
-                     */
-                    -54, -2, -70, -66, 0, 0, 0, 49, 0, 16, 10, 0, 4, 0, 13, 7,
-                    0, 14, 10, 0, 2, 0, 13, 7, 0, 15, 1, 0, 6, 60, 105, 110,
-                    105, 116, 62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100,
-                    101, 1, 0, 15, 76, 105, 110, 101, 78, 117, 109, 98, 101,
-                    114, 84, 97, 98, 108, 101, 1, 0, 8, 99, 114, 101, 97, 116,
-                    101, 85, 73, 1, 0, 56, 40, 76, 106, 97, 118, 97, 120, 47,
-                    115, 119, 105, 110, 103, 47, 74, 67, 111, 109, 112, 111,
-                    110, 101, 110, 116, 59, 41, 76, 106, 97, 118, 97, 120, 47,
-                    115, 119, 105, 110, 103, 47, 112, 108, 97, 102, 47, 67,
-                    111, 109, 112, 111, 110, 101, 110, 116, 85, 73, 59, 1, 0,
-                    10, 83, 111, 117, 114, 99, 101, 70, 105, 108, 101, 1, 0,
-                    14, 77, 121, 76, 97, 98, 101, 108, 85, 73, 46, 106, 97,
-                    118, 97, 12, 0, 5, 0, 6, 1, 0, 9, 77, 121, 76, 97, 98, 101,
-                    108, 85, 73, 1, 0, 24, 106, 97, 118, 97, 120, 47, 115, 119,
-                    105, 110, 103, 47, 112, 108, 97, 102, 47, 76, 97, 98, 101,
-                    108, 85, 73, 0, 33, 0, 2, 0, 4, 0, 0, 0, 0, 0, 2, 0, 1, 0,
-                    5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 29, 0, 1, 0, 1, 0, 0, 0, 5,
-                    42, -73, 0, 1, -79, 0, 0, 0, 1, 0, 8, 0, 0, 0, 6, 0, 1, 0,
-                    0, 0, 5, 0, 9, 0, 9, 0, 10, 0, 1, 0, 7, 0, 0, 0, 32, 0, 2,
-                    0, 1, 0, 0, 0, 8, -69, 0, 2, 89, -73, 0, 3, -80, 0, 0, 0,
-                    1, 0, 8, 0, 0, 0, 6, 0, 1, 0, 0, 0, 7, 0, 1, 0, 11, 0, 0,
-                    0, 2, 0, 12 });
-            }
-
-            protected Class findClass(String name) throws ClassNotFoundException {
-                byte[] bytes = table.get(name);
-
-                if (bytes == null) {
-                    throw new ClassNotFoundException(name);
-                }
-                return defineClass(name, bytes, 0, bytes.length);
-            }
-        }
         uiDefaults.put("LabelUI", "MyLabelUI");
         Class<? extends JComponent> cls = (Class<? extends JComponent>)
                 new ArrayClassLoader().loadClass("MyJLabel");
@@ -378,47 +264,6 @@
     public void testGetUIClassWithThreadClassLoader() throws Exception {
         // Regression test for HARMONY-3398
 
-        class ArrayClassLoader extends ClassLoader {
-            byte[] bytesMyLabelUI= new byte[] {
-                    /*
-                     * public class MyLabelUI extends LabelUI {
-                     *     public static ComponentUI createUI(JComponent c) {
-                     *         return new MyLabelUI();
-                     *     }
-                     * }
-                     */
-                    -54, -2, -70, -66, 0, 0, 0, 49, 0, 16, 10, 0, 4, 0, 13, 7,
-                    0, 14, 10, 0, 2, 0, 13, 7, 0, 15, 1, 0, 6, 60, 105, 110,
-                    105, 116, 62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100,
-                    101, 1, 0, 15, 76, 105, 110, 101, 78, 117, 109, 98, 101,
-                    114, 84, 97, 98, 108, 101, 1, 0, 8, 99, 114, 101, 97, 116,
-                    101, 85, 73, 1, 0, 56, 40, 76, 106, 97, 118, 97, 120, 47,
-                    115, 119, 105, 110, 103, 47, 74, 67, 111, 109, 112, 111,
-                    110, 101, 110, 116, 59, 41, 76, 106, 97, 118, 97, 120, 47,
-                    115, 119, 105, 110, 103, 47, 112, 108, 97, 102, 47, 67,
-                    111, 109, 112, 111, 110, 101, 110, 116, 85, 73, 59, 1, 0,
-                    10, 83, 111, 117, 114, 99, 101, 70, 105, 108, 101, 1, 0,
-                    14, 77, 121, 76, 97, 98, 101, 108, 85, 73, 46, 106, 97,
-                    118, 97, 12, 0, 5, 0, 6, 1, 0, 9, 77, 121, 76, 97, 98, 101,
-                    108, 85, 73, 1, 0, 24, 106, 97, 118, 97, 120, 47, 115, 119,
-                    105, 110, 103, 47, 112, 108, 97, 102, 47, 76, 97, 98, 101,
-                    108, 85, 73, 0, 33, 0, 2, 0, 4, 0, 0, 0, 0, 0, 2, 0, 1, 0,
-                    5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 29, 0, 1, 0, 1, 0, 0, 0, 5,
-                    42, -73, 0, 1, -79, 0, 0, 0, 1, 0, 8, 0, 0, 0, 6, 0, 1, 0,
-                    0, 0, 5, 0, 9, 0, 9, 0, 10, 0, 1, 0, 7, 0, 0, 0, 32, 0, 2,
-                    0, 1, 0, 0, 0, 8, -69, 0, 2, 89, -73, 0, 3, -80, 0, 0, 0,
-                    1, 0, 8, 0, 0, 0, 6, 0, 1, 0, 0, 0, 7, 0, 1, 0, 11, 0, 0,
-                    0, 2, 0, 12
-            };
-
-            protected Class findClass(String name) throws ClassNotFoundException {
-                if ("MyLabelUI".equals(name)) {
-                    return defineClass(name, bytesMyLabelUI, 0, bytesMyLabelUI.length);
-                }
-                throw new ClassNotFoundException(name);
-            }
-        };
-
         final ClassLoader classLoader = new ArrayClassLoader();
 
         class ThreadGetUIClass extends Thread {
@@ -624,4 +469,82 @@
             e.printStackTrace();
         }
     }
-}
\ No newline at end of file
+
+    /**
+     * Special classloader for classloader-based tests.
+     */
+    private static class ArrayClassLoader extends ClassLoader {
+
+        private static Hashtable<String, byte[]> table =
+                new Hashtable<String, byte[]>();
+
+        static {
+            table.put("MyJLabel", new byte[] {
+                /*
+                 * public class MyJLabel extends JLabel {
+                 *     public String getUIClassID() {
+                 *         return "LabelUI";
+                 *     }
+                 * }
+                 */
+                -54, -2, -70, -66, 0, 0, 0, 49, 0, 17, 10, 0, 4, 0, 13, 8,
+                0, 14, 7, 0, 15, 7, 0, 16, 1, 0, 6, 60, 105, 110, 105, 116,
+                62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100, 101, 1, 0,
+                15, 76, 105, 110, 101, 78, 117, 109, 98, 101, 114, 84, 97,
+                98, 108, 101, 1, 0, 12, 103, 101, 116, 85, 73, 67, 108, 97,
+                115, 115, 73, 68, 1, 0, 20, 40, 41, 76, 106, 97, 118, 97,
+                47, 108, 97, 110, 103, 47, 83, 116, 114, 105, 110, 103, 59,
+                1, 0, 10, 83, 111, 117, 114, 99, 101, 70, 105, 108, 101, 1,
+                0, 13, 77, 121, 74, 76, 97, 98, 101, 108, 46, 106, 97, 118,
+                97, 12, 0, 5, 0, 6, 1, 0, 7, 76, 97, 98, 101, 108, 85, 73,
+                1, 0, 8, 77, 121, 74, 76, 97, 98, 101, 108, 1, 0, 18, 106,
+                97, 118, 97, 120, 47, 115, 119, 105, 110, 103, 47, 74, 76,
+                97, 98, 101, 108, 0, 33, 0, 3, 0, 4, 0, 0, 0, 0, 0, 2, 0,
+                1, 0, 5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 29, 0, 1, 0, 1, 0, 0,
+                0, 5, 42, -73, 0, 1, -79, 0, 0, 0, 1, 0, 8, 0, 0, 0, 6, 0,
+                1, 0, 0, 0, 3, 0, 1, 0, 9, 0, 10, 0, 1, 0, 7, 0, 0, 0, 27,
+                0, 1, 0, 1, 0, 0, 0, 3, 18, 2, -80, 0, 0, 0, 1, 0, 8, 0, 0,
+                0, 6, 0, 1, 0, 0, 0, 5, 0, 1, 0, 11, 0, 0, 0, 2, 0, 12 });
+
+            table.put("MyLabelUI", new byte[] {
+                /*
+                 * public class MyLabelUI extends LabelUI {
+                 *     public static ComponentUI createUI(JComponent c) {
+                 *         return new MyLabelUI();
+                 *     }
+                 * }
+                 */
+                -54, -2, -70, -66, 0, 0, 0, 49, 0, 16, 10, 0, 4, 0, 13, 7,
+                0, 14, 10, 0, 2, 0, 13, 7, 0, 15, 1, 0, 6, 60, 105, 110,
+                105, 116, 62, 1, 0, 3, 40, 41, 86, 1, 0, 4, 67, 111, 100,
+                101, 1, 0, 15, 76, 105, 110, 101, 78, 117, 109, 98, 101,
+                114, 84, 97, 98, 108, 101, 1, 0, 8, 99, 114, 101, 97, 116,
+                101, 85, 73, 1, 0, 56, 40, 76, 106, 97, 118, 97, 120, 47,
+                115, 119, 105, 110, 103, 47, 74, 67, 111, 109, 112, 111,
+                110, 101, 110, 116, 59, 41, 76, 106, 97, 118, 97, 120, 47,
+                115, 119, 105, 110, 103, 47, 112, 108, 97, 102, 47, 67,
+                111, 109, 112, 111, 110, 101, 110, 116, 85, 73, 59, 1, 0,
+                10, 83, 111, 117, 114, 99, 101, 70, 105, 108, 101, 1, 0,
+                14, 77, 121, 76, 97, 98, 101, 108, 85, 73, 46, 106, 97,
+                118, 97, 12, 0, 5, 0, 6, 1, 0, 9, 77, 121, 76, 97, 98, 101,
+                108, 85, 73, 1, 0, 24, 106, 97, 118, 97, 120, 47, 115, 119,
+                105, 110, 103, 47, 112, 108, 97, 102, 47, 76, 97, 98, 101,
+                108, 85, 73, 0, 33, 0, 2, 0, 4, 0, 0, 0, 0, 0, 2, 0, 1, 0,
+                5, 0, 6, 0, 1, 0, 7, 0, 0, 0, 29, 0, 1, 0, 1, 0, 0, 0, 5,
+                42, -73, 0, 1, -79, 0, 0, 0, 1, 0, 8, 0, 0, 0, 6, 0, 1, 0,
+                0, 0, 5, 0, 9, 0, 9, 0, 10, 0, 1, 0, 7, 0, 0, 0, 32, 0, 2,
+                0, 1, 0, 0, 0, 8, -69, 0, 2, 89, -73, 0, 3, -80, 0, 0, 0,
+                1, 0, 8, 0, 0, 0, 6, 0, 1, 0, 0, 0, 7, 0, 1, 0, 11, 0, 0,
+                0, 2, 0, 12 });
+            }
+
+        protected Class findClass(String name) throws ClassNotFoundException {
+            byte[] bytes = table.get(name);
+
+            if (bytes == null) {
+                throw new ClassNotFoundException(name);
+            }
+            return defineClass(name, bytes, 0, bytes.length);
+        }
+    }
+}



Mime
View raw message