summaryrefslogtreecommitdiff
path: root/bridges/test/com/sun/star
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/test/com/sun/star')
-rw-r--r--bridges/test/com/sun/star/lib/TestBed.java232
-rw-r--r--bridges/test/com/sun/star/lib/makefile.mk36
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java394
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java163
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java124
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java103
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug114133_Test.java76
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java84
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java99
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java105
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.idl37
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java104
-rwxr-xr-xbridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java473
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.idl52
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java260
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java108
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk51
17 files changed, 2501 insertions, 0 deletions
diff --git a/bridges/test/com/sun/star/lib/TestBed.java b/bridges/test/com/sun/star/lib/TestBed.java
new file mode 100644
index 000000000000..2e96a724ebc3
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/TestBed.java
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib;
+
+import com.sun.star.bridge.XBridge;
+import com.sun.star.bridge.XBridgeFactory;
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.comp.helper.Bootstrap;
+import com.sun.star.connection.Acceptor;
+import com.sun.star.connection.Connector;
+import com.sun.star.connection.XAcceptor;
+import com.sun.star.connection.XConnection;
+import com.sun.star.connection.XConnector;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+
+public final class TestBed {
+ public boolean execute(XInstanceProvider provider, boolean waitForServer,
+ Class client, long wait) throws Exception {
+ // assert client.isAssignableFrom(client) && wait >= 0;
+ synchronized (lock) {
+ server = new Server(provider);
+ server.start();
+ server.waitAccepting();
+ }
+ Process p = Runtime.getRuntime().exec(new String[] {
+ "java", "-classpath", System.getProperty("java.class.path"),
+/*
+ "-Xdebug",
+ "-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n",
+*/
+ client.getName() });
+ pipe(p.getInputStream(), System.out, "CO> ");
+ pipe(p.getErrorStream(), System.err, "CE> ");
+ boolean clientDone = false;
+ if (wait <= 0) {
+ clientDone = p.waitFor() == CLIENT_DONE;
+ } else {
+ try {
+ Thread.sleep(wait);
+ } catch (InterruptedException e) {
+ p.destroy();
+ throw e;
+ }
+ try {
+ clientDone = p.exitValue() == CLIENT_DONE;
+ } catch (IllegalThreadStateException e) {
+ p.destroy();
+ }
+ }
+ boolean success = clientDone;
+ if (waitForServer) {
+ success &= server.waitDone();
+ }
+ return success;
+ }
+
+ public void serverDone(boolean success) {
+ synchronized (lock) {
+ server.done(success);
+ }
+ }
+
+ private void pipe(final InputStream in, final PrintStream out,
+ final String prefix) {
+ new Thread("Pipe: " + prefix) {
+ public void run() {
+ BufferedReader r
+ = new BufferedReader(new InputStreamReader(in));
+ try {
+ for (;;) {
+ String s = r.readLine();
+ if (s == null) {
+ break;
+ }
+ out.println(prefix + s);
+ }
+ } catch (java.io.IOException e) {
+ e.printStackTrace(System.err);
+ }
+ }
+ }.start();
+ }
+
+ public static abstract class Client {
+ protected abstract boolean run(XComponentContext context)
+ throws Throwable;
+
+ protected final String getConnectionDescription() {
+ return connectionDescription;
+ }
+
+ protected final String getProtocolDescription() {
+ return protocolDescription;
+ }
+
+ protected final XBridge getBridge(XComponentContext context)
+ throws com.sun.star.uno.Exception
+ {
+ XConnector connector = Connector.create(context);
+ XBridgeFactory factory = UnoRuntime.queryInterface(
+ XBridgeFactory.class,
+ context.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", context));
+ System.out.println("Client: Connecting...");
+ XConnection connection = connector.connect(connectionDescription);
+ System.out.println("Client: ...connected...");
+ XBridge bridge = factory.createBridge(
+ "", protocolDescription, connection, null);
+ System.out.println("Client: ...bridged.");
+ return bridge;
+ }
+
+ protected final void execute() {
+ int status = CLIENT_FAILED;
+ try {
+ if (run(Bootstrap.createInitialComponentContext(null))) {
+ status = CLIENT_DONE;
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ }
+ System.exit(status);
+ }
+ }
+
+ private static final class Server extends Thread {
+ public Server(XInstanceProvider provider) {
+ super("Server");
+ // assert provider != null;
+ this.provider = provider;
+ }
+
+ public void run() {
+ try {
+ XComponentContext context
+ = Bootstrap.createInitialComponentContext(null);
+ XAcceptor acceptor = Acceptor.create(context);
+ XBridgeFactory factory
+ = UnoRuntime.queryInterface(
+ XBridgeFactory.class,
+ context.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", context));
+ System.out.println("Server: Accepting...");
+ synchronized (this) {
+ state = ACCEPTING;
+ notifyAll();
+ }
+ for (;;) {
+ XConnection connection = acceptor.accept(
+ connectionDescription);
+ System.out.println("Server: ...connected...");
+ XBridge bridge = factory.createBridge(
+ "", protocolDescription, connection, provider);
+ System.out.println("Server: ...bridged.");
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ }
+ }
+
+ public synchronized void waitAccepting() throws InterruptedException {
+ while (state < ACCEPTING) {
+ wait();
+ }
+ }
+
+ public synchronized boolean waitDone() throws InterruptedException {
+ while (state <= ACCEPTING) {
+ wait();
+ }
+ return state == SUCCEEDED;
+ }
+
+ public synchronized void done(boolean success) {
+ state = success ? SUCCEEDED : FAILED;
+ notifyAll();
+ }
+
+ private static final int INITIAL = 0;
+ private static final int ACCEPTING = 1;
+ private static final int FAILED = 2;
+ private static final int SUCCEEDED = 3;
+
+ private final XInstanceProvider provider;
+
+ private int state = INITIAL;
+ }
+
+ private static final int TEST_SUCCEEDED = 0;
+ private static final int TEST_FAILED = 1;
+ private static final int TEST_ERROR = 2;
+
+ private static final int CLIENT_FAILED = 0;
+ private static final int CLIENT_DONE = 123;
+
+ private static final String connectionDescription
+ = "socket,host=localhost,port=12345";
+ private static final String protocolDescription = "urp";
+
+ private final Object lock = new Object();
+ private Server server = null;
+}
diff --git a/bridges/test/com/sun/star/lib/makefile.mk b/bridges/test/com/sun/star/lib/makefile.mk
new file mode 100644
index 000000000000..3af025ba8667
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/makefile.mk
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..$/..$/..$/..
+PRJNAME := bridges
+TARGET := test_com_sun_star_lib
+
+PACKAGE := com$/sun$/star$/lib
+JAVAFILES := TestBed.java
+JARFILES := juh.jar jurt.jar ridl.jar
+
+.INCLUDE: javaunittest.mk
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java
new file mode 100644
index 000000000000..badc38df256e
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java
@@ -0,0 +1,394 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+/**
+ * Test case for bug #107753#.
+ *
+ * <p>Bug #107753# "Java UNO: Proxies should implement intuitive semantics of
+ * equals and hashCode" requests that two proxies are equal iff they represent
+ * the same UNO object. This implies that if two proxies repsent the same UNO
+ * object, they must have the same hash code.</p>
+ */
+public final class Bug107753_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
+ }
+
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ TestBed t = new TestBed();
+ assure("test", t.execute(new Provider(t), false, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ boolean success = true;
+ XTransport transport = UnoRuntime.queryInterface(
+ XTransport.class, getBridge(context).getInstance("Transport"));
+
+ Object obj1a = new XType1() {};
+ XType1 obj1b = UnoRuntime.queryInterface(XType1.class, obj1a);
+ success &= test("obj1a == obj1b", obj1a == obj1b);
+
+ Object obj2a = new XType2() {};
+ XType2 obj2b = UnoRuntime.queryInterface(XType2.class, obj2a);
+ success &= test("obj2a == obj2b", obj2a == obj2b);
+
+ Object obj3a = transport.getType1();
+ XType1 obj3b = UnoRuntime.queryInterface(XType1.class, obj3a);
+ success &= test(
+ "obj3a != obj3b; only meaningful as long as different proxy"
+ + " instances are used for different UNO interfaces of one UNO"
+ + " object",
+ obj3a != obj3b);
+
+ Object obj4a = transport.getType2();
+ XType2 obj4b = UnoRuntime.queryInterface(XType2.class, obj4a);
+ success &= test(
+ "obj4a != obj4b; only meaningful as long as different proxy"
+ + " instances are used for different UNO interfaces of one UNO"
+ + " object",
+ obj4a != obj4b);
+
+ success &= test("UnoRuntime.areSame(null, null)",
+ UnoRuntime.areSame(null, null));
+ success &= test("!UnoRuntime.areSame(null, obj1a)",
+ !UnoRuntime.areSame(null, obj1a));
+ success &= test("!UnoRuntime.areSame(null, obj1b)",
+ !UnoRuntime.areSame(null, obj1b));
+ success &= test("!UnoRuntime.areSame(null, obj2a)",
+ !UnoRuntime.areSame(null, obj2a));
+ success &= test("!UnoRuntime.areSame(null, obj2b)",
+ !UnoRuntime.areSame(null, obj2b));
+ success &= test("!UnoRuntime.areSame(null, obj3a)",
+ !UnoRuntime.areSame(null, obj3a));
+ success &= test("!UnoRuntime.areSame(null, obj3b)",
+ !UnoRuntime.areSame(null, obj3b));
+ success &= test("!UnoRuntime.areSame(null, obj4a)",
+ !UnoRuntime.areSame(null, obj4a));
+ success &= test("!UnoRuntime.areSame(null, obj4b)",
+ !UnoRuntime.areSame(null, obj4b));
+
+ success &= test("!obj1a.equals(null)", !obj1a.equals(null));
+ success &= test("!UnoRuntime.areSame(obj1a, null)",
+ !UnoRuntime.areSame(obj1a, null));
+ success &= test("obj1a.equals(obj1a)", obj1a.equals(obj1a));
+ success &= test("UnoRuntime.areSame(obj1a, obj1a)",
+ UnoRuntime.areSame(obj1a, obj1a));
+ success &= test("obj1a.equals(obj1b)", obj1a.equals(obj1b));
+ success &= test("UnoRuntime.areSame(obj1a, obj1b)",
+ UnoRuntime.areSame(obj1a, obj1b));
+ success &= test("!obj1a.equals(obj2a)", !obj1a.equals(obj2a));
+ success &= test("!UnoRuntime.areSame(obj1a, obj2a)",
+ !UnoRuntime.areSame(obj1a, obj2a));
+ success &= test("!obj1a.equals(obj2b)", !obj1a.equals(obj2b));
+ success &= test("!UnoRuntime.areSame(obj1a, obj2b)",
+ !UnoRuntime.areSame(obj1a, obj2b));
+ success &= test("!obj1a.equals(obj3a)", !obj1a.equals(obj3a));
+ success &= test("!UnoRuntime.areSame(obj1a, obj3a)",
+ !UnoRuntime.areSame(obj1a, obj3a));
+ success &= test("!obj1a.equals(obj3b)", !obj1a.equals(obj3b));
+ success &= test("!UnoRuntime.areSame(obj1a, obj3b)",
+ !UnoRuntime.areSame(obj1a, obj3b));
+ success &= test("!obj1a.equals(obj4a)", !obj1a.equals(obj4a));
+ success &= test("!UnoRuntime.areSame(obj1a, obj4a)",
+ !UnoRuntime.areSame(obj1a, obj4a));
+ success &= test("!obj1a.equals(obj4b)", !obj1a.equals(obj4b));
+ success &= test("!UnoRuntime.areSame(obj1a, obj4b)",
+ !UnoRuntime.areSame(obj1a, obj4b));
+
+ success &= test("!obj1b.equals(null)", !obj1b.equals(null));
+ success &= test("!UnoRuntime.areSame(obj1b, null)",
+ !UnoRuntime.areSame(obj1b, null));
+ success &= test("obj1b.equals(obj1a)", obj1b.equals(obj1a));
+ success &= test("UnoRuntime.areSame(obj1b, obj1a)",
+ UnoRuntime.areSame(obj1b, obj1a));
+ success &= test("obj1b.equals(obj1b)", obj1b.equals(obj1b));
+ success &= test("UnoRuntime.areSame(obj1b, obj1b)",
+ UnoRuntime.areSame(obj1b, obj1b));
+ success &= test("!obj1b.equals(obj2a)", !obj1b.equals(obj2a));
+ success &= test("!UnoRuntime.areSame(obj1b, obj2a)",
+ !UnoRuntime.areSame(obj1b, obj2a));
+ success &= test("!obj1b.equals(obj2b)", !obj1b.equals(obj2b));
+ success &= test("!UnoRuntime.areSame(obj1b, obj2b)",
+ !UnoRuntime.areSame(obj1b, obj2b));
+ success &= test("!obj1b.equals(obj3a)", !obj1b.equals(obj3a));
+ success &= test("!UnoRuntime.areSame(obj1b, obj3a)",
+ !UnoRuntime.areSame(obj1b, obj3a));
+ success &= test("!obj1b.equals(obj3b)", !obj1b.equals(obj3b));
+ success &= test("!UnoRuntime.areSame(obj1b, obj3b)",
+ !UnoRuntime.areSame(obj1b, obj3b));
+ success &= test("!obj1b.equals(obj4a)", !obj1b.equals(obj4a));
+ success &= test("!UnoRuntime.areSame(obj1b, obj4a)",
+ !UnoRuntime.areSame(obj1b, obj4a));
+ success &= test("!obj1b.equals(obj4b)", !obj1b.equals(obj4b));
+ success &= test("!UnoRuntime.areSame(obj1b, obj4b)",
+ !UnoRuntime.areSame(obj1b, obj4b));
+
+ success &= test("!obj2a.equals(null)", !obj2a.equals(null));
+ success &= test("!UnoRuntime.areSame(obj2a, null)",
+ !UnoRuntime.areSame(obj2a, null));
+ success &= test("!obj2a.equals(obj1a)", !obj2a.equals(obj1a));
+ success &= test("!UnoRuntime.areSame(obj2a, obj1a)",
+ !UnoRuntime.areSame(obj2a, obj1a));
+ success &= test("!obj2a.equals(obj1b)", !obj2a.equals(obj1b));
+ success &= test("!UnoRuntime.areSame(obj2a, obj1b)",
+ !UnoRuntime.areSame(obj2a, obj1b));
+ success &= test("obj2a.equals(obj2a)", obj2a.equals(obj2a));
+ success &= test("UnoRuntime.areSame(obj2a, obj2a)",
+ UnoRuntime.areSame(obj2a, obj2a));
+ success &= test("obj2a.equals(obj2b)", obj2a.equals(obj2b));
+ success &= test("UnoRuntime.areSame(obj2a, obj2b)",
+ UnoRuntime.areSame(obj2a, obj2b));
+ success &= test("!obj2a.equals(obj3a)", !obj2a.equals(obj3a));
+ success &= test("!UnoRuntime.areSame(obj2a, obj3a)",
+ !UnoRuntime.areSame(obj2a, obj3a));
+ success &= test("!obj2a.equals(obj3b)", !obj2a.equals(obj3b));
+ success &= test("!UnoRuntime.areSame(obj2a, obj3b)",
+ !UnoRuntime.areSame(obj2a, obj3b));
+ success &= test("!obj2a.equals(obj4a)", !obj2a.equals(obj4a));
+ success &= test("!UnoRuntime.areSame(obj2a, obj4a)",
+ !UnoRuntime.areSame(obj2a, obj4a));
+ success &= test("!obj2a.equals(obj4b)", !obj2a.equals(obj4b));
+ success &= test("!UnoRuntime.areSame(obj2a, obj4b)",
+ !UnoRuntime.areSame(obj2a, obj4b));
+
+ success &= test("!obj2b.equals(null)", !obj2b.equals(null));
+ success &= test("!UnoRuntime.areSame(obj2b, null)",
+ !UnoRuntime.areSame(obj2b, null));
+ success &= test("!obj2b.equals(obj1a)", !obj2b.equals(obj1a));
+ success &= test("!UnoRuntime.areSame(obj2b, obj1a)",
+ !UnoRuntime.areSame(obj2b, obj1a));
+ success &= test("!obj2b.equals(obj1b)", !obj2b.equals(obj1b));
+ success &= test("!UnoRuntime.areSame(obj2b, obj1b)",
+ !UnoRuntime.areSame(obj2b, obj1b));
+ success &= test("obj2b.equals(obj2a)", obj2b.equals(obj2a));
+ success &= test("UnoRuntime.areSame(obj2b, obj2a)",
+ UnoRuntime.areSame(obj2b, obj2a));
+ success &= test("obj2b.equals(obj2b)", obj2b.equals(obj2b));
+ success &= test("UnoRuntime.areSame(obj2b, obj2b)",
+ UnoRuntime.areSame(obj2b, obj2b));
+ success &= test("!obj2b.equals(obj3a)", !obj2b.equals(obj3a));
+ success &= test("!UnoRuntime.areSame(obj2b, obj3a)",
+ !UnoRuntime.areSame(obj2b, obj3a));
+ success &= test("!obj2b.equals(obj3b)", !obj2b.equals(obj3b));
+ success &= test("!UnoRuntime.areSame(obj2b, obj3b)",
+ !UnoRuntime.areSame(obj2b, obj3b));
+ success &= test("!obj2b.equals(obj4a)", !obj2b.equals(obj4a));
+ success &= test("!UnoRuntime.areSame(obj2b, obj4a)",
+ !UnoRuntime.areSame(obj2b, obj4a));
+ success &= test("!obj2b.equals(obj4b)", !obj2b.equals(obj4b));
+ success &= test("!UnoRuntime.areSame(obj2b, obj4b)",
+ !UnoRuntime.areSame(obj2b, obj4b));
+
+ success &= test("!obj3a.equals(null)", !obj3a.equals(null));
+ success &= test("!UnoRuntime.areSame(obj3a, null)",
+ !UnoRuntime.areSame(obj3a, null));
+ success &= test("!obj3a.equals(obj1a)", !obj3a.equals(obj1a));
+ success &= test("!UnoRuntime.areSame(obj3a, obj1a)",
+ !UnoRuntime.areSame(obj3a, obj1a));
+ success &= test("!obj3a.equals(obj1b)", !obj3a.equals(obj1b));
+ success &= test("!UnoRuntime.areSame(obj3a, obj1b)",
+ !UnoRuntime.areSame(obj3a, obj1b));
+ success &= test("!obj3a.equals(obj2a)", !obj3a.equals(obj2a));
+ success &= test("!UnoRuntime.areSame(obj3a, obj2a)",
+ !UnoRuntime.areSame(obj3a, obj2a));
+ success &= test("!obj3a.equals(obj2b)", !obj3a.equals(obj2b));
+ success &= test("!UnoRuntime.areSame(obj3a, obj2b)",
+ !UnoRuntime.areSame(obj3a, obj2b));
+ success &= test("obj3a.equals(obj3a)", obj3a.equals(obj3a));
+ success &= test("UnoRuntime.areSame(obj3a, obj3a)",
+ UnoRuntime.areSame(obj3a, obj3a));
+ success &= test("obj3a.equals(obj3b)", obj3a.equals(obj3b));
+ success &= test("UnoRuntime.areSame(obj3a, obj3b)",
+ UnoRuntime.areSame(obj3a, obj3b));
+ success &= test("!obj3a.equals(obj4a)", !obj3a.equals(obj4a));
+ success &= test("!UnoRuntime.areSame(obj3a, obj4a)",
+ !UnoRuntime.areSame(obj3a, obj4a));
+ success &= test("!obj3a.equals(obj4b)", !obj3a.equals(obj4b));
+ success &= test("!UnoRuntime.areSame(obj3a, obj4b)",
+ !UnoRuntime.areSame(obj3a, obj4b));
+
+ success &= test("!obj3b.equals(null)", !obj3b.equals(null));
+ success &= test("!UnoRuntime.areSame(obj3b, null)",
+ !UnoRuntime.areSame(obj3b, null));
+ success &= test("!obj3b.equals(obj1a)", !obj3b.equals(obj1a));
+ success &= test("!UnoRuntime.areSame(obj3b, obj1a)",
+ !UnoRuntime.areSame(obj3b, obj1a));
+ success &= test("!obj3b.equals(obj1b)", !obj3b.equals(obj1b));
+ success &= test("!UnoRuntime.areSame(obj3b, obj1b)",
+ !UnoRuntime.areSame(obj3b, obj1b));
+ success &= test("!obj3b.equals(obj2a)", !obj3b.equals(obj2a));
+ success &= test("!UnoRuntime.areSame(obj3b, obj2a)",
+ !UnoRuntime.areSame(obj3b, obj2a));
+ success &= test("!obj3b.equals(obj2b)", !obj3b.equals(obj2b));
+ success &= test("!UnoRuntime.areSame(obj3b, obj2b)",
+ !UnoRuntime.areSame(obj3b, obj2b));
+ success &= test("obj3b.equals(obj3a)", obj3b.equals(obj3a));
+ success &= test("UnoRuntime.areSame(obj3b, obj3a)",
+ UnoRuntime.areSame(obj3b, obj3a));
+ success &= test("obj3b.equals(obj3b)", obj3b.equals(obj3b));
+ success &= test("UnoRuntime.areSame(obj3b, obj3b)",
+ UnoRuntime.areSame(obj3b, obj3b));
+ success &= test("!obj3b.equals(obj4a)", !obj3b.equals(obj4a));
+ success &= test("!UnoRuntime.areSame(obj3b, obj4a)",
+ !UnoRuntime.areSame(obj3b, obj4a));
+ success &= test("!obj3b.equals(obj4b)", !obj3b.equals(obj4b));
+ success &= test("!UnoRuntime.areSame(obj3b, obj4b)",
+ !UnoRuntime.areSame(obj3b, obj4b));
+
+ success &= test("!obj4a.equals(null)", !obj4a.equals(null));
+ success &= test("!UnoRuntime.areSame(obj4a, null)",
+ !UnoRuntime.areSame(obj4a, null));
+ success &= test("!obj4a.equals(obj1a)", !obj4a.equals(obj1a));
+ success &= test("!UnoRuntime.areSame(obj4a, obj1a)",
+ !UnoRuntime.areSame(obj4a, obj1a));
+ success &= test("!obj4a.equals(obj1b)", !obj4a.equals(obj1b));
+ success &= test("!UnoRuntime.areSame(obj4a, obj1b)",
+ !UnoRuntime.areSame(obj4a, obj1b));
+ success &= test("!obj4a.equals(obj2a)", !obj4a.equals(obj2a));
+ success &= test("!UnoRuntime.areSame(obj4a, obj2a)",
+ !UnoRuntime.areSame(obj4a, obj2a));
+ success &= test("!obj4a.equals(obj2b)", !obj4a.equals(obj2b));
+ success &= test("!UnoRuntime.areSame(obj4a, obj2b)",
+ !UnoRuntime.areSame(obj4a, obj2b));
+ success &= test("!obj4a.equals(obj3a)", !obj4a.equals(obj3a));
+ success &= test("!UnoRuntime.areSame(obj4a, obj3a)",
+ !UnoRuntime.areSame(obj4a, obj3a));
+ success &= test("!obj4a.equals(obj3b)", !obj4a.equals(obj3b));
+ success &= test("!UnoRuntime.areSame(obj4a, obj3b)",
+ !UnoRuntime.areSame(obj4a, obj3b));
+ success &= test("obj4a.equals(obj4a)", obj4a.equals(obj4a));
+ success &= test("UnoRuntime.areSame(obj4a, obj4a)",
+ UnoRuntime.areSame(obj4a, obj4a));
+ success &= test("obj4a.equals(obj4b)", obj4a.equals(obj4b));
+ success &= test("UnoRuntime.areSame(obj4a, obj4b)",
+ UnoRuntime.areSame(obj4a, obj4b));
+
+ success &= test("!obj4b.equals(null)", !obj4b.equals(null));
+ success &= test("!UnoRuntime.areSame(obj4b, null)",
+ !UnoRuntime.areSame(obj4b, null));
+ success &= test("!obj4b.equals(obj1a)", !obj4b.equals(obj1a));
+ success &= test("!UnoRuntime.areSame(obj4b, obj1a)",
+ !UnoRuntime.areSame(obj4b, obj1a));
+ success &= test("!obj4b.equals(obj1b)", !obj4b.equals(obj1b));
+ success &= test("!UnoRuntime.areSame(obj4b, obj1b)",
+ !UnoRuntime.areSame(obj4b, obj1b));
+ success &= test("!obj4b.equals(obj2a)", !obj4b.equals(obj2a));
+ success &= test("!UnoRuntime.areSame(obj4b, obj2a)",
+ !UnoRuntime.areSame(obj4b, obj2a));
+ success &= test("!obj4b.equals(obj2b)", !obj4b.equals(obj2b));
+ success &= test("!UnoRuntime.areSame(obj4b, obj2b)",
+ !UnoRuntime.areSame(obj4b, obj2b));
+ success &= test("!obj4b.equals(obj3a)", !obj4b.equals(obj3a));
+ success &= test("!UnoRuntime.areSame(obj4b, obj3a)",
+ !UnoRuntime.areSame(obj4b, obj3a));
+ success &= test("!obj4b.equals(obj3b)", !obj4b.equals(obj3b));
+ success &= test("!UnoRuntime.areSame(obj4b, obj3b)",
+ !UnoRuntime.areSame(obj4b, obj3b));
+ success &= test("obj4b.equals(obj4a)", obj4b.equals(obj4a));
+ success &= test("UnoRuntime.areSame(obj4b, obj4a)",
+ UnoRuntime.areSame(obj4b, obj4a));
+ success &= test("obj4b.equals(obj4b)", obj4b.equals(obj4b));
+ success &= test("UnoRuntime.areSame(obj4b, obj4b)",
+ UnoRuntime.areSame(obj4b, obj4b));
+
+ success &= test("obj1a.hashCode() == obj1b.hashCode()",
+ obj1a.hashCode() == obj1b.hashCode());
+ success &= test("obj2a.hashCode() == obj2b.hashCode()",
+ obj2a.hashCode() == obj2b.hashCode());
+ success &= test("obj3a.hashCode() == obj3b.hashCode()",
+ obj3a.hashCode() == obj3b.hashCode());
+ success &= test("obj4a.hashCode() == obj4b.hashCode()",
+ obj4a.hashCode() == obj4b.hashCode());
+
+ return success;
+ }
+
+ private static boolean test(String message, boolean condition) {
+ if (!condition) {
+ System.err.println("Failed: " + message);
+ }
+ return condition;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Provider(TestBed testBed) {
+ this.testBed = testBed;
+ }
+
+ public Object getInstance(String instanceName) {
+ return new XTransport() {
+ public Object getType1() {
+ return new XType1() {};
+ }
+
+ public Object getType2() {
+ return new XType2() {};
+ }
+ };
+ }
+
+ private final TestBed testBed;
+ }
+
+ public interface XTransport extends XInterface {
+ Object getType1();
+
+ Object getType2();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getType1", 0, 0),
+ new MethodTypeInfo("getType2", 1, 0) };
+ }
+
+ public interface XType1 extends XInterface {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+
+ public interface XType2 extends XInterface {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java
new file mode 100644
index 000000000000..9c7b84a960b3
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+/**
+ * Test case for bug #108825#.
+ *
+ * <p>Bug #108825# "Java UNO Remote Bridge: Mapped-out Objects Not Held" shows
+ * that local objects that are mapped out via a remote bridge, but not held
+ * locally, might be garbage collected while there are still remote references
+ * to them. This test is not guaranteed to always work reliably, see comment in
+ * the code.</p>
+ */
+public final class Bug108825_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
+ }
+
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ TestBed t = new TestBed();
+ assure("test", t.execute(new Provider(t), true, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTest test = UnoRuntime.queryInterface(
+ XTest.class, getBridge(context).getInstance("Test"));
+ // Send the XObject that is held on the server side amidst two
+ // dummies that are not held on the server side; then wait for the
+ // dummies to be garbage collected, hoping that the XObject, if it
+ // is erroneously not held on the client side, will be garbage
+ // collected, too. Obviously, this is not guaranteed to always work
+ // (the VM might chose not to garbage collect the dummies, hanging
+ // the test forever; or the VM might chose to garbage collect the
+ // dummies but not the XObject, making the test pass erroneously).
+ test.offer(new Dummy(), new XObject() { public void call() {} },
+ new Dummy());
+ System.out.println("Client waiting for garbage collection...");
+ for (;;) {
+ synchronized (lock) {
+ if (finalizedCount == 2) {
+ break;
+ }
+ }
+ test.remoteGc();
+ gc();
+ }
+ System.out.println("Client garbage collection done.");
+ test.notification();
+ return true;
+ }
+
+ private final class Dummy implements XDummy {
+ protected void finalize() {
+ synchronized (lock) {
+ ++finalizedCount;
+ }
+ }
+ }
+
+ private final Object lock = new Object();
+ private int finalizedCount = 0;
+ }
+
+ // Make it as likely as possible that the VM reclaims all garbage:
+ private static void gc() {
+ System.gc();
+ System.runFinalization();
+ byte[] garbage = new byte[1024 * 1024];
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Provider(TestBed testBed) {
+ this.testBed = testBed;
+ }
+
+ public Object getInstance(String instanceName) {
+ return new XTest() {
+ public void offer(XDummy dummy1, XObject obj, XDummy dummy2)
+ {
+ this.obj = obj;
+ }
+
+ public void remoteGc() {
+ gc();
+ }
+
+ public void notification() {
+ obj.call();
+ testBed.serverDone(true);
+ }
+
+ private XObject obj;
+ };
+ }
+
+ private final TestBed testBed;
+ }
+
+ public interface XDummy extends XInterface {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+
+ public interface XObject extends XInterface {
+ void call();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) };
+ }
+
+ public interface XTest extends XInterface {
+ void offer(XDummy dummy1, XObject obj, XDummy dummy2);
+
+ void remoteGc();
+
+ void notification();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("offer", 0, 0),
+ new MethodTypeInfo("remoteGc", 1, 0),
+ new MethodTypeInfo("notification", 2, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java
new file mode 100644
index 000000000000..322f8051ed60
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+import util.WaitUnreachable;
+
+/**
+ * Test case for bug #110892#.
+ *
+ * <p>Bug #110892# "Java URP bridge holds objects indefinitely" applies to cases
+ * where an object is sent from server to client, then recursively back from
+ * client to server. In such a case, the client should not increment its
+ * internal reference count for the object, as the server will never send back a
+ * corresponding release message.</p>
+ *
+ * <p>This test has to detect whether the spawned client process fails to
+ * garbage-collect an object, which can not be done reliably. As an
+ * approximation, it waits for 10 sec and considers the process failing if it
+ * has not garbage-collected the object by then.</p>
+ */
+public final class Bug110892_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure("test",
+ new TestBed().execute(new Provider(), false, Client.class,
+ 10000));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTest test = UnoRuntime.queryInterface(
+ XTest.class, getBridge(context).getInstance("Test"));
+ test.start(new ClientObject());
+ synchronized (lock) {
+ unreachable.waitUnreachable();
+ }
+ return true;
+ }
+
+ private final class ClientObject implements XClientObject {
+ public void call(XServerObject server, XInterface object) {
+ synchronized (lock) {
+ unreachable = new WaitUnreachable(object);
+ }
+ server.call(object);
+ }
+ }
+
+ private final Object lock = new Object();
+ private WaitUnreachable unreachable = null;
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTest() {
+ public void start(XClientObject client) {
+ client.call(
+ new XServerObject() {
+ public void call(XInterface object) {}
+ },
+ new XInterface() {});
+ }
+ };
+ }
+ }
+
+ public interface XClientObject extends XInterface {
+ void call(XServerObject server, XInterface object);
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) };
+ }
+
+ public interface XServerObject extends XInterface {
+ void call(XInterface object);
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) };
+ }
+
+ public interface XTest extends XInterface {
+ void start(XClientObject client);
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("start", 0, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java
new file mode 100644
index 000000000000..351481cb4680
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+/**
+ * Test case for bug #111153#.
+ *
+ * <P>Bug #111153# "jni_uno bridge sometimes fails to map objects
+ * correctly" describes that mapping a local object out with type XDerived and
+ * then mapping it back in with type XBase produces a proxy, instead of
+ * short-cutting to the local object.</P>
+ */
+public final class Bug111153_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure("test", new TestBed().execute(new Provider(), false,
+ Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTransport t = UnoRuntime.queryInterface(
+ XTransport.class, getBridge(context).getInstance("Transport"));
+ XDerived d = new XDerived() {};
+ t.setDerived(d);
+ return t.getBase() == d;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTransport() {
+ public synchronized void setDerived(XDerived derived) {
+ this.derived = derived;
+ }
+
+ public synchronized XBase getBase() {
+ return this.derived;
+ }
+
+ private XDerived derived = null;
+ };
+ }
+ }
+
+ public interface XBase extends XInterface {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+
+ public interface XDerived extends XBase {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+
+ public interface XTransport extends XInterface {
+ void setDerived(XDerived derived);
+
+ XBase getBase();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("setDerived", 0, 0),
+ new MethodTypeInfo("getBase", 1, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug114133_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug114133_Test.java
new file mode 100644
index 000000000000..0049b966be1c
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug114133_Test.java
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+import util.WaitUnreachable;
+
+/**
+ * Test case for bug #114133#.
+ *
+ * <p>Bug #114133# "Java UNO: UnoRuntime.getBride and disposed bridges." The
+ * client calls UnoRuntime.getBridge to get a bridge to the server, uses the
+ * bridge, waits until it terminates itself (when all bridged objects have been
+ * garbage-collected), then calls UnoRuntime.getBridge again. This must return
+ * a fresh, unterminated bridge.</p>
+ */
+public final class Bug114133_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure(
+ "test",
+ new TestBed().execute(new Provider(), false, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ new WaitUnreachable(getBridge(context).getInstance("Test")).
+ waitUnreachable();
+ new WaitUnreachable(getBridge(context).getInstance("Test")).
+ waitUnreachable();
+ return true;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XInterface() {};
+ }
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java
new file mode 100644
index 000000000000..bb13c55ee1ad
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XBridgeFactory;
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.connection.Connector;
+import com.sun.star.connection.XConnection;
+import com.sun.star.lib.TestBed;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+import util.WaitUnreachable;
+
+/**
+ * Test case for bug #i51323#.
+ *
+ * <p>Bug #i51323# "jurt: BridgeFactory.createBridge creates bridge names."
+ * Make sure that multiple calls to BridgeFactory.getBridge with empty names
+ * create different bridges.</p>
+ */
+public final class Bug51323_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure(
+ "test",
+ new TestBed().execute(new Provider(), false, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XConnection connection =
+ Connector.create(context).connect(getConnectionDescription());
+ XBridgeFactory factory = UnoRuntime.queryInterface(
+ XBridgeFactory.class,
+ context.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", context));
+ return !UnoRuntime.areSame(
+ factory.createBridge(
+ "", getProtocolDescription(), connection, null),
+ factory.createBridge(
+ "", getProtocolDescription(), connection, null));
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XInterface() {};
+ }
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java
new file mode 100644
index 000000000000..9c425a61fb2b
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+public final class Bug92174_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure("test",
+ new TestBed().execute(new Provider(), false, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTransport t = UnoRuntime.queryInterface(
+ XTransport.class, getBridge(context).getInstance("Transport"));
+ t.setDerived(new XDerived() {
+ public void fn() {}
+ });
+ t.getBase().fn();
+ return true;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTransport() {
+ public XBase getBase() {
+ return derived;
+ }
+
+ public synchronized void setDerived(XDerived derived) {
+ this.derived = derived;
+ }
+
+ private XDerived derived = null;
+ };
+ }
+ }
+
+ public interface XBase extends XInterface {
+ void fn();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("fn", 0, 0) };
+ }
+
+ public interface XDerived extends XBase {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+
+ public interface XTransport extends XInterface {
+ XBase getBase();
+
+ void setDerived(XDerived derived);
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getBase", 0, 0),
+ new MethodTypeInfo("setDerived", 1, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java
new file mode 100644
index 000000000000..34d98532688b
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+/**
+ * Test case for bug #97697#.
+ *
+ * <p>Bug #97697# "GPF in java-uno bridge in bugdoc scenario" shows that sending
+ * a plain <code>Object</code> as an <code>Any</code> over the URP bridge lead
+ * to a <code>StackOverflowError</code> on the writer thread, which was silently
+ * discarded (and the bridge was not disposed).</p>
+ *
+ * <p>This test has to detect whether the spawned client process indeed hangs,
+ * which can not be done reliably. As an approximation, it waits for 10 sec and
+ * considers the process hanging if it has not completed by then.</p>
+ */
+public final class Bug97697_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
+ }
+
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ TestBed t = new TestBed();
+ assure("test", t.execute(new Provider(t), true, Client.class, 10000));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTransport transport = UnoRuntime.queryInterface(
+ XTransport.class, getBridge(context).getInstance("Transport"));
+ try {
+ transport.getAny();
+ } catch (DisposedException e) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Provider(TestBed testBed) {
+ this.testBed = testBed;
+ }
+
+ public Object getInstance(String instanceName) {
+ return new XTransport() {
+ public Object getAny() {
+ testBed.serverDone(true);
+ return new Object();
+ }
+ };
+ }
+
+ private final TestBed testBed;
+ }
+
+ public interface XTransport extends XInterface {
+ Object getAny();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getAny", 0, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.idl b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.idl
new file mode 100644
index 000000000000..491f82cc0a83
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.idl
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/uno/XInterface.idl"
+
+module com { module sun { module star { module lib { module uno {
+module bridges { module javaremote {
+
+struct Test98508Struct<T> { T member; };
+
+interface Test98508Interface { Test98508Struct<long> get(); };
+
+}; }; }; }; }; }; };
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java
new file mode 100644
index 000000000000..82804cf22e67
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lib.TestBed;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import complexlib.ComplexTestCase;
+
+/**
+ * Test case for bug #98508#.
+ *
+ * <p>Bug #98508# "JAVA UNO bridge is not disposed when Exception occures during
+ * sendReply()" states that the server returning <code>null</code> instead of a
+ * valid <code>String</code> from <code>XServiceName.getServiceName</code>
+ * causes an exception when sending the reply, but this exception did not cause
+ * the bridge to be disposed, it rather caused both client and server to
+ * hang.</p>
+ *
+ * <p>Since null instead of a <code>String</code> no longer causes an exception
+ * in the bridge, this test has been redesigned to send a value of a wrong
+ * instantiated polymorphic struct type instead.</p>
+ *
+ * <p>This test has to detect whether the spawned client process indeed hangs,
+ * which can not be done reliably. As an approximation, it waits for 10 sec and
+ * considers the process hanging if it has not completed by then.</p>
+ */
+public final class Bug98508_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
+ }
+
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ TestBed t = new TestBed();
+ assure("test", t.execute(new Provider(t), true, Client.class, 10000));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ Test98508Interface ifc
+ = UnoRuntime.queryInterface(
+ Test98508Interface.class,
+ getBridge(context).getInstance(""));
+ try {
+ ifc.get();
+ } catch (DisposedException e) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Provider(TestBed testBed) {
+ this.testBed = testBed;
+ }
+
+ public Object getInstance(String instanceName) {
+ return new Test98508Interface() {
+ public Test98508Struct get() {
+ testBed.serverDone(true);
+ return new Test98508Struct(Boolean.FALSE);
+ }
+ };
+ }
+
+ private final TestBed testBed;
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java
new file mode 100755
index 000000000000..39c8a0639b8f
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java
@@ -0,0 +1,473 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+/**
+ * Test case for bug #111153#.
+ *
+ * <P>Bug #111153# "jni_uno bridge sometimes fails to map objects
+ * correctly" describes that mapping a local object out with type XDerived and
+ * then mapping it back in with type XBase produces a proxy, instead of
+ * short-cutting to the local object.</P>
+ */
+public final class MethodIdTest extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure(
+ "test",
+ new TestBed().execute(new Provider(), false, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTest t = UnoRuntime.queryInterface(
+ XTest.class, getBridge(context).getInstance("Test"));
+ return t.f129() == 129;
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTest() {
+ public int f0() { return 0; }
+ public int f1() { return 1; }
+ public int f2() { return 2; }
+ public int f3() { return 3; }
+ public int f4() { return 4; }
+ public int f5() { return 5; }
+ public int f6() { return 6; }
+ public int f7() { return 7; }
+ public int f8() { return 8; }
+ public int f9() { return 9; }
+ public int f10() { return 10; }
+ public int f11() { return 11; }
+ public int f12() { return 12; }
+ public int f13() { return 13; }
+ public int f14() { return 14; }
+ public int f15() { return 15; }
+ public int f16() { return 16; }
+ public int f17() { return 17; }
+ public int f18() { return 18; }
+ public int f19() { return 19; }
+ public int f20() { return 20; }
+ public int f21() { return 21; }
+ public int f22() { return 22; }
+ public int f23() { return 23; }
+ public int f24() { return 24; }
+ public int f25() { return 25; }
+ public int f26() { return 26; }
+ public int f27() { return 27; }
+ public int f28() { return 28; }
+ public int f29() { return 29; }
+ public int f30() { return 30; }
+ public int f31() { return 31; }
+ public int f32() { return 32; }
+ public int f33() { return 33; }
+ public int f34() { return 34; }
+ public int f35() { return 35; }
+ public int f36() { return 36; }
+ public int f37() { return 37; }
+ public int f38() { return 38; }
+ public int f39() { return 39; }
+ public int f40() { return 40; }
+ public int f41() { return 41; }
+ public int f42() { return 42; }
+ public int f43() { return 43; }
+ public int f44() { return 44; }
+ public int f45() { return 45; }
+ public int f46() { return 46; }
+ public int f47() { return 47; }
+ public int f48() { return 48; }
+ public int f49() { return 49; }
+ public int f50() { return 50; }
+ public int f51() { return 51; }
+ public int f52() { return 52; }
+ public int f53() { return 53; }
+ public int f54() { return 54; }
+ public int f55() { return 55; }
+ public int f56() { return 56; }
+ public int f57() { return 57; }
+ public int f58() { return 58; }
+ public int f59() { return 59; }
+ public int f60() { return 60; }
+ public int f61() { return 61; }
+ public int f62() { return 62; }
+ public int f63() { return 63; }
+ public int f64() { return 64; }
+ public int f65() { return 65; }
+ public int f66() { return 66; }
+ public int f67() { return 67; }
+ public int f68() { return 68; }
+ public int f69() { return 69; }
+ public int f70() { return 70; }
+ public int f71() { return 71; }
+ public int f72() { return 72; }
+ public int f73() { return 73; }
+ public int f74() { return 74; }
+ public int f75() { return 75; }
+ public int f76() { return 76; }
+ public int f77() { return 77; }
+ public int f78() { return 78; }
+ public int f79() { return 79; }
+ public int f80() { return 80; }
+ public int f81() { return 81; }
+ public int f82() { return 82; }
+ public int f83() { return 83; }
+ public int f84() { return 84; }
+ public int f85() { return 85; }
+ public int f86() { return 86; }
+ public int f87() { return 87; }
+ public int f88() { return 88; }
+ public int f89() { return 89; }
+ public int f90() { return 90; }
+ public int f91() { return 91; }
+ public int f92() { return 92; }
+ public int f93() { return 93; }
+ public int f94() { return 94; }
+ public int f95() { return 95; }
+ public int f96() { return 96; }
+ public int f97() { return 97; }
+ public int f98() { return 98; }
+ public int f99() { return 99; }
+ public int f100() { return 100; }
+ public int f101() { return 101; }
+ public int f102() { return 102; }
+ public int f103() { return 103; }
+ public int f104() { return 104; }
+ public int f105() { return 105; }
+ public int f106() { return 106; }
+ public int f107() { return 107; }
+ public int f108() { return 108; }
+ public int f109() { return 109; }
+ public int f110() { return 110; }
+ public int f111() { return 111; }
+ public int f112() { return 112; }
+ public int f113() { return 113; }
+ public int f114() { return 114; }
+ public int f115() { return 115; }
+ public int f116() { return 116; }
+ public int f117() { return 117; }
+ public int f118() { return 118; }
+ public int f119() { return 119; }
+ public int f120() { return 120; }
+ public int f121() { return 121; }
+ public int f122() { return 122; }
+ public int f123() { return 123; }
+ public int f124() { return 124; }
+ public int f125() { return 125; }
+ public int f126() { return 126; }
+ public int f127() { return 127; }
+ public int f128() { return 128; }
+ public int f129() { return 129; }
+ public int f130() { return 130; }
+ };
+ }
+ }
+
+ public interface XTest extends XInterface {
+ int f0();
+ int f1();
+ int f2();
+ int f3();
+ int f4();
+ int f5();
+ int f6();
+ int f7();
+ int f8();
+ int f9();
+ int f10();
+ int f11();
+ int f12();
+ int f13();
+ int f14();
+ int f15();
+ int f16();
+ int f17();
+ int f18();
+ int f19();
+ int f20();
+ int f21();
+ int f22();
+ int f23();
+ int f24();
+ int f25();
+ int f26();
+ int f27();
+ int f28();
+ int f29();
+ int f30();
+ int f31();
+ int f32();
+ int f33();
+ int f34();
+ int f35();
+ int f36();
+ int f37();
+ int f38();
+ int f39();
+ int f40();
+ int f41();
+ int f42();
+ int f43();
+ int f44();
+ int f45();
+ int f46();
+ int f47();
+ int f48();
+ int f49();
+ int f50();
+ int f51();
+ int f52();
+ int f53();
+ int f54();
+ int f55();
+ int f56();
+ int f57();
+ int f58();
+ int f59();
+ int f60();
+ int f61();
+ int f62();
+ int f63();
+ int f64();
+ int f65();
+ int f66();
+ int f67();
+ int f68();
+ int f69();
+ int f70();
+ int f71();
+ int f72();
+ int f73();
+ int f74();
+ int f75();
+ int f76();
+ int f77();
+ int f78();
+ int f79();
+ int f80();
+ int f81();
+ int f82();
+ int f83();
+ int f84();
+ int f85();
+ int f86();
+ int f87();
+ int f88();
+ int f89();
+ int f90();
+ int f91();
+ int f92();
+ int f93();
+ int f94();
+ int f95();
+ int f96();
+ int f97();
+ int f98();
+ int f99();
+ int f100();
+ int f101();
+ int f102();
+ int f103();
+ int f104();
+ int f105();
+ int f106();
+ int f107();
+ int f108();
+ int f109();
+ int f110();
+ int f111();
+ int f112();
+ int f113();
+ int f114();
+ int f115();
+ int f116();
+ int f117();
+ int f118();
+ int f119();
+ int f120();
+ int f121();
+ int f122();
+ int f123();
+ int f124();
+ int f125();
+ int f126();
+ int f127();
+ int f128();
+ int f129();
+ int f130();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("f0", 0, 0),
+ new MethodTypeInfo("f1", 1, 0),
+ new MethodTypeInfo("f2", 2, 0),
+ new MethodTypeInfo("f3", 3, 0),
+ new MethodTypeInfo("f4", 4, 0),
+ new MethodTypeInfo("f5", 5, 0),
+ new MethodTypeInfo("f6", 6, 0),
+ new MethodTypeInfo("f7", 7, 0),
+ new MethodTypeInfo("f8", 8, 0),
+ new MethodTypeInfo("f9", 9, 0),
+ new MethodTypeInfo("f10", 10, 0),
+ new MethodTypeInfo("f11", 11, 0),
+ new MethodTypeInfo("f12", 12, 0),
+ new MethodTypeInfo("f13", 13, 0),
+ new MethodTypeInfo("f14", 14, 0),
+ new MethodTypeInfo("f15", 15, 0),
+ new MethodTypeInfo("f16", 16, 0),
+ new MethodTypeInfo("f17", 17, 0),
+ new MethodTypeInfo("f18", 18, 0),
+ new MethodTypeInfo("f19", 19, 0),
+ new MethodTypeInfo("f20", 20, 0),
+ new MethodTypeInfo("f21", 21, 0),
+ new MethodTypeInfo("f22", 22, 0),
+ new MethodTypeInfo("f23", 23, 0),
+ new MethodTypeInfo("f24", 24, 0),
+ new MethodTypeInfo("f25", 25, 0),
+ new MethodTypeInfo("f26", 26, 0),
+ new MethodTypeInfo("f27", 27, 0),
+ new MethodTypeInfo("f28", 28, 0),
+ new MethodTypeInfo("f29", 29, 0),
+ new MethodTypeInfo("f30", 30, 0),
+ new MethodTypeInfo("f31", 31, 0),
+ new MethodTypeInfo("f32", 32, 0),
+ new MethodTypeInfo("f33", 33, 0),
+ new MethodTypeInfo("f34", 34, 0),
+ new MethodTypeInfo("f35", 35, 0),
+ new MethodTypeInfo("f36", 36, 0),
+ new MethodTypeInfo("f37", 37, 0),
+ new MethodTypeInfo("f38", 38, 0),
+ new MethodTypeInfo("f39", 39, 0),
+ new MethodTypeInfo("f40", 40, 0),
+ new MethodTypeInfo("f41", 41, 0),
+ new MethodTypeInfo("f42", 42, 0),
+ new MethodTypeInfo("f43", 43, 0),
+ new MethodTypeInfo("f44", 44, 0),
+ new MethodTypeInfo("f45", 45, 0),
+ new MethodTypeInfo("f46", 46, 0),
+ new MethodTypeInfo("f47", 47, 0),
+ new MethodTypeInfo("f48", 48, 0),
+ new MethodTypeInfo("f49", 49, 0),
+ new MethodTypeInfo("f50", 50, 0),
+ new MethodTypeInfo("f51", 51, 0),
+ new MethodTypeInfo("f52", 52, 0),
+ new MethodTypeInfo("f53", 53, 0),
+ new MethodTypeInfo("f54", 54, 0),
+ new MethodTypeInfo("f55", 55, 0),
+ new MethodTypeInfo("f56", 56, 0),
+ new MethodTypeInfo("f57", 57, 0),
+ new MethodTypeInfo("f58", 58, 0),
+ new MethodTypeInfo("f59", 59, 0),
+ new MethodTypeInfo("f60", 60, 0),
+ new MethodTypeInfo("f61", 61, 0),
+ new MethodTypeInfo("f62", 62, 0),
+ new MethodTypeInfo("f63", 63, 0),
+ new MethodTypeInfo("f64", 64, 0),
+ new MethodTypeInfo("f65", 65, 0),
+ new MethodTypeInfo("f66", 66, 0),
+ new MethodTypeInfo("f67", 67, 0),
+ new MethodTypeInfo("f68", 68, 0),
+ new MethodTypeInfo("f69", 69, 0),
+ new MethodTypeInfo("f70", 70, 0),
+ new MethodTypeInfo("f71", 71, 0),
+ new MethodTypeInfo("f72", 72, 0),
+ new MethodTypeInfo("f73", 73, 0),
+ new MethodTypeInfo("f74", 74, 0),
+ new MethodTypeInfo("f75", 75, 0),
+ new MethodTypeInfo("f76", 76, 0),
+ new MethodTypeInfo("f77", 77, 0),
+ new MethodTypeInfo("f78", 78, 0),
+ new MethodTypeInfo("f79", 79, 0),
+ new MethodTypeInfo("f80", 80, 0),
+ new MethodTypeInfo("f81", 81, 0),
+ new MethodTypeInfo("f82", 82, 0),
+ new MethodTypeInfo("f83", 83, 0),
+ new MethodTypeInfo("f84", 84, 0),
+ new MethodTypeInfo("f85", 85, 0),
+ new MethodTypeInfo("f86", 86, 0),
+ new MethodTypeInfo("f87", 87, 0),
+ new MethodTypeInfo("f88", 88, 0),
+ new MethodTypeInfo("f89", 89, 0),
+ new MethodTypeInfo("f90", 90, 0),
+ new MethodTypeInfo("f91", 91, 0),
+ new MethodTypeInfo("f92", 92, 0),
+ new MethodTypeInfo("f93", 93, 0),
+ new MethodTypeInfo("f94", 94, 0),
+ new MethodTypeInfo("f95", 95, 0),
+ new MethodTypeInfo("f96", 96, 0),
+ new MethodTypeInfo("f97", 97, 0),
+ new MethodTypeInfo("f98", 98, 0),
+ new MethodTypeInfo("f99", 99, 0),
+ new MethodTypeInfo("f100", 100, 0),
+ new MethodTypeInfo("f101", 101, 0),
+ new MethodTypeInfo("f102", 102, 0),
+ new MethodTypeInfo("f103", 103, 0),
+ new MethodTypeInfo("f104", 104, 0),
+ new MethodTypeInfo("f105", 105, 0),
+ new MethodTypeInfo("f106", 106, 0),
+ new MethodTypeInfo("f107", 107, 0),
+ new MethodTypeInfo("f108", 108, 0),
+ new MethodTypeInfo("f109", 109, 0),
+ new MethodTypeInfo("f110", 110, 0),
+ new MethodTypeInfo("f111", 111, 0),
+ new MethodTypeInfo("f112", 112, 0),
+ new MethodTypeInfo("f113", 113, 0),
+ new MethodTypeInfo("f114", 114, 0),
+ new MethodTypeInfo("f115", 115, 0),
+ new MethodTypeInfo("f116", 116, 0),
+ new MethodTypeInfo("f117", 117, 0),
+ new MethodTypeInfo("f118", 118, 0),
+ new MethodTypeInfo("f119", 119, 0),
+ new MethodTypeInfo("f120", 120, 0),
+ new MethodTypeInfo("f121", 121, 0),
+ new MethodTypeInfo("f122", 122, 0),
+ new MethodTypeInfo("f123", 123, 0),
+ new MethodTypeInfo("f124", 124, 0),
+ new MethodTypeInfo("f125", 125, 0),
+ new MethodTypeInfo("f126", 126, 0),
+ new MethodTypeInfo("f127", 127, 0),
+ new MethodTypeInfo("f128", 128, 0),
+ new MethodTypeInfo("f129", 129, 0),
+ new MethodTypeInfo("f130", 130, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.idl b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.idl
new file mode 100644
index 000000000000..68330567d405
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.idl
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/uno/XInterface.idl"
+
+module com { module sun { module star { module lib { module uno {
+module bridges { module javaremote {
+
+enum TestEnum { VALUE1 = 100, VALUE2 = -100 };
+
+struct TestPolyStruct<T> { T member; };
+
+interface TestTransport {
+ TestPolyStruct<boolean> transportBoolean([in] TestPolyStruct<boolean> arg);
+ TestPolyStruct<byte> transportByte([in] TestPolyStruct<byte> arg);
+ TestPolyStruct<short> transportShort([in] TestPolyStruct<short> arg);
+ TestPolyStruct<long> transportLong([in] TestPolyStruct<long> arg);
+ TestPolyStruct<hyper> transportHyper([in] TestPolyStruct<hyper> arg);
+ TestPolyStruct<float> transportFloat([in] TestPolyStruct<float> arg);
+ TestPolyStruct<double> transportDouble([in] TestPolyStruct<double> arg);
+ TestPolyStruct<char> transportChar([in] TestPolyStruct<char> arg);
+ TestPolyStruct<string> transportString([in] TestPolyStruct<string> arg);
+ TestPolyStruct<type> transportType([in] TestPolyStruct<type> arg);
+ TestPolyStruct<any> transportAny([in] TestPolyStruct<any> arg);
+ TestPolyStruct<TestEnum> transportEnum([in] TestPolyStruct<TestEnum> arg);
+};
+
+}; }; }; }; }; }; };
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java
new file mode 100644
index 000000000000..ebf1ed57bc2c
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MemberTypeInfo;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.ParameterTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.TypeClass;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+public final class PolyStructTest extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure(
+ "test",
+ new TestBed().execute(new Provider(), false, Client.class, 0));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ TestTransport t = UnoRuntime.queryInterface(
+ TestTransport.class, getBridge(context).getInstance(""));
+
+ assertEquals(
+ Boolean.FALSE, t.transportBoolean(new TestPolyStruct()).member);
+ assertEquals(
+ Boolean.FALSE,
+ t.transportBoolean(new TestPolyStruct(Boolean.FALSE)).member);
+ assertEquals(
+ Boolean.TRUE,
+ t.transportBoolean(new TestPolyStruct(Boolean.TRUE)).member);
+
+ assertEquals(
+ new Byte((byte) 0),
+ t.transportByte(new TestPolyStruct()).member);
+ assertEquals(
+ new Byte(Byte.MIN_VALUE),
+ t.transportByte(
+ new TestPolyStruct(new Byte(Byte.MIN_VALUE))).member);
+ assertEquals(
+ new Byte(Byte.MAX_VALUE),
+ t.transportByte(
+ new TestPolyStruct(new Byte(Byte.MAX_VALUE))).member);
+
+ assertEquals(
+ new Short((short) 0),
+ t.transportShort(new TestPolyStruct()).member);
+ assertEquals(
+ new Short(Short.MIN_VALUE),
+ t.transportShort(
+ new TestPolyStruct(new Short(Short.MIN_VALUE))).member);
+ assertEquals(
+ new Short(Short.MAX_VALUE),
+ t.transportShort(
+ new TestPolyStruct(new Short(Short.MAX_VALUE))).member);
+
+ assertEquals(
+ new Integer(0), t.transportLong(new TestPolyStruct()).member);
+ assertEquals(
+ new Integer(Integer.MIN_VALUE),
+ t.transportLong(
+ new TestPolyStruct(new Integer(Integer.MIN_VALUE))).member);
+ assertEquals(
+ new Integer(Integer.MAX_VALUE),
+ t.transportLong(
+ new TestPolyStruct(new Integer(Integer.MAX_VALUE))).member);
+
+ assertEquals(
+ new Long(0L), t.transportHyper(new TestPolyStruct()).member);
+ assertEquals(
+ new Long(Long.MIN_VALUE),
+ t.transportHyper(
+ new TestPolyStruct(new Long(Long.MIN_VALUE))).member);
+ assertEquals(
+ new Long(Long.MAX_VALUE),
+ t.transportHyper(
+ new TestPolyStruct(new Long(Long.MAX_VALUE))).member);
+
+ assertEquals(
+ new Float(0.0f), t.transportFloat(new TestPolyStruct()).member);
+ assertEquals(
+ new Float(Float.MIN_VALUE),
+ t.transportFloat(
+ new TestPolyStruct(new Float(Float.MIN_VALUE))).member);
+ assertEquals(
+ new Float(Float.MAX_VALUE),
+ t.transportFloat(
+ new TestPolyStruct(new Float(Float.MAX_VALUE))).member);
+
+ assertEquals(
+ new Double(0.0),
+ t.transportDouble(new TestPolyStruct()).member);
+ assertEquals(
+ new Double(Double.MIN_VALUE),
+ t.transportDouble(
+ new TestPolyStruct(new Double(Double.MIN_VALUE))).member);
+ assertEquals(
+ new Double(Double.MAX_VALUE),
+ t.transportDouble(
+ new TestPolyStruct(new Double(Double.MAX_VALUE))).member);
+
+ assertEquals(
+ new Character(Character.MIN_VALUE),
+ t.transportChar(new TestPolyStruct()).member);
+ assertEquals(
+ new Character(Character.MIN_VALUE),
+ t.transportChar(
+ new TestPolyStruct(
+ new Character(Character.MIN_VALUE))).member);
+ assertEquals(
+ new Character(Character.MAX_VALUE),
+ t.transportChar(
+ new TestPolyStruct(
+ new Character(Character.MAX_VALUE))).member);
+
+ assertEquals("", t.transportString(new TestPolyStruct()).member);
+ assertEquals(
+ "ABC", t.transportString(new TestPolyStruct("ABC")).member);
+
+ assertEquals(
+ Type.VOID, t.transportType(new TestPolyStruct()).member);
+ assertEquals(
+ new Type(
+ "[]com.sun.star.lib.uno.bridges.javaremote.TestPolyStruct"
+ + "<long>"),
+ t.transportType(
+ new TestPolyStruct(
+ new Type(
+ "[]com.sun.star.lib.uno.bridges.javaremote."
+ + "TestPolyStruct<long>"))).member);
+
+ assertEquals(null, t.transportAny(new TestPolyStruct()).member);
+ assertEquals(
+ Any.VOID, t.transportAny(new TestPolyStruct(Any.VOID)).member);
+ assertEquals(null, t.transportAny(new TestPolyStruct(null)).member);
+ assertEquals(
+ new Any(Type.UNSIGNED_LONG, new Integer(5)),
+ t.transportAny(
+ new TestPolyStruct(
+ new Any(Type.UNSIGNED_LONG, new Integer(5)))).member);
+
+ assertEquals(
+ TestEnum.VALUE1, t.transportEnum(new TestPolyStruct()).member);
+ assertEquals(
+ TestEnum.VALUE1,
+ t.transportEnum(new TestPolyStruct(TestEnum.VALUE1)).member);
+ assertEquals(
+ TestEnum.VALUE2,
+ t.transportEnum(new TestPolyStruct(TestEnum.VALUE2)).member);
+
+ return success;
+ }
+
+ private void assertEquals(Object expected, Object actual) {
+ if (!(expected == null ? actual == null : expected.equals(actual)))
+ {
+ new RuntimeException(
+ "failed; expected " + expected + ", got " + actual).
+ printStackTrace();
+ success = false;
+ }
+ }
+
+ private boolean success = true;
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new TestTransport() {
+ public TestPolyStruct transportBoolean(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportByte(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportShort(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportLong(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportHyper(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportFloat(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportDouble(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportChar(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportString(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportType(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportAny(TestPolyStruct s) {
+ return s;
+ }
+
+ public TestPolyStruct transportEnum(TestPolyStruct s) {
+ return s;
+ }
+ };
+ }
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java
new file mode 100644
index 000000000000..2456d681563d
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.bridges.javaremote;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lib.TestBed;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+
+/* This test has to detect whether the spawned client process hangs, which can
+ * not be done reliably. As an approximation, it waits for 10 sec and considers
+ * the process hanging if it has not terminated by then.
+ */
+public final class StopMessageDispatcherTest extends ComplexTestCase {
+ public StopMessageDispatcherTest() {}
+
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() throws Exception {
+ assure(
+ "test",
+ new TestBed().execute(new Provider(), false, Client.class, 10000));
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTest test = UnoRuntime.queryInterface(
+ XTest.class, getBridge(context).getInstance("Test"));
+ Thread[] threads = new Thread[101];
+ int n = Thread.enumerate(threads);
+ if (n > 100) {
+ System.err.println("ERROR: too many threads");
+ return false;
+ }
+ boolean stopped = false;
+ for (int i = 0; i < n; ++i) {
+ if (threads[i].getName().equals("MessageDispatcher")) {
+ threads[i].stop();
+ stopped = true;
+ break;
+ }
+ }
+ if (!stopped) {
+ System.err.println("ERROR: thread not found");
+ return false;
+ }
+ try {
+ test.call();
+ System.err.println("ERROR: no DisposedException");
+ return false;
+ } catch (DisposedException e) {
+ return true;
+ }
+ }
+
+ private Client() {}
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTest() {
+ public void call() {}
+ };
+ }
+ }
+
+ public interface XTest extends XInterface {
+ void call();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) };
+ }
+}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk
new file mode 100644
index 000000000000..e532a012c615
--- /dev/null
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..$/..$/..$/..$/..$/..$/..
+PRJNAME := bridges
+TARGET := test_com_sun_star_lib_uno_bridges_javaremote
+
+PACKAGE := com$/sun$/star$/lib$/uno$/bridges$/javaremote
+JAVATESTFILES := \
+ Bug51323_Test.java \
+ Bug92174_Test.java \
+ Bug97697_Test.java \
+ Bug98508_Test.java \
+ Bug107753_Test.java \
+ Bug108825_Test.java \
+ Bug110892_Test.java \
+ Bug111153_Test.java \
+ Bug114133_Test.java \
+ MethodIdTest.java \
+ PolyStructTest.java \
+ StopMessageDispatcherTest.java
+IDLTESTFILES := \
+ Bug98508_Test.idl \
+ PolyStructTest.idl
+JARFILES := juh.jar jurt.jar ridl.jar
+
+.INCLUDE: javaunittest.mk