harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r545554 [8/13] - in /harmony/enhanced/buildtest/branches/2.0/tests/reliability: ./ run/ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/harmony/ src/java/org/apache/harmony/test/ src/java/org/apache/harmony/test/reliab...
Date Fri, 08 Jun 2007 16:35:10 GMT
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/MappedByteBufferForceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/MappedByteBufferForceTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/MappedByteBufferForceTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/MappedByteBufferForceTest.java Fri Jun  8 09:34:52 2007
@@ -0,0 +1,270 @@
+/*
+ * Copyright 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
+ *
+ * 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 Nikolay V. Bannikov
+ * @version $Revision: 1.1 $
+ */
+
+package org.apache.harmony.test.reliability.api.nio.channels.filechannel;
+
+import org.apache.harmony.test.reliability.share.Test;
+import org.apache.harmony.test.reliability.share.Result;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.RandomAccessFile;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.MappedByteBuffer;
+
+/**
+ * Goal: find resource leaks or intermittent failures caused by MappedByteBuffer.force() / FileChannel.force() operations.
+ * The test does: 
+ * 1. Reads parameters, which are: 
+ *        param[0] - number of threads to run in parallel 
+ *        param[1] - directory where input file is located 
+ *        param[2] - input file name 
+ *        param[3] - number of iterations each thread does
+ * 
+ * 2. Starts and, then, joins all started threads
+ * 
+ * 3. Checks that in each thread all checks PASSed.
+ * 
+ * 4. Each thread, being started:
+ * 
+ * a. Reads content from input of RandomAccess file (param[1] + "/" + param[3])
+ *    to a file channel for mapping into memory
+ * 
+ * b. In each of param[4] iterations: 
+ *        - maps region of this channel's file
+ *        - directly into memory
+ *         - writes random memory buffers to tmpfile
+ *        - Forces any changes made to this buffer's content 
+ *        - Forces any updates to this channel's file  
+ */
+
+public class MappedByteBufferForceTest extends Test {
+
+    // Each thread does NUMBER_OF_ITERATIONS mapping operations
+    public int NUMBER_OF_ITERATIONS = 1000;
+
+    // Directory where input file is located
+    public String path_to_file;
+
+    // Input file name
+    public String fileName = "Test.out";
+
+    // Number of threads to run in parallel
+    public int numThreads = 1;
+
+    public int callSystemGC = 1;
+
+    // Each thread sets PASS/FAIL flag into its corresponding array element
+    public int[] statuses;
+
+    public static void main(String[] args) {
+        System.exit(new MappedByteBufferForceTest().test(args));
+    }
+
+    public int test(String[] params) {
+
+        parseParams(params);
+
+        // Start 'numThreads' threads each reading from file
+
+        Thread[] t = new Thread[numThreads];
+
+        statuses = new int[t.length];
+
+        for (int i = 0; i < t.length; i++) {
+            t[i] = new Thread(new MappedByteBufferForceTestThread(i, this));
+            t[i].start();
+            // log.add("Thread " + i + " started");
+        }
+
+        // Correctly wait for all threads to finish
+
+        for (int i = 0; i < t.length; ++i) {
+            try {
+                t[i].join();
+                // log.add("Thread " + i + ": joined() ");
+
+            } catch (InterruptedException ie) {
+                return fail("interruptedException while join() of thread #" + i);
+            }
+        }
+
+        // For each thread check whether operations/checks PASSed in the thread
+
+        for (int i = 0; i < statuses.length; ++i) {
+            if (statuses[i] != Result.PASS) {
+                return fail("thread #" + i + " returned not PASS status");
+            }
+            // log.add("Status of thread " + i + ": is PASS");
+        }
+
+        return pass("OK");
+    }
+
+    public void parseParams(String[] params) {
+
+        if (params.length >= 1 && Integer.parseInt(params[0]) > 0) {
+            numThreads = Integer.parseInt(params[0]);
+        }
+
+        if (params.length >= 2) {
+            path_to_file = params[1];
+        }
+
+        if (params.length >= 3) {
+            fileName = params[2];
+        }
+
+        if (params.length >= 4) {
+            NUMBER_OF_ITERATIONS = Integer.parseInt(params[3]);
+        }
+
+    }
+
+}
+
+class MappedByteBufferForceTestThread implements Runnable {
+
+    public int id;
+
+    public MappedByteBufferForceTest base;
+
+    public MappedByteBufferForceTestThread(int id,
+        MappedByteBufferForceTest base) {
+        this.id = id;
+        this.base = base;
+    }
+
+    FileChannel getFileChannelFromFile(String fileName) {
+        File f = null;
+        FileChannel fc = null;
+        try {
+            f = new File(fileName);
+            fc = new RandomAccessFile(f, "rw").getChannel();
+        } catch (IOException e) {
+            base.statuses[id] = Result.FAIL;
+            base.log.add("Thread " + id
+                + ": IOException on RandomAccessFile creation");
+        }
+        return fc;
+    }
+
+    MappedByteBuffer getMappedByteBuffer(FileChannel fc) {
+
+        File tmpfile = null;
+        try {
+            tmpfile = File.createTempFile("tmpfile", null);
+        } catch (IOException e) {
+            base.statuses[id] = Result.FAIL;
+            base.log.add("Thread " + id + ": IOException on TempFile creation");
+        }
+
+        tmpfile.deleteOnExit();
+
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(tmpfile);
+        } catch (FileNotFoundException e) {
+            base.statuses[id] = Result.FAIL;
+            base.log.add("Thread " + id
+                + ": FileNotFoundException on TempFile creation");
+        }
+        MappedByteBuffer mb = null;
+        int size = 0;
+        try {
+            base.statuses[id] = Result.FAIL;
+            mb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            base.statuses[id] = Result.PASS;
+            size = (int) fc.size();
+        } catch (IOException e) {
+            base.statuses[id] = Result.FAIL;
+            base.log.add("Thread " + id
+                + ": IOException while getting size of channel's file");
+        }
+        byte[] buf = new byte[size];
+
+        int len = 0;
+        //for (int i = 0; i < iteration; ++i) {
+        mb.position(0);
+        while ((len = Math.min(buf.length, mb.remaining())) > 0) {
+            mb.get(buf, 0, len);
+            try {
+                fos.write(buf);
+            } catch (IOException e) {
+                base.statuses[id] = Result.FAIL;
+                base.log.add("Thread " + id
+                    + ": IOException while writing buffer");
+            }
+
+        }
+        try {
+            fos.flush();
+            fos.close();
+        } catch (IOException e) {
+            base.statuses[id] = Result.FAIL;
+            base.log.add("Thread " + id
+                + ": IOException while closing FileOutputStream");
+        }
+
+        //}
+        return mb;
+    }
+
+    public void run() {
+
+        FileChannel.MapMode mode = FileChannel.MapMode.READ_ONLY;
+        FileChannel fc = null;
+        MappedByteBuffer mb = null;
+
+        long s = 0;
+        base.statuses[id] = Result.PASS;
+
+        for (int i = 0; i < base.NUMBER_OF_ITERATIONS; i++) {
+            fc = getFileChannelFromFile(base.path_to_file + File.separator
+                + base.fileName);
+            mb = getMappedByteBuffer(fc);
+            mb.force();
+            try {
+                fc.force(true);
+            } catch (IOException e) {
+                base.statuses[id] = Result.FAIL;
+                base.log.add("Thread " + id
+                    + ": IOException while forcing FileChannel");
+            }
+            try {
+                fc.close();
+            } catch (IOException e) {
+                base.statuses[id] = Result.FAIL;
+                base.log.add("Thread " + id
+                    + ": IOException while closing FileChannel");
+            }
+
+            if (base.callSystemGC != 0) {
+                System.gc();
+            }
+
+        }
+    }
+}
\ No newline at end of file

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/MappedByteBufferForceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/Utils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/Utils.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/Utils.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/Utils.java Fri Jun  8 09:34:52 2007
@@ -0,0 +1,70 @@
+/*
+ * Copyright 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
+ *
+ * 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 Oleg V. Oleinik
+ * @version $Revision: 1.1 $
+ */
+
+package org.apache.harmony.test.reliability.api.nio.channels.filechannel;
+
+import java.util.Random;
+import java.io.File;
+
+
+public class Utils {
+
+    static Random r = new Random(10);
+
+    public static File createWorkFile(String workFileName) throws Exception {
+  
+        File f = new File(workFileName);
+
+        if (f.exists()){
+            f.delete();
+        }
+
+        return f;
+    }
+
+
+
+    public static byte[] createRndBytes(int size) {
+        return createRndBytes(size, null);
+    }
+
+
+    public static byte[] createRndBytes(int size, byte[] exclusion) {
+
+        byte[] b = new byte[size];
+
+        for (int i = 0; i < b.length; ++i){
+
+            byte b_value = (byte) r.nextInt(Byte.MAX_VALUE);
+
+            if (exclusion != null && (b_value >= exclusion[0] && b_value <= exclusion[1])) {
+                continue;
+            }
+
+            b[i] = b_value;
+        }
+
+        return b;
+    }
+
+}
+

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/auxiliary/Test.out
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/auxiliary/Test.out?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/auxiliary/Test.out (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/channels/filechannel/auxiliary/Test.out Fri Jun  8 09:34:52 2007
@@ -0,0 +1,1090 @@
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+public class Test {
+    static void createFrame() {
+	new javax.swing.JFrame();
+        System.out.println("PASSED"); 
+    } 
+    public static void main(String args[]) throws Exception { 
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() { createFrame(); }});
+    } 
+} 
+

Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/CharsetSyncCacheTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/CharsetSyncCacheTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/CharsetSyncCacheTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/CharsetSyncCacheTest.java Fri Jun  8 09:34:52 2007
@@ -0,0 +1,236 @@
+/*
+ * Copyright 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
+ *
+ * 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 Oleg Oleinik
+ * @version $Revision: 1.2 $
+ */
+
+package org.apache.harmony.test.reliability.api.nio.charset;
+
+
+import org.apache.harmony.test.reliability.share.Test;
+import java.io.UnsupportedEncodingException;
+import java.util.SortedMap;
+import java.nio.charset.Charset;
+
+/**
+ * Goal: check that Charset's: forName(), availableCharsets(), encode(), decode()
+ * are thread safe and manage internal Charset cashes without leading to cach overflow.
+ *
+ * The test does:
+ *    1. Reads parameters, which are:
+ *          param[0] - number of threads to run in parallel
+ *          param[1] - number of iterations to run Charset operations in each thread
+ *
+ *    2. Starts and, then, joins all started threads
+ *
+ *    3. Checks that in each thread all checks PASSed.
+ *
+ *    4. Each thread, being started:
+ *
+ *        a. Runs param[1] iterations in a cycle, on each iteration:
+ *        b. Receives all available charsets via Charset.availableCharsets()
+ *        c. For each Charset in returned list:
+ *           1) calls forName(canonical name), checks that returned Charset is as expected, 
+ *              i.e. its name() returns correct Charset's canonical name.
+ *           2) calls forName(alias name) for each Charset's alias, checks that returned 
+ *              Charset is as expected, i.e. its name() returns correct Charset's canonical name.
+ *           3) calls encode/decode for each Charset returned via alias, compares that resulted string
+ *              is as after encoding/decoding by original Charset.
+ *
+ */
+
+public class CharsetSyncCacheTest extends Test {
+
+    public int callSystemGC = 1;
+
+    public int NUMBER_OF_ITERATIONS = 100;
+
+    public int numThreads = 10;
+        
+    public int[] statuses;
+
+    public static void main(String[] args) {
+        System.exit(new CharsetSyncCacheTest().test(args));
+    }
+
+
+    public int test(String[] params) {
+    
+        parseParams(params);
+                                
+        // Start 'numThreads' threads each reading from file, inflating/deflating
+
+        Thread[] t = new Thread[numThreads];
+
+        statuses = new int[t.length];
+                                
+        for (int i = 0; i < t.length; i++) {
+            t[i] = new Thread(new CharsetForNameRunner(i, this));
+            t[i].start();
+            //log.add("Thread " + i + " started");
+        }
+                
+        // Correctly wait for all threads to finish
+
+        for (int i = 0; i < t.length; ++i){
+            try {
+                t[i].join();
+                //log.add("Thread " + i + ": joined() ");
+
+            } catch (InterruptedException ie){
+                return fail("interruptedException while join() of thread #" + i);
+            }
+        }
+
+        // For each thread check whether operations/checks PASSed in the thread
+
+        for (int i = 0; i < statuses.length; ++i){
+            if (statuses[i] != Status.PASS){
+                return fail("thread #" + i + " returned not PASS status");
+            }
+            //log.add("Status of thread " + i + ": is PASS");
+        }
+
+        return pass("OK");
+    }
+
+
+    public void parseParams(String[] params) {
+
+        if (params.length >= 1) {
+            numThreads = Integer.parseInt(params[0]);
+        }        
+
+        if (params.length >= 2) {
+            NUMBER_OF_ITERATIONS = Integer.parseInt(params[1]);
+        }        
+
+    }
+
+}
+
+
+class CharsetForNameRunner implements Runnable {
+
+    public int id;
+    public CharsetSyncCacheTest base;
+
+    public final String STRING_TO_ENCODE = "1aBc0#$%&fghfgh1242345";
+
+    public CharsetForNameRunner(int id, CharsetSyncCacheTest base) {
+        this.id = id;
+        this.base = base;
+    }
+
+    public void run() {
+
+        int k = 0;
+
+        while (k++ < base.NUMBER_OF_ITERATIONS) {
+
+            SortedMap allCharsets = Charset.availableCharsets();
+
+            // base.log.add("Thread " + id + ": iteration " + k + ": received available Charsets");
+
+            Object[] names = allCharsets.keySet().toArray();
+
+            // for each of received Charset load each charset by alias and forName()
+            // look at what we received - must be Charset with the same canonical name:
+
+            for (int i = 0; i < names.length; ++i){
+
+                // FIRST, load Charset by canonical name and forName()
+ 
+                Charset _chset = (Charset) allCharsets.get(names[i]);
+                Thread.yield();
+ 
+                Charset chset = Charset.forName((String) names[i]);
+                if(!chset.canEncode()) {
+                    continue;
+                }  
+                Thread.yield();
+
+                // base.log.add("Thread " + id + ": iteration " + k + ": forName(" + names[i] + ")");
+                // look at what returned - names must be the same - canonical
+
+                if (!chset.name().equals(_chset.name())){
+                    base.statuses[id] = Status.FAIL;
+                    base.log.add("Thread " + id + ", forName(" + names[i] + ") returned Charset \"" +
+                        chset.name() + "\", instead of \"" + _chset.name() + "\"");
+                    return;
+                }
+
+                if (!chset.name().equals((String) names[i])){
+                    base.statuses[id] = Status.FAIL;
+                    base.log.add("Thread " + id + ", forName(" + names[i] + ") returned Charset " +
+                        "with value of name() different from canonical \"" + names[i] + "\"");
+                    return;
+                }
+
+                String str = chset.decode(chset.encode(STRING_TO_ENCODE)).toString();
+
+                Object[] aliases = _chset.aliases().toArray();
+
+                // SECOND, load Charset by each of alias of this Charset and forName()
+
+                for (int j = 0; j < aliases.length; ++j){
+
+                    chset = Charset.forName((String) aliases[j]);
+                    Thread.yield();
+
+                    // base.log.add("Thread " + id + ": iteration " + k + ": forName(" + aliases[j] + "), alias");
+
+                    // look at what returned - names must be the same - canonical
+
+                    if (!chset.name().equals((String) names[i])){
+                        base.statuses[id] = Status.FAIL;
+                        base.log.add("Thread " + id + ", forName(" + aliases[j] + ") by alias returned " + 
+                            "Charset with different value of name()");
+                        return;
+                    }
+
+                    String str2 = chset.decode(chset.encode(STRING_TO_ENCODE)).toString();
+
+                    if (!str.equals(str2)){
+                        base.statuses[id] = Status.FAIL;
+                        base.log.add("Thread " + id + ", forName(" + aliases[j] + ") by alias, encode/decode " + 
+                            "returned \"" + str2 + "\" instead of \"" + str + "\"");
+                        return;
+                    }
+                       
+                } // alias
+                    
+            } // charset
+            
+            if (base.callSystemGC != 0){
+                System.gc();
+            }
+    
+        } // while
+
+        base.statuses[id] = Status.PASS;
+    }
+
+}
+
+
+class Status {
+    public static final int FAIL = -10;
+    public static final int PASS = 10;
+}

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/CharsetSyncCacheTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/ContainsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/ContainsTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/ContainsTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/ContainsTest.java Fri Jun  8 09:34:52 2007
@@ -0,0 +1,106 @@
+/*
+ * Copyright 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
+ *
+ * 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 Olessia Salmina
+ * @version $Revision: 1.1 $
+ */
+
+package org.apache.harmony.test.reliability.api.nio.charset;
+
+import org.apache.harmony.test.reliability.share.Test;
+import java.util.SortedMap;
+import java.nio.charset.Charset;
+
+
+/**
+ * Goal: find memory leaks, connected with use of abstract method java.nio.charset.Charset.contains(Charset cs). 
+ *
+ * The test does:
+ *     1. Reads parameters, which are:
+ *          param[0] - number of iterations. During single iteration each available charset is chekced whether it contains
+ *        all other available charsets. 
+ *
+ *     2. All available charsets are obtained. Each charset is checked by method java.nio.charset.Charset.contains(...) to
+ *        be contained in all other charsets. Each charset must contains itself. 
+ *
+ */
+
+public class ContainsTest extends Test {
+
+
+    public int callSystemGC = 1;
+
+
+    public int NUMBER_OF_ITERATIONS = 100;
+
+    public static void main(String[] args) {
+        System.exit(new ContainsTest().test(args));
+    }
+
+
+    public int test(String[] params) {
+    
+        boolean failed = false;
+
+        parseParams(params);
+                                
+        SortedMap allCharsets = Charset.availableCharsets();
+
+        Object[] names = allCharsets.keySet().toArray();
+
+        for (int i = 0; i < names.length; i++){
+
+            //log.add("Charset " + names[i]);
+   
+            for (int j = 0; j < names.length; j++){
+
+                for (int k = 0; k < NUMBER_OF_ITERATIONS; k++) {
+
+                    Charset chset1 = (Charset) allCharsets.get(names[i]);
+                    Charset chset2 = (Charset) allCharsets.get(names[j]);
+                    boolean contains = chset1.contains(chset2);
+
+                    if (i == j && !contains) {
+                        log.add("Charset(" + chset1.name() + ").contains(Charset(" + chset2.name() + ")) returns false");
+                        failed = true;
+                    }
+
+                    // log.add("Charset " + names[i] + " contains " + names[j] + "? - " + contains);
+                }
+            }
+
+            if (callSystemGC != 0){
+                System.gc();
+            }
+    
+        }
+
+        return failed == true ? fail("failed") : pass("OK");
+    }
+
+
+    public void parseParams(String[] params) {
+
+        if (params.length >= 1) {
+            NUMBER_OF_ITERATIONS = Integer.parseInt(params[0]);
+        }        
+
+    }
+
+}
+

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/ContainsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/DecodingModesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/DecodingModesTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/DecodingModesTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/DecodingModesTest.java Fri Jun  8 09:34:52 2007
@@ -0,0 +1,204 @@
+/*
+ * Copyright 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
+ *
+ * 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 Oleg Oleinik
+ * @version $Revision: 1.1 $
+ */
+
+package org.apache.harmony.test.reliability.api.nio.charset;
+
+import org.apache.harmony.test.reliability.share.Test;
+
+import java.io.UnsupportedEncodingException;
+import java.util.SortedMap;
+import java.util.Random;
+import java.nio.CharBuffer;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
+
+/**
+ * Goal: find memory leaks invoking decodings for each available charset using different 
+ *       combinations of onUnmappable/onMalformed.
+ *
+ * The test does:
+ *    1. Reads parameters, which are:
+ *          param[0] - number of iterations. For each string, each decoding -
+ *                     - number of cycles with all combinations of malformed, unmappable actions flags.
+ *
+ *    2. Creates 2 byte arrays of length 0xFF:
+ *       byte[0][] = array of chars for which isJavaIdentifierPart(ch) returns true converted to bytes via UTF-8
+ *       byte[1][] = randomly generated bytes
+ *
+ *    3. For each of the byte array:
+ *          1) receives all charsets through availableCharsets().
+ *          2) for each charset:
+ *              2.1) starts a cycle of param[0] iterations. On each iteration:
+ *                   a) sets replaceWith(String) string
+ *                   b) choses next combination of onUnmappable/onMalformed
+ *                   c) invokes decode(ByteBuffer, CharBuffer, false)
+ *                   d) repeats b-c until all 9 combinations of onUnmappable/onMalformed are chosen
+ *              2.2) runs System.gc()
+ *
+ */
+
+
+public class DecodingModesTest extends Test {
+
+    public int callSystemGC = 1;
+
+    public int SWITCH_ITERATIONS = 100;
+
+
+    public static void main(String[] args) {
+        System.exit(new DecodingModesTest().test(args));
+    }
+
+
+    public int test(String[] params) {
+
+        parseParams(params);
+
+        byte[][] bytes_to_decode = new byte[2][];
+
+        bytes_to_decode[0] = BytesCreator.getUTFBytes(0xFF, "UTF-8");
+        bytes_to_decode[1] = BytesCreator.getRandomBytes(0xFF);
+
+        CodingErrorAction[] action = {CodingErrorAction.REPLACE, CodingErrorAction.IGNORE, CodingErrorAction.REPORT};
+
+        for (int k = 0; k < bytes_to_decode.length; ++k) {
+
+            SortedMap allCharsets = Charset.availableCharsets();
+
+            Object[] names = allCharsets.keySet().toArray();
+
+            for (int i = 0; i < names.length; ++i){
+
+                Charset chset = (Charset) allCharsets.get(names[i]);
+
+                CharsetDecoder de = chset.newDecoder().reset();
+
+                ByteBuffer bytes;
+                CharBuffer chars;
+
+                // log.add("Charset " + names[i]); 
+
+                for (int j = 0; j < SWITCH_ITERATIONS; ++j) {
+
+                    for (int x = 0; x < action.length; ++x) {
+
+                        for (int y = 0; y < action.length; ++y) {
+
+                            try {
+
+                                bytes = ByteBuffer.wrap(bytes_to_decode[k]);
+                                de = de.replaceWith(getReplacementString());
+                                de.onMalformedInput(action[x]);
+                                de.onUnmappableCharacter(action[y]);
+                                de.decode(bytes, CharBuffer.wrap(new char[bytes_to_decode.length]), false);
+  
+                            } catch (Throwable t) {
+                                // log.add(t);
+                            }
+                        }
+                    }
+
+                }
+
+                if (callSystemGC !=0 ){
+                    System.gc();
+                }
+
+            }
+
+        }
+
+        return pass("OK");
+    }
+
+
+    public void parseParams(String[] params) {
+
+        if (params.length >= 1) {
+            SWITCH_ITERATIONS = Integer.parseInt(params[0]);
+        }        
+
+    }
+
+
+    public String getReplacementString() {
+        return "a";
+    }
+
+
+}
+
+class BytesCreator {
+
+    public static final int START_TO_END = 2;
+
+    public static final int RANDOM = 3;
+
+    public static byte[] getRandomBytes(int size) {
+        
+        // creates a byte array of 'size' size with random bytes
+
+        byte[] b = new byte[size];
+  
+        Random rand = new Random(1);
+
+        int i = 0;
+
+        while (i < b.length) { 
+
+            b[i++] = (byte)rand.nextInt(Byte.MAX_VALUE);
+
+        }
+
+        return b;
+    }
+
+
+    public static byte[] getUTFBytes(int size, String encoding) {
+
+        // creates a byte array of 'size' size with bytes, received
+        // by String.getBytes(encoding), where encoding must be Unicode 
+        // encoding scheme ("UTG-8", "UTG-16*", etc.) 
+
+        String s = StringCreator.getValidString((char)0, (char)size, StringCreator.START_TO_END);
+
+        try {
+
+            return s.getBytes(encoding);
+
+        } catch (UnsupportedEncodingException uee){
+
+            // log.add("UnsupportedEncodingException :" + encoding);
+
+            return new byte[0];
+        }
+
+    }
+
+
+}
+
+
+

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/DecodingModesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/EncDecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/EncDecTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/EncDecTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/EncDecTest.java Fri Jun  8 09:34:52 2007
@@ -0,0 +1,244 @@
+/*
+ * Copyright 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
+ *
+ * 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 Olessia Salmina
+ * @version $Revision: 1.7 $
+ */
+
+package org.apache.harmony.test.reliability.api.nio.charset;
+
+import org.apache.harmony.test.reliability.share.Test;
+import org.apache.harmony.test.reliability.api.nio.charset.auxiliary.*;
+import java.util.SortedMap;
+import java.nio.charset.Charset;
+
+    //import java.util.Random;
+import java.nio.CharBuffer;
+import java.nio.ByteBuffer;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
+
+/**
+ * Goal: find resource leaks or intermittent failures or Encoder/Decoder cache
+ *     problems, connected with use of abstract methods
+ *     java.nio.charset.Charset.newEncoder() and
+ *     java.nio.charset.Charset.newDecoder().
+ * 
+ * The test does: 
+ *     1. Reads parameters, which are: 
+ *        param[0] - number of threads to be run in parallel 
+ *        param[1] - number of iterations with encoding and decoding in each thread. 
+ * 
+ *     2. Receives all charsets through availableCharsets().
+ * 
+ *     3. Creates 3 strings of length 0xFFFF: 
+ *        string[0] = all chars are those for which isJavaIdentifierPart(ch) returns true,
+ *                    from 0 to 0xFFFF. 
+ *        string[1] = all chars in range 0..0xFFFF, including malformed. 
+ *        string[2] = all chars are those for which isJavaIdentifierPart(ch) 
+ *                    returns true, randomly chosen.
+ * 
+ *    4. For each charset and each string:
+ *       - creates CharsetDecoder and CharsetEncoder objects via newEncoder(), newDecoder()
+ *       - specifies CodingErrorAction.IGNORE for both CharsetEncoder and CharsetDecoder
+ *       - encodes and decodes each string param[1] times and compare results after
+ *         first iteration and after the last one, expecting they are the same
+ *       - runs System.gc()
+ */
+
+public class EncDecTest extends Test {
+
+    public static int callSystemGC = 1;
+
+    public static int NUMBER_OF_ITERATIONS = 100;
+    public static int numThreads = 10;
+    public static int[] statuses;
+    public static final SortedMap allCharsets = Charset.availableCharsets();
+
+    public static void main(String[] args) {
+        System.exit(new EncDecTest().test(args));
+    }
+
+    public int test(String[] params) {
+
+        parseParams(params);
+        // Start 'numThreads' threads each encoding/decoding
+        Thread[] t = new Thread[numThreads];
+        statuses = new int[t.length];
+
+        for (int i = 0; i < t.length; i++) {
+            t[i] = new Thread(new Encoder_DecoderRunner(i, this));
+            t[i].start();
+            //log.add("Thread " + i + " started");
+        }
+
+        // Correctly wait for all threads to finish
+        for (int i = 0; i < t.length; i++) {
+            try {
+                t[i].join();
+                //log.add("Thread " + i + ": joined() ");
+
+            } catch (InterruptedException ie) {
+                return fail("InterruptedException while join() of thread #" + i);
+            }
+        }
+
+        // For each thread check whether operations/checks PASSed in the thread
+
+        for (int i = 0; i < statuses.length; ++i) {
+            if (statuses[i] != Status.PASS) {
+                return fail("thread #" + i + " returned not PASS status");
+            }
+            //log.add("Status of thread " + i + ": is PASS");
+        }
+        return pass("OK");
+    }
+
+    public void parseParams(String[] params) {
+
+        if (params.length >= 1) {
+            numThreads = Integer.parseInt(params[0]);
+        }
+        if (params.length >= 2) {
+            NUMBER_OF_ITERATIONS = Integer.parseInt(params[1]);
+        }
+    }
+
+}
+
+class Encoder_DecoderRunner implements Runnable {
+
+    public int id;
+
+    public EncDecTest base;
+
+    public Encoder_DecoderRunner(int id, EncDecTest base) {
+        this.id = id;
+        this.base = base;
+    }
+
+    public void run() {
+
+        Object[] names = base.allCharsets.keySet().toArray();
+        String[] strs_to_encode = new String[3];
+        strs_to_encode[0] = StringCreator.getValidString((char)0,(char)0xFFFF, StringCreator.START_TO_END);
+        strs_to_encode[1] = StringCreator.getInvalidString();
+        strs_to_encode[2] = StringCreator.getValidString((char)0,(char)0xFFFF, StringCreator.RANDOM);
+
+        base.statuses[id] = Status.PASS;
+        
+        for (int i = 0; i < names.length; i++) {
+            Charset chset = (Charset) base.allCharsets.get(names[i]);
+            if(!chset.canEncode()) {
+                continue;
+            }            
+            // base.log.add("Charset " + names[i]);
+            Thread.yield();
+
+            for (int j = 0; j < strs_to_encode.length; j++) {
+                CharsetEncoder ce = chset.newEncoder().reset();
+                CharsetDecoder de = chset.newDecoder().reset();
+                CharBuffer chars_to_encode = CharBuffer.wrap(strs_to_encode[j]
+                    .subSequence(0, strs_to_encode[j].length()));
+
+                ByteBuffer encoded_bytes = null;
+                CharBuffer decoded_chars = null;
+                Thread.yield();
+                try {
+                    //base.log.add("String was:"+chars_to_encode.toString());
+                    ce.onMalformedInput(CodingErrorAction.IGNORE);
+                    ce.onUnmappableCharacter(CodingErrorAction.IGNORE);
+
+                    de.onMalformedInput(CodingErrorAction.IGNORE);
+                    de.onUnmappableCharacter(CodingErrorAction.IGNORE);
+
+                    encoded_bytes = ce.encode(chars_to_encode);
+                    decoded_chars = de.decode(encoded_bytes);
+
+                } catch (Throwable t) {
+                    // base.log.add(t);
+                }
+                // base.log.add("After encoding-decoding, 0 iteration: " +
+                // decoded_chars.toString());
+                String s = "";
+                if (decoded_chars == null) {
+                    continue;
+                } else {
+                    s = decoded_chars.toString();
+                }
+
+                // base.log.add("Thread " + id + ", Charset: " + names[i] +
+                //              ", string length initial = " + s.length());
+                Thread.yield();
+
+                for (int k = 0; k < base.NUMBER_OF_ITERATIONS; ++k) {
+                    try {
+                        ce.reset();
+                        de.reset();
+                        ce.onMalformedInput(CodingErrorAction.IGNORE);
+                        ce.onUnmappableCharacter(CodingErrorAction.IGNORE);
+                        de.onMalformedInput(CodingErrorAction.IGNORE);
+                        de.onUnmappableCharacter(CodingErrorAction.IGNORE);
+                        encoded_bytes = ce.encode(decoded_chars);
+                        decoded_chars = de.decode(encoded_bytes);
+
+                        // base.log.add("After encoding-decoding, "+ k +"
+                        // iteration: "+ decoded_chars.toString());
+                        Thread.yield();
+                    } catch (Throwable t) {
+                        // base.log.add(t);
+                    }
+                    if (base.callSystemGC != 0) {
+                        System.gc();
+                    }
+                }
+
+                // base.log.add("Thread " + id + ", Charset: " + names[i] +
+                // ", string length last = " +
+                // decoded_chars.toString().length());
+                // for these Charsets it is known at the moment of test creation
+                // that they return different results after the first and
+                // further encoding/decodings
+
+                if (   !(names[i].equals("ISO-2022-JP")
+                    || names[i].equals("x-ISCII91")
+                    || names[i].equals("x-IBM1383")
+                    || names[i].equals("x-IBM948") 
+                    || names[i].equals("x-IBM950")
+                    || names[i].equals("x-ISO-2022-CN-CNS")                      
+                    || ((String) names[i]).startsWith("x-iscii-"))) {
+                    if (!s.equals(decoded_chars.toString())) {
+                        base.statuses[id] = Status.FAIL;
+                        base.log.add("Thread " + id
+                            + ", Charset: " + names[i]
+                            + " chars after first "
+                            + " encoding/decoding are not equal to chars after "
+                            + base.NUMBER_OF_ITERATIONS + " encoding/decoding");
+                        /*next statement closed to find all bad charsets 
+                         return;
+                         */ 
+                    }
+                }
+            } // for strings            
+        } // for Charset names        
+    }
+}
+
+
+

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/nio/charset/EncDecTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message