jdk/test/java/awt/xembed/server/TesterClient.java
author yan
Fri, 25 Mar 2016 12:31:16 +0300
changeset 36915 2258afe73d4c
parent 36511 9d0388c6b336
permissions -rw-r--r--
8150535: [TEST_BUG] fix @library for test/java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java 8151033: [TEST_BUG] typo in java/awt/MouseInfo/PointerInfoCrashTest.java: no sun.awt.peer 8151037: [TEST_BUG] javax/swing/Action/8133039/bug8133039.java requires @modules 8152301: [TESTBUG] Compilation errors in client lib test files Reviewed-by: serb, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
     2
 * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     4
 *
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     8
 *
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    13
 * accompanied this code).
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    14
 *
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
    21
 * questions.
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    22
 */
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    23
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    24
import java.lang.reflect.*;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    25
import java.awt.Rectangle;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    26
import java.util.logging.*;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    27
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    28
public class TesterClient {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    29
    private static final Logger log = Logger.getLogger("test.xembed.TesterClient");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    30
    private static Method test;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    31
    private static boolean passed = false;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    32
    public static void main(String[] args) throws Throwable {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    33
        // First parameter is the name of the test, second is the window, the rest are rectangles
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    34
        Class cl = Class.forName("sun.awt.X11.XEmbedServerTester");
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 5506
diff changeset
    35
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    36
        test = cl.getMethod(args[0], new Class[0]);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    37
        long window = Long.parseLong(args[1]);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    38
        Rectangle r[] = new Rectangle[(args.length-2)/4];
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    39
        for (int i = 0; i < r.length; i++) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    40
            r[i] = new Rectangle(Integer.parseInt(args[2+i*4]), Integer.parseInt(args[2+i*4+1]),
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    41
                                 Integer.parseInt(args[2+i*4+2]), Integer.parseInt(args[2+i*4+3]));
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    42
        }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    43
        startClient(r, window);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    44
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    45
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    46
    public static void startClient(Rectangle bounds[], long window) throws Throwable {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    47
        Method m_getTester = Class.forName("sun.awt.X11.XEmbedServerTester").
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    48
            getMethod("getTester", new Class[] {bounds.getClass(), Long.TYPE});
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    49
        final Object tester = m_getTester.invoke(null, new Object[] {bounds, window});
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    50
        try {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    51
            log.info("Starting test " + test.getName());
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    52
            test.invoke(tester, (Object[])null);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    53
            log.info("Test " + test.getName() + " PASSED.");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    54
            passed = true;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    55
        } catch (Exception e) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    56
            log.log(Level.WARNING, "Test " + test.getName() + " FAILED.", e);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    57
        }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    58
        System.exit(passed?0:1);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    59
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    60
}