summaryrefslogtreecommitdiff
path: root/bridges/test
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/test')
-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
-rw-r--r--bridges/test/inter_libs_exc/inter.cxx66
-rw-r--r--bridges/test/inter_libs_exc/makefile.mk80
-rw-r--r--bridges/test/inter_libs_exc/share.h7
-rw-r--r--bridges/test/inter_libs_exc/starter.cxx65
-rw-r--r--bridges/test/inter_libs_exc/starter.map7
-rw-r--r--bridges/test/inter_libs_exc/thrower.cxx48
-rw-r--r--bridges/test/inter_libs_exc/thrower.map7
-rw-r--r--bridges/test/java_uno/acquire/TestAcquire.java304
-rw-r--r--bridges/test/java_uno/acquire/makefile.mk117
-rw-r--r--bridges/test/java_uno/acquire/readme.txt21
-rw-r--r--bridges/test/java_uno/acquire/testacquire.cxx574
-rw-r--r--bridges/test/java_uno/acquire/types.idl68
-rw-r--r--bridges/test/java_uno/any/TestAny.java2267
-rw-r--r--bridges/test/java_uno/any/TestJni.java48
-rw-r--r--bridges/test/java_uno/any/TestRemote.java64
-rw-r--r--bridges/test/java_uno/any/makefile.mk127
-rw-r--r--bridges/test/java_uno/any/test_javauno_any.map6
-rw-r--r--bridges/test/java_uno/any/transport.cxx108
-rw-r--r--bridges/test/java_uno/any/types.idl42
-rw-r--r--bridges/test/java_uno/equals/TestEquals.java1304
-rw-r--r--bridges/test/java_uno/equals/makefile.mk96
-rw-r--r--bridges/test/java_uno/equals/testequals.cxx232
-rw-r--r--bridges/test/java_uno/equals/types.idl47
-rw-r--r--bridges/test/java_uno/nativethreadpool/Relay.java125
-rw-r--r--bridges/test/java_uno/nativethreadpool/makefile.mk121
-rw-r--r--bridges/test/java_uno/nativethreadpool/readme39
-rw-r--r--bridges/test/java_uno/nativethreadpool/relay.manifest2
-rw-r--r--bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx184
-rw-r--r--bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx146
-rw-r--r--bridges/test/java_uno/nativethreadpool/types.idl40
-rw-r--r--bridges/test/java_uno/nativethreadpool/version.map35
-rw-r--r--bridges/test/makefile.mk175
-rw-r--r--bridges/test/performance/makefile.mk62
-rw-r--r--bridges/test/performance/testperformance.cxx190
-rw-r--r--bridges/test/test_bridge.idl82
-rw-r--r--bridges/test/testclient.cxx247
-rw-r--r--bridges/test/testclient.java156
-rw-r--r--bridges/test/testcomp.cxx799
-rw-r--r--bridges/test/testcomp.h156
-rw-r--r--bridges/test/testoffice.cxx279
-rw-r--r--bridges/test/testsameprocess.cxx215
-rw-r--r--bridges/test/testserver.cxx253
59 files changed, 11512 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
diff --git a/bridges/test/inter_libs_exc/inter.cxx b/bridges/test/inter_libs_exc/inter.cxx
new file mode 100644
index 000000000000..799b5f02fc87
--- /dev/null
+++ b/bridges/test/inter_libs_exc/inter.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include <stdio.h>
+#include "share.h"
+
+#include <rtl/string.hxx>
+#include <osl/module.hxx>
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+extern "C" int main( int argc, char const * argv [] )
+{
+#ifdef SAL_W32
+#define SAL_DLLPREFIX ""
+#endif
+ Module mod_starter(
+ OUSTR(SAL_DLLPREFIX"starter"SAL_DLLEXTENSION),
+ SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+ Module mod_thrower(
+ OUSTR(SAL_DLLPREFIX"thrower"SAL_DLLEXTENSION),
+ SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+
+ typedef t_throws_exc (SAL_CALL * t_get_thrower)();
+ t_get_thrower get_thrower = (t_get_thrower)mod_thrower.getSymbol( OUSTR("get_thrower") );
+ t_throws_exc thrower = (*get_thrower)();
+
+ typedef void (SAL_CALL * t_starter)( t_throws_exc );
+ t_starter start = (t_starter)mod_starter.getSymbol( OUSTR("start") );
+
+ (*start)( thrower );
+
+ return 0;
+}
diff --git a/bridges/test/inter_libs_exc/makefile.mk b/bridges/test/inter_libs_exc/makefile.mk
new file mode 100644
index 000000000000..7f9ff0512e24
--- /dev/null
+++ b/bridges/test/inter_libs_exc/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# 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=inter
+LIBTARGET=NO
+TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/udkapi.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb
+
+# output directory (one dir for each project)
+UNOUCROUT=$(OUT)$/inc$/$(TARGET)
+
+# adding to inludeoath
+INCPRE+=$(UNOUCROUT)
+
+UNOTYPESTYPES := \
+ com.sun.star.lang.IllegalArgumentException \
+ com.sun.star.uno.DeploymentException
+
+SLOFILES=$(SLO)$/starter.obj $(SLO)$/thrower.obj
+
+SHL1TARGET=starter
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1OBJS=$(SLO)$/starter.obj
+DEF1NAME=$(SHL1TARGET)
+SHL1STDLIBS+= $(CPPULIB) $(SALLIB)
+SHL1VERSIONMAP=$(SHL1TARGET).map
+
+SHL2TARGET=thrower
+SHL2DEF=$(MISC)$/$(SHL2TARGET).def
+SHL2IMPLIB=i$(SHL2TARGET)
+SHL2OBJS=$(SLO)$/thrower.obj
+DEF2NAME=$(SHL2TARGET)
+SHL2STDLIBS+= $(CPPULIB) $(SALLIB)
+SHL2VERSIONMAP=$(SHL2TARGET).map
+
+OBJFILES=$(OBJ)$/inter.obj
+APP1TARGET=inter
+APP1OBJS=$(OBJ)$/inter.obj
+APP1STDLIBS+=\
+ $(SALLIB)
+
+.INCLUDE : target.mk
+
diff --git a/bridges/test/inter_libs_exc/share.h b/bridges/test/inter_libs_exc/share.h
new file mode 100644
index 000000000000..28c4dfd5bb15
--- /dev/null
+++ b/bridges/test/inter_libs_exc/share.h
@@ -0,0 +1,7 @@
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/DeploymentException.hpp>
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+typedef void (SAL_CALL * t_throws_exc)();
diff --git a/bridges/test/inter_libs_exc/starter.cxx b/bridges/test/inter_libs_exc/starter.cxx
new file mode 100644
index 000000000000..4a1207db0e91
--- /dev/null
+++ b/bridges/test/inter_libs_exc/starter.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include <stdio.h>
+#include "share.h"
+
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+static void some_more( t_throws_exc p )
+{
+ (*p)();
+}
+
+extern "C" void SAL_CALL start( t_throws_exc p )
+{
+ try
+ {
+ some_more( p );
+ }
+ catch (lang::IllegalArgumentException & exc)
+ {
+ OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ printf( "starter.cxx: caught IllegalArgumentException: %s\n", msg.getStr() );
+ }
+ catch (Exception & exc)
+ {
+ OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ printf( "starter.cxx: caught some UNO exc: %s\n", msg.getStr() );
+ }
+ catch (...)
+ {
+ printf( "starter.cxx: caught something\n" );
+ }
+}
diff --git a/bridges/test/inter_libs_exc/starter.map b/bridges/test/inter_libs_exc/starter.map
new file mode 100644
index 000000000000..69bf77c0a34b
--- /dev/null
+++ b/bridges/test/inter_libs_exc/starter.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ start;
+ local:
+ *;
+};
+
diff --git a/bridges/test/inter_libs_exc/thrower.cxx b/bridges/test/inter_libs_exc/thrower.cxx
new file mode 100644
index 000000000000..e90ab6a21e84
--- /dev/null
+++ b/bridges/test/inter_libs_exc/thrower.cxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include "share.h"
+
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+static void SAL_CALL throws_exc()
+{
+ throw lang::IllegalArgumentException(
+ OUSTR("bla"), Reference< XInterface >(), 0 );
+}
+
+extern "C" t_throws_exc SAL_CALL get_thrower()
+{
+ return throws_exc;
+}
diff --git a/bridges/test/inter_libs_exc/thrower.map b/bridges/test/inter_libs_exc/thrower.map
new file mode 100644
index 000000000000..163d434e0121
--- /dev/null
+++ b/bridges/test/inter_libs_exc/thrower.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ get_thrower;
+ local:
+ *;
+};
+
diff --git a/bridges/test/java_uno/acquire/TestAcquire.java b/bridges/test/java_uno/acquire/TestAcquire.java
new file mode 100644
index 000000000000..0314e6bfcf9d
--- /dev/null
+++ b/bridges/test/java_uno/acquire/TestAcquire.java
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * 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 test.javauno.acquire;
+
+import com.sun.star.bridge.UnoUrlResolver;
+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.XAcceptor;
+import com.sun.star.connection.XConnection;
+import com.sun.star.lib.uno.helper.UnoUrl;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import util.WaitUnreachable;
+
+public final class TestAcquire {
+ public static void main(String[] arguments) throws Exception {
+ // - arguments[0] must be "client" or "server"
+ // - arguments[1] must be the UNO URL to connect to (client) or accept
+ // on (server)
+ XComponentContext context
+ = Bootstrap.createInitialComponentContext(null);
+ if (arguments[0].equals("client")) {
+ execClient(context, arguments[1]);
+ } else {
+ execServer(context, arguments[1]);
+ }
+ }
+
+ private static void assertNotNull(Object obj) {
+ if (obj == null) {
+ throw new RuntimeException("assertNotNull failed");
+ }
+ }
+
+ private static void receive(Object obj) {
+ assertNotNull(obj);
+ WaitUnreachable.ensureFinalization(obj);
+ }
+
+ private static void execClient(XComponentContext context, String url)
+ throws Exception
+ {
+ XTest test = UnoRuntime.queryInterface(
+ XTest.class, UnoUrlResolver.create(context).resolve(url));
+
+ WaitUnreachable u;
+
+ u = new WaitUnreachable(new XInterface() {});
+ test.setInterfaceToInterface((XInterface) u.get());
+ receive(test.getInterfaceFromInterface());
+ test.clearInterface();
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XBase() {});
+ test.setInterfaceToInterface((XBase) u.get());
+ receive(test.getInterfaceFromInterface());
+ test.clearInterface();
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XDerived() {});
+ test.setInterfaceToInterface((XDerived) u.get());
+ receive(test.getInterfaceFromInterface());
+ test.clearInterface();
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XBase() {});
+ test.setBaseToInterface((XBase) u.get());
+ receive(test.getInterfaceFromInterface());
+ test.clearInterface();
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XDerived() {});
+ test.setBaseToInterface((XDerived) u.get());
+ receive(test.getInterfaceFromInterface());
+ test.clearInterface();
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XDerived() {});
+ test.setDerivedToInterface((XDerived) u.get());
+ receive(test.getInterfaceFromInterface());
+ test.clearInterface();
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XBase() {});
+ test.setBaseToBase((XBase) u.get());
+ receive(test.getInterfaceFromBase());
+ receive(test.getBaseFromBase());
+ test.clearBase();
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XDerived() {});
+ test.setBaseToBase((XDerived) u.get());
+ receive(test.getInterfaceFromBase());
+ receive(test.getBaseFromBase());
+ test.clearBase();
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XDerived() {});
+ test.setDerivedToBase((XDerived) u.get());
+ receive(test.getInterfaceFromBase());
+ receive(test.getBaseFromBase());
+ test.clearBase();
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XDerived() {});
+ test.setDerivedToDerived((XDerived) u.get());
+ receive(test.getInterfaceFromDerived());
+ receive(test.getBaseFromDerived());
+ receive(test.getDerivedFromDerived());
+ test.clearDerived();
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XInterface() {});
+ receive(test.roundTripInterfaceToInterface((XInterface) u.get()));
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XBase() {});
+ receive(test.roundTripInterfaceToInterface((XBase) u.get()));
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XDerived() {});
+ receive(test.roundTripInterfaceToInterface((XDerived) u.get()));
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XBase() {});
+ receive(test.roundTripBaseToInterface((XBase) u.get()));
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XDerived() {});
+ receive(test.roundTripBaseToInterface((XDerived) u.get()));
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XDerived() {});
+ receive(test.roundTripDerivedToInterface((XDerived) u.get()));
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XBase() {});
+ receive(test.roundTripBaseToBase((XBase) u.get()));
+ u.waitUnreachable();
+ u = new WaitUnreachable(new XDerived() {});
+ receive(test.roundTripBaseToBase((XDerived) u.get()));
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XDerived() {});
+ receive(test.roundTripDerivedToBase((XDerived) u.get()));
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(new XDerived() {});
+ receive(test.roundTripDerivedToDerived((XDerived) u.get()));
+ u.waitUnreachable();
+
+ u = new WaitUnreachable(test);
+ test = null;
+ u.waitUnreachable();
+ System.out.println(
+ "Client and server both cleanly terminate now: Success");
+ }
+
+ private static void execServer(XComponentContext context, String url)
+ throws Exception
+ {
+ XAcceptor acceptor = Acceptor.create(context);
+ XBridgeFactory factory = UnoRuntime.queryInterface(
+ XBridgeFactory.class,
+ context.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", context));
+ UnoUrl unoUrl = UnoUrl.parseUnoUrl(url);
+ System.out.println("Server: Accepting...");
+ XConnection connection = acceptor.accept(
+ unoUrl.getConnectionAndParametersAsString());
+ System.out.println("Server: ...connected...");
+ factory.createBridge(
+ "", unoUrl.getProtocolAndParametersAsString(), connection,
+ new Provider());
+ System.out.println("Server: ...bridged.");
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTest() {
+ public void setInterfaceToInterface(Object obj) {
+ iface = obj;
+ }
+
+ public void setBaseToInterface(XBase obj) {
+ iface = obj;
+ }
+
+ public void setDerivedToInterface(XDerived obj) {
+ iface = obj;
+ }
+
+ public Object getInterfaceFromInterface() {
+ return iface;
+ }
+
+ public void clearInterface() {
+ WaitUnreachable u = new WaitUnreachable(iface);
+ iface = null;
+ u.waitUnreachable();
+ }
+
+ public void setBaseToBase(XBase obj) {
+ base = obj;
+ }
+
+ public void setDerivedToBase(XDerived obj) {
+ base = obj;
+ }
+
+ public Object getInterfaceFromBase() {
+ return base;
+ }
+
+ public XBase getBaseFromBase() {
+ return base;
+ }
+
+ public void clearBase() {
+ WaitUnreachable u = new WaitUnreachable(base);
+ base = null;
+ u.waitUnreachable();
+ }
+
+ public void setDerivedToDerived(XDerived obj) {
+ derived = obj;
+ }
+
+ public Object getInterfaceFromDerived() {
+ return derived;
+ }
+
+ public XBase getBaseFromDerived() {
+ return derived;
+ }
+
+ public XDerived getDerivedFromDerived() {
+ return derived;
+ }
+
+ public void clearDerived() {
+ WaitUnreachable u = new WaitUnreachable(derived);
+ derived = null;
+ u.waitUnreachable();
+ }
+
+ public Object roundTripInterfaceToInterface(Object obj) {
+ WaitUnreachable.ensureFinalization(obj);
+ return obj;
+ }
+
+ public Object roundTripBaseToInterface(XBase obj) {
+ WaitUnreachable.ensureFinalization(obj);
+ return obj;
+ }
+
+ public Object roundTripDerivedToInterface(XDerived obj) {
+ WaitUnreachable.ensureFinalization(obj);
+ return obj;
+ }
+
+ public XBase roundTripBaseToBase(XBase obj) {
+ WaitUnreachable.ensureFinalization(obj);
+ return obj;
+ }
+
+ public XBase roundTripDerivedToBase(XDerived obj) {
+ WaitUnreachable.ensureFinalization(obj);
+ return obj;
+ }
+
+ public XDerived roundTripDerivedToDerived(XDerived obj) {
+ WaitUnreachable.ensureFinalization(obj);
+ return obj;
+ }
+
+ private Object iface;
+ private XBase base;
+ private XDerived derived;
+ };
+ }
+ }
+}
diff --git a/bridges/test/java_uno/acquire/makefile.mk b/bridges/test/java_uno/acquire/makefile.mk
new file mode 100644
index 000000000000..def12dd53c49
--- /dev/null
+++ b/bridges/test/java_uno/acquire/makefile.mk
@@ -0,0 +1,117 @@
+#*************************************************************************
+#
+# 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_javauno_acquire
+PACKAGE := test$/javauno$/acquire
+
+ENABLE_EXCEPTIONS := TRUE
+
+.INCLUDE: settings.mk
+
+DLLPRE = # no leading "lib" on .so files
+INCPRE += $(MISC)$/$(TARGET)$/inc
+
+SLOFILES = $(SLO)$/testacquire.obj
+
+SHL1TARGET = testacquire.uno
+SHL1OBJS = $(SLOFILES)
+SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
+SHL1VERSIONMAP = $(SOLARENV)/src/component.map
+SHL1IMPLIB = itestacquire
+
+JAVAFILES = TestAcquire.java
+JARFILES = OOoRunner.jar juh.jar jurt.jar ridl.jar
+
+.INCLUDE: target.mk
+
+ALLTAR: \
+ $(BIN)$/testacquire-java-client \
+ $(BIN)$/testacquire-java-server \
+ $(BIN)$/testacquire-native-client \
+ $(BIN)$/testacquire-native-server
+
+.IF "$(GUI)" == "WNT"
+GIVE_EXEC_RIGHTS = @echo
+.ELSE # GUI, WNT
+GIVE_EXEC_RIGHTS = chmod +x
+.ENDIF # GUI, WNT
+
+EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i)
+EXEC_CLASSPATH = \
+ $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/)))
+
+$(BIN)$/$(TARGET).rdb: types.idl
+ - rm $@
+ - $(MKDIR) $(MISC)$/$(TARGET)
+ - $(MKDIR) $(MISC)$/$(TARGET)$/inc
+ $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $<
+ $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/types.urd
+ $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb
+ $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb
+ $(REGMERGE) $@ / $(SOLARBINDIR)$/types.rdb
+ $(REGCOMP) -register -r $@ -c acceptor.uno$(DLLPOST) \
+ -c bridgefac.uno$(DLLPOST) -c connector.uno$(DLLPOST) \
+ -c remotebridge.uno$(DLLPOST) -c uuresolver.uno$(DLLPOST)
+
+$(SLOFILES) $(JAVACLASSFILES): $(BIN)$/$(TARGET).rdb
+
+# Use "127.0.0.1" instead of "localhost", see #i32281#:
+TEST_JAVAUNO_ACQUIRE_UNO_URL := \
+ \"'uno:socket,host=127.0.0.1,port=2002;urp;test'\"
+
+$(BIN)$/testacquire-java-client:
+ echo java -classpath \
+ ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\
+..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \
+ test.javauno.acquire.TestAcquire client \
+ $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@
+ $(GIVE_EXEC_RIGHTS) $@
+
+$(BIN)$/testacquire-java-server:
+ echo java -classpath \
+ ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\
+..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \
+ test.javauno.acquire.TestAcquire server \
+ $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@
+ $(GIVE_EXEC_RIGHTS) $@
+
+$(BIN)$/testacquire-native-client:
+ echo '$(AUGMENT_LIBRARY_PATH)' uno \
+ -c com.sun.star.test.bridges.testacquire.impl \
+ -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb -- \
+ $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@
+ $(GIVE_EXEC_RIGHTS) $@
+
+$(BIN)$/testacquire-native-server:
+ echo '$(AUGMENT_LIBRARY_PATH)' uno \
+ -c com.sun.star.test.bridges.testacquire.impl \
+ -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb \
+ -u $(TEST_JAVAUNO_ACQUIRE_UNO_URL) --singleaccept > $@
+ $(GIVE_EXEC_RIGHTS) $@
diff --git a/bridges/test/java_uno/acquire/readme.txt b/bridges/test/java_uno/acquire/readme.txt
new file mode 100644
index 000000000000..40bdf645c295
--- /dev/null
+++ b/bridges/test/java_uno/acquire/readme.txt
@@ -0,0 +1,21 @@
+Test scenarios:
+
+> cd .../bridges/<outdir>/bin
+> ./testacquire-java-server &
+> sleep 3 # wait for server to accept connection
+> ./testacquire-java-client
+
+> cd .../bridges/<outdir>/bin
+> ./testacquire-java-server &
+> sleep 3 # wait for server to accept connection
+> ./testacquire-native-client
+
+> cd .../bridges/<outdir>/bin
+> ./testacquire-native-server &
+> sleep 3 # wait for server to accept connection
+> ./testacquire-java-client
+
+> cd .../bridges/<outdir>/bin
+> ./testacquire-native-server &
+> sleep 3 # wait for server to accept connection
+> ./testacquire-native-client
diff --git a/bridges/test/java_uno/acquire/testacquire.cxx b/bridges/test/java_uno/acquire/testacquire.cxx
new file mode 100644
index 000000000000..897986c91aa5
--- /dev/null
+++ b/bridges/test/java_uno/acquire/testacquire.cxx
@@ -0,0 +1,574 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include "com/sun/star/bridge/UnoUrlResolver.hpp"
+#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "com/sun/star/lang/XMain.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "com/sun/star/registry/InvalidRegistryException.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/Type.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/conditn.hxx"
+#include "osl/interlck.h"
+#include "rtl/string.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "test/javauno/acquire/XBase.hpp"
+#include "test/javauno/acquire/XDerived.hpp"
+#include "test/javauno/acquire/XTest.hpp"
+#include "uno/environment.h"
+#include "uno/lbnames.h"
+
+#include <iostream>
+#include <cstdlib>
+
+namespace css = com::sun::star;
+
+namespace {
+
+class WaitCondition {
+public:
+ WaitCondition() {}
+
+ ~WaitCondition();
+
+ osl::Condition & get() { return m_condition; }
+
+private:
+ WaitCondition(WaitCondition &); // not implemented
+ void operator =(WaitCondition); // not implemented
+
+ osl::Condition m_condition;
+};
+
+}
+
+WaitCondition::~WaitCondition() {
+ std::cout << "waiting for condition\n";
+ if (m_condition.wait() != osl::Condition::result_ok) {
+ throw "osl::Condition::wait failed";
+ }
+}
+
+namespace {
+
+class Interface: public css::uno::XInterface {
+public:
+ explicit Interface(osl::Condition & condition):
+ m_condition(condition), m_refCount(0) {}
+
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw ()
+ { osl_incrementInterlockedCount(&m_refCount); }
+
+ virtual void SAL_CALL release() throw ();
+
+protected:
+ virtual ~Interface() { m_condition.set(); }
+
+private:
+ Interface(Interface &); // not implemented
+ void operator =(Interface); // not implemented
+
+ osl::Condition & m_condition;
+ oslInterlockedCount m_refCount;
+};
+
+}
+
+css::uno::Any Interface::queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException)
+{
+ return type.getTypeName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.uno.XInterface"))
+ ? css::uno::makeAny(css::uno::Reference< css::uno::XInterface >(this))
+ : css::uno::Any();
+}
+
+void Interface::release() throw () {
+ if (osl_decrementInterlockedCount(&m_refCount) == 0) {
+ delete this;
+ }
+}
+
+namespace {
+
+class Base: public Interface, public test::javauno::acquire::XBase {
+public:
+ explicit Base(osl::Condition & condition): Interface(condition) {}
+
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw () { Interface::acquire(); }
+
+ virtual void SAL_CALL release() throw () { Interface::release(); }
+
+protected:
+ virtual ~Base() {}
+};
+
+}
+
+css::uno::Any Base::queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException)
+{
+ return type.getTypeName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "test.javauno.acquire.XBase"))
+ ? css::uno::makeAny(
+ css::uno::Reference< test::javauno::acquire::XBase >(this))
+ : Interface::queryInterface(type);
+}
+
+namespace {
+
+class Derived: public Base, public test::javauno::acquire::XDerived {
+public:
+ explicit Derived(osl::Condition & condition): Base(condition) {}
+
+ virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw () { Base::acquire(); }
+
+ virtual void SAL_CALL release() throw () { Base::release(); }
+
+private:
+ virtual ~Derived() {}
+};
+
+}
+
+css::uno::Any Derived::queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException)
+{
+ return (type.getTypeName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("test.javauno.acquire.XDerived")))
+ ? css::uno::makeAny(
+ css::uno::Reference< test::javauno::acquire::XDerived >(this))
+ : Interface::queryInterface(type);
+}
+
+namespace {
+
+class Service: public cppu::WeakImplHelper3<
+ css::lang::XServiceInfo, css::lang::XMain, test::javauno::acquire::XTest >
+{
+public:
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return getImplementationName_static(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return getSupportedServiceNames_static(); }
+
+ virtual sal_Int32 SAL_CALL
+ run(css::uno::Sequence< rtl::OUString > const & arguments)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL setInterfaceToInterface(
+ css::uno::Reference< css::uno::XInterface > const & obj)
+ throw (css::uno::RuntimeException)
+ { m_interface = obj; }
+
+ virtual void SAL_CALL setBaseToInterface(
+ css::uno::Reference< test::javauno::acquire::XBase > const & obj)
+ throw (css::uno::RuntimeException)
+ { m_interface = obj; }
+
+ virtual void SAL_CALL setDerivedToInterface(
+ css::uno::Reference< test::javauno::acquire::XDerived > const & obj)
+ throw (css::uno::RuntimeException)
+ { m_interface = obj; }
+
+ virtual css::uno::Reference< css::uno::XInterface >
+ SAL_CALL getInterfaceFromInterface() throw (css::uno::RuntimeException)
+ { return m_interface; }
+
+ virtual void SAL_CALL clearInterface() throw (css::uno::RuntimeException)
+ { m_interface.clear(); }
+
+ virtual void SAL_CALL setBaseToBase(
+ css::uno::Reference< test::javauno::acquire::XBase > const & obj)
+ throw (css::uno::RuntimeException)
+ { m_base = obj; }
+
+ virtual void SAL_CALL setDerivedToBase(
+ css::uno::Reference< test::javauno::acquire::XDerived > const & obj)
+ throw (css::uno::RuntimeException)
+ { m_base = obj.get(); }
+
+ virtual css::uno::Reference< css::uno::XInterface >
+ SAL_CALL getInterfaceFromBase() throw (css::uno::RuntimeException)
+ { return m_base; }
+
+ virtual css::uno::Reference< test::javauno::acquire::XBase >
+ SAL_CALL getBaseFromBase() throw (css::uno::RuntimeException)
+ { return m_base; }
+
+ virtual void SAL_CALL clearBase() throw (css::uno::RuntimeException)
+ { m_base.clear(); }
+
+ virtual void SAL_CALL setDerivedToDerived(
+ css::uno::Reference< test::javauno::acquire::XDerived > const & obj)
+ throw (css::uno::RuntimeException)
+ { m_derived = obj; }
+
+ virtual css::uno::Reference< css::uno::XInterface >
+ SAL_CALL getInterfaceFromDerived() throw (css::uno::RuntimeException)
+ { return m_derived; }
+
+ virtual css::uno::Reference< test::javauno::acquire::XBase >
+ SAL_CALL getBaseFromDerived() throw (css::uno::RuntimeException)
+ { return m_derived.get(); }
+
+ virtual css::uno::Reference< test::javauno::acquire::XDerived >
+ SAL_CALL getDerivedFromDerived() throw (css::uno::RuntimeException)
+ { return m_derived; }
+
+ virtual void SAL_CALL clearDerived() throw (css::uno::RuntimeException)
+ { m_derived.clear(); }
+
+ virtual css::uno::Reference< css::uno::XInterface >
+ SAL_CALL roundTripInterfaceToInterface(
+ css::uno::Reference< css::uno::XInterface > const & obj)
+ throw (css::uno::RuntimeException)
+ { return obj; }
+
+ virtual css::uno::Reference< css::uno::XInterface >
+ SAL_CALL roundTripBaseToInterface(
+ css::uno::Reference< test::javauno::acquire::XBase > const & obj)
+ throw (css::uno::RuntimeException)
+ { return obj; }
+
+ virtual css::uno::Reference< css::uno::XInterface >
+ SAL_CALL roundTripDerivedToInterface(
+ css::uno::Reference< test::javauno::acquire::XDerived > const & obj)
+ throw (css::uno::RuntimeException)
+ { return obj; }
+
+ virtual css::uno::Reference< test::javauno::acquire::XBase >
+ SAL_CALL roundTripBaseToBase(
+ css::uno::Reference< test::javauno::acquire::XBase > const & obj)
+ throw (css::uno::RuntimeException)
+ { return obj; }
+
+ virtual css::uno::Reference< test::javauno::acquire::XBase >
+ SAL_CALL roundTripDerivedToBase(
+ css::uno::Reference< test::javauno::acquire::XDerived > const & obj)
+ throw (css::uno::RuntimeException)
+ { return obj.get(); }
+
+ virtual css::uno::Reference< test::javauno::acquire::XDerived >
+ SAL_CALL roundTripDerivedToDerived(
+ css::uno::Reference< test::javauno::acquire::XDerived > const & obj)
+ throw (css::uno::RuntimeException)
+ { return obj; }
+
+ static rtl::OUString getImplementationName_static();
+
+ static css::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_static();
+
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const & context)
+ throw (css::uno::Exception);
+
+private:
+ explicit Service(
+ css::uno::Reference< css::uno::XComponentContext > const & context):
+ m_context(context) {}
+
+ css::uno::Reference< css::uno::XComponentContext > m_context;
+ css::uno::Reference< css::uno::XInterface > m_interface;
+ css::uno::Reference< test::javauno::acquire::XBase > m_base;
+ css::uno::Reference< test::javauno::acquire::XDerived > m_derived;
+};
+
+}
+
+sal_Bool Service::supportsService(rtl::OUString const & serviceName)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > names(
+ getSupportedServiceNames_static());
+ for (sal_Int32 i = 0; i< names.getLength(); ++i) {
+ if (names[i] == serviceName) {
+ return true;
+ }
+ }
+ return false;
+}
+
+namespace {
+
+template< typename T > void assertNotNull(css::uno::Reference< T > const & ref)
+{
+ if (!ref.is()) {
+ std::cerr << "assertNotNull failed\n";
+ std::abort();
+ }
+}
+
+}
+
+sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const & arguments)
+ throw (css::uno::RuntimeException)
+{
+ // - arguments[0] must be the UNO URL to connect to:
+ css::uno::Reference< XTest > test(
+ css::bridge::UnoUrlResolver::create(m_context)->resolve(arguments[0]),
+ css::uno::UNO_QUERY_THROW);
+
+ {
+ WaitCondition c;
+ test->setInterfaceToInterface(new Interface(c.get()));
+ assertNotNull(test->getInterfaceFromInterface());
+ test->clearInterface();
+ }
+ {
+ WaitCondition c;
+ test->setInterfaceToInterface(
+ static_cast< Interface * >(new Base(c.get())));
+ assertNotNull(test->getInterfaceFromInterface());
+ test->clearInterface();
+ }
+ {
+ WaitCondition c;
+ test->setInterfaceToInterface(
+ static_cast< Interface * >(new Derived(c.get())));
+ assertNotNull(test->getInterfaceFromInterface());
+ test->clearInterface();
+ }
+
+ {
+ WaitCondition c;
+ test->setBaseToInterface(new Base(c.get()));
+ assertNotNull(test->getInterfaceFromInterface());
+ test->clearInterface();
+ }
+ {
+ WaitCondition c;
+ test->setBaseToInterface(static_cast< Base * >(new Derived(c.get())));
+ assertNotNull(test->getInterfaceFromInterface());
+ test->clearInterface();
+ }
+
+ {
+ WaitCondition c;
+ test->setDerivedToInterface(new Derived(c.get()));
+ assertNotNull(test->getInterfaceFromInterface());
+ test->clearInterface();
+ }
+
+ {
+ WaitCondition c;
+ test->setBaseToBase(new Base(c.get()));
+ assertNotNull(test->getInterfaceFromBase());
+ assertNotNull(test->getBaseFromBase());
+ test->clearBase();
+ }
+ {
+ WaitCondition c;
+ test->setBaseToBase(static_cast< Base * >(new Derived(c.get())));
+ assertNotNull(test->getInterfaceFromBase());
+ assertNotNull(test->getBaseFromBase());
+ test->clearBase();
+ }
+
+ {
+ WaitCondition c;
+ test->setDerivedToBase(new Derived(c.get()));
+ assertNotNull(test->getInterfaceFromBase());
+ assertNotNull(test->getBaseFromBase());
+ test->clearBase();
+ }
+
+ {
+ WaitCondition c;
+ test->setDerivedToDerived(new Derived(c.get()));
+ assertNotNull(test->getInterfaceFromDerived());
+ assertNotNull(test->getBaseFromDerived());
+ assertNotNull(test->getDerivedFromDerived());
+ test->clearDerived();
+ }
+
+ {
+ WaitCondition c;
+ assertNotNull(
+ test->roundTripInterfaceToInterface(new Interface(c.get())));
+ }
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripInterfaceToInterface(
+ static_cast< Interface * >(new Base(c.get()))));
+ }
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripInterfaceToInterface(
+ static_cast< Interface * >(new Derived(c.get()))));
+ }
+
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripBaseToInterface(new Base(c.get())));
+ }
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripBaseToInterface(
+ static_cast< Base * >(new Derived(c.get()))));
+ }
+
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripDerivedToInterface(new Derived(c.get())));
+ }
+
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripBaseToBase(new Base(c.get())));
+ }
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripBaseToBase(
+ static_cast< Base * >(new Derived(c.get()))));
+ }
+
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripDerivedToBase(new Derived(c.get())));
+ }
+
+ {
+ WaitCondition c;
+ assertNotNull(test->roundTripDerivedToDerived(new Derived(c.get())));
+ }
+
+ std::cout << "Client and server both cleanly terminate now: Success\n";
+ return 0;
+}
+
+rtl::OUString Service::getImplementationName_static() {
+ return rtl::OUString::createFromAscii(
+ "com.sun.star.test.bridges.testacquire.impl");
+}
+
+css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames_static() {
+ css::uno::Sequence< rtl::OUString > names(1);
+ names[0] = rtl::OUString::createFromAscii(
+ "com.sun.star.test.bridges.testacquire");
+ return names;
+}
+
+css::uno::Reference< css::uno::XInterface > Service::createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const & context)
+ throw (css::uno::Exception)
+{
+ return static_cast< cppu::OWeakObject * >(new Service(context));
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ char const ** envTypeName, uno_Environment **)
+{
+ if (envTypeName != 0) {
+ *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+}
+
+extern "C" void * SAL_CALL component_getFactory(char const * implName,
+ void * serviceManager, void *) {
+ void * p = 0;
+ if (serviceManager != 0) {
+ css::uno::Reference< css::lang::XSingleComponentFactory > f;
+ if (Service::getImplementationName_static().equalsAscii(implName)) {
+ f = cppu::createSingleComponentFactory(
+ &Service::createInstance,
+ Service::getImplementationName_static(),
+ Service::getSupportedServiceNames_static());
+ }
+ if (f.is()) {
+ f->acquire();
+ p = f.get();
+ }
+ }
+ return p;
+}
+
+namespace {
+
+bool writeInfo(void * registryKey, rtl::OUString const & implementationName,
+ css::uno::Sequence< rtl::OUString > const & serviceNames) {
+ rtl::OUString keyName(rtl::OUString::createFromAscii("/"));
+ keyName += implementationName;
+ keyName += rtl::OUString::createFromAscii("/UNO/SERVICES");
+ css::uno::Reference< css::registry::XRegistryKey > key;
+ try {
+ key = static_cast< css::registry::XRegistryKey * >(registryKey)->
+ createKey(keyName);
+ } catch (css::registry::InvalidRegistryException &) {}
+ if (!key.is()) {
+ return false;
+ }
+ bool success = true;
+ for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
+ try {
+ key->createKey(serviceNames[i]);
+ } catch (css::registry::InvalidRegistryException &) {
+ success = false;
+ break;
+ }
+ }
+ return success;
+}
+
+}
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) {
+ return registryKey
+ && writeInfo(registryKey, Service::getImplementationName_static(),
+ Service::getSupportedServiceNames_static());
+}
diff --git a/bridges/test/java_uno/acquire/types.idl b/bridges/test/java_uno/acquire/types.idl
new file mode 100644
index 000000000000..6dd2964777bd
--- /dev/null
+++ b/bridges/test/java_uno/acquire/types.idl
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * 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 test { module javauno { module acquire {
+
+interface XBase: com::sun::star::uno::XInterface {};
+
+interface XDerived: XBase {};
+
+interface XTest: com::sun::star::uno::XInterface
+{
+ void setInterfaceToInterface([in] com::sun::star::uno::XInterface obj);
+ void setBaseToInterface([in] XBase obj);
+ void setDerivedToInterface([in] XDerived obj);
+ com::sun::star::uno::XInterface getInterfaceFromInterface();
+ void clearInterface();
+
+ void setBaseToBase([in] XBase obj);
+ void setDerivedToBase([in] XDerived obj);
+ com::sun::star::uno::XInterface getInterfaceFromBase();
+ XBase getBaseFromBase();
+ void clearBase();
+
+ void setDerivedToDerived([in] XDerived obj);
+ com::sun::star::uno::XInterface getInterfaceFromDerived();
+ XBase getBaseFromDerived();
+ XDerived getDerivedFromDerived();
+ void clearDerived();
+
+ com::sun::star::uno::XInterface roundTripInterfaceToInterface(
+ [in] com::sun::star::uno::XInterface obj);
+ com::sun::star::uno::XInterface roundTripBaseToInterface([in] XBase obj);
+ com::sun::star::uno::XInterface roundTripDerivedToInterface(
+ [in] XDerived obj);
+
+ XBase roundTripBaseToBase([in] XBase obj);
+ XBase roundTripDerivedToBase([in] XDerived obj);
+
+ XDerived roundTripDerivedToDerived([in] XDerived obj);
+};
+
+}; }; };
diff --git a/bridges/test/java_uno/any/TestAny.java b/bridges/test/java_uno/any/TestAny.java
new file mode 100644
index 000000000000..43e8bf542479
--- /dev/null
+++ b/bridges/test/java_uno/any/TestAny.java
@@ -0,0 +1,2267 @@
+/*************************************************************************
+ *
+ * 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 test.java_uno.anytest;
+
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Enum;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.TypeClass;
+import com.sun.star.uno.XInterface;
+import java.lang.reflect.Array;
+
+final class TestAny {
+ public static boolean test(XTransport transport, boolean createTypes) {
+ boolean success = true;
+
+ // Sanity check for com.sun.star.uno.Type:
+ success &= testType(void.class, TypeClass.VOID, "void");
+ success &= testType(boolean.class, TypeClass.BOOLEAN, "boolean");
+ success &= testType(byte.class, TypeClass.BYTE, "byte");
+ success &= testType(short.class, TypeClass.SHORT, "short");
+ success &= testType(int.class, TypeClass.LONG, "long");
+ success &= testType(long.class, TypeClass.HYPER, "hyper");
+ success &= testType(float.class, TypeClass.FLOAT, "float");
+ success &= testType(double.class, TypeClass.DOUBLE, "double");
+ success &= testType(char.class, TypeClass.CHAR, "char");
+ success &= testType(String.class, TypeClass.STRING, "string");
+ success &= testType(Type.class, TypeClass.TYPE, "type");
+ success &= testType(Any.class, TypeClass.ANY, "any");
+ success &= testType(boolean[].class, TypeClass.SEQUENCE, "[]boolean");
+ success &= testType(byte[].class, TypeClass.SEQUENCE, "[]byte");
+ success &= testType(short[].class, TypeClass.SEQUENCE, "[]short");
+ success &= testType(int[].class, TypeClass.SEQUENCE, "[]long");
+ success &= testType(long[].class, TypeClass.SEQUENCE, "[]hyper");
+ success &= testType(float[].class, TypeClass.SEQUENCE, "[]float");
+ success &= testType(double[].class, TypeClass.SEQUENCE, "[]double");
+ success &= testType(char[].class, TypeClass.SEQUENCE, "[]char");
+ success &= testType(String[].class, TypeClass.SEQUENCE, "[]string");
+ success &= testType(Type[].class, TypeClass.SEQUENCE, "[]type");
+ success &= testType(Any[].class, TypeClass.SEQUENCE, "[]any");
+ success &= testType(Enum1[].class, TypeClass.SEQUENCE,
+ "[]" + Enum1.class.getName());
+ success &= testType(BaseStruct[].class, TypeClass.SEQUENCE,
+ "[]" + BaseStruct.class.getName());
+ success &= testType(DerivedStruct[].class, TypeClass.SEQUENCE,
+ "[]" + DerivedStruct.class.getName());
+ success &= testType(XInterface[].class, TypeClass.SEQUENCE,
+ "[]" + XInterface.class.getName());
+ success &= testType(BaseInterface[].class, TypeClass.SEQUENCE,
+ "[]" + BaseInterface.class.getName());
+ success &= testType(DerivedInterface[].class, TypeClass.SEQUENCE,
+ "[]" + DerivedInterface.class.getName());
+ success &= testType(boolean[][].class, TypeClass.SEQUENCE,
+ "[][]boolean");
+ success &= testType(byte[][].class, TypeClass.SEQUENCE, "[][]byte");
+ success &= testType(short[][].class, TypeClass.SEQUENCE, "[][]short");
+ success &= testType(int[][].class, TypeClass.SEQUENCE, "[][]long");
+ success &= testType(long[][].class, TypeClass.SEQUENCE, "[][]hyper");
+ success &= testType(float[][].class, TypeClass.SEQUENCE, "[][]float");
+ success &= testType(double[][].class, TypeClass.SEQUENCE, "[][]double");
+ success &= testType(char[][].class, TypeClass.SEQUENCE, "[][]char");
+ success &= testType(String[][].class, TypeClass.SEQUENCE, "[][]string");
+ success &= testType(Type[][].class, TypeClass.SEQUENCE, "[][]type");
+ success &= testType(Any[][].class, TypeClass.SEQUENCE, "[][]any");
+ success &= testType(Enum1[][].class, TypeClass.SEQUENCE,
+ "[][]" + Enum1.class.getName());
+ success &= testType(BaseStruct[][].class, TypeClass.SEQUENCE,
+ "[][]" + BaseStruct.class.getName());
+ success &= testType(DerivedStruct[][].class, TypeClass.SEQUENCE,
+ "[][]" + DerivedStruct.class.getName());
+ success &= testType(XInterface[][].class, TypeClass.SEQUENCE,
+ "[][]" + XInterface.class.getName());
+ success &= testType(BaseInterface[][].class, TypeClass.SEQUENCE,
+ "[][]" + BaseInterface.class.getName());
+ success &= testType(DerivedInterface[][].class, TypeClass.SEQUENCE,
+ "[][]" + DerivedInterface.class.getName());
+ success &= testType(Enum1.class, TypeClass.ENUM, Enum1.class.getName());
+ success &= testType(BaseStruct.class, TypeClass.STRUCT,
+ BaseStruct.class.getName());
+ success &= testType(DerivedStruct.class, TypeClass.STRUCT,
+ DerivedStruct.class.getName());
+ success &= testType(com.sun.star.uno.Exception.class,
+ TypeClass.EXCEPTION,
+ com.sun.star.uno.Exception.class.getName());
+ success &= testType(com.sun.star.uno.RuntimeException.class,
+ TypeClass.EXCEPTION,
+ com.sun.star.uno.RuntimeException.class.getName());
+ success &= testType(XInterface.class, TypeClass.INTERFACE,
+ XInterface.class.getName());
+ success &= testType(BaseInterface.class, TypeClass.INTERFACE,
+ BaseInterface.class.getName());
+ success &= testType(DerivedInterface.class, TypeClass.INTERFACE,
+ DerivedInterface.class.getName());
+
+ // VOID:
+ success &= testMapAny(transport, Any.VOID, new CompareBoxed());
+
+ // BOOLEAN:
+ success &= testMapAny(transport, Boolean.FALSE, new CompareBoxed());
+ success &= testMapAny(transport, Boolean.TRUE, new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.BOOLEAN, Boolean.FALSE),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.BOOLEAN, Boolean.TRUE),
+ new CompareUnboxed());
+
+ // BYTE:
+ success &= testMapAny(transport, new Byte((byte) -128),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Byte((byte) 0),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Byte((byte) 127),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.BYTE, new Byte((byte) -128)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.BYTE, new Byte((byte) 0)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.BYTE, new Byte((byte) 127)),
+ new CompareUnboxed());
+
+ // SHORT:
+ success &= testMapAny(transport, new Short((short) -32768),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Short((short) 0),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Short((short) 32767),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.SHORT,
+ new Short((short) -32768)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.SHORT, new Short((short) 0)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.SHORT, new Short((short) 32767)),
+ new CompareUnboxed());
+
+ // UNSIGNED SHORT:
+ success &= testMapAny(transport,
+ new Any(Type.UNSIGNED_SHORT,
+ new Short((short) 0)),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.UNSIGNED_SHORT,
+ new Short((short) -32768)),
+ new CompareBoxed());
+
+ // LONG:
+ success &= testMapAny(transport, new Integer(-2147483648),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Integer(0),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Integer(2147483647),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.LONG, new Integer(-2147483648)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.LONG, new Integer(0)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.LONG, new Integer(2147483647)),
+ new CompareUnboxed());
+
+ // UNSIGNED LONG:
+ success &= testMapAny(transport,
+ new Any(Type.UNSIGNED_LONG, new Integer(0)),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.UNSIGNED_LONG,
+ new Integer(-2147483648)),
+ new CompareBoxed());
+
+ // HYPER:
+ success &= testMapAny(transport, new Long(-9223372036854775808L),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Long(0L), new CompareBoxed());
+ success &= testMapAny(transport, new Long(9223372036854775807L),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.HYPER,
+ new Long(-9223372036854775808L)),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.HYPER, new Long(0L)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.HYPER,
+ new Long(9223372036854775807L)),
+ new CompareUnboxed());
+
+ // UNSIGNED HYPER:
+ success &= testMapAny(transport,
+ new Any(Type.UNSIGNED_HYPER, new Long(0L)),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.UNSIGNED_HYPER,
+ new Long(-9223372036854775808L)),
+ new CompareBoxed());
+
+ // FLOAT:
+ success &= testMapAny(transport, new Float(Float.NEGATIVE_INFINITY),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Float(Float.MIN_VALUE),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Float(-0.0f),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Float(0.0f),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Float(Float.MAX_VALUE),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Float(Float.POSITIVE_INFINITY),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Float(Float.NaN),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT,
+ new Float(Float.NEGATIVE_INFINITY)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT,
+ new Float(Float.MIN_VALUE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT, new Float(-0.0f)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT, new Float(0.0f)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT,
+ new Float(Float.MAX_VALUE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT,
+ new Float(Float.POSITIVE_INFINITY)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.FLOAT, new Float(Float.NaN)),
+ new CompareUnboxed());
+
+ // DOUBLE:
+ success &= testMapAny(transport,
+ new Double(Double.NEGATIVE_INFINITY),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Double(Double.MIN_VALUE),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Double(-0.0f),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Double(0.0f),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Double(Double.MAX_VALUE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Double(Double.POSITIVE_INFINITY),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Double(Double.NaN),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE,
+ new Double(Double.NEGATIVE_INFINITY)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE,
+ new Double(Double.MIN_VALUE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE, new Double(-0.0)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE, new Double(0.0)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE,
+ new Double(Double.MAX_VALUE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE,
+ new Double(Double.POSITIVE_INFINITY)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.DOUBLE, new Double(Double.NaN)),
+ new CompareUnboxed());
+
+ // CHAR:
+ success &= testMapAny(transport, new Character('\u0000'),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Character('\uDBFF'),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Character('\uFFFD'),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(Type.CHAR, new Character('\u0000')),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.CHAR, new Character('\uDBFF')),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.CHAR, new Character('\uFFFD')),
+ new CompareUnboxed());
+
+ // STRING:
+ success &= testMapAny(transport, "", new CompareBoxed());
+ success &= testMapAny(transport, "\uD800\uDC00",
+ new CompareBoxed());
+ success &= testMapAny(transport, "Test", new CompareBoxed());
+ success &= testMapAny(transport, new Any(Type.STRING, ""),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.STRING, "\uD800\uDC00"),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.STRING, "Test"),
+ new CompareUnboxed());
+
+ // TYPE:
+ success &= testMapAny(transport, Type.VOID, new CompareBoxed());
+ success &= testMapAny(transport, Type.BOOLEAN, new CompareBoxed());
+ success &= testMapAny(transport, Type.BYTE, new CompareBoxed());
+ success &= testMapAny(transport, Type.SHORT, new CompareBoxed());
+ success &= testMapAny(transport, Type.UNSIGNED_SHORT,
+ new CompareBoxed());
+ success &= testMapAny(transport, Type.LONG, new CompareBoxed());
+ success &= testMapAny(transport, Type.UNSIGNED_LONG,
+ new CompareBoxed());
+ success &= testMapAny(transport, Type.HYPER, new CompareBoxed());
+ success &= testMapAny(transport, Type.UNSIGNED_HYPER,
+ new CompareBoxed());
+ success &= testMapAny(transport, Type.FLOAT, new CompareBoxed());
+ success &= testMapAny(transport, Type.DOUBLE, new CompareBoxed());
+ success &= testMapAny(transport, Type.CHAR, new CompareBoxed());
+ success &= testMapAny(transport, Type.STRING, new CompareBoxed());
+ success &= testMapAny(transport, Type.TYPE, new CompareBoxed());
+ success &= testMapAny(transport, Type.ANY, new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]boolean", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]byte", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]short", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]unsigned short",
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]long", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]unsigned long",
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]hyper", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]unsigned hyper",
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]float", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]double", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]char", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]string", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]type", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]any", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Type("[]" + Enum1.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]" + BaseStruct.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]" + DerivedStruct.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ }
+ success &= testMapAny(transport,
+ new Type("[]" + XInterface.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]" + BaseInterface.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[]"
+ + DerivedInterface.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]boolean", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]byte", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]short", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]unsigned short",
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]long", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]unsigned long",
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]hyper", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]unsigned hyper",
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]float", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]double", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]char", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]string", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]type", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]any", TypeClass.SEQUENCE),
+ new CompareBoxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Type("[][]" + Enum1.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]" + BaseStruct.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]"
+ + DerivedStruct.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ }
+ success &= testMapAny(transport,
+ new Type("[][]" + XInterface.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]"
+ + BaseInterface.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type("[][]"
+ + DerivedInterface.class.getName(),
+ TypeClass.SEQUENCE),
+ new CompareBoxed());
+ if (createTypes) {
+ success &= testMapAny(transport, new Type(Enum1.class.getName(),
+ TypeClass.ENUM),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type(BaseStruct.class.getName(),
+ TypeClass.STRUCT),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type(DerivedStruct.class.getName(),
+ TypeClass.STRUCT),
+ new CompareBoxed());
+ }
+ success &= testMapAny(transport,
+ new Type(
+ com.sun.star.uno.Exception.class.
+ getName(),
+ TypeClass.EXCEPTION),
+ new CompareBoxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Type(BaseException.class.getName(),
+ TypeClass.EXCEPTION),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type(DerivedException.class.getName(),
+ TypeClass.EXCEPTION),
+ new CompareBoxed());
+ }
+ success &= testMapAny(transport,
+ new Type(
+ com.sun.star.uno.RuntimeException.class.
+ getName(),
+ TypeClass.EXCEPTION),
+ new CompareBoxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Type(
+ BaseRuntimeException.class.getName(),
+ TypeClass.EXCEPTION),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type(
+ DerivedRuntimeException.class.
+ getName(),
+ TypeClass.EXCEPTION),
+ new CompareBoxed());
+ }
+ success &= testMapAny(transport,
+ new Type(XInterface.class.getName(),
+ TypeClass.INTERFACE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type(BaseInterface.class.getName(),
+ TypeClass.INTERFACE),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type(DerivedInterface.class.getName(),
+ TypeClass.INTERFACE),
+ new CompareBoxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.VOID),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.BOOLEAN),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.BYTE),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.SHORT),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE, Type.UNSIGNED_SHORT),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.LONG),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE, Type.UNSIGNED_LONG),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.HYPER),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE, Type.UNSIGNED_HYPER),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.FLOAT),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.DOUBLE),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.CHAR),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.STRING),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.TYPE),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(Type.TYPE, Type.ANY),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]boolean",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]byte",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]short",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]unsigned short",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]long",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]unsigned long",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]hyper",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]unsigned hyper",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]float",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]double",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]char",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]string",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]type",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]any",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]" + Enum1.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]"
+ + BaseStruct.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ "[]"
+ + DerivedStruct.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[]"
+ + XInterface.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ "[]"
+ + BaseInterface.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ "[]"
+ + DerivedInterface.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]boolean",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]byte",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]short",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]unsigned short",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]long",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]unsigned long",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]hyper",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]unsigned hyper",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]float",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]double",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]char",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]string",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]type",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]any",
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]"
+ + Enum1.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]"
+ + BaseStruct.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ "[][]"
+ + DerivedStruct.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type("[][]"
+ + XInterface.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ "[][]"
+ + BaseInterface.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ "[][]"
+ + DerivedInterface.class.getName(),
+ TypeClass.SEQUENCE)),
+ new CompareUnboxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(Enum1.class.getName(),
+ TypeClass.ENUM)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(BaseStruct.class.getName(),
+ TypeClass.STRUCT)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ DerivedStruct.class.getName(),
+ TypeClass.STRUCT)),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ com.sun.star.uno.Exception.class.
+ getName(),
+ TypeClass.EXCEPTION)),
+ new CompareUnboxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ BaseException.class.getName(),
+ TypeClass.EXCEPTION)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ DerivedException.class.getName(),
+ TypeClass.EXCEPTION)),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ com.sun.star.uno.RuntimeException.
+ class.getName(),
+ TypeClass.EXCEPTION)),
+ new CompareUnboxed());
+ if (createTypes) {
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ BaseRuntimeException.class.
+ getName(),
+ TypeClass.EXCEPTION)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ Type.TYPE,
+ new Type(
+ DerivedRuntimeException.class.
+ getName(),
+ TypeClass.EXCEPTION)),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(XInterface.class.getName(),
+ TypeClass.INTERFACE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ BaseInterface.class.getName(),
+ TypeClass.INTERFACE)),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(Type.TYPE,
+ new Type(
+ DerivedInterface.class.getName(),
+ TypeClass.INTERFACE)),
+ new CompareUnboxed());
+
+ // Sequence Types:
+ success &= testMapAny(transport, new boolean[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport, new boolean[] { false, true },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(boolean[].class),
+ new boolean[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(boolean[].class),
+ new boolean[] { false, true }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new byte[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport, new byte[] { -128, 0, 127 },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(byte[].class),
+ new byte[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(byte[].class),
+ new byte[] { -128, 0, 127 }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new short[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport, new short[] { -32768, 0, 32767 },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(short[].class),
+ new short[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(short[].class),
+ new short[] { -32768, 0, 32767 }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[]unsigned short",
+ TypeClass.SEQUENCE),
+ new short[] {}),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[]unsigned short",
+ TypeClass.SEQUENCE),
+ new short[] { 0, -32768 }),
+ new CompareBoxed());
+ success &= testMapAny(transport, new int[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new int[] { -2147483648, 0, 2147483647 },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(int[].class),
+ new int[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(int[].class),
+ new int[] { -2147483648, 0,
+ 2147483647 }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[]unsigned long",
+ TypeClass.SEQUENCE),
+ new int[] {}),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[]unsigned long",
+ TypeClass.SEQUENCE),
+ new int[] { 0, -2147483648 }),
+ new CompareBoxed());
+ success &= testMapAny(transport, new long[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new long[] { -9223372036854775808L, 0L,
+ 9223372036854775807L },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(long[].class),
+ new long[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(long[].class),
+ new long[] { -9223372036854775808L,
+ 0L,
+ 9223372036854775807L }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[]unsigned hyper",
+ TypeClass.SEQUENCE),
+ new long[] {}),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[]unsigned hyper",
+ TypeClass.SEQUENCE),
+ new long[] { 0L,
+ -9223372036854775808L }),
+ new CompareBoxed());
+ success &= testMapAny(transport, new float[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new float[] { Float.NEGATIVE_INFINITY,
+ Float.MIN_VALUE, -0.0f, 0.0f,
+ Float.MAX_VALUE,
+ Float.POSITIVE_INFINITY,
+ Float.NaN },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(float[].class),
+ new float[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(float[].class),
+ new float[] { Float.NEGATIVE_INFINITY,
+ Float.MIN_VALUE, -0.0f,
+ 0.0f, Float.MAX_VALUE,
+ Float.POSITIVE_INFINITY,
+ Float.NaN }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new double[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new double[] { Double.NEGATIVE_INFINITY,
+ Double.MIN_VALUE, -0.0, 0.0,
+ Double.MAX_VALUE,
+ Double.POSITIVE_INFINITY,
+ Double.NaN },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(double[].class),
+ new double[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(double[].class),
+ new double[] {
+ Double.NEGATIVE_INFINITY,
+ Double.MIN_VALUE, -0.0, 0.0,
+ Double.MAX_VALUE,
+ Double.POSITIVE_INFINITY,
+ Double.NaN }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new char[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new char[] { '\u0000', '\uDBFF', '\uFFFD' },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(char[].class),
+ new char[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(char[].class),
+ new char[] { '\u0000', '\uDBFF',
+ '\uFFFD' }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new String[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new String[] { "", "\uD800\uDC00", "Test" },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(String[].class),
+ new String[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(String[].class),
+ new String[] { "", "\uD800\uDC00",
+ "Test" }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Type[] {}, new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type[] {
+ Type.VOID,
+ new Type(DerivedInterface.class.getName(),
+ TypeClass.INTERFACE) },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Type[].class),
+ new Type[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(Type[].class),
+ new Type[] {
+ Type.VOID,
+ new Type(
+ DerivedInterface.class.getName(),
+ TypeClass.INTERFACE) }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Object[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Object[] { Any.VOID, Boolean.FALSE },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Object[] {
+ Boolean.FALSE,
+ new Any(Type.BOOLEAN, Boolean.TRUE) },
+ new CompareBoxed(true));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class),
+ new Object[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class),
+ new Object[] { Any.VOID,
+ Boolean.FALSE }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class),
+ new Object[] {
+ Boolean.FALSE,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) }),
+ new CompareUnboxed(true));
+ success &= testMapAny(transport, new Any[] {},
+ new CompareSpecific(new Object[] {}));
+ success &= testMapAny(transport,
+ new Any[] { Any.VOID,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) },
+ new CompareSpecific(
+ new Object[] { Any.VOID, Boolean.TRUE }));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class), new Any[] {}),
+ new CompareSpecific(new Object[] {}));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class),
+ new Any[] { Any.VOID,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) }),
+ new CompareSpecific(
+ new Object[] { Any.VOID, Boolean.TRUE }));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class),
+ new Boolean[] {}),
+ new CompareSpecific(new Object[] {}));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[].class),
+ new Boolean[] { Boolean.FALSE }),
+ new CompareSpecific(
+ new Object[] { Boolean.FALSE }));
+ if (createTypes) {
+ success &= testMapAny(transport, new Enum1[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport, new Enum1[] { new Enum1(),
+ new Enum2() },
+ new CompareSpecific(
+ new Enum1[] { new Enum1(),
+ new Enum1() }));
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[].class),
+ new Enum1[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[].class),
+ new Enum1[] { new Enum1(),
+ new Enum2() }),
+ new CompareSpecific(
+ new Enum1[] { new Enum1(),
+ new Enum1() }));
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[].class),
+ new Enum2[] {}),
+ new CompareSpecific(new Enum1[] {}));
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[].class),
+ new Enum2[] { new Enum2() }),
+ new CompareSpecific(
+ new Enum1[] { new Enum1() }));
+ success &= testMapAny(transport, new BaseStruct[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new BaseStruct[] { new BaseStruct(),
+ new DerivedStruct() },
+ new CompareSpecific(
+ new BaseStruct[] { new BaseStruct(),
+ new BaseStruct() }));
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[].class),
+ new BaseStruct[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[].class),
+ new BaseStruct[] {
+ new BaseStruct(),
+ new DerivedStruct() }),
+ new CompareSpecific(
+ new BaseStruct[] { new BaseStruct(),
+ new BaseStruct() }));
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[].class),
+ new DerivedStruct[] {}),
+ new CompareSpecific(new BaseStruct[] {}));
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[].class),
+ new DerivedStruct[] {
+ new DerivedStruct() }),
+ new CompareSpecific(
+ new BaseStruct[] { new BaseStruct() }));
+ success &= testMapAny(transport, new DerivedStruct[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new DerivedStruct[] { new DerivedStruct() },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedStruct[].class),
+ new DerivedStruct[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedStruct[].class),
+ new DerivedStruct[] {
+ new DerivedStruct() }),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport, new XInterface[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new XInterface[] {
+ null, new XInterface() {},
+ new BaseInterface() {},
+ new DerivedInterface() {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new XInterface[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new XInterface[] {
+ null, new XInterface() {},
+ new BaseInterface() {},
+ new DerivedInterface() {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new Object[] {}),
+ new CompareSpecific(new XInterface[] {}));
+ {
+ XInterface if1 = new XInterface() {};
+ XInterface if2 = new BaseInterface() {};
+ XInterface if3 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new Object[] { null, if1, if2,
+ if3 }),
+ new CompareSpecific(
+ new XInterface[] { null, if1, if2,
+ if3 }));
+ }
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new BaseInterface[] {}),
+ new CompareSpecific(new XInterface[] {}));
+ {
+ BaseInterface if1 = new BaseInterface() {};
+ BaseInterface if2 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new BaseInterface[] { null, if1,
+ if2 }),
+ new CompareSpecific(
+ new XInterface[] { null, if1, if2 }));
+ }
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new DerivedInterface[] {}),
+ new CompareSpecific(new XInterface[] {}));
+ {
+ DerivedInterface if1 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[].class),
+ new DerivedInterface[] { null,
+ if1 }),
+ new CompareSpecific(
+ new XInterface[] { null, if1 }));
+ }
+ success &= testMapAny(transport, new BaseInterface[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new BaseInterface[] {
+ null, new BaseInterface() {},
+ new DerivedInterface() {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[].class),
+ new BaseInterface[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[].class),
+ new BaseInterface[] {
+ null, new BaseInterface() {},
+ new DerivedInterface() {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[].class),
+ new DerivedInterface[] {}),
+ new CompareSpecific(new BaseInterface[] {}));
+ {
+ DerivedInterface if1 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[].class),
+ new DerivedInterface[] { null,
+ if1 }),
+ new CompareSpecific(
+ new BaseInterface[] { null, if1 }));
+ }
+ success &= testMapAny(transport, new DerivedInterface[] {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new DerivedInterface[] {
+ null, new DerivedInterface() {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedInterface[].class),
+ new DerivedInterface[] {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedInterface[].class),
+ new DerivedInterface[] {
+ null,
+ new DerivedInterface() {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new boolean[][] { new boolean[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new boolean[][] {
+ new boolean[] { false, true } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(boolean[][].class),
+ new boolean[][] { new boolean[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(boolean[][].class),
+ new boolean[][] {
+ new boolean[] { false, true } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new byte[][] { new byte[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new byte[][] { new byte[] { -128, 0, 127 } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(byte[][].class),
+ new byte[][] { new byte[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(byte[][].class),
+ new byte[][] {
+ new byte[] { -128, 0, 127 } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new short[][] { new short[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new short[][] {
+ new short[] { -32768, 0, 32767 } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(short[][].class),
+ new short[][] { new short[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(short[][].class),
+ new short[][] {
+ new short[] { -32768, 0,
+ 32767 } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[][]unsigned short",
+ TypeClass.SEQUENCE),
+ new short[][] { new short[] {} }),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[][]unsigned short",
+ TypeClass.SEQUENCE),
+ new short[][] {
+ new short[] { 0, -32768 } }),
+ new CompareBoxed());
+ success &= testMapAny(transport, new int[][] { new int[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new int[][] { new int[] { -2147483648, 0,
+ 2147483647 } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(int[][].class),
+ new int[][] { new int[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(int[][].class),
+ new int[][] {
+ new int[] { -2147483648, 0,
+ 2147483647 } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[][]unsigned long",
+ TypeClass.SEQUENCE),
+ new int[][] { new int[] {} }),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[][]unsigned long",
+ TypeClass.SEQUENCE),
+ new int[][] {
+ new int[] { 0, -2147483648 } }),
+ new CompareBoxed());
+ success &= testMapAny(transport, new long[][] { new long[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new long[][] {
+ new long[] { -9223372036854775808L, 0L,
+ 9223372036854775807L } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(long[][].class),
+ new long[][] { new long[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(long[][].class),
+ new long[][] {
+ new long[] {
+ -9223372036854775808L, 0L,
+ 9223372036854775807L } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[][]unsigned hyper",
+ TypeClass.SEQUENCE),
+ new long[][] { new long[] {} }),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type("[][]unsigned hyper",
+ TypeClass.SEQUENCE),
+ new long[][] {
+ new long[] {
+ 0L,
+ -9223372036854775808L } }),
+ new CompareBoxed());
+ success &= testMapAny(transport, new float[][] { new float[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new float[][] {
+ new float[] { Float.NEGATIVE_INFINITY,
+ Float.MIN_VALUE, -0.0f,
+ 0.0f, Float.MAX_VALUE,
+ Float.POSITIVE_INFINITY,
+ Float.NaN } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(float[][].class),
+ new float[][] { new float[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(float[][].class),
+ new float[][] {
+ new float[] {
+ Float.NEGATIVE_INFINITY,
+ Float.MIN_VALUE, -0.0f, 0.0f,
+ Float.MAX_VALUE,
+ Float.POSITIVE_INFINITY,
+ Float.NaN } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new double[][] { new double[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new double[][] {
+ new double[] { Double.NEGATIVE_INFINITY,
+ Double.MIN_VALUE, -0.0,
+ 0.0, Double.MAX_VALUE,
+ Double.POSITIVE_INFINITY,
+ Double.NaN } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(double[][].class),
+ new double[][] { new double[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(double[][].class),
+ new double[][] {
+ new double[] {
+ Double.NEGATIVE_INFINITY,
+ Double.MIN_VALUE, -0.0, 0.0,
+ Double.MAX_VALUE,
+ Double.POSITIVE_INFINITY,
+ Double.NaN } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new char[][] { new char[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new char[][] {
+ new char[] { '\u0000', '\uDBFF',
+ '\uFFFD' } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(char[][].class),
+ new char[][] { new char[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(char[][].class),
+ new char[][] {
+ new char[] { '\u0000', '\uDBFF',
+ '\uFFFD' } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new String[][] { new String[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new String[][] {
+ new String[] { "", "\uD800\uDC00",
+ "Test" } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(String[][].class),
+ new String[][] { new String[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(String[][].class),
+ new String[][] {
+ new String[] { "", "\uD800\uDC00",
+ "Test" } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Type[][] { new Type[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Type[][] {
+ new Type[] {
+ Type.VOID,
+ new Type(
+ DerivedInterface.class.getName(),
+ TypeClass.INTERFACE) } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Type[][].class),
+ new Type[][] { new Type[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(Type[][].class),
+ new Type[][] {
+ new Type[] {
+ Type.VOID,
+ new Type(
+ DerivedInterface.class.
+ getName(),
+ TypeClass.INTERFACE) } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Object[][] { new Object[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Object[][] {
+ new Object[] { Any.VOID,
+ Boolean.FALSE } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Object[][] {
+ new Object[] {
+ Boolean.FALSE,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) } },
+ new CompareBoxed(true));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Object[][] { new Object[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Object[][] {
+ new Object[] { Any.VOID,
+ Boolean.FALSE } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Object[][] {
+ new Object[] {
+ Boolean.FALSE,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) } }),
+ new CompareUnboxed(true));
+ success &= testMapAny(transport, new Any[][] { new Any[] {} },
+ new CompareSpecific(
+ new Object[][] { new Object[] {} }));
+ success &= testMapAny(transport,
+ new Any[][] {
+ new Any[] { Any.VOID,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) } },
+ new CompareSpecific(
+ new Object[][] {
+ new Object[] { Any.VOID,
+ Boolean.TRUE } }));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Any[][] { new Any[] {} }),
+ new CompareSpecific(
+ new Object[][] { new Object[] {} }));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Any[][] {
+ new Any[] {
+ Any.VOID,
+ new Any(Type.BOOLEAN,
+ Boolean.TRUE) } }),
+ new CompareSpecific(
+ new Object[][] {
+ new Object[] { Any.VOID,
+ Boolean.TRUE } }));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Boolean[][] { new Boolean[] {} }),
+ new CompareSpecific(
+ new Object[][] { new Object[] {} }));
+ success &= testMapAny(transport,
+ new Any(new Type(Any[][].class),
+ new Boolean[][] {
+ new Boolean[] {
+ Boolean.FALSE } }),
+ new CompareSpecific(
+ new Object[][] {
+ new Object[] { Boolean.FALSE } }));
+ if (createTypes) {
+ success &= testMapAny(transport, new Enum1[][] { new Enum1[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Enum1[][] {
+ new Enum1[] { new Enum1(),
+ new Enum2() } },
+ new CompareSpecific(
+ new Enum1[][] {
+ new Enum1[] { new Enum1(),
+ new Enum1() } }));
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[][].class),
+ new Enum1[][] { new Enum1[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[][].class),
+ new Enum1[][] {
+ new Enum1[] { new Enum1(),
+ new Enum2() } }),
+ new CompareSpecific(
+ new Enum1[][] {
+ new Enum1[] { new Enum1(),
+ new Enum1() } }));
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[][].class),
+ new Enum2[][] { new Enum2[] {} }),
+ new CompareSpecific(
+ new Enum1[][] { new Enum1[] {} }));
+ success &= testMapAny(transport,
+ new Any(new Type(Enum1[][].class),
+ new Enum2[][] {
+ new Enum2[] { new Enum2() } }),
+ new CompareSpecific(
+ new Enum1[][] {
+ new Enum1[] { new Enum1() } }));
+ success &= testMapAny(transport,
+ new BaseStruct[][] { new BaseStruct[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new BaseStruct[][] {
+ new BaseStruct[] {
+ new BaseStruct(),
+ new DerivedStruct() } },
+ new CompareSpecific(
+ new BaseStruct[][] {
+ new BaseStruct[] {
+ new BaseStruct(),
+ new BaseStruct() } }));
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[][].class),
+ new BaseStruct[][] {
+ new BaseStruct[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[][].class),
+ new BaseStruct[][] {
+ new BaseStruct[] {
+ new BaseStruct(),
+ new DerivedStruct() } }),
+ new CompareSpecific(
+ new BaseStruct[][] {
+ new BaseStruct[] {
+ new BaseStruct(),
+ new BaseStruct() } }));
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[][].class),
+ new DerivedStruct[][] {
+ new DerivedStruct[] {} }),
+ new CompareSpecific(
+ new BaseStruct[][] {
+ new BaseStruct[] {} }));
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct[][].class),
+ new DerivedStruct[][] {
+ new DerivedStruct[] {
+ new DerivedStruct() } }),
+ new CompareSpecific(
+ new BaseStruct[][] {
+ new BaseStruct[] {
+ new BaseStruct() } }));
+ success &= testMapAny(transport,
+ new DerivedStruct[][] {
+ new DerivedStruct[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new DerivedStruct[][] {
+ new DerivedStruct[] {
+ new DerivedStruct() } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedStruct[][].class),
+ new DerivedStruct[][] {
+ new DerivedStruct[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedStruct[][].class),
+ new DerivedStruct[][] {
+ new DerivedStruct[] {
+ new DerivedStruct() } }),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new XInterface[][] { new XInterface[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new XInterface[][] {
+ new XInterface[] {
+ null, new XInterface() {},
+ new BaseInterface() {},
+ new DerivedInterface() {} } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new XInterface[][] {
+ new XInterface[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(XInterface[][].class),
+ new XInterface[][] {
+ new XInterface[] {
+ null, new XInterface() {},
+ new BaseInterface() {},
+ new DerivedInterface() {} } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new Object[][] { new Object[] {} }),
+ new CompareSpecific(
+ new XInterface[][] {
+ new XInterface[] {} }));
+ {
+ XInterface if1 = new XInterface() {};
+ XInterface if2 = new BaseInterface() {};
+ XInterface if3 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new Object[][] {
+ new Object[] { null, if1, if2,
+ if3 } }),
+ new CompareSpecific(
+ new XInterface[][] {
+ new XInterface[] { null, if1, if2,
+ if3 } }));
+ }
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new BaseInterface[][] {
+ new BaseInterface[] {} }),
+ new CompareSpecific(
+ new XInterface[][] {
+ new XInterface[] {} }));
+ {
+ BaseInterface if1 = new BaseInterface() {};
+ BaseInterface if2 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new BaseInterface[][] {
+ new BaseInterface[] {
+ null, if1, if2 } }),
+ new CompareSpecific(
+ new XInterface[][] {
+ new XInterface[] {
+ null, if1, if2 } }));
+ }
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new DerivedInterface[][] {
+ new DerivedInterface[] {} }),
+ new CompareSpecific(
+ new XInterface[][] {
+ new XInterface[] {} }));
+ {
+ DerivedInterface if1 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface[][].class),
+ new DerivedInterface[][] {
+ new DerivedInterface[] {
+ null, if1 } }),
+ new CompareSpecific(
+ new XInterface[][] {
+ new XInterface[] {
+ null, if1 } }));
+ }
+ success &= testMapAny(transport,
+ new BaseInterface[][] {
+ new BaseInterface[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new BaseInterface[][] {
+ new BaseInterface[] {
+ null, new BaseInterface() {},
+ new DerivedInterface() {} } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[][].class),
+ new BaseInterface[][] {
+ new BaseInterface[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(BaseInterface[][].class),
+ new BaseInterface[][] {
+ new BaseInterface[] {
+ null, new BaseInterface() {},
+ new DerivedInterface() {} } }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[][].class),
+ new DerivedInterface[][] {
+ new DerivedInterface[] {} }),
+ new CompareSpecific(
+ new BaseInterface[][] {
+ new BaseInterface[] {} }));
+ {
+ DerivedInterface if1 = new DerivedInterface() {};
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface[][].class),
+ new DerivedInterface[][] {
+ new DerivedInterface[] {
+ null, if1 } }),
+ new CompareSpecific(
+ new BaseInterface[][] {
+ new BaseInterface[] {
+ null, if1 } }));
+ }
+ success &= testMapAny(transport,
+ new DerivedInterface[][] {
+ new DerivedInterface[] {} },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new DerivedInterface[][] {
+ new DerivedInterface[] {
+ null, new DerivedInterface() {} } },
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedInterface[][].class),
+ new DerivedInterface[][] {
+ new DerivedInterface[] {} }),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(
+ new Type(DerivedInterface[][].class),
+ new DerivedInterface[][] {
+ new DerivedInterface[] {
+ null,
+ new DerivedInterface() {} } }),
+ new CompareUnboxed());
+
+ // Enum Types:
+ if (createTypes) {
+ success &= testMapAny(transport, new Enum1(), new CompareBoxed());
+ success &= testMapAny(transport, new Any(new Type(Enum1.class),
+ new Enum1()),
+ new CompareUnboxed());
+ success &= testMapAny(transport, new Any(new Type(Enum1.class),
+ new Enum2()),
+ new CompareSpecific(new Enum1()));
+ }
+
+ // Struct Types:
+ if (createTypes) {
+ success &= testMapAny(transport, new BaseStruct(),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct.class),
+ new BaseStruct()),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseStruct.class),
+ new DerivedStruct()),
+ new CompareSpecific(new BaseStruct()));
+ success &= testMapAny(transport, new DerivedStruct(),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedStruct.class),
+ new DerivedStruct()),
+ new CompareUnboxed());
+ }
+
+ // Exception Types:
+ success &= testMapAny(transport, new com.sun.star.uno.Exception(),
+ new CompareClass(
+ com.sun.star.uno.Exception.class));
+ success &= testMapAny(transport,
+ new Any(new Type(
+ com.sun.star.uno.Exception.class),
+ new com.sun.star.uno.Exception()),
+ new CompareClass(
+ com.sun.star.uno.Exception.class));
+ success &= testMapAny(transport,
+ new Any(new Type(
+ com.sun.star.uno.Exception.class),
+ new BaseException()),
+ new CompareClass(
+ com.sun.star.uno.Exception.class));
+ success &= testMapAny(transport,
+ new Any(new Type(
+ com.sun.star.uno.Exception.class),
+ new DerivedException()),
+ new CompareClass(
+ com.sun.star.uno.Exception.class));
+ if (createTypes) {
+ success &= testMapAny(transport, new BaseException(),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseException.class),
+ new BaseException()),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseException.class),
+ new DerivedException()),
+ new CompareSpecific(new BaseException()));
+ success &= testMapAny(transport, new DerivedException(),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedException.class),
+ new DerivedException()),
+ new CompareUnboxed());
+ }
+ success &= testMapAny(transport,
+ new com.sun.star.uno.RuntimeException(),
+ new CompareClass(
+ com.sun.star.uno.RuntimeException.class));
+ success &= testMapAny(transport,
+ new Any(
+ new Type(
+ com.sun.star.uno.RuntimeException.
+ class),
+ new com.sun.star.uno.RuntimeException()),
+ new CompareClass(
+ com.sun.star.uno.RuntimeException.class));
+ success &= testMapAny(transport,
+ new Any(
+ new Type(
+ com.sun.star.uno.RuntimeException.
+ class),
+ new BaseRuntimeException()),
+ new CompareClass(
+ com.sun.star.uno.RuntimeException.class));
+ success &= testMapAny(transport,
+ new Any(
+ new Type(
+ com.sun.star.uno.RuntimeException.
+ class),
+ new DerivedRuntimeException()),
+ new CompareClass(
+ com.sun.star.uno.RuntimeException.class));
+ if (createTypes) {
+ success &= testMapAny(transport, new BaseRuntimeException(),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(
+ BaseRuntimeException.class),
+ new BaseRuntimeException()),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(
+ BaseRuntimeException.class),
+ new DerivedRuntimeException()),
+ new CompareSpecific(
+ new BaseRuntimeException()));
+ success &= testMapAny(transport, new DerivedRuntimeException(),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(
+ DerivedRuntimeException.class),
+ new DerivedRuntimeException()),
+ new CompareUnboxed());
+ }
+
+ // Interface Types:
+ success &= testMapAny(transport, null, new CompareBoxed());
+ success &= testMapAny(transport, new XInterface() {},
+ new CompareBoxed());
+ success &= testMapAny(transport, new BaseInterface() {},
+ new CompareBoxed());
+ success &= testMapAny(transport, new DerivedInterface() {},
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface.class), null),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface.class),
+ new XInterface() {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface.class),
+ new BaseInterface() {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(XInterface.class),
+ new DerivedInterface() {}),
+ new CompareUnboxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface.class), null),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface.class),
+ new BaseInterface() {}),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(BaseInterface.class),
+ new DerivedInterface() {}),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedInterface.class),
+ null),
+ new CompareBoxed());
+ success &= testMapAny(transport,
+ new Any(new Type(DerivedInterface.class),
+ new DerivedInterface() {}),
+ new CompareBoxed());
+
+ // Misc:
+ try {
+ transport.mapAny(new Object());
+ System.out.println("BAD mapAny(Object), no exception");
+ success = false;
+ } catch (StackOverflowError e) {
+ System.out.println("BAD mapAny(Object): " + e);
+ success = false;
+ } catch (RuntimeException e) {}
+
+ return success;
+ }
+
+ private TestAny() {} // do not instantiate
+
+ private static boolean testType(Class zclass, TypeClass tclass,
+ String tname) {
+ Type t1 = new Type(zclass);
+ Type t2 = new Type(tname, tclass);
+ boolean ok = true;
+ if (t1.getTypeClass() != tclass) {
+ ok = false;
+ System.out.println("BAD Type(" + zclass + ").getTypeClass() = "
+ + t1.getTypeClass() + " != " + tclass);
+ }
+ if (!t1.getTypeName().equals(tname)) {
+ ok = false;
+ System.out.println("BAD Type(" + zclass + ").getTypeName() = "
+ + t1.getTypeName() + " != " + tname);
+ }
+ if (!t1.equals(t2)) {
+ ok = false;
+ System.out.println("BAD Type(" + zclass + ") != Type(" + tname
+ + ", " + tclass + ")");
+ }
+ return ok;
+ }
+
+ private static boolean testMapAny(XTransport transport, Object any,
+ Compare compare) {
+ Object any2 = transport.mapAny(any);
+ boolean eq = compare.equal(any, any2);
+ if (!eq) {
+ System.out.println("BAD mapAny(" + any + ") -> " + any2);
+ }
+ return eq;
+ }
+
+ private static abstract class Compare {
+ public abstract boolean equal(Object o1, Object o2);
+ }
+
+ private static final class CompareBoxed extends Compare {
+ public CompareBoxed() {
+ this(false);
+ }
+
+ public CompareBoxed(boolean unboxInner) {
+ this.unboxInner = unboxInner;
+ }
+
+ public boolean equal(Object o1, Object o2) {
+ if (o1 instanceof Any) {
+ return o2 instanceof Any
+ && ((Any) o1).getType().equals(((Any) o2).getType())
+ && equalValues(((Any) o1).getObject(),
+ ((Any) o2).getObject());
+ } else {
+ return equalValues(o1, o2);
+ }
+ }
+
+ private boolean equalValues(Object o1, Object o2) {
+ if (o1 == null) {
+ return o2 == null;
+ } else if (o1.getClass().isArray()) {
+ if (!(o2 != null && o1.getClass() == o2.getClass()
+ && Array.getLength(o1) == Array.getLength(o2))) {
+ return false;
+ }
+ for (int i = 0; i < Array.getLength(o1); ++i) {
+ Object oo1 = Array.get(o1, i);
+ if (unboxInner && oo1 instanceof Any) {
+ oo1 = ((Any) oo1).getObject();
+ }
+ if (!equal(oo1, Array.get(o2, i))) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return o1.equals(o2);
+ }
+ }
+
+ private final boolean unboxInner;
+ }
+
+ private static final class CompareUnboxed extends Compare {
+ public CompareUnboxed() {
+ this(false);
+ }
+
+ public CompareUnboxed(boolean unboxInner) {
+ this.unboxInner = unboxInner;
+ }
+
+ public boolean equal(Object o1, Object o2) {
+ return new CompareBoxed(unboxInner).equal(((Any) o1).getObject(),
+ o2);
+ }
+
+ private final boolean unboxInner;
+ }
+
+ private static final class CompareSpecific extends Compare {
+ public CompareSpecific(Object specific) {
+ this.specific = specific;
+ }
+
+ public boolean equal(Object o1, Object o2) {
+ return new CompareBoxed().equal(specific, o2);
+ }
+
+ private final Object specific;
+ }
+
+ private static final class CompareClass extends Compare {
+ public CompareClass(Class clazz) {
+ this.clazz = clazz;
+ }
+
+ public boolean equal(Object o1, Object o2) {
+ return o2 != null && o2.getClass() == clazz;
+ }
+
+ private final Class clazz;
+ }
+
+ public static class Enum1 extends Enum {
+ public Enum1() {
+ super(0);
+ }
+
+ public static Enum1 fromInt(int value) {
+ return new Enum1();
+ }
+
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == Enum1.class;
+ }
+ }
+
+ public static class Enum2 extends Enum1 {
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == Enum2.class;
+ }
+ }
+
+ public static class BaseStruct {
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == BaseStruct.class;
+ }
+ }
+
+ public static class DerivedStruct extends BaseStruct {
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == DerivedStruct.class;
+ }
+ }
+
+ public static class BaseException extends com.sun.star.uno.Exception {
+ public BaseException() {}
+
+ public BaseException(String message) {
+ super(message);
+ }
+
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == BaseException.class;
+ }
+ }
+
+ public static class DerivedException extends BaseException {
+ public DerivedException() {}
+
+ public DerivedException(String message) {
+ super(message);
+ }
+
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == DerivedException.class;
+ }
+ }
+
+ public static class BaseRuntimeException
+ extends com.sun.star.uno.RuntimeException
+ {
+ public BaseRuntimeException() {}
+
+ public BaseRuntimeException(String message) {
+ super(message);
+ }
+
+ public boolean equals(Object obj) {
+ return obj != null
+ && obj.getClass() == BaseRuntimeException.class;
+ }
+ }
+
+ public static class DerivedRuntimeException extends BaseRuntimeException
+ {
+ public DerivedRuntimeException() {}
+
+ public DerivedRuntimeException(String message) {
+ super(message);
+ }
+
+ public boolean equals(Object obj) {
+ return obj != null
+ && obj.getClass() == DerivedRuntimeException.class;
+ }
+ }
+}
diff --git a/bridges/test/java_uno/any/TestJni.java b/bridges/test/java_uno/any/TestJni.java
new file mode 100644
index 000000000000..1242c38e86b0
--- /dev/null
+++ b/bridges/test/java_uno/any/TestJni.java
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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 test.java_uno.anytest;
+
+public class TestJni
+{
+ static { System.loadLibrary( "test_javauno_any" ); }
+ private static native XTransport create_jni_transport(ClassLoader loader);
+
+ public static void main( String args [] )
+ {
+ if (TestAny.test(
+ create_jni_transport(TestJni.class.getClassLoader()), false ))
+ {
+ System.out.println( "jni any test succeeded." );
+ }
+ else
+ {
+ System.err.println( "jni any test failed!" );
+ System.exit( 1 );
+ }
+ }
+}
diff --git a/bridges/test/java_uno/any/TestRemote.java b/bridges/test/java_uno/any/TestRemote.java
new file mode 100644
index 000000000000..4d038559660f
--- /dev/null
+++ b/bridges/test/java_uno/any/TestRemote.java
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * 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 test.java_uno.anytest;
+
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.lib.TestBed;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+
+public final class TestRemote {
+ public static void main(String[] args) throws Exception {
+ boolean success = new TestBed().execute(
+ new Provider(), false, Client.class, 0);
+ System.out.println("success? " + success);
+ System.exit(success ? 0 : 1);
+ }
+
+ 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"));
+ return TestAny.test(transport, true);
+ }
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ return new XTransport() {
+ public Object mapAny(Object any) {
+ return any;
+ }
+ };
+ }
+ }
+}
diff --git a/bridges/test/java_uno/any/makefile.mk b/bridges/test/java_uno/any/makefile.mk
new file mode 100644
index 000000000000..888fae21d3d2
--- /dev/null
+++ b/bridges/test/java_uno/any/makefile.mk
@@ -0,0 +1,127 @@
+#*************************************************************************
+#
+# 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_javauno_any
+
+PACKAGE = test$/java_uno$/anytest
+
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE: settings.mk
+
+.IF "$(GUI)" == "WNT"
+GIVE_EXEC_RIGHTS = @echo
+.ELSE
+GIVE_EXEC_RIGHTS = chmod +x
+.ENDIF
+
+JAVAFILES = \
+ $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES)))
+
+# Make sure TestBed.class is found under $(CLASSDIR)$/test:
+.IF "$(XCLASSPATH)" == ""
+XCLASSPATH := $(CLASSDIR)$/test
+.ELSE
+XCLASSPATH !:= $(XCLASSPATH)$(PATH_SEPERATOR)$(CLASSDIR)$/test
+.ENDIF
+
+EXEC_CLASSPATH_TMP = \
+ $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i)$(PATH_SEPERATOR)$(XCLASSPATH)
+EXEC_CLASSPATH = \
+ $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/)))
+
+JARFILES = juh.jar jurt.jar ridl.jar
+JAVACLASSFILES = \
+ $(CLASSDIR)$/$(PACKAGE)$/TestAny.class \
+ $(CLASSDIR)$/$(PACKAGE)$/TestRemote.class \
+ $(CLASSDIR)$/$(PACKAGE)$/TestJni.class
+
+#--------------------------------------------------
+
+USE_DEFFILE = TRUE
+ENABLE_EXCEPTIONS = TRUE
+INCPRE += $(OUT)$/inc$/test
+
+.IF "$(debug)" != ""
+.IF "$(COM)" == "MSC"
+CFLAGS += -Ob0
+.ENDIF
+.ENDIF
+
+SLOFILES= \
+ $(SLO)$/transport.obj
+
+SHL1TARGET=$(TARGET)
+
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(SALHELPERLIB) \
+ $(JVMACCESSLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1VERSIONMAP=$(TARGET).map
+SHL1IMPLIB=i$(TARGET)
+SHL1LIBS=$(SLB)$/$(TARGET).lib
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.INCLUDE: target.mk
+
+#--------------------------------------------------
+
+$(SLOFILES) : $(MISC)$/gen_files.flag
+$(JAVACLASSFILES) : $(MISC)$/gen_files.flag
+
+ALLTAR : \
+ $(OUT)$/bin$/TestRemote \
+ $(OUT)$/bin$/TestJni
+
+$(OUT)$/bin$/TestRemote : $(JAVACLASSFILES)
+ -rm -f $@
+ echo java -classpath ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \
+ test.java_uno.anytest.TestRemote > $@
+ $(GIVE_EXEC_RIGHTS) $@
+
+$(OUT)$/bin$/TestJni : $(JAVACLASSFILES)
+ -rm -f $@
+ echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \
+ .$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \
+ -Djava.library.path=..$/lib test.java_uno.anytest.TestJni >> $@
+ $(GIVE_EXEC_RIGHTS) $@
+
+$(BIN)$/test_java_uno_anytest.rdb : types.idl
+ $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $?
+ $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+
+$(MISC)$/gen_files.flag : $(BIN)$/test_java_uno_anytest.rdb
+ $(CPPUMAKER) -C -BUCR -O $(OUT)$/inc$/test -X $(SOLARBINDIR)$/udkapi.rdb $?
+ $(CPPUMAKER) -C -BUCR -O $(OUT)$/inc$/test -T com.sun.star.uno.XInterface $(SOLARBINDIR)$/udkapi.rdb
+ $(JAVAMAKER) -nD -BUCR -O $(CLASSDIR) -X $(SOLARBINDIR)$/udkapi.rdb $?
+ $(TOUCH) $@
diff --git a/bridges/test/java_uno/any/test_javauno_any.map b/bridges/test/java_uno/any/test_javauno_any.map
new file mode 100644
index 000000000000..c50f7b162db7
--- /dev/null
+++ b/bridges/test/java_uno/any/test_javauno_any.map
@@ -0,0 +1,6 @@
+UDK_3_0_0 {
+ global:
+ Java_test_java_1uno_anytest_TestJni_create_1jni_1transport;
+ local:
+ *;
+};
diff --git a/bridges/test/java_uno/any/transport.cxx b/bridges/test/java_uno/any/transport.cxx
new file mode 100644
index 000000000000..9ea4d59dcfe9
--- /dev/null
+++ b/bridges/test/java_uno/any/transport.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include "jni.h"
+
+#include "uno/mapping.hxx"
+#include "uno/environment.hxx"
+#include "jvmaccess/virtualmachine.hxx"
+#include "jvmaccess/unovirtualmachine.hxx"
+#include "cppuhelper/implbase1.hxx"
+
+#include "test/java_uno/anytest/XTransport.hpp"
+#include "test/java_uno/anytest/DerivedInterface.hpp"
+
+
+using namespace ::com::sun::star::uno;
+using ::test::java_uno::anytest::XTransport;
+using ::rtl::OUString;
+
+namespace
+{
+//==================================================================================================
+class Transport : public ::cppu::WeakImplHelper1< XTransport >
+{
+public:
+ virtual Any SAL_CALL mapAny( Any const & any )
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+Any Transport::mapAny( Any const & any )
+ throw (RuntimeException)
+{
+ return any;
+}
+}
+
+//##################################################################################################
+extern "C" JNIEXPORT jobject JNICALL Java_test_java_1uno_anytest_TestJni_create_1jni_1transport(
+ JNIEnv * jni_env, jclass, jobject loader )
+ SAL_THROW_EXTERN_C()
+{
+ // publish some idl types
+ ::getCppuType( (Reference< XTransport > const *)0 );
+ ::getCppuType( (Reference< ::test::java_uno::anytest::DerivedInterface > const *)0 );
+
+ Reference< XTransport > xRet( new Transport() );
+
+ // get java vm
+ JavaVM * java_vm;
+ OSL_VERIFY( 0 == jni_env->GetJavaVM( &java_vm ) );
+ // create jvmaccess vm
+ ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > vm;
+ try {
+ vm = new ::jvmaccess::UnoVirtualMachine(
+ new ::jvmaccess::VirtualMachine(
+ java_vm, JNI_VERSION_1_2, false, jni_env ),
+ loader );
+ } catch ( ::jvmaccess::UnoVirtualMachine::CreationException & ) {
+ OSL_ASSERT( false );
+ throw;
+ }
+ // create uno envs
+ OUString java_name( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_JAVA) );
+ OUString cpp_name( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
+ Environment java_env, cpp_env;
+ uno_getEnvironment( (uno_Environment **)&java_env, java_name.pData, vm.get() );
+ OSL_ASSERT( java_env.is() );
+ uno_getEnvironment( (uno_Environment **)&cpp_env, cpp_name.pData, 0 );
+ OSL_ASSERT( cpp_env.is() );
+
+ // map interface
+ Mapping mapping( cpp_env.get(), java_env.get() );
+ OSL_ASSERT( mapping.is() );
+ jobject jo_global = (jobject)mapping.mapInterface( xRet.get(), ::getCppuType( &xRet ) );
+ OSL_ASSERT( 0 != jo_global );
+
+ // return
+ jobject jo_ret = jni_env->NewLocalRef( jo_global );
+ jni_env->DeleteGlobalRef( jo_global );
+ return jo_ret;
+}
diff --git a/bridges/test/java_uno/any/types.idl b/bridges/test/java_uno/any/types.idl
new file mode 100644
index 000000000000..a7d7df5487e6
--- /dev/null
+++ b/bridges/test/java_uno/any/types.idl
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * 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 test { module java_uno { module anytest {
+
+interface XTransport : com::sun::star::uno::XInterface
+{
+ any mapAny([in] any a);
+};
+
+interface BaseInterface : com::sun::star::uno::XInterface {};
+
+interface DerivedInterface : BaseInterface {};
+
+}; }; };
diff --git a/bridges/test/java_uno/equals/TestEquals.java b/bridges/test/java_uno/equals/TestEquals.java
new file mode 100644
index 000000000000..5f3ee34a1c1d
--- /dev/null
+++ b/bridges/test/java_uno/equals/TestEquals.java
@@ -0,0 +1,1304 @@
+/*************************************************************************
+ *
+ * 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 test.java_uno.equals;
+
+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.XAcceptor;
+import com.sun.star.connection.XConnection;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XSingleComponentFactory;
+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.loader.XImplementationLoader;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Hashtable;
+
+// In this test scenario, the Java server (see implementation of method
+// notifyAccepting) has a remote bridge to the Java client and a local JNI
+// bridge to a C++ com.sun.star.test.bridges.testequals.impl service. The C++
+// service and the Java client are also connected via a remote bridge.
+//
+// The Java server gets two objects (INSTANCE1, INSTANCE2), once directly from
+// the Java client via the remote bridge (proxies test1A, test2A), and once
+// through the C++ service via the JNI bridge (proxies test1B, test2B).
+// Exhaustive tests on the proxies' equals and hashCode methods are done.
+
+public final class TestEquals {
+ // args[0] must be a file system path to a types.rdb,
+ // args[1] must be a file system path to a services.rdb
+ public static void main(String[] args) throws Exception {
+ TestBed t = new TestBed();
+ boolean success = t.execute(
+ new Provider(t, toFileUrl(args[0]), toFileUrl(args[1])), true,
+ Client.class, 0);
+ System.out.println("success? " + success);
+ System.exit(success ? 0 : 1);
+ }
+
+ private static String toFileUrl(String path) throws MalformedURLException {
+ String url = new File(path).toURL().toString();
+ String prefix = "file:/";
+ if (url.startsWith(prefix)
+ && (url.length() == prefix.length()
+ || url.charAt(prefix.length()) != '/')) {
+ url = url.substring(0, prefix.length()) + "//"
+ + url.substring(prefix.length());
+ }
+ return url;
+ }
+
+ public static final class Client extends TestBed.Client {
+ public static void main(String[] args) {
+ new Client().execute();
+ }
+
+ protected boolean run(XComponentContext context) throws Throwable {
+ XTestFrame f = UnoRuntime.queryInterface(
+ XTestFrame.class, getBridge(context).getInstance("TestFrame"));
+ XAcceptor acceptor = Acceptor.create(context);
+ XBridgeFactory factory = UnoRuntime.queryInterface(
+ XBridgeFactory.class,
+ context.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", context));
+ System.out.println("Client, 2nd connection: Accepting...");
+ XInstanceProvider prov = new Provider();
+ f.notifyAccepting(new Done(), prov.getInstance(INSTANCE1),
+ prov.getInstance(INSTANCE2));
+ XConnection connection = acceptor.accept(CONNECTION_DESCRIPTION);
+ System.out.println("Client, 2nd connection: ...connected...");
+ XBridge bridge2 = factory.createBridge(
+ "", PROTOCOL_DESCRIPTION, connection, prov);
+ System.out.println("Client, 2nd connection: ...bridged.");
+ synchronized (lock) {
+ while (!done) {
+ lock.wait();
+ }
+ }
+ return true;
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Object getInstance(String instanceName) {
+ synchronized (map) {
+ Object o = map.get(instanceName);
+ if (o == null) {
+ o = new XDerived() {};
+ map.put(instanceName, o);
+ }
+ return o;
+ }
+ }
+
+ private final HashMap map = new HashMap();
+ }
+
+ private final class Done implements XDone {
+ public void notifyDone() {
+ synchronized (lock) {
+ done = true;
+ lock.notifyAll();
+ }
+ }
+ }
+
+ private final Object lock = new Object();
+ private boolean done = false;
+ }
+
+ private static final class Provider implements XInstanceProvider {
+ public Provider(TestBed testBed, String unoTypes, String unoServices) {
+ this.testBed = testBed;
+ this.unoTypes = unoTypes;
+ this.unoServices = unoServices;
+ }
+
+ public Object getInstance(String instanceName) {
+ return new XTestFrame() {
+ public void notifyAccepting(
+ final XDone done, final Object object1,
+ final Object object2)
+ {
+ new Thread() {
+ public void run() {
+ try {
+ Object test1Aa = object1;
+ XBase test1Ab = UnoRuntime.queryInterface(
+ XBase.class, test1Aa);
+ XDerived test1Ac =
+ UnoRuntime.queryInterface(
+ XDerived.class, test1Aa);
+ Object test2Aa = object2;
+ XBase test2Ab = UnoRuntime.queryInterface(
+ XBase.class, test2Aa);
+ XDerived test2Ac =
+ UnoRuntime.queryInterface(
+ XDerived.class, test2Aa);
+
+ Hashtable params = new Hashtable();
+ params.put("UNO_TYPES", unoTypes);
+ params.put("UNO_SERVICES", unoServices);
+ XComponentContext context = Bootstrap.
+ defaultBootstrap_InitialComponentContext(
+ null, params);
+ XMultiComponentFactory factory
+ = context.getServiceManager();
+ XImplementationLoader loader =
+ UnoRuntime.queryInterface(
+ XImplementationLoader.class,
+ factory.createInstanceWithContext(
+ "com.sun.star.loader."
+ + "SharedLibrary",
+ context));
+ XSingleComponentFactory factory2 =
+ UnoRuntime.queryInterface(
+ XSingleComponentFactory.class,
+ loader.activate(
+ "com.sun.star.test.bridges."
+ + "testequals.impl",
+ "", "../lib/testequals.uno",
+ null));
+ XTestInterface test =
+ UnoRuntime.queryInterface(
+ XTestInterface.class,
+ factory2.createInstanceWithContext(
+ context));
+ // allow client to start accepting:
+ Thread.sleep(3000);
+ test.connect(
+ CONNECTION_DESCRIPTION,
+ PROTOCOL_DESCRIPTION);
+
+ Object test1Ba = test.get(INSTANCE1);
+ XBase test1Bb = UnoRuntime.queryInterface(
+ XBase.class, test1Ba);
+ XDerived test1Bc =
+ UnoRuntime.queryInterface(
+ XDerived.class, test1Ba);
+ Object test2Ba = test.get(INSTANCE2);
+ XBase test2Bb = UnoRuntime.queryInterface(
+ XBase.class, test2Ba);
+ XDerived test2Bc =
+ UnoRuntime.queryInterface(
+ XDerived.class, test2Ba);
+
+ boolean success = true;
+
+ success &= test(
+ "UnoRumtime.areSame(null, null)",
+ UnoRuntime.areSame(null, null));
+ success &= test(
+ "!UnoRumtime.areSame(null, test1Aa)",
+ !UnoRuntime.areSame(null, test1Aa));
+ success &= test(
+ "!UnoRumtime.areSame(null, test1Ab)",
+ !UnoRuntime.areSame(null, test1Ab));
+ success &= test(
+ "!UnoRumtime.areSame(null, test1Ac)",
+ !UnoRuntime.areSame(null, test1Ac));
+ success &= test(
+ "!UnoRumtime.areSame(null, test1Ba)",
+ !UnoRuntime.areSame(null, test1Ba));
+ success &= test(
+ "!UnoRumtime.areSame(null, test1Bb)",
+ !UnoRuntime.areSame(null, test1Bb));
+ success &= test(
+ "!UnoRumtime.areSame(null, test1Bc)",
+ !UnoRuntime.areSame(null, test1Bc));
+ success &= test(
+ "!UnoRumtime.areSame(null, test2Aa)",
+ !UnoRuntime.areSame(null, test2Aa));
+ success &= test(
+ "!UnoRumtime.areSame(null, test2Ab)",
+ !UnoRuntime.areSame(null, test2Ab));
+ success &= test(
+ "!UnoRumtime.areSame(null, test2Ac)",
+ !UnoRuntime.areSame(null, test2Ac));
+ success &= test(
+ "!UnoRumtime.areSame(null, test2Ba)",
+ !UnoRuntime.areSame(null, test2Ba));
+ success &= test(
+ "!UnoRumtime.areSame(null, test2Bb)",
+ !UnoRuntime.areSame(null, test2Bb));
+ success &= test(
+ "!UnoRumtime.areSame(null, test2Bc)",
+ !UnoRuntime.areSame(null, test2Bc));
+
+ success &= test(
+ "!test1Aa.equals(null)",
+ !test1Aa.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, null)",
+ !UnoRuntime.areSame(test1Aa, null));
+ success &= test(
+ "test1Aa.equals(test1Aa)",
+ test1Aa.equals(test1Aa));
+ success &= test(
+ "UnoRuntime.areSame(test1Aa, test1Aa)",
+ UnoRuntime.areSame(test1Aa, test1Aa));
+ success &= test(
+ "test1Aa.equals(test1Ab)",
+ test1Aa.equals(test1Ab));
+ success &= test(
+ "UnoRuntime.areSame(test1Aa, test1Ab)",
+ UnoRuntime.areSame(test1Aa, test1Ab));
+ success &= test(
+ "test1Aa.equals(test1Ac)",
+ test1Aa.equals(test1Ac));
+ success &= test(
+ "UnoRuntime.areSame(test1Aa, test1Ac)",
+ UnoRuntime.areSame(test1Aa, test1Ac));
+ success &= test(
+ "test1Aa.equals(test1Ba)",
+ test1Aa.equals(test1Ba));
+ success &= test(
+ "UnoRuntime.areSame(test1Aa, test1Ba)",
+ UnoRuntime.areSame(test1Aa, test1Ba));
+ success &= test(
+ "test1Aa.equals(test1Bb)",
+ test1Aa.equals(test1Bb));
+ success &= test(
+ "UnoRuntime.areSame(test1Aa, test1Bb)",
+ UnoRuntime.areSame(test1Aa, test1Bb));
+ success &= test(
+ "test1Aa.equals(test1Bc)",
+ test1Aa.equals(test1Bc));
+ success &= test(
+ "UnoRuntime.areSame(test1Aa, test1Bc)",
+ UnoRuntime.areSame(test1Aa, test1Bc));
+ success &= test(
+ "!test1Aa.equals(test2Aa)",
+ !test1Aa.equals(test2Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, test2Aa)",
+ !UnoRuntime.areSame(test1Aa, test2Aa));
+ success &= test(
+ "!test1Aa.equals(test2Ab)",
+ !test1Aa.equals(test2Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, test2Ab)",
+ !UnoRuntime.areSame(test1Aa, test2Ab));
+ success &= test(
+ "!test1Aa.equals(test2Ac)",
+ !test1Aa.equals(test2Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, test2Ac)",
+ !UnoRuntime.areSame(test1Aa, test2Ac));
+ success &= test(
+ "!test1Aa.equals(test2Ba)",
+ !test1Aa.equals(test2Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, test2Ba)",
+ !UnoRuntime.areSame(test1Aa, test2Ba));
+ success &= test(
+ "!test1Aa.equals(test2Bb)",
+ !test1Aa.equals(test2Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, test2Bb)",
+ !UnoRuntime.areSame(test1Aa, test2Bb));
+ success &= test(
+ "!test1Aa.equals(test2Bc)",
+ !test1Aa.equals(test2Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test1Aa, test2Bc)",
+ !UnoRuntime.areSame(test1Aa, test2Bc));
+
+ success &= test(
+ "!test1Ab.equals(null)",
+ !test1Ab.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, null)",
+ !UnoRuntime.areSame(test1Ab, null));
+ success &= test(
+ "test1Ab.equals(test1Aa)",
+ test1Ab.equals(test1Aa));
+ success &= test(
+ "UnoRuntime.areSame(test1Ab, test1Aa)",
+ UnoRuntime.areSame(test1Ab, test1Aa));
+ success &= test(
+ "test1Ab.equals(test1Ab)",
+ test1Ab.equals(test1Ab));
+ success &= test(
+ "UnoRuntime.areSame(test1Ab, test1Ab)",
+ UnoRuntime.areSame(test1Ab, test1Ab));
+ success &= test(
+ "test1Ab.equals(test1Ac)",
+ test1Ab.equals(test1Ac));
+ success &= test(
+ "UnoRuntime.areSame(test1Ab, test1Ac)",
+ UnoRuntime.areSame(test1Ab, test1Ac));
+ success &= test(
+ "test1Ab.equals(test1Ba)",
+ test1Ab.equals(test1Ba));
+ success &= test(
+ "UnoRuntime.areSame(test1Ab, test1Ba)",
+ UnoRuntime.areSame(test1Ab, test1Ba));
+ success &= test(
+ "test1Ab.equals(test1Bb)",
+ test1Ab.equals(test1Bb));
+ success &= test(
+ "UnoRuntime.areSame(test1Ab, test1Bb)",
+ UnoRuntime.areSame(test1Ab, test1Bb));
+ success &= test(
+ "test1Ab.equals(test1Bc)",
+ test1Ab.equals(test1Bc));
+ success &= test(
+ "UnoRuntime.areSame(test1Ab, test1Bc)",
+ UnoRuntime.areSame(test1Ab, test1Bc));
+ success &= test(
+ "!test1Ab.equals(test2Aa)",
+ !test1Ab.equals(test2Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, test2Aa)",
+ !UnoRuntime.areSame(test1Ab, test2Aa));
+ success &= test(
+ "!test1Ab.equals(test2Ab)",
+ !test1Ab.equals(test2Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, test2Ab)",
+ !UnoRuntime.areSame(test1Ab, test2Ab));
+ success &= test(
+ "!test1Ab.equals(test2Ac)",
+ !test1Ab.equals(test2Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, test2Ac)",
+ !UnoRuntime.areSame(test1Ab, test2Ac));
+ success &= test(
+ "!test1Ab.equals(test2Ba)",
+ !test1Ab.equals(test2Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, test2Ba)",
+ !UnoRuntime.areSame(test1Ab, test2Ba));
+ success &= test(
+ "!test1Ab.equals(test2Bb)",
+ !test1Ab.equals(test2Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, test2Bb)",
+ !UnoRuntime.areSame(test1Ab, test2Bb));
+ success &= test(
+ "!test1Ab.equals(test2Bc)",
+ !test1Ab.equals(test2Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ab, test2Bc)",
+ !UnoRuntime.areSame(test1Ab, test2Bc));
+
+ success &= test(
+ "!test1Ac.equals(null)",
+ !test1Ac.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, null)",
+ !UnoRuntime.areSame(test1Ac, null));
+ success &= test(
+ "test1Ac.equals(test1Aa)",
+ test1Ac.equals(test1Aa));
+ success &= test(
+ "UnoRuntime.areSame(test1Ac, test1Aa)",
+ UnoRuntime.areSame(test1Ac, test1Aa));
+ success &= test(
+ "test1Ac.equals(test1Ab)",
+ test1Ac.equals(test1Ab));
+ success &= test(
+ "UnoRuntime.areSame(test1Ac, test1Ab)",
+ UnoRuntime.areSame(test1Ac, test1Ab));
+ success &= test(
+ "test1Ac.equals(test1Ac)",
+ test1Ac.equals(test1Ac));
+ success &= test(
+ "UnoRuntime.areSame(test1Ac, test1Ac)",
+ UnoRuntime.areSame(test1Ac, test1Ac));
+ success &= test(
+ "test1Ac.equals(test1Ba)",
+ test1Ac.equals(test1Ba));
+ success &= test(
+ "UnoRuntime.areSame(test1Ac, test1Ba)",
+ UnoRuntime.areSame(test1Ac, test1Ba));
+ success &= test(
+ "test1Ac.equals(test1Bb)",
+ test1Ac.equals(test1Bb));
+ success &= test(
+ "UnoRuntime.areSame(test1Ac, test1Bb)",
+ UnoRuntime.areSame(test1Ac, test1Bb));
+ success &= test(
+ "test1Ac.equals(test1Bc)",
+ test1Ac.equals(test1Bc));
+ success &= test(
+ "UnoRuntime.areSame(test1Ac, test1Bc)",
+ UnoRuntime.areSame(test1Ac, test1Bc));
+ success &= test(
+ "!test1Ac.equals(test2Aa)",
+ !test1Ac.equals(test2Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, test2Aa)",
+ !UnoRuntime.areSame(test1Ac, test2Aa));
+ success &= test(
+ "!test1Ac.equals(test2Ab)",
+ !test1Ac.equals(test2Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, test2Ab)",
+ !UnoRuntime.areSame(test1Ac, test2Ab));
+ success &= test(
+ "!test1Ac.equals(test2Ac)",
+ !test1Ac.equals(test2Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, test2Ac)",
+ !UnoRuntime.areSame(test1Ac, test2Ac));
+ success &= test(
+ "!test1Ac.equals(test2Ba)",
+ !test1Ac.equals(test2Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, test2Ba)",
+ !UnoRuntime.areSame(test1Ac, test2Ba));
+ success &= test(
+ "!test1Ac.equals(test2Bb)",
+ !test1Ac.equals(test2Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, test2Bb)",
+ !UnoRuntime.areSame(test1Ac, test2Bb));
+ success &= test(
+ "!test1Ac.equals(test2Bc)",
+ !test1Ac.equals(test2Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ac, test2Bc)",
+ !UnoRuntime.areSame(test1Ac, test2Bc));
+
+ success &= test(
+ "!test1Ba.equals(null)",
+ !test1Ba.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, null)",
+ !UnoRuntime.areSame(test1Ba, null));
+ success &= test(
+ "test1Ba.equals(test1Aa)",
+ test1Ba.equals(test1Aa));
+ success &= test(
+ "UnoRuntime.areSame(test1Ba, test1Aa)",
+ UnoRuntime.areSame(test1Ba, test1Aa));
+ success &= test(
+ "test1Ba.equals(test1Ab)",
+ test1Ba.equals(test1Ab));
+ success &= test(
+ "UnoRuntime.areSame(test1Ba, test1Ab)",
+ UnoRuntime.areSame(test1Ba, test1Ab));
+ success &= test(
+ "test1Ba.equals(test1Ac)",
+ test1Ba.equals(test1Ac));
+ success &= test(
+ "UnoRuntime.areSame(test1Ba, test1Ac)",
+ UnoRuntime.areSame(test1Ba, test1Ac));
+ success &= test(
+ "test1Ba.equals(test1Ba)",
+ test1Ba.equals(test1Ba));
+ success &= test(
+ "UnoRuntime.areSame(test1Ba, test1Ba)",
+ UnoRuntime.areSame(test1Ba, test1Ba));
+ success &= test(
+ "test1Ba.equals(test1Bb)",
+ test1Ba.equals(test1Bb));
+ success &= test(
+ "UnoRuntime.areSame(test1Ba, test1Bb)",
+ UnoRuntime.areSame(test1Ba, test1Bb));
+ success &= test(
+ "test1Ba.equals(test1Bc)",
+ test1Ba.equals(test1Bc));
+ success &= test(
+ "UnoRuntime.areSame(test1Ba, test1Bc)",
+ UnoRuntime.areSame(test1Ba, test1Bc));
+ success &= test(
+ "!test1Ba.equals(test2Aa)",
+ !test1Ba.equals(test2Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, test2Aa)",
+ !UnoRuntime.areSame(test1Ba, test2Aa));
+ success &= test(
+ "!test1Ba.equals(test2Ab)",
+ !test1Ba.equals(test2Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, test2Ab)",
+ !UnoRuntime.areSame(test1Ba, test2Ab));
+ success &= test(
+ "!test1Ba.equals(test2Ac)",
+ !test1Ba.equals(test2Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, test2Ac)",
+ !UnoRuntime.areSame(test1Ba, test2Ac));
+ success &= test(
+ "!test1Ba.equals(test2Ba)",
+ !test1Ba.equals(test2Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, test2Ba)",
+ !UnoRuntime.areSame(test1Ba, test2Ba));
+ success &= test(
+ "!test1Ba.equals(test2Bb)",
+ !test1Ba.equals(test2Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, test2Bb)",
+ !UnoRuntime.areSame(test1Ba, test2Bb));
+ success &= test(
+ "!test1Ba.equals(test2Bc)",
+ !test1Ba.equals(test2Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test1Ba, test2Bc)",
+ !UnoRuntime.areSame(test1Ba, test2Bc));
+
+ success &= test(
+ "!test1Bb.equals(null)",
+ !test1Bb.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, null)",
+ !UnoRuntime.areSame(test1Bb, null));
+ success &= test(
+ "test1Bb.equals(test1Aa)",
+ test1Bb.equals(test1Aa));
+ success &= test(
+ "UnoRuntime.areSame(test1Bb, test1Aa)",
+ UnoRuntime.areSame(test1Bb, test1Aa));
+ success &= test(
+ "test1Bb.equals(test1Ab)",
+ test1Bb.equals(test1Ab));
+ success &= test(
+ "UnoRuntime.areSame(test1Bb, test1Ab)",
+ UnoRuntime.areSame(test1Bb, test1Ab));
+ success &= test(
+ "test1Bb.equals(test1Ac)",
+ test1Bb.equals(test1Ac));
+ success &= test(
+ "UnoRuntime.areSame(test1Bb, test1Ac)",
+ UnoRuntime.areSame(test1Bb, test1Ac));
+ success &= test(
+ "test1Bb.equals(test1Ba)",
+ test1Bb.equals(test1Ba));
+ success &= test(
+ "UnoRuntime.areSame(test1Bb, test1Ba)",
+ UnoRuntime.areSame(test1Bb, test1Ba));
+ success &= test(
+ "test1Bb.equals(test1Bb)",
+ test1Bb.equals(test1Bb));
+ success &= test(
+ "UnoRuntime.areSame(test1Bb, test1Bb)",
+ UnoRuntime.areSame(test1Bb, test1Bb));
+ success &= test(
+ "test1Bb.equals(test1Bc)",
+ test1Bb.equals(test1Bc));
+ success &= test(
+ "UnoRuntime.areSame(test1Bb, test1Bc)",
+ UnoRuntime.areSame(test1Bb, test1Bc));
+ success &= test(
+ "!test1Bb.equals(test2Aa)",
+ !test1Bb.equals(test2Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, test2Aa)",
+ !UnoRuntime.areSame(test1Bb, test2Aa));
+ success &= test(
+ "!test1Bb.equals(test2Ab)",
+ !test1Bb.equals(test2Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, test2Ab)",
+ !UnoRuntime.areSame(test1Bb, test2Ab));
+ success &= test(
+ "!test1Bb.equals(test2Ac)",
+ !test1Bb.equals(test2Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, test2Ac)",
+ !UnoRuntime.areSame(test1Bb, test2Ac));
+ success &= test(
+ "!test1Bb.equals(test2Ba)",
+ !test1Bb.equals(test2Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, test2Ba)",
+ !UnoRuntime.areSame(test1Bb, test2Ba));
+ success &= test(
+ "!test1Bb.equals(test2Bb)",
+ !test1Bb.equals(test2Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, test2Bb)",
+ !UnoRuntime.areSame(test1Bb, test2Bb));
+ success &= test(
+ "!test1Bb.equals(test2Bc)",
+ !test1Bb.equals(test2Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bb, test2Bc)",
+ !UnoRuntime.areSame(test1Bb, test2Bc));
+
+ success &= test(
+ "!test1Bc.equals(null)",
+ !test1Bc.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, null)",
+ !UnoRuntime.areSame(test1Bc, null));
+ success &= test(
+ "test1Bc.equals(test1Aa)",
+ test1Bc.equals(test1Aa));
+ success &= test(
+ "UnoRuntime.areSame(test1Bc, test1Aa)",
+ UnoRuntime.areSame(test1Bc, test1Aa));
+ success &= test(
+ "test1Bc.equals(test1Ab)",
+ test1Bc.equals(test1Ab));
+ success &= test(
+ "UnoRuntime.areSame(test1Bc, test1Ab)",
+ UnoRuntime.areSame(test1Bc, test1Ab));
+ success &= test(
+ "test1Bc.equals(test1Ac)",
+ test1Bc.equals(test1Ac));
+ success &= test(
+ "UnoRuntime.areSame(test1Bc, test1Ac)",
+ UnoRuntime.areSame(test1Bc, test1Ac));
+ success &= test(
+ "test1Bc.equals(test1Ba)",
+ test1Bc.equals(test1Ba));
+ success &= test(
+ "UnoRuntime.areSame(test1Bc, test1Ba)",
+ UnoRuntime.areSame(test1Bc, test1Ba));
+ success &= test(
+ "test1Bc.equals(test1Bb)",
+ test1Bc.equals(test1Bb));
+ success &= test(
+ "UnoRuntime.areSame(test1Bc, test1Bb)",
+ UnoRuntime.areSame(test1Bc, test1Bb));
+ success &= test(
+ "test1Bc.equals(test1Bc)",
+ test1Bc.equals(test1Bc));
+ success &= test(
+ "UnoRuntime.areSame(test1Bc, test1Bc)",
+ UnoRuntime.areSame(test1Bc, test1Bc));
+ success &= test(
+ "!test1Bc.equals(test2Aa)",
+ !test1Bc.equals(test2Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, test2Aa)",
+ !UnoRuntime.areSame(test1Bc, test2Aa));
+ success &= test(
+ "!test1Bc.equals(test2Ab)",
+ !test1Bc.equals(test2Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, test2Ab)",
+ !UnoRuntime.areSame(test1Bc, test2Ab));
+ success &= test(
+ "!test1Bc.equals(test2Ac)",
+ !test1Bc.equals(test2Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, test2Ac)",
+ !UnoRuntime.areSame(test1Bc, test2Ac));
+ success &= test(
+ "!test1Bc.equals(test2Ba)",
+ !test1Bc.equals(test2Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, test2Ba)",
+ !UnoRuntime.areSame(test1Bc, test2Ba));
+ success &= test(
+ "!test1Bc.equals(test2Bb)",
+ !test1Bc.equals(test2Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, test2Bb)",
+ !UnoRuntime.areSame(test1Bc, test2Bb));
+ success &= test(
+ "!test1Bc.equals(test2Bc)",
+ !test1Bc.equals(test2Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test1Bc, test2Bc)",
+ !UnoRuntime.areSame(test1Bc, test2Bc));
+
+ success &= test(
+ "!test2Aa.equals(null)",
+ !test2Aa.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, null)",
+ !UnoRuntime.areSame(test2Aa, null));
+ success &= test(
+ "!test2Aa.equals(test1Aa)",
+ !test2Aa.equals(test1Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, test1Aa)",
+ !UnoRuntime.areSame(test2Aa, test1Aa));
+ success &= test(
+ "!test2Aa.equals(test1Ab)",
+ !test2Aa.equals(test1Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, test1Ab)",
+ !UnoRuntime.areSame(test2Aa, test1Ab));
+ success &= test(
+ "!test2Aa.equals(test1Ac)",
+ !test2Aa.equals(test1Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, test1Ac)",
+ !UnoRuntime.areSame(test2Aa, test1Ac));
+ success &= test(
+ "!test2Aa.equals(test1Ba)",
+ !test2Aa.equals(test1Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, test1Ba)",
+ !UnoRuntime.areSame(test2Aa, test1Ba));
+ success &= test(
+ "!test2Aa.equals(test1Bb)",
+ !test2Aa.equals(test1Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, test1Bb)",
+ !UnoRuntime.areSame(test2Aa, test1Bb));
+ success &= test(
+ "!test2Aa.equals(test1Bc)",
+ !test2Aa.equals(test1Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test2Aa, test1Bc)",
+ !UnoRuntime.areSame(test2Aa, test1Bc));
+ success &= test(
+ "test2Aa.equals(test2Aa)",
+ test2Aa.equals(test2Aa));
+ success &= test(
+ "UnoRuntime.areSame(test2Aa, test2Aa)",
+ UnoRuntime.areSame(test2Aa, test2Aa));
+ success &= test(
+ "test2Aa.equals(test2Ab)",
+ test2Aa.equals(test2Ab));
+ success &= test(
+ "UnoRuntime.areSame(test2Aa, test2Ab)",
+ UnoRuntime.areSame(test2Aa, test2Ab));
+ success &= test(
+ "test2Aa.equals(test2Ac)",
+ test2Aa.equals(test2Ac));
+ success &= test(
+ "UnoRuntime.areSame(test2Aa, test2Ac)",
+ UnoRuntime.areSame(test2Aa, test2Ac));
+ success &= test(
+ "test2Aa.equals(test2Ba)",
+ test2Aa.equals(test2Ba));
+ success &= test(
+ "UnoRuntime.areSame(test2Aa, test2Ba)",
+ UnoRuntime.areSame(test2Aa, test2Ba));
+ success &= test(
+ "test2Aa.equals(test2Bb)",
+ test2Aa.equals(test2Bb));
+ success &= test(
+ "UnoRuntime.areSame(test2Aa, test2Bb)",
+ UnoRuntime.areSame(test2Aa, test2Bb));
+ success &= test(
+ "test2Aa.equals(test2Bc)",
+ test2Aa.equals(test2Bc));
+ success &= test(
+ "UnoRuntime.areSame(test2Aa, test2Bc)",
+ UnoRuntime.areSame(test2Aa, test2Bc));
+
+ success &= test(
+ "!test2Ab.equals(null)",
+ !test2Ab.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, null)",
+ !UnoRuntime.areSame(test2Ab, null));
+ success &= test(
+ "!test2Ab.equals(test1Aa)",
+ !test2Ab.equals(test1Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, test1Aa)",
+ !UnoRuntime.areSame(test2Ab, test1Aa));
+ success &= test(
+ "!test2Ab.equals(test1Ab)",
+ !test2Ab.equals(test1Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, test1Ab)",
+ !UnoRuntime.areSame(test2Ab, test1Ab));
+ success &= test(
+ "!test2Ab.equals(test1Ac)",
+ !test2Ab.equals(test1Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, test1Ac)",
+ !UnoRuntime.areSame(test2Ab, test1Ac));
+ success &= test(
+ "!test2Ab.equals(test1Ba)",
+ !test2Ab.equals(test1Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, test1Ba)",
+ !UnoRuntime.areSame(test2Ab, test1Ba));
+ success &= test(
+ "!test2Ab.equals(test1Bb)",
+ !test2Ab.equals(test1Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, test1Bb)",
+ !UnoRuntime.areSame(test2Ab, test1Bb));
+ success &= test(
+ "!test2Ab.equals(test1Bc)",
+ !test2Ab.equals(test1Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ab, test1Bc)",
+ !UnoRuntime.areSame(test2Ab, test1Bc));
+ success &= test(
+ "test2Ab.equals(test2Aa)",
+ test2Ab.equals(test2Aa));
+ success &= test(
+ "UnoRuntime.areSame(test2Ab, test2Aa)",
+ UnoRuntime.areSame(test2Ab, test2Aa));
+ success &= test(
+ "test2Ab.equals(test2Ab)",
+ test2Ab.equals(test2Ab));
+ success &= test(
+ "UnoRuntime.areSame(test2Ab, test2Ab)",
+ UnoRuntime.areSame(test2Ab, test2Ab));
+ success &= test(
+ "test2Ab.equals(test2Ac)",
+ test2Ab.equals(test2Ac));
+ success &= test(
+ "UnoRuntime.areSame(test2Ab, test2Ac)",
+ UnoRuntime.areSame(test2Ab, test2Ac));
+ success &= test(
+ "test2Ab.equals(test2Ba)",
+ test2Ab.equals(test2Ba));
+ success &= test(
+ "UnoRuntime.areSame(test2Ab, test2Ba)",
+ UnoRuntime.areSame(test2Ab, test2Ba));
+ success &= test(
+ "test2Ab.equals(test2Bb)",
+ test2Ab.equals(test2Bb));
+ success &= test(
+ "UnoRuntime.areSame(test2Ab, test2Bb)",
+ UnoRuntime.areSame(test2Ab, test2Bb));
+ success &= test(
+ "test2Ab.equals(test2Bc)",
+ test2Ab.equals(test2Bc));
+ success &= test(
+ "UnoRuntime.areSame(test2Ab, test2Bc)",
+ UnoRuntime.areSame(test2Ab, test2Bc));
+
+ success &= test(
+ "!test2Ac.equals(null)",
+ !test2Ac.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, null)",
+ !UnoRuntime.areSame(test2Ac, null));
+ success &= test(
+ "!test2Ac.equals(test1Aa)",
+ !test2Ac.equals(test1Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, test1Aa)",
+ !UnoRuntime.areSame(test2Ac, test1Aa));
+ success &= test(
+ "!test2Ac.equals(test1Ab)",
+ !test2Ac.equals(test1Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, test1Ab)",
+ !UnoRuntime.areSame(test2Ac, test1Ab));
+ success &= test(
+ "!test2Ac.equals(test1Ac)",
+ !test2Ac.equals(test1Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, test1Ac)",
+ !UnoRuntime.areSame(test2Ac, test1Ac));
+ success &= test(
+ "!test2Ac.equals(test1Ba)",
+ !test2Ac.equals(test1Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, test1Ba)",
+ !UnoRuntime.areSame(test2Ac, test1Ba));
+ success &= test(
+ "!test2Ac.equals(test1Bb)",
+ !test2Ac.equals(test1Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, test1Bb)",
+ !UnoRuntime.areSame(test2Ac, test1Bb));
+ success &= test(
+ "!test2Ac.equals(test1Bc)",
+ !test2Ac.equals(test1Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ac, test1Bc)",
+ !UnoRuntime.areSame(test2Ac, test1Bc));
+ success &= test(
+ "test2Ac.equals(test2Aa)",
+ test2Ac.equals(test2Aa));
+ success &= test(
+ "UnoRuntime.areSame(test2Ac, test2Aa)",
+ UnoRuntime.areSame(test2Ac, test2Aa));
+ success &= test(
+ "test2Ac.equals(test2Ab)",
+ test2Ac.equals(test2Ab));
+ success &= test(
+ "UnoRuntime.areSame(test2Ac, test2Ab)",
+ UnoRuntime.areSame(test2Ac, test2Ab));
+ success &= test(
+ "test2Ac.equals(test2Ac)",
+ test2Ac.equals(test2Ac));
+ success &= test(
+ "UnoRuntime.areSame(test2Ac, test2Ac)",
+ UnoRuntime.areSame(test2Ac, test2Ac));
+ success &= test(
+ "test2Ac.equals(test2Ba)",
+ test2Ac.equals(test2Ba));
+ success &= test(
+ "UnoRuntime.areSame(test2Ac, test2Ba)",
+ UnoRuntime.areSame(test2Ac, test2Ba));
+ success &= test(
+ "test2Ac.equals(test2Bb)",
+ test2Ac.equals(test2Bb));
+ success &= test(
+ "UnoRuntime.areSame(test2Ac, test2Bb)",
+ UnoRuntime.areSame(test2Ac, test2Bb));
+ success &= test(
+ "test2Ac.equals(test2Bc)",
+ test2Ac.equals(test2Bc));
+ success &= test(
+ "UnoRuntime.areSame(test2Ac, test2Bc)",
+ UnoRuntime.areSame(test2Ac, test2Bc));
+
+ success &= test(
+ "!test2Ba.equals(null)",
+ !test2Ba.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, null)",
+ !UnoRuntime.areSame(test2Ba, null));
+ success &= test(
+ "!test2Ba.equals(test1Aa)",
+ !test2Ba.equals(test1Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, test1Aa)",
+ !UnoRuntime.areSame(test2Ba, test1Aa));
+ success &= test(
+ "!test2Ba.equals(test1Ab)",
+ !test2Ba.equals(test1Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, test1Ab)",
+ !UnoRuntime.areSame(test2Ba, test1Ab));
+ success &= test(
+ "!test2Ba.equals(test1Ac)",
+ !test2Ba.equals(test1Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, test1Ac)",
+ !UnoRuntime.areSame(test2Ba, test1Ac));
+ success &= test(
+ "!test2Ba.equals(test1Ba)",
+ !test2Ba.equals(test1Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, test1Ba)",
+ !UnoRuntime.areSame(test2Ba, test1Ba));
+ success &= test(
+ "!test2Ba.equals(test1Bb)",
+ !test2Ba.equals(test1Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, test1Bb)",
+ !UnoRuntime.areSame(test2Ba, test1Bb));
+ success &= test(
+ "!test2Ba.equals(test1Bc)",
+ !test2Ba.equals(test1Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test2Ba, test1Bc)",
+ !UnoRuntime.areSame(test2Ba, test1Bc));
+ success &= test(
+ "test2Ba.equals(test2Aa)",
+ test2Ba.equals(test2Aa));
+ success &= test(
+ "UnoRuntime.areSame(test2Ba, test2Aa)",
+ UnoRuntime.areSame(test2Ba, test2Aa));
+ success &= test(
+ "test2Ba.equals(test2Ab)",
+ test2Ba.equals(test2Ab));
+ success &= test(
+ "UnoRuntime.areSame(test2Ba, test2Ab)",
+ UnoRuntime.areSame(test2Ba, test2Ab));
+ success &= test(
+ "test2Ba.equals(test2Ac)",
+ test2Ba.equals(test2Ac));
+ success &= test(
+ "UnoRuntime.areSame(test2Ba, test2Ac)",
+ UnoRuntime.areSame(test2Ba, test2Ac));
+ success &= test(
+ "test2Ba.equals(test2Ba)",
+ test2Ba.equals(test2Ba));
+ success &= test(
+ "UnoRuntime.areSame(test2Ba, test2Ba)",
+ UnoRuntime.areSame(test2Ba, test2Ba));
+ success &= test(
+ "test2Ba.equals(test2Bb)",
+ test2Ba.equals(test2Bb));
+ success &= test(
+ "UnoRuntime.areSame(test2Ba, test2Bb)",
+ UnoRuntime.areSame(test2Ba, test2Bb));
+ success &= test(
+ "test2Ba.equals(test2Bc)",
+ test2Ba.equals(test2Bc));
+ success &= test(
+ "UnoRuntime.areSame(test2Ba, test2Bc)",
+ UnoRuntime.areSame(test2Ba, test2Bc));
+
+ success &= test(
+ "!test2Bb.equals(null)",
+ !test2Bb.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, null)",
+ !UnoRuntime.areSame(test2Bb, null));
+ success &= test(
+ "!test2Bb.equals(test1Aa)",
+ !test2Bb.equals(test1Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, test1Aa)",
+ !UnoRuntime.areSame(test2Bb, test1Aa));
+ success &= test(
+ "!test2Bb.equals(test1Ab)",
+ !test2Bb.equals(test1Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, test1Ab)",
+ !UnoRuntime.areSame(test2Bb, test1Ab));
+ success &= test(
+ "!test2Bb.equals(test1Ac)",
+ !test2Bb.equals(test1Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, test1Ac)",
+ !UnoRuntime.areSame(test2Bb, test1Ac));
+ success &= test(
+ "!test2Bb.equals(test1Ba)",
+ !test2Bb.equals(test1Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, test1Ba)",
+ !UnoRuntime.areSame(test2Bb, test1Ba));
+ success &= test(
+ "!test2Bb.equals(test1Bb)",
+ !test2Bb.equals(test1Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, test1Bb)",
+ !UnoRuntime.areSame(test2Bb, test1Bb));
+ success &= test(
+ "!test2Bb.equals(test1Bc)",
+ !test2Bb.equals(test1Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bb, test1Bc)",
+ !UnoRuntime.areSame(test2Bb, test1Bc));
+ success &= test(
+ "test2Bb.equals(test2Aa)",
+ test2Bb.equals(test2Aa));
+ success &= test(
+ "UnoRuntime.areSame(test2Bb, test2Aa)",
+ UnoRuntime.areSame(test2Bb, test2Aa));
+ success &= test(
+ "test2Bb.equals(test2Ab)",
+ test2Bb.equals(test2Ab));
+ success &= test(
+ "UnoRuntime.areSame(test2Bb, test2Ab)",
+ UnoRuntime.areSame(test2Bb, test2Ab));
+ success &= test(
+ "test2Bb.equals(test2Ac)",
+ test2Bb.equals(test2Ac));
+ success &= test(
+ "UnoRuntime.areSame(test2Bb, test2Ac)",
+ UnoRuntime.areSame(test2Bb, test2Ac));
+ success &= test(
+ "test2Bb.equals(test2Ba)",
+ test2Bb.equals(test2Ba));
+ success &= test(
+ "UnoRuntime.areSame(test2Bb, test2Ba)",
+ UnoRuntime.areSame(test2Bb, test2Ba));
+ success &= test(
+ "test2Bb.equals(test2Bb)",
+ test2Bb.equals(test2Bb));
+ success &= test(
+ "UnoRuntime.areSame(test2Bb, test2Bb)",
+ UnoRuntime.areSame(test2Bb, test2Bb));
+ success &= test(
+ "test2Bb.equals(test2Bc)",
+ test2Bb.equals(test2Bc));
+ success &= test(
+ "UnoRuntime.areSame(test2Bb, test2Bc)",
+ UnoRuntime.areSame(test2Bb, test2Bc));
+
+ success &= test(
+ "!test2Bc.equals(null)",
+ !test2Bc.equals(null));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, null)",
+ !UnoRuntime.areSame(test2Bc, null));
+ success &= test(
+ "!test2Bc.equals(test1Aa)",
+ !test2Bc.equals(test1Aa));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, test1Aa)",
+ !UnoRuntime.areSame(test2Bc, test1Aa));
+ success &= test(
+ "!test2Bc.equals(test1Ab)",
+ !test2Bc.equals(test1Ab));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, test1Ab)",
+ !UnoRuntime.areSame(test2Bc, test1Ab));
+ success &= test(
+ "!test2Bc.equals(test1Ac)",
+ !test2Bc.equals(test1Ac));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, test1Ac)",
+ !UnoRuntime.areSame(test2Bc, test1Ac));
+ success &= test(
+ "!test2Bc.equals(test1Ba)",
+ !test2Bc.equals(test1Ba));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, test1Ba)",
+ !UnoRuntime.areSame(test2Bc, test1Ba));
+ success &= test(
+ "!test2Bc.equals(test1Bb)",
+ !test2Bc.equals(test1Bb));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, test1Bb)",
+ !UnoRuntime.areSame(test2Bc, test1Bb));
+ success &= test(
+ "!test2Bc.equals(test1Bc)",
+ !test2Bc.equals(test1Bc));
+ success &= test(
+ "!UnoRuntime.areSame(test2Bc, test1Bc)",
+ !UnoRuntime.areSame(test2Bc, test1Bc));
+ success &= test(
+ "test2Bc.equals(test2Aa)",
+ test2Bc.equals(test2Aa));
+ success &= test(
+ "UnoRuntime.areSame(test2Bc, test2Aa)",
+ UnoRuntime.areSame(test2Bc, test2Aa));
+ success &= test(
+ "test2Bc.equals(test2Ab)",
+ test2Bc.equals(test2Ab));
+ success &= test(
+ "UnoRuntime.areSame(test2Bc, test2Ab)",
+ UnoRuntime.areSame(test2Bc, test2Ab));
+ success &= test(
+ "test2Bc.equals(test2Ac)",
+ test2Bc.equals(test2Ac));
+ success &= test(
+ "UnoRuntime.areSame(test2Bc, test2Ac)",
+ UnoRuntime.areSame(test2Bc, test2Ac));
+ success &= test(
+ "test2Bc.equals(test2Ba)",
+ test2Bc.equals(test2Ba));
+ success &= test(
+ "UnoRuntime.areSame(test2Bc, test2Ba)",
+ UnoRuntime.areSame(test2Bc, test2Ba));
+ success &= test(
+ "test2Bc.equals(test2Bb)",
+ test2Bc.equals(test2Bb));
+ success &= test(
+ "UnoRuntime.areSame(test2Bc, test2Bb)",
+ UnoRuntime.areSame(test2Bc, test2Bb));
+ success &= test(
+ "test2Bc.equals(test2Bc)",
+ test2Bc.equals(test2Bc));
+ success &= test(
+ "UnoRuntime.areSame(test2Bc, test2Bc)",
+ UnoRuntime.areSame(test2Bc, test2Bc));
+
+ success &= test(
+ "test1Aa.hashCode() == test1Ab.hashCode()",
+ test1Aa.hashCode()
+ == test1Ab.hashCode());
+ success &= test(
+ "test1Aa.hashCode()"
+ + " == test1Ac.hashCode()",
+ test1Aa.hashCode()
+ == test1Ac.hashCode());
+ success &= test(
+ "test1Aa.hashCode()"
+ + " == test1Ba.hashCode()",
+ test1Aa.hashCode()
+ == test1Ba.hashCode());
+ success &= test(
+ "test1Aa.hashCode()"
+ + " == test1Bb.hashCode()",
+ test1Aa.hashCode()
+ == test1Bb.hashCode());
+ success &= test(
+ "test1Aa.hashCode()"
+ + " == test1Bc.hashCode()",
+ test1Aa.hashCode()
+ == test1Bc.hashCode());
+ success &= test(
+ "test2Aa.hashCode()"
+ + " == test2Ab.hashCode()",
+ test2Aa.hashCode()
+ == test2Ab.hashCode());
+ success &= test(
+ "test2Aa.hashCode()"
+ + " == test2Ac.hashCode()",
+ test2Aa.hashCode()
+ == test2Ac.hashCode());
+ success &= test(
+ "test2Aa.hashCode()"
+ + " == test2Ba.hashCode()",
+ test2Aa.hashCode()
+ == test2Ba.hashCode());
+ success &= test(
+ "test2Aa.hashCode()"
+ + " == test2Bb.hashCode()",
+ test2Aa.hashCode()
+ == test2Bb.hashCode());
+ success &= test(
+ "test2Aa.hashCode()"
+ + " == test2Bc.hashCode()",
+ test2Aa.hashCode()
+ == test2Bc.hashCode());
+
+ done.notifyDone();
+ testBed.serverDone(success);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+ };
+
+ private /*static*/ boolean test(
+ String message, boolean condition)
+ {
+ if (!condition) {
+ System.err.println("Failed: " + message);
+ }
+ return condition;
+ }
+ }.start();
+ }
+ };
+ }
+
+ private final TestBed testBed;
+ private final String unoTypes;
+ private final String unoServices;
+ }
+
+ public interface XDone extends XInterface {
+ void notifyDone();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("notifyDone", 0, 0) };
+ }
+
+ public interface XTestFrame extends XInterface {
+ void notifyAccepting(XDone done, Object object1, Object object2);
+
+ TypeInfo[] UNOTYPEINFO = {
+ new MethodTypeInfo("notifyAccepting", 0, TypeInfo.ONEWAY) };
+ }
+
+ // Use "127.0.0.1" instead of "localhost", see #i32281#:
+ private static final String CONNECTION_DESCRIPTION
+ = "socket,host=127.0.0.1,port=12346";
+ private static final String PROTOCOL_DESCRIPTION = "urp";
+
+ private static final String INSTANCE1 = "instance1";
+ private static final String INSTANCE2 = "instance2";
+}
diff --git a/bridges/test/java_uno/equals/makefile.mk b/bridges/test/java_uno/equals/makefile.mk
new file mode 100644
index 000000000000..9ac266f80ff5
--- /dev/null
+++ b/bridges/test/java_uno/equals/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# 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_javauno_equals
+PACKAGE = test$/java_uno$/equals
+
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE: settings.mk
+
+# Make sure TestBed.class is found under $(CLASSDIR)$/test:
+.IF "$(XCLASSPATH)" == ""
+XCLASSPATH := $(CLASSDIR)$/test
+.ELSE
+XCLASSPATH !:= $(XCLASSPATH)$(PATH_SEPERATOR)$(CLASSDIR)$/test
+.ENDIF
+
+DLLPRE = # no leading "lib" on .so files
+INCPRE += $(MISC)$/$(TARGET)$/inc
+
+SLOFILES = $(SLO)$/testequals.obj
+
+SHL1TARGET = testequals.uno
+SHL1OBJS = $(SLOFILES)
+SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
+SHL1VERSIONMAP = $(SOLARENV)/src/component.map
+SHL1IMPLIB = itestequals
+
+JAVAFILES = TestEquals.java
+JARFILES = juh.jar jurt.jar ridl.jar
+
+.INCLUDE: target.mk
+
+ALLTAR: $(BIN)$/testequals
+
+.IF "$(GUI)" == "WNT"
+GIVE_EXEC_RIGHTS = @echo
+.ELSE # GUI, WNT
+GIVE_EXEC_RIGHTS = chmod +x
+.ENDIF # GUI, WNT
+
+EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i)
+EXEC_CLASSPATH = \
+ $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/)))
+
+$(MISC)$/$(TARGET).rdb: types.idl
+ - rm $@
+ - $(MKDIR) $(MISC)$/$(TARGET)
+ - $(MKDIR) $(MISC)$/$(TARGET)$/inc
+ $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $<
+ $(REGMERGE) $(MISC)$/$(TARGET).rdb /UCR $(MISC)$/$(TARGET)$/types.urd
+ $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb
+ $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb
+
+$(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET).rdb
+
+$(BIN)$/testequals: $(BIN)$/testequals_services.rdb
+ echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \
+ ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\
+..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \
+ test.java_uno.equals.TestEquals $(SOLARBINDIR)$/types.rdb \
+ testequals_services.rdb > $@
+ $(GIVE_EXEC_RIGHTS) $@
+
+$(BIN)$/testequals_services.rdb:
+ - rm $@
+ $(REGCOMP) -register -r $@ -c bridgefac.uno
+ $(REGCOMP) -register -r $@ -c connector.uno
+ $(REGCOMP) -register -r $@ -c remotebridge.uno
diff --git a/bridges/test/java_uno/equals/testequals.cxx b/bridges/test/java_uno/equals/testequals.cxx
new file mode 100644
index 000000000000..81357e12899b
--- /dev/null
+++ b/bridges/test/java_uno/equals/testequals.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include "com/sun/star/bridge/XBridge.hpp"
+#include "com/sun/star/bridge/XBridgeFactory.hpp"
+#include "com/sun/star/connection/Connector.hpp"
+#include "com/sun/star/connection/XConnection.hpp"
+#include "com/sun/star/connection/XConnector.hpp"
+#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "com/sun/star/registry/InvalidRegistryException.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/weak.hxx"
+#include "rtl/string.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "test/java_uno/equals/XBase.hpp"
+#include "test/java_uno/equals/XDerived.hpp"
+#include "test/java_uno/equals/XTestInterface.hpp"
+#include "uno/environment.h"
+#include "uno/lbnames.h"
+
+namespace css = com::sun::star;
+
+namespace {
+
+class Service: public cppu::WeakImplHelper2<
+ css::lang::XServiceInfo, test::java_uno::equals::XTestInterface >
+{
+public:
+ virtual inline rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return rtl::OUString::createFromAscii(getImplementationName_static()); }
+
+ virtual sal_Bool SAL_CALL supportsService(
+ rtl::OUString const & rServiceName) throw (css::uno::RuntimeException);
+
+ virtual inline css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return getSupportedServiceNames_static(); }
+
+ virtual void SAL_CALL connect(rtl::OUString const & rConnection,
+ rtl::OUString const & rProtocol)
+ throw (css::uno::Exception);
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL get(
+ rtl::OUString const & rName) throw (css::uno::RuntimeException);
+
+ static inline sal_Char const * getImplementationName_static()
+ { return "com.sun.star.test.bridges.testequals.impl"; }
+
+ static css::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_static();
+
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const & rContext)
+ throw (css::uno::Exception);
+
+private:
+ explicit inline Service(
+ css::uno::Reference< css::uno::XComponentContext > const & rContext):
+ m_xContext(rContext) {}
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::bridge::XBridge > m_xBridge;
+};
+
+}
+
+sal_Bool Service::supportsService(rtl::OUString const & rServiceName)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > aNames(
+ getSupportedServiceNames_static());
+ for (sal_Int32 i = 0; i< aNames.getLength(); ++i)
+ if (aNames[i] == rServiceName)
+ return true;
+ return false;
+}
+
+void Service::connect(rtl::OUString const & rConnection,
+ rtl::OUString const & rProtocol)
+ throw (css::uno::Exception)
+{
+ css::uno::Reference< css::connection::XConnection > xConnection(
+ css::connection::Connector::create(m_xContext)->connect(rConnection));
+ css::uno::Reference< css::bridge::XBridgeFactory > xBridgeFactory(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.bridge.BridgeFactory"),
+ m_xContext),
+ css::uno::UNO_QUERY);
+ m_xBridge = xBridgeFactory->createBridge(rtl::OUString(), rProtocol,
+ xConnection, 0);
+}
+
+css::uno::Reference< css::uno::XInterface >
+Service::get(rtl::OUString const & rName) throw (css::uno::RuntimeException)
+{
+ return m_xBridge->getInstance(rName);
+}
+
+css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames_static()
+{
+ css::uno::Sequence< rtl::OUString > aNames(1);
+ aNames[0] = rtl::OUString::createFromAscii(
+ "com.sun.star.test.bridges.testequals");
+ return aNames;
+}
+
+css::uno::Reference< css::uno::XInterface > Service::createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const & rContext)
+ throw (css::uno::Exception)
+{
+ // Make types known:
+ getCppuType(
+ static_cast<
+ css::uno::Reference< test::java_uno::equals::XBase > const * >(0));
+ getCppuType(
+ static_cast<
+ css::uno::Reference< test::java_uno::equals::XDerived > const * >(0));
+ getCppuType(
+ static_cast<
+ css::uno::Reference< test::java_uno::equals::XTestInterface > const * >(
+ 0));
+
+ return static_cast< cppu::OWeakObject * >(new Service(rContext));
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ sal_Char const ** pEnvTypeName, uno_Environment **)
+{
+ *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName,
+ void * pServiceManager, void *)
+{
+ void * pFactory = 0;
+ if (pServiceManager)
+ if (rtl_str_compare(pImplName, Service::getImplementationName_static())
+ == 0)
+ {
+ css::uno::Reference< css::lang::XSingleComponentFactory >
+ xFactory(cppu::createSingleComponentFactory(
+ &Service::createInstance,
+ rtl::OUString::createFromAscii(
+ Service::getImplementationName_static()),
+ Service::getSupportedServiceNames_static()));
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pFactory = xFactory.get();
+ }
+ }
+ return pFactory;
+}
+
+namespace {
+
+bool writeInfo(void * pRegistryKey, sal_Char const * pImplementationName,
+ css::uno::Sequence< rtl::OUString > const & rServiceNames)
+{
+ rtl::OUString aKeyName(rtl::OUString::createFromAscii("/"));
+ aKeyName += rtl::OUString::createFromAscii(pImplementationName);
+ aKeyName += rtl::OUString::createFromAscii("/UNO/SERVICES");
+ css::uno::Reference< css::registry::XRegistryKey > xKey;
+ try
+ {
+ xKey = static_cast< css::registry::XRegistryKey * >(pRegistryKey)->
+ createKey(aKeyName);
+ }
+ catch (css::registry::InvalidRegistryException &) {}
+ if (!xKey.is())
+ return false;
+ bool bSuccess = true;
+ for (sal_Int32 i = 0; i < rServiceNames.getLength(); ++i)
+ try
+ {
+ xKey->createKey(rServiceNames[i]);
+ }
+ catch (css::registry::InvalidRegistryException &)
+ {
+ bSuccess = false;
+ break;
+ }
+ return bSuccess;
+}
+
+}
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey)
+{
+ return pRegistryKey
+ && writeInfo(pRegistryKey, Service::getImplementationName_static(),
+ Service::getSupportedServiceNames_static());
+}
diff --git a/bridges/test/java_uno/equals/types.idl b/bridges/test/java_uno/equals/types.idl
new file mode 100644
index 000000000000..c8ddc2f072fe
--- /dev/null
+++ b/bridges/test/java_uno/equals/types.idl
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * 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/Exception.idl"
+#include "com/sun/star/uno/XInterface.idl"
+
+// UNO interfaces used between Java and native (C++) environments.
+
+module test { module java_uno { module equals {
+
+interface XBase: com::sun::star::uno::XInterface {};
+
+interface XDerived: XBase {};
+
+interface XTestInterface: com::sun::star::uno::XInterface
+{
+ void connect([in] string connection, [in] string protocol)
+ raises (com::sun::star::uno::Exception);
+
+ com::sun::star::uno::XInterface get([in] string name);
+};
+
+}; }; };
diff --git a/bridges/test/java_uno/nativethreadpool/Relay.java b/bridges/test/java_uno/nativethreadpool/Relay.java
new file mode 100644
index 000000000000..50e198a2d819
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/Relay.java
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * 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 test.javauno.nativethreadpool;
+
+import com.sun.star.bridge.BridgeExistsException;
+import com.sun.star.bridge.XBridgeFactory;
+import com.sun.star.bridge.XInstanceProvider;
+import com.sun.star.comp.helper.Bootstrap;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.connection.AlreadyAcceptingException;
+import com.sun.star.connection.ConnectionSetupException;
+import com.sun.star.connection.Acceptor;
+import com.sun.star.connection.XAcceptor;
+import com.sun.star.connection.XConnection;
+import com.sun.star.lang.WrappedTargetRuntimeException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+
+public final class Relay implements XRelay, XSource {
+ public void start(XSource source) {
+ this.source = source;
+ XComponentContext context;
+ try {
+ context = Bootstrap.createInitialComponentContext(null);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (com.sun.star.uno.Exception e) {
+ throw new WrappedTargetRuntimeException(e.toString(), this, e);
+ } catch (Exception e) {
+ throw new com.sun.star.uno.RuntimeException(e.toString(), this);
+ }
+ final XAcceptor acceptor = Acceptor.create(context);
+ final XBridgeFactory factory;
+ try {
+ factory = UnoRuntime.queryInterface(
+ XBridgeFactory.class,
+ context.getServiceManager().createInstanceWithContext(
+ "com.sun.star.bridge.BridgeFactory", context));
+ } catch (com.sun.star.uno.Exception e) {
+ throw new WrappedTargetRuntimeException(e.toString(), this, e);
+ }
+ new Thread() {
+ public void run() {
+ try {
+ // Use "127.0.0.1" instead of "localhost", see #i32281#:
+ factory.createBridge(
+ "", "urp",
+ acceptor.accept("socket,host=127.0.0.1,port=3831"),
+ new XInstanceProvider() {
+ public Object getInstance(String instanceName) {
+ return Relay.this;
+ }
+ });
+ } catch (AlreadyAcceptingException e) {
+ e.printStackTrace(System.err);
+ } catch (ConnectionSetupException e) {
+ e.printStackTrace(System.err);
+ } catch (BridgeExistsException e) {
+ e.printStackTrace(System.err);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(System.err);
+ }
+ }
+ }.start();
+ try {
+ Thread.sleep(3000); // wait for new thread to accept connection
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new com.sun.star.uno.RuntimeException(e.toString(), this);
+ }
+ }
+
+ public int get() {
+ return source.get();
+ }
+
+ public static XSingleServiceFactory __getServiceFactory(
+ String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)
+ {
+ return implName.equals(implementationName)
+ ? FactoryHelper.getServiceFactory(
+ Relay.class, serviceName, multiFactory, regKey)
+ : null;
+ }
+
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ return FactoryHelper.writeRegistryServiceInfo(
+ implementationName, serviceName, regKey);
+ }
+
+ private static final String implementationName
+ = "test.javauno.nativethreadpool.comp.Relay";
+ private static final String serviceName
+ = "test.javauno.nativethreadpool.Relay";
+
+ private XSource source;
+}
diff --git a/bridges/test/java_uno/nativethreadpool/makefile.mk b/bridges/test/java_uno/nativethreadpool/makefile.mk
new file mode 100644
index 000000000000..d4926e07307b
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/makefile.mk
@@ -0,0 +1,121 @@
+#*************************************************************************
+#
+# 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_javauno_nativethreadpool
+PACKAGE := test$/javauno$/nativethreadpool
+
+ENABLE_EXCEPTIONS := TRUE
+
+#TODO:
+.IF "$(OS)" == "LINUX"
+JVM_LIB_URL := file:///net/grande.germany/develop6/update/dev/Linux_JDK_1.4.1_03/jre/lib/i386/client/libjvm.so
+.ELSE
+ERROR -- missing platform
+.ENDIF
+
+.INCLUDE: settings.mk
+
+DLLPRE = # no leading "lib" on .so files
+INCPRE += $(MISC)$/$(TARGET)$/inc
+
+SHL1TARGET = $(TARGET)_client.uno
+SHL1OBJS = $(SLO)$/testnativethreadpoolclient.obj
+SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
+SHL1VERSIONMAP = version.map
+SHL1IMPLIB = i$(TARGET)_client
+
+SHL2TARGET = $(TARGET)_server.uno
+SHL2OBJS = $(SLO)$/testnativethreadpoolserver.obj
+SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
+SHL2VERSIONMAP = version.map
+SHL2IMPLIB = i$(TARGET)_server
+
+SLOFILES = $(SHL1OBJS) $(SHL2OBJS)
+
+JAVAFILES = Relay.java
+JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar
+
+.INCLUDE: target.mk
+
+ALLTAR: test
+
+EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i)
+EXEC_CLASSPATH = \
+ $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/)))
+
+$(MISC)$/$(TARGET)$/types.rdb: types.idl
+ - rm $@
+ - $(MKDIR) $(MISC)$/$(TARGET)
+ - $(MKDIR) $(MISC)$/$(TARGET)$/inc
+ $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $<
+ $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/types.urd
+ $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb
+ $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb
+
+$(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET)$/types.rdb
+
+$(BIN)$/$(TARGET).uno.jar: $(JAVACLASSFILES) relay.manifest
+ jar cfm $@ relay.manifest -C $(CLASSDIR) test/javauno/nativethreadpool
+
+$(BIN)$/$(TARGET).rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.rdb \
+ $(BIN)$/$(TARGET).uno.jar
+ cp $(MISC)$/$(TARGET)$/types.rdb $@
+ $(REGMERGE) $@ / $(SOLARBINDIR)$/types.rdb
+ $(REGCOMP) -register -r $@ -c acceptor.uno$(DLLPOST) \
+ -c bridgefac.uno$(DLLPOST) -c connector.uno$(DLLPOST) \
+ -c remotebridge.uno$(DLLPOST) -c uuresolver.uno$(DLLPOST) \
+ -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \
+ -c stocservices.uno$(DLLPOST)
+ cp $(SOLARBINDIR)$/types.rdb $(MISC)$/$(TARGET)$/bootstrap.rdb
+ $(REGCOMP) -register -r $(MISC)$/$(TARGET)$/bootstrap.rdb \
+ -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \
+ -c stocservices.uno$(DLLPOST)
+.IF "$(GUI)" == "WNT"
+ ERROR -- missing platform
+.ELSE # GUI, WNT
+ + export OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' && \
+ $(REGCOMP) -register -r $@ -c file://$(PWD)/$(BIN)$/$(TARGET).uno.jar \
+ -br $(MISC)$/$(TARGET)$/bootstrap.rdb -classpath $(EXEC_CLASSPATH) \
+ -env:URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR)
+.ENDIF # GUI, WNT
+
+test .PHONY: $(SHL1TARGETN) $(BIN)$/$(TARGET).uno.jar $(BIN)$/$(TARGET).rdb
+.IF "$(GUI)" == "WNT"
+ ERROR -- missing platform
+.ELSE # GUI, WNT
+ $(AUGMENT_LIBRARY_PATH) uno -c test.javauno.nativethreadpool.server \
+ -l $(SHL2TARGETN) -ro $(BIN)$/$(TARGET).rdb \
+ -u 'uno:socket,host=localhost,port=3830;urp;test' --singleaccept &
+ + $(AUGMENT_LIBRARY_PATH) OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' \
+ CLASSPATH=$(EXEC_CLASSPATH)$(PATH_SEPERATOR)$(BIN)$/$(TARGET).uno.jar \
+ uno -c test.javauno.nativethreadpool.client -l $(SHL1TARGETN) \
+ -ro $(BIN)$/$(TARGET).rdb \
+ -env:URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR)
+.ENDIF # GUI, WNT
diff --git a/bridges/test/java_uno/nativethreadpool/readme b/bridges/test/java_uno/nativethreadpool/readme
new file mode 100644
index 000000000000..c137ed162372
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/readme
@@ -0,0 +1,39 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+Test that a Java URP bridge started in a native process uses the same thread
+pool as a C++ URP bridge. This test currently only works on Linux Intel.
+
+There are two processes involved. The client starts as a native process. It
+first loads a Java component (Relay) via the in-process JNI bridge, which in
+turn starts to accept incomming URP connections. The native part of the client
+then connects to the server, retrieves a thread-local token from it, and checks
+the token for correctness. The server simply waits for a connection from the
+native part of the client, creates a connection to the Java part of the client,
+and routes all requests from the native part of the client to the Java part of
+the client. The Java part of the client in turn uses the in-process JNI bridge
+to obtain the thread-local token.
diff --git a/bridges/test/java_uno/nativethreadpool/relay.manifest b/bridges/test/java_uno/nativethreadpool/relay.manifest
new file mode 100644
index 000000000000..6cd1d9dbd611
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/relay.manifest
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+RegistrationClassName: test.javauno.nativethreadpool.Relay
diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx
new file mode 100644
index 000000000000..1964a73d1878
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include "test/javauno/nativethreadpool/XRelay.hpp"
+#include "test/javauno/nativethreadpool/XSource.hpp"
+
+#include "com/sun/star/bridge/UnoUrlResolver.hpp"
+#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "com/sun/star/connection/ConnectionSetupException.hpp"
+#include "com/sun/star/connection/NoConnectException.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/lang/XMain.hpp"
+#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/thread.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/lbnames.h"
+
+#include <iostream>
+
+namespace css = com::sun::star;
+
+namespace {
+
+class Client: public cppu::WeakImplHelper2<
+ css::lang::XMain, test::javauno::nativethreadpool::XSource >
+{
+public:
+ explicit Client(
+ css::uno::Reference< css::uno::XComponentContext > const & theContext):
+ context(theContext) {}
+
+private:
+ virtual ~Client() {}
+
+ virtual sal_Int32 SAL_CALL run(css::uno::Sequence< rtl::OUString > const &)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL get() throw (css::uno::RuntimeException);
+
+ css::uno::Reference< css::uno::XComponentContext > context;
+ osl::ThreadData data;
+};
+
+sal_Int32 Client::run(css::uno::Sequence< rtl::OUString > const &)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Reference< css::lang::XMultiComponentFactory > factory(
+ context->getServiceManager());
+ if (!factory.is()) {
+ throw new css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "no component context service manager"),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ css::uno::Reference< test::javauno::nativethreadpool::XRelay > relay;
+ try {
+ relay = css::uno::Reference< test::javauno::nativethreadpool::XRelay >(
+ factory->createInstanceWithContext(
+ rtl::OUString::createFromAscii(
+ "test.javauno.nativethreadpool.Relay"),
+ context),
+ css::uno::UNO_QUERY_THROW);
+ } catch (css::uno::RuntimeException &) {
+ throw;
+ } catch (css::uno::Exception & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "creating test.javauno.nativethreadpool.Relay service"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ }
+ relay->start(this);
+ if (!data.setData(reinterpret_cast< void * >(12345))) {
+ throw new css::uno::RuntimeException(
+ rtl::OUString::createFromAscii("osl::ThreadData::setData failed"),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ css::uno::Reference< test::javauno::nativethreadpool::XSource > source;
+ try {
+ source
+ = css::uno::Reference< test::javauno::nativethreadpool::XSource >(
+ css::bridge::UnoUrlResolver::create(context)->resolve(
+ rtl::OUString::createFromAscii(
+ "uno:socket,host=localhost,port=3830;urp;test")),
+ css::uno::UNO_QUERY_THROW);
+ } catch (css::connection::NoConnectException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.uno.UnoUrlResolver.resolve"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ } catch (css::connection::ConnectionSetupException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.uno.UnoUrlResolver.resolve"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.uno.UnoUrlResolver.resolve"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ }
+ bool success = source->get() == 12345;
+ std::cout << "success? " << (success ? "yes" : "no") << '\n';
+ return success ? 0 : 1;
+}
+
+sal_Int32 Client::get() throw (css::uno::RuntimeException) {
+ return reinterpret_cast< sal_Int32 >(data.getData());
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL create(
+ css::uno::Reference< css::uno::XComponentContext > const & context)
+ SAL_THROW((css::uno::Exception))
+{
+ return static_cast< cppu::OWeakObject * >(new Client(context));
+}
+
+rtl::OUString SAL_CALL getImplementationName() {
+ return rtl::OUString::createFromAscii(
+ "test.javauno.nativethreadpool.client");
+}
+
+css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() {
+ return css::uno::Sequence< rtl::OUString >();
+}
+
+cppu::ImplementationEntry entries[] = {
+ { &create, &getImplementationName, &getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" void * SAL_CALL component_getFactory(
+ char const * implName, void * serviceManager, void * registryKey)
+{
+ return cppu::component_getFactoryHelper(
+ implName, serviceManager, registryKey, entries);
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ char const ** envTypeName, uno_Environment **)
+{
+ *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx
new file mode 100644
index 000000000000..0e3b30effb7e
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include "test/javauno/nativethreadpool/XSource.hpp"
+
+#include "com/sun/star/bridge/UnoUrlResolver.hpp"
+#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "com/sun/star/connection/ConnectionSetupException.hpp"
+#include "com/sun/star/connection/NoConnectException.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/weak.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/lbnames.h"
+
+namespace css = com::sun::star;
+
+namespace {
+
+class Server:
+ public cppu::WeakImplHelper1< test::javauno::nativethreadpool::XSource >
+{
+public:
+ explicit Server(
+ css::uno::Reference< css::uno::XComponentContext > const & theContext):
+ context(theContext) {}
+
+private:
+ virtual ~Server() {}
+
+ virtual sal_Int32 SAL_CALL get() throw (css::uno::RuntimeException);
+
+ css::uno::Reference< css::uno::XComponentContext > context;
+};
+
+sal_Int32 Server::get() throw (css::uno::RuntimeException) {
+ css::uno::Reference< css::lang::XMultiComponentFactory > factory(
+ context->getServiceManager());
+ if (!factory.is()) {
+ throw new css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "no component context service manager"),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ css::uno::Reference< test::javauno::nativethreadpool::XSource > source;
+ try {
+ // Use "127.0.0.1" instead of "localhost", see #i32281#:
+ source
+ = css::uno::Reference< test::javauno::nativethreadpool::XSource >(
+ css::bridge::UnoUrlResolver::create(context)->resolve(
+ rtl::OUString::createFromAscii(
+ "uno:socket,host=127.0.0.1,port=3831;urp;test")),
+ css::uno::UNO_QUERY_THROW);
+ } catch (css::connection::NoConnectException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.uno.UnoUrlResolver.resolve"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ } catch (css::connection::ConnectionSetupException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.uno.UnoUrlResolver.resolve"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.uno.UnoUrlResolver.resolve"),
+ static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
+ }
+ return source->get();
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL create(
+ css::uno::Reference< css::uno::XComponentContext > const & context)
+ SAL_THROW((css::uno::Exception))
+{
+ return static_cast< cppu::OWeakObject * >(new Server(context));
+}
+
+rtl::OUString SAL_CALL getImplementationName() {
+ return rtl::OUString::createFromAscii(
+ "test.javauno.nativethreadpool.server");
+}
+
+css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() {
+ return css::uno::Sequence< rtl::OUString >();
+}
+
+cppu::ImplementationEntry entries[] = {
+ { &create, &getImplementationName, &getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" void * SAL_CALL component_getFactory(
+ char const * implName, void * serviceManager, void * registryKey)
+{
+ return cppu::component_getFactoryHelper(
+ implName, serviceManager, registryKey, entries);
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ char const ** envTypeName, uno_Environment **)
+{
+ *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
diff --git a/bridges/test/java_uno/nativethreadpool/types.idl b/bridges/test/java_uno/nativethreadpool/types.idl
new file mode 100644
index 000000000000..36ca44af37e0
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/types.idl
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * 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 test { module javauno { module nativethreadpool {
+
+interface XSource: com::sun::star::uno::XInterface {
+ long get();
+};
+
+interface XRelay: com::sun::star::uno::XInterface {
+ void start([in] XSource source);
+};
+
+}; }; };
diff --git a/bridges/test/java_uno/nativethreadpool/version.map b/bridges/test/java_uno/nativethreadpool/version.map
new file mode 100644
index 000000000000..b560ad15b99f
--- /dev/null
+++ b/bridges/test/java_uno/nativethreadpool/version.map
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+ global:
+ component_getFactory;
+ component_getImplementationEnvironment;
+
+ local:
+ *;
+};
diff --git a/bridges/test/makefile.mk b/bridges/test/makefile.mk
new file mode 100644
index 000000000000..1c8c6f8cf10d
--- /dev/null
+++ b/bridges/test/makefile.mk
@@ -0,0 +1,175 @@
+#*************************************************************************
+#
+# 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
+LIBTARGET=NO
+TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+ALLIDLFILES = test_bridge.idl
+CPPUMAKERFLAGS += -C
+
+
+UNOUCRDEP=$(SOLARBINDIR)$/udkapi.rdb $(BIN)$/test.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb $(BIN)$/test.rdb
+
+# output directory (one dir for each project)
+UNOUCROUT=$(OUT)$/inc
+
+# adding to inludeoath
+INCPRE+=$(UNOUCROUT)
+CFLAGS += -I..$/source$/remote$/urp
+
+UNOTYPES = \
+ com.sun.star.uno.XWeak\
+ com.sun.star.uno.XNamingService\
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.TypeClass\
+ com.sun.star.io.XInputStream\
+ com.sun.star.io.XOutputStream\
+ com.sun.star.lang.XInitialization \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.corba.giop.TargetAddress \
+ com.sun.star.corba.giop.TargetAddressGroup \
+ com.sun.star.lang.XComponent \
+ com.sun.star.bridge.XBridgeFactory\
+ com.sun.star.connection.XAcceptor\
+ com.sun.star.connection.XConnector\
+ com.sun.star.beans.Property\
+ com.sun.star.corba.giop.RequestHeader_1_2\
+ com.sun.star.container.XSet\
+ com.sun.star.lang.XServiceInfo\
+ test.XTestFactory \
+ com.sun.star.test.performance.XPerformanceTest \
+ com.sun.star.lang.XMain \
+ com.sun.star.lang.XMultiComponentFactory \
+ com.sun.star.lang.XSingleComponentFactory
+
+JARFILES = jurt.jar unoil.jar
+
+OBJFILES= \
+ $(OBJ)$/testserver.obj \
+ $(OBJ)$/testclient.obj \
+ $(OBJ)$/testcomp.obj \
+ $(OBJ)$/testsameprocess.obj
+
+
+APP2TARGET= testserver
+APP2OBJS= $(OBJ)$/testserver.obj \
+ $(OBJ)$/testcomp.obj
+
+.IF "$(OS)" == "LINUX"
+APP2STDLIBS+= -lstdc++
+.ENDIF
+
+APP2STDLIBS+= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+APP3TARGET= testclient
+APP3OBJS= $(OBJ)$/testclient.obj \
+ $(OBJ)$/testcomp.obj
+
+.IF "$(OS)" == "LINUX"
+APP3STDLIBS+= -lstdc++
+.ENDIF
+
+APP3STDLIBS+= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+#----------------------------------
+
+APP4TARGET= testsameprocess
+APP4OBJS= $(OBJ)$/testsameprocess.obj \
+ $(OBJ)$/testcomp.obj
+
+.IF "$(OS)" == "LINUX"
+APP4STDLIBS+= -lstdc++
+.ENDIF
+
+APP4STDLIBS+= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+APP4DEF= $(MISC)$/$(APP4TARGET).def
+
+#----------------------------------
+
+# APP5TARGET= testoffice
+# APP5OBJS= $(OBJ)$/testoffice.obj \
+# $(OBJ)$/testcomp.obj
+
+# .IF "$(OS)" == "LINUX"
+# APP5STDLIBS+= -lstdc++
+# .ENDIF
+
+# APP5STDLIBS+= \
+# $(CPPULIB) \
+# $(CPPUHELPERLIB)\
+# $(SALLIB)
+
+# APP5DEF= $(MISC)$/$(APP5TARGET).def
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+ALLTAR : $(BIN)$/test.rdb \
+ $(BIN)$/server.rdb \
+ $(BIN)$/client.rdb
+
+$(BIN)$/test.rdb: $(ALLIDLFILES)
+ $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $?
+ $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+ touch $@
+
+$(BIN)$/client.rdb: $(BIN)$/test.rdb
+ rm -f $(BIN)$/client.rdb
+ $(REGMERGE) $@ / $(BIN)$/test.rdb $(SOLARBINDIR)$/udkapi.rdb
+
+$(BIN)$/server.rdb: $(BIN)$/test.rdb
+ rm -f $(BIN)$/client.rdb
+ $(REGMERGE) $@ / $(BIN)$/test.rdb $(SOLARBINDIR)$/udkapi.rdb
+
diff --git a/bridges/test/performance/makefile.mk b/bridges/test/performance/makefile.mk
new file mode 100644
index 000000000000..c987699f5bd9
--- /dev/null
+++ b/bridges/test/performance/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# 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
+LIBTARGET=NO
+TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/testperformance.obj
+
+#----------------------------------
+
+APP1TARGET= testperformance
+APP1OBJS= $(OBJ)$/testperformance.obj
+
+.IF "$(OS)" == "LINUX"
+APP1STDLIBS+= -lstdc++
+.ENDIF
+
+APP1STDLIBS+= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+APP1DEF= $(MISC)$/$(APP1TARGET).def
+
+.INCLUDE : target.mk
+
diff --git a/bridges/test/performance/testperformance.cxx b/bridges/test/performance/testperformance.cxx
new file mode 100644
index 000000000000..be63f093627a
--- /dev/null
+++ b/bridges/test/performance/testperformance.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+
+#include <stdio.h>
+#include <math.h>
+
+#include <osl/interlck.h>
+#include <osl/mutex.hxx>
+#include <osl/semaphor.h>
+
+#include <rtl/string.hxx>
+#include <rtl/byteseq.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#ifdef SAL_W32
+#include <windows.h>
+#else
+#include <sys/times.h>
+#endif
+#ifndef ULONG_MAX
+#define ULONG_MAX 0xffffffff
+#endif
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star::uno;
+
+static inline sal_uInt32 getSystemTicks()
+{
+#ifdef SAL_W32
+ return (sal_uInt32)GetTickCount();
+#else // only UNX supported for now
+ static sal_uInt32 nImplTicksPerSecond = 0;
+ static double dImplTicksPerSecond;
+ static double dImplTicksULONGMAX;
+
+ struct tms aTms;
+ sal_uInt32 nTicks = (sal_uInt32)times( &aTms );
+
+ if ( !nImplTicksPerSecond )
+ {
+ nImplTicksPerSecond = CLK_TCK;
+ dImplTicksPerSecond = nImplTicksPerSecond;
+ dImplTicksULONGMAX = (double)(sal_uInt32)ULONG_MAX;
+ }
+
+ double fTicks = nTicks;
+ fTicks *= 1000;
+ fTicks /= dImplTicksPerSecond;
+ fTicks = fmod (fTicks, dImplTicksULONGMAX);
+
+ return (sal_uInt32)fTicks;
+#endif
+}
+
+class MyTimer
+{
+public:
+ MyTimer( const OString &descString ) :
+ nStart( getSystemTicks() ),
+ m_descString( descString )
+ {
+ }
+ ~MyTimer( )
+ {
+ printf( "%f s : %s\n", (getSystemTicks() -nStart) / 1000., m_descString.getStr() );
+ }
+private:
+ sal_uInt32 nStart;
+ OString m_descString;
+};
+
+void main()
+{
+ // interlocked count
+ {
+ MyTimer timer( "performance - 1000*10000 interlocked count" );
+ oslInterlockedCount count;
+ for( int i = 0 ; i < 1000*10000 ; i ++ )
+ {
+ osl_incrementInterlockedCount( &count );
+ }
+ }
+ {
+ OString myDummyString( "blubber" );
+ MyTimer timer( "performance - 1000*10000 acquiring/releasing a refcounted string(without destruction)" );
+ for( int i = 0 ; i < 1000*10000 ; i ++ )
+ {
+ OString myNextDummyString = myDummyString ;
+ }
+ }
+
+ printf( "--------------------\n" );
+ {
+ Mutex mutex;
+ MyTimer timer( "performance - 1000*10000 acquiring/releasing an osl::Mutex" );
+ for( int i = 0 ; i < 1000*10000 ; i ++ )
+ {
+ MutexGuard guard( mutex );
+ }
+ }
+
+ {
+ oslSemaphore sema = osl_createSemaphore(1);
+ MyTimer timer( "performance - 1000*10000 acquiring/releasing an osl::Semaphore" );
+ for( int i = 0 ; i < 1000*10000 ; i ++ )
+ {
+ osl_acquireSemaphore( sema );
+ osl_releaseSemaphore( sema );
+ }
+ }
+
+ printf( "--------------------\n" );
+ {
+ MyTimer timer( "performance - 1000*10000 rtl::ByteSequence(500)" );
+ for( int i = 0 ; i < 1000*1000 ; i ++ )
+ {
+ ByteSequence seq(500);
+ }
+ }
+
+ {
+ MyTimer timer( "performance - 1000*1000 rtl::ByteSequence(500,BYTESEQ_NODEFAULT)" );
+ for( int i = 0 ; i < 1000*1000 ; i ++ )
+ {
+ ByteSequence seq(500, BYTESEQ_NODEFAULT);
+ }
+ }
+ {
+ MyTimer timer( "performance - 1000*1000 com::sun::star::uno::Sequence< sal_Int8 > (500)" );
+ for( int i = 0 ; i < 1000*1000 ; i ++ )
+ {
+ Sequence< sal_Int8> seq(500);
+ }
+ }
+ {
+ MyTimer timer( "performance - 1000*1000 rtl_freeMemory( rtl_allocateMemory( 512 ) )" );
+ for( int i = 0 ; i < 1000*1000 ; i ++ )
+ {
+ rtl_freeMemory( rtl_allocateMemory( 512 ) );
+ }
+ }
+
+ printf( "--------------------\n" );
+ {
+ MyTimer timer( "performance - 1000*1000 byte string construction/destruction" );
+ for( int i = 0 ; i < 1000*1000 ; i ++ )
+ {
+ OString textEnc( "this is a test string" );
+ }
+ }
+
+ {
+ MyTimer timer( "performance - 1000*1000 unicode string construction/destruction" );
+ for( int i = 0 ; i < 1000*1000 ; i ++ )
+ {
+ OUString textEnc( RTL_CONSTASCII_USTRINGPARAM( "this is a test string" ) );
+ }
+ }
+
+}
diff --git a/bridges/test/test_bridge.idl b/bridges/test/test_bridge.idl
new file mode 100644
index 000000000000..ce38594ecd88
--- /dev/null
+++ b/bridges/test/test_bridge.idl
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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>
+#include <com/sun/star/uno/Exception.idl>
+
+module test
+{
+
+struct TestTypes
+{
+ boolean Bool;
+ char Char;
+ byte Byte;
+ short Short;
+ unsigned short UShort;
+ long Long;
+ unsigned long ULong;
+ hyper Hyper;
+ unsigned hyper UHyper;
+ float Float;
+ double Double;
+// test::TestEnum Enum;
+ string String;
+ com::sun::star::uno::XInterface Interface;
+ any Any;
+};
+
+exception TestBridgeException : com::sun::star::uno::Exception
+{
+
+};
+
+interface XCallMe : com::sun::star::uno::XInterface
+{
+ void call( [in] string s , [in] long nToDo ) raises( TestBridgeException );
+ [oneway] void callOneway( [in] string s , [in] long nToDo );
+ [attribute] string sAttribute;
+ void callAgain( [in] XCallMe callAgain, [in] long nToCall );
+ TestTypes transport( [in] TestTypes types );
+ [oneway] void drawLine( [in] long x1 , [in] long y1, [in] long x2, [in] long y2 );
+};
+
+interface XInterfaceTest : com::sun::star::uno::XInterface
+{
+ void setIn( [in] XCallMe callback );
+ void setInOut( [inout] XCallMe callback );
+ void getOut( [out] XCallMe callback );
+ XCallMe get();
+};
+
+interface XTestFactory : com::sun::star::uno::XInterface
+{
+ XCallMe createCallMe();
+ XInterfaceTest createInterfaceTest();
+};
+
+
+};
diff --git a/bridges/test/testclient.cxx b/bridges/test/testclient.cxx
new file mode 100644
index 000000000000..df7164c844d2
--- /dev/null
+++ b/bridges/test/testclient.cxx
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+#include <string.h>
+
+#include <osl/time.h>
+
+#include <osl/mutex.hxx>
+#include <osl/module.h>
+#include <osl/thread.h>
+#include <osl/conditn.h>
+#include <osl/diagnose.h>
+
+#include <uno/mapping.hxx>
+
+#include <cppuhelper/servicefactory.hxx>
+
+#include <com/sun/star/connection/XConnector.hpp>
+
+#include <com/sun/star/bridge/XBridgeFactory.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMain.hpp>
+
+#include <com/sun/star/test/performance/XPerformanceTest.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/factory.hxx>
+
+#include <test/XTestFactory.hpp>
+
+
+using namespace ::test;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::bridge;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::connection;
+using namespace ::com::sun::star::test::performance;
+
+#include "testcomp.h"
+
+
+void doPerformanceTest( const Reference < XPerformanceTest > & /* xBench */)
+{
+ printf( "not implemented\n" );
+// sal_Int32 i,nLoop = 2000;
+// sal_Int32 tStart, tEnd , tEnd2;
+// //------------------------------------
+// // oneway calls
+// i = nLoop;
+// tStart = GetTickCount();
+// while (i--)
+// xBench->async();
+// tEnd = GetTickCount();
+// xBench->sync();
+// tEnd2 = GetTickCount();
+// printf( "%d %d %d\n" , nLoop, tEnd - tStart , tEnd2 -tStart );
+// // synchron calls
+// i = nLoop;
+// tStart = GetTickCount();
+// while (i--)
+// xBench->sync();
+// tEnd = GetTickCount();
+// printf( "%d %d \n" , nLoop, tEnd - tStart );
+
+}
+
+void testLatency( const Reference < XConnection > &r , sal_Bool /* bReply */)
+{
+ sal_Int32 nLoop = 10000;
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+
+ sal_Int32 i;
+ for( i = 0 ; i < nLoop ; i++ )
+ {
+ Sequence< sal_Int8 > s1( 200 );
+ r->write( s1 );
+ r->read( s1 , 12 );
+ r->read( s1 , 48 );
+ }
+ osl_getSystemTime( &aEndTime );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+
+ printf( "System latency per call : %g\n" , (( fEnd-fStart )/2.) / ((double)(nLoop)) );
+}
+
+int main( int argc, char *argv[] )
+{
+ if( argc < 2 )
+ {
+ printf(
+ "usage : testclient [-r] connectionstring\n"
+ " -r reverse call me test (server calls client)"
+ );
+ return 0;
+ }
+
+ OUString sConnectionString;
+ OUString sProtocol;
+ sal_Bool bLatency = sal_False;
+ sal_Bool bReverse = sal_False;
+
+ parseCommandLine( argv , &sConnectionString , &sProtocol , &bLatency , &bReverse );
+
+ {
+ Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("client.rdb")) );
+
+
+ Reference < XConnector > rConnector(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("connector.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+
+ try
+ {
+ Reference < XConnection > rConnection =
+ rConnector->connect( sConnectionString );
+
+ printf( "%s\n" , OUStringToOString( rConnection->getDescription(),
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+
+
+ if( bLatency )
+ {
+ testLatency( rConnection , sal_False );
+ testLatency( rConnection , sal_True );
+ }
+ else
+ {
+ // just ensure that it is registered
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.Bridge.iiop")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("remotebridge.uno" SAL_DLLEXTENSION)),
+ rSMgr );
+
+ Reference < XBridgeFactory > rFactory(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bridgefac.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+ if( rFactory.is() )
+ {
+
+ Reference < XBridge > rBridge = rFactory->createBridge(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bla blub")),
+ sProtocol,
+ rConnection,
+ new OInstanceProvider );
+ {
+ // test the factory
+ Reference < XBridge > rBridge2 = rFactory->getBridge( OUString( RTL_CONSTASCII_USTRINGPARAM("bla blub")) );
+ OSL_ASSERT( rBridge2.is() );
+ OSL_ASSERT( rBridge2->getDescription() == rBridge->getDescription( ) );
+ OSL_ASSERT( rBridge2->getName() == rBridge->getName() );
+ OSL_ASSERT( rBridge2 == rBridge );
+ }
+
+
+ Reference < XInterface > rInitialObject = rBridge->getInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bridges-testobject")) );
+
+ if( rInitialObject.is() )
+ {
+ printf( "got the remote object\n" );
+ if( ! bReverse )
+ {
+ // Reference < XComponent > rPerfTest( rInitialObject , UNO_QUERY );
+// if( rPerfTest.is() )
+// {
+// // doPerformanceTest( rPerfTest );
+// }
+// else
+// {
+ testRemote( rInitialObject );
+// }
+ }
+ }
+// Reference < XComponent > rComp( rBridge , UNO_QUERY );
+// rComp->dispose();
+
+ rInitialObject = Reference < XInterface > ();
+ printf( "Waiting...\n" );
+ TimeValue value={bReverse ?1000 :2,0};
+ osl_waitThread( &value );
+ printf( "Closing...\n" );
+ }
+
+ Reference < XBridge > rBridge = rFactory->getBridge( OUString( RTL_CONSTASCII_USTRINGPARAM("bla blub")) );
+// OSL_ASSERT( ! rBridge.is() );
+ }
+
+ }
+ catch( DisposedException & e )
+ {
+ OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
+ printf( "A remote object reference became invalid\n%s\n" , o.pData->buffer );
+ }
+ catch( Exception &e )
+ {
+ OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
+ printf( "Login failed, got an Exception !\n%s\n" , o.pData->buffer );
+ }
+
+
+ Reference < XComponent > rComp( rSMgr , UNO_QUERY );
+ rComp->dispose();
+ }
+ printf( "Closed\n" );
+ return 0;
+}
+
diff --git a/bridges/test/testclient.java b/bridges/test/testclient.java
new file mode 100644
index 000000000000..f2963f685b9f
--- /dev/null
+++ b/bridges/test/testclient.java
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.IBridge;
+import com.sun.star.connection.XConnector;
+import com.sun.star.connection.XConnection;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.bridge.XInstanceProvider;
+
+import test.XCallMe;
+import test.XTestFactory;
+
+
+class MyInstanceProvider implements XInstanceProvider
+{
+ public Object getInstance( String sName )
+ {
+ System.out.println( "getInstance called" );
+ return new MyTestFactory();
+ }
+
+}
+
+
+class MyTestFactory implements XTestFactory
+{
+ public XCallMe createCallMe( ) throws com.sun.star.uno.RuntimeException
+ {
+ return new MyCallMe();
+ }
+
+ public test.XInterfaceTest createInterfaceTest( ) throws com.sun.star.uno.RuntimeException
+ {
+ return null;
+ }
+
+}
+class MyCallMe implements XCallMe
+{
+ public String getsAttribute() throws com.sun.star.uno.RuntimeException
+ {
+ return "";
+ }
+ public void setsAttribute( String _sattribute ) throws com.sun.star.uno.RuntimeException
+ {
+ }
+
+ // Methods
+ public void call( /*IN*/String s, /*IN*/int nToDo ) throws test.TestBridgeException, com.sun.star.uno.RuntimeException
+ {
+
+ }
+ public void callOneway( /*IN*/String s, /*IN*/int nToDo ) throws com.sun.star.uno.RuntimeException
+ {
+ System.out.println( "entering callOneway" );
+// this.wait( 5 );
+ try {
+ Thread.currentThread().sleep( 4000 );
+ }
+ catch ( java.lang.Exception e )
+ {
+ System.out.println( e );
+ }
+ System.out.println( "leaving callOneway" );
+ }
+ public void callAgain( /*IN*/XCallMe callAgain, /*IN*/int nToCall ) throws com.sun.star.uno.RuntimeException
+ {
+
+ }
+ public test.TestTypes transport( /*IN*/test.TestTypes types ) throws com.sun.star.uno.RuntimeException
+ {
+ return new test.TestTypes();
+ }
+
+}
+
+public class testclient
+{
+ static void main( String[] args )
+ {
+ try {
+
+ com.sun.star.comp.servicemanager.ServiceManager smgr =
+ new com.sun.star.comp.servicemanager.ServiceManager();
+ smgr.addFactories( new String[] { "com.sun.star.comp.connections.Connector" });
+
+ Object x = smgr.createInstance("com.sun.star.connection.Connector");
+ if( x == null )
+ {
+ System.out.println( "couldn't create connector\n" );
+ return;
+ }
+
+
+ XConnector xConnector =
+ UnoRuntime.queryInterface( XConnector.class , x );
+
+ XConnection xConnection = xConnector.connect(args[0]);
+
+ if( null != xConnection )
+ {
+ System.out.println( "after connect" );
+ String rootOid = "OfficeDaemon.Factory";
+ com.sun.star.uno.IBridge bridge = (IBridge ) UnoRuntime.getBridgeByName(
+ "java",
+ null,
+ "remote",
+ null,
+ new Object[]{"iiop", xConnection, new MyInstanceProvider()});
+
+ System.out.println( "after building bridge" );
+// Object rInitialObject = m_bridge.mapInterfaceFrom(rootOid, XInterface.class);
+// XTestFactory rFactory =
+// UnoRuntime.queryInterface(XTestFactory.class,rInitialObject );
+
+// XCallMe callMerFactory->
+ Thread.currentThread().sleep( 100000 );
+ }
+ }
+ catch( com.sun.star.uno.Exception e)
+ {
+ System.out.println( "Exception thrown" );
+ }
+ catch( java.lang.Exception e)
+ {
+ System.out.println( "java.lang.Exception thrown" );
+ }
+
+ System.out.println( "exiting" );
+ }
+}
diff --git a/bridges/test/testcomp.cxx b/bridges/test/testcomp.cxx
new file mode 100644
index 000000000000..9e09a5c4c52c
--- /dev/null
+++ b/bridges/test/testcomp.cxx
@@ -0,0 +1,799 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+#include <string.h>
+#include <stdlib.h>
+#include <osl/time.h>
+
+#include <uno/threadpool.h>
+
+#include <osl/mutex.hxx>
+#include <osl/diagnose.h>
+
+#include <test/XTestFactory.hpp>
+#include <cppuhelper/servicefactory.hxx>
+
+#include <com/sun/star/bridge/XInstanceProvider.hpp>
+
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+
+#include <com/sun/star/test/performance/XPerformanceTest.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <cppuhelper/weak.hxx>
+
+using namespace ::test;
+using namespace ::rtl;
+using namespace ::test;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::bridge;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::test::performance;
+
+#include "testcomp.h"
+
+
+void parseCommandLine( char *argv[] ,
+ ::rtl::OUString *pConnection , ::rtl::OUString *pProtocol ,
+ sal_Bool *pbLatency , sal_Bool *pbReverse)
+{
+ sal_Int32 nArgIndex = 1;
+ if( ! strcmp( argv[1] , "-r" ) )
+ {
+ nArgIndex = 2;
+ *pbReverse = sal_True;
+ }
+ else if( ! strcmp( argv[1] , "-latency" ) )
+ {
+ *pbLatency = sal_True;
+ nArgIndex = 2;
+ }
+
+ OUString sTemp = OUString::createFromAscii( argv[nArgIndex] );
+ sal_Int32 nIndex = sTemp.indexOf( ';' );
+ if( -1 == nIndex )
+ {
+ *pConnection = sTemp;
+ *pProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "iiop" ) );
+ }
+ else
+ {
+ *pConnection = sTemp.copy( 0 , nIndex );
+ *pProtocol = sTemp.copy( nIndex+1, sTemp.getLength() - (nIndex+1) );
+ }
+}
+
+Any OInstanceProvider::queryInterface( const Type & aType ) throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface( aType ,
+ SAL_STATIC_CAST( XInstanceProvider * , this ) );
+ if( a.hasValue() )
+ {
+ return a;
+ }
+ return OWeakObject::queryInterface( aType );
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ OInstanceProvider::getInstance( const ::rtl::OUString& sObjectName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ // Tries to get the PerformanceTestObject
+ if( sObjectName == OUString( RTL_CONSTASCII_USTRINGPARAM( "TestRemoteObject" ) ) )
+ {
+ return m_rSMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.performance.PerformanceTestObject") ) );
+ }
+ return Reference < XInterface > ( (::cppu::OWeakObject * ) new OTestFactory() );
+}
+
+class ServiceImpl
+ : public XServiceInfo
+ , public XPerformanceTest
+{
+ OUString _aDummyString;
+ Any _aDummyAny;
+ Sequence< Reference< XInterface > > _aDummySequence;
+ ComplexTypes _aDummyStruct;
+ RuntimeException _aDummyRE;
+
+ sal_Int32 _nRef;
+
+public:
+ ServiceImpl()
+ : _nRef( 0 )
+ {}
+ ServiceImpl( const Reference< XMultiServiceFactory > & /* xMgr */)
+ : _nRef( 0 )
+ {}
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ // execution time remains appr. constant any time
+ Any aRet;
+ if (aType == ::getCppuType( (const Reference< XInterface > *)0 ))
+ {
+ void * p = (XInterface *)(XPerformanceTest *)this;
+ aRet.setValue( &p, ::getCppuType( (const Reference< XInterface > *)0 ) );
+ }
+ if (aType == ::getCppuType( (const Reference< XPerformanceTest > *)0 ))
+ {
+ void * p = (XPerformanceTest *)this;
+ aRet.setValue( &p, ::getCppuType( (const Reference< XPerformanceTest > *)0 ) );
+ }
+ if (! aRet.hasValue())
+ {
+ void * p = (XPerformanceTest *)this;
+ Any aDummy( &p, ::getCppuType( (const Reference< XPerformanceTest > *)0 ) );
+ }
+ return aRet;
+ }
+ virtual void SAL_CALL acquire() throw()
+ { osl_incrementInterlockedCount( &_nRef ); }
+ virtual void SAL_CALL release() throw()
+ { if (! osl_decrementInterlockedCount( &_nRef )) delete this; }
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
+
+ // Attributes
+ virtual sal_Int32 SAL_CALL getLong_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return 0; }
+ virtual void SAL_CALL setLong_attr( sal_Int32 /* _attributelong */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual sal_Int64 SAL_CALL getHyper_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return 0; }
+ virtual void SAL_CALL setHyper_attr( sal_Int64 /* _attributehyper */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual float SAL_CALL getFloat_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return 0.0; }
+ virtual void SAL_CALL setFloat_attr( float /* _attributefloat */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual double SAL_CALL getDouble_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return 0.0; }
+ virtual void SAL_CALL setDouble_attr( double /* _attributedouble */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual OUString SAL_CALL getString_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummyString; }
+ virtual void SAL_CALL setString_attr( const ::rtl::OUString& /* _attributestring */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Reference< XInterface > SAL_CALL getInterface_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return Reference< XInterface >(); }
+ virtual void SAL_CALL setInterface_attr( const Reference< XInterface >& /* _attributeinterface */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Any SAL_CALL getAny_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummyAny; }
+ virtual void SAL_CALL setAny_attr( const Any& /* _attributeany */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Sequence< Reference< XInterface > > SAL_CALL getSequence_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummySequence; }
+ virtual void SAL_CALL setSequence_attr( const Sequence< Reference< XInterface > >& /* _attributesequence */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual ComplexTypes SAL_CALL getStruct_attr() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummyStruct; }
+ virtual void SAL_CALL setStruct_attr( const ::com::sun::star::test::performance::ComplexTypes& /* _attributestruct */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+
+ // Methods
+ virtual sal_Int32 SAL_CALL getLong() throw(::com::sun::star::uno::RuntimeException)
+ { return 0; }
+ virtual void SAL_CALL setLong( sal_Int32 /* _long */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual sal_Int64 SAL_CALL getHyper() throw(::com::sun::star::uno::RuntimeException)
+ { return 0; }
+ virtual void SAL_CALL setHyper( sal_Int64 /* _hyper */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual float SAL_CALL getFloat() throw(::com::sun::star::uno::RuntimeException)
+ { return 0; }
+ virtual void SAL_CALL setFloat( float /* _float */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual double SAL_CALL getDouble() throw(::com::sun::star::uno::RuntimeException)
+ { return 0; }
+ virtual void SAL_CALL setDouble( double /* _double */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummyString; }
+ virtual void SAL_CALL setString( const ::rtl::OUString& /* _string */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Reference< XInterface > SAL_CALL getInterface() throw(::com::sun::star::uno::RuntimeException)
+ { return Reference< XInterface >(); }
+ virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /* _interface */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Any SAL_CALL getAny() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummyAny; }
+ virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& /* _any */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Sequence< Reference< XInterface > > SAL_CALL getSequence() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummySequence; }
+ virtual void SAL_CALL setSequence( const Sequence< Reference< XInterface > >& /*_sequence */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual ComplexTypes SAL_CALL getStruct() throw(::com::sun::star::uno::RuntimeException)
+ { return _aDummyStruct; }
+ virtual void SAL_CALL setStruct( const ::com::sun::star::test::performance::ComplexTypes& /* c */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL async() throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL sync() throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual ComplexTypes SAL_CALL complex_in( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
+ { return aVal; }
+ virtual ComplexTypes SAL_CALL complex_inout( ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException)
+ { return aVal; }
+ virtual void SAL_CALL complex_oneway( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual void SAL_CALL complex_noreturn( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException)
+ {}
+ virtual Reference< XPerformanceTest > SAL_CALL createObject() throw(::com::sun::star::uno::RuntimeException)
+ { return new ServiceImpl(); }
+ virtual void SAL_CALL raiseRuntimeException( ) throw(::com::sun::star::uno::RuntimeException)
+ { throw _aDummyRE; }
+};
+
+
+void ServiceImpl::async() throw(::com::sun::star::uno::RuntimeException)
+{}
+
+// XServiceInfo
+//__________________________________________________________________________________________________
+OUString ServiceImpl::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString( );
+}
+//__________________________________________________________________________________________________
+sal_Bool ServiceImpl::supportsService( const OUString & /* rServiceName */)
+ throw (RuntimeException)
+{
+ return sal_False;
+}
+//__________________________________________________________________________________________________
+Sequence< OUString > ServiceImpl::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return Sequence< OUString > ();
+}
+
+/******************
+ * OCallMe
+ *
+ *****************/
+
+Any OCallMe::queryInterface( const Type & aType ) throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface( aType,
+ SAL_STATIC_CAST( XCallMe * , this ) );
+
+ if( a.hasValue() )
+ {
+ return a;
+ }
+
+ return OWeakObject::queryInterface( aType );
+}
+
+void OCallMe::call( const ::rtl::OUString& s, sal_Int32 nToDo )
+ throw( RuntimeException, ::test::TestBridgeException)
+{
+ if( nToDo < 0 )
+ {
+ throw TestBridgeException();
+ }
+
+ OUString sDummy;
+ if( ! nToDo ) {
+ OString o = OUStringToOString( s,RTL_TEXTENCODING_ASCII_US);
+ printf( "%s\n" , o.pData->buffer );
+ }
+ for( sal_Int32 i = 0 ; i < nToDo ; i ++ )
+ {
+ sDummy += s;
+ }
+}
+
+void SAL_CALL OCallMe::drawLine( sal_Int32 /* x1 */, sal_Int32 /* y1 */, sal_Int32 /* x2 */, sal_Int32 /* y2 */)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ // do nothings
+}
+
+void OCallMe::callOneway( const ::rtl::OUString& /* s */, sal_Int32 nToDo )
+ throw(RuntimeException)
+{
+ OUString sDummy;
+ m_nLastToDos = nToDo;
+
+
+ if( nToDo )
+ {
+ printf( "+" );
+ fflush( stdout );
+
+ TimeValue val = { nToDo , 0 };
+ osl_waitThread( &val );
+ printf( "-\n" );
+ }
+
+}
+
+::test::TestTypes SAL_CALL OCallMe::transport( const ::test::TestTypes& types )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return types;
+}
+
+::rtl::OUString OCallMe::getsAttribute() throw(RuntimeException)
+{
+ return m_sAttribute;
+}
+void OCallMe::setsAttribute( const ::rtl::OUString& _sattribute )
+ throw(RuntimeException)
+{
+ m_sAttribute = _sattribute;
+}
+void OCallMe::callAgain( const Reference< ::test::XCallMe >& callAgainArg,
+ sal_Int32 nToCall ) throw(RuntimeException)
+{
+ ::osl::MutexGuard guard( m_mutex );
+ if( nToCall %2 )
+ {
+ printf( "Deadlocktest pong %" SAL_PRIdINT32 "\n", nToCall );
+ }
+ else
+ {
+ printf( "Deadlocktest ping %" SAL_PRIdINT32 "\n", nToCall );
+ }
+ if( nToCall )
+ {
+ callAgainArg->callAgain( Reference< XCallMe > ( (XCallMe *) this ) , nToCall -1 );
+ }
+}
+
+/********************
+ * OInterfaceTest
+ *
+ *******************/
+Any OInterfaceTest::queryInterface( const Type & aType ) throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface( aType,
+ SAL_STATIC_CAST( XInterfaceTest * , this ) );
+ if( a.hasValue() )
+ {
+ return a;
+ }
+ return OWeakObject::queryInterface( aType );
+}
+
+
+void OInterfaceTest::setIn(
+ const Reference< ::test::XCallMe >& callback )
+ throw(RuntimeException)
+{
+ m_rCallMe = callback;
+ call();
+}
+
+void OInterfaceTest::setInOut( Reference< ::test::XCallMe >& callback )
+ throw(RuntimeException)
+{
+ Reference< XCallMe > r = m_rCallMe;
+ m_rCallMe = callback;
+ callback = r;
+ call();
+}
+
+
+void OInterfaceTest::getOut( Reference< ::test::XCallMe >& callback )
+ throw(RuntimeException)
+{
+ callback = m_rCallMe;
+}
+
+Reference< ::test::XCallMe > OInterfaceTest::get( )
+ throw(RuntimeException)
+{
+ call();
+ return m_rCallMe;
+}
+
+void OInterfaceTest::call()
+{
+ if( m_rCallMe.is() )
+ {
+ m_rCallMe->call( OUString( RTL_CONSTASCII_USTRINGPARAM("This is my String during a callback!")) , 5);
+ }
+}
+
+
+Any OTestFactory::queryInterface( const Type & aType ) throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface( aType,
+ SAL_STATIC_CAST( XTestFactory * , this ) );
+
+ if( a.hasValue() )
+ {
+ return a;
+ }
+
+ return OWeakObject::queryInterface( aType );
+}
+
+Reference< ::test::XCallMe > OTestFactory::createCallMe( )
+ throw(RuntimeException)
+{
+ return Reference< XCallMe > ( (XCallMe * ) new OCallMe() );
+}
+
+Reference< ::test::XInterfaceTest > SAL_CALL OTestFactory::createInterfaceTest( )
+ throw(RuntimeException)
+{
+ return Reference < XInterfaceTest > ( (XInterfaceTest * ) new OInterfaceTest() );
+}
+
+
+
+
+// class OInstanceProvider :
+// public ::cppu::OWeakObject,
+// public XInstanceProvider
+// {
+// public:
+// OInstanceProvider( ){}
+// ~OInstanceProvider(){ printf( "instance provider dies\n" );}
+// public:
+// // XInterface
+// Any SAL_CALL queryInterface( const Type & aType);
+// void SAL_CALL acquire() { OWeakObject::acquire(); }
+// void SAL_CALL release() { OWeakObject::release(); }
+
+// public:
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+// getInstance( const ::rtl::OUString& sObjectName )
+// throw( ::com::sun::star::container::NoSuchElementException,
+// ::com::sun::star::uno::RuntimeException);
+// };
+
+
+
+
+
+
+
+
+double getCallsPerSec( const Reference < XCallMe > &rCall , int nLoops, int nToDo )
+{
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+ for( sal_Int32 i = 0; i < nLoops; i ++ )
+ {
+ rCall->call( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string")) , nToDo );
+ }
+ osl_getSystemTime( &aEndTime );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+ return fEnd-fStart;
+}
+
+double getCallsPerSecOneway( const Reference < XCallMe > &rCall ,
+ int nLoops,
+ int nToDo,
+ double *pdAfterExecution
+ )
+{
+ TimeValue aStartTime, aEndTime, aAfterExecution;
+ osl_getSystemTime( &aStartTime );
+ for( sal_Int32 i = 0; i < nLoops; i ++ )
+ {
+// rCall->callOneway( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string" )), 0 );
+ rCall->drawLine( 0 , 0 , 500 , 123 );
+ }
+ osl_getSystemTime( &aEndTime );
+
+ rCall->call( OUString( RTL_CONSTASCII_USTRINGPARAM("Performance test string")) , nToDo );
+ osl_getSystemTime( &aAfterExecution );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+ *pdAfterExecution = (double)aAfterExecution.Seconds +
+ ((double)aAfterExecution.Nanosec / 1000000000.0) - fStart;
+ return fEnd-fStart;
+}
+
+void testOnewayPerformanceOnTwoInterfaces(
+ const Reference < XCallMe > &rRemote1, const Reference < XCallMe > &rRemote2 )
+{
+ printf( "Doing oneway performance test on two interfaces ...\n" );
+ const sal_Int32 nLoops = 10000;
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+ for( sal_Int32 i = 0; i < nLoops ; i ++ )
+ {
+ rRemote1->drawLine( 0 , 0 , 500 , 123 );
+ rRemote2->drawLine( 0 , 0 , 500 , 123 );
+ }
+ osl_getSystemTime( &aEndTime );
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+
+ printf( "Overhead per Call [ms] %g\n" , ((fEnd-fStart)/((double)nLoops/1000 ))/2. );
+}
+
+void testPerformance( const Reference < XCallMe > &rRemote,
+ const Reference < XCallMe > &rLocal )
+{
+ OUString aTestString;
+
+ sal_Int32 nDoSomething = 1;
+ sal_Int32 nCalls = 80000;
+ double dRemote, dLocal,dAfterExecution;
+
+ printf( "performance test oneway...\n" );
+ dLocal = getCallsPerSecOneway( rLocal , nCalls , nDoSomething , &dAfterExecution);
+ dRemote = getCallsPerSecOneway( rRemote , nCalls , nDoSomething , &dAfterExecution);
+ printf( "Local=%g s,"
+ "Remote : %g s\n" , dLocal, dRemote );
+ if( dLocal > 0. )
+ {
+ printf( "Remote/Local : %g\n", dRemote/dLocal );
+ }
+
+ printf( "Overhead per Call [ms] %g\n" , (dRemote - dLocal)/((double)nCalls/1000 ) );
+ printf( "Overhead per Call after completion [ms] %g\n" , (dAfterExecution - dLocal)/((double)nCalls/1000 ) );
+
+ nCalls = 2000;
+
+ printf( "Doing performance test ...\n" );
+ dRemote = getCallsPerSec( rRemote , nCalls , nDoSomething );
+ dLocal = getCallsPerSec( rLocal , nCalls , nDoSomething );
+ printf( "Local=%g s,\n"
+ "Remote=%g s\n" , dLocal, dRemote );
+ if( dLocal > 0. )
+ {
+ printf( "Remote/Local : %g\n", dRemote/dLocal );
+ }
+ printf( "Overhead per synchron Call [ms] %g\n" , ((dRemote - dLocal)/((double)nCalls/1000 )) );
+}
+
+void testException( const Reference < XCallMe > &r )
+{
+ try {
+ r->call( OUString( RTL_CONSTASCII_USTRINGPARAM("dummy")) , -1 );
+ OSL_ASSERT( ! "no exception flown !" );
+ }
+ catch( TestBridgeException & e )
+ {
+ // Exception flew successfully !
+ }
+ catch( Exception & e )
+ {
+ OSL_ASSERT( ! "only base class of exception could be catched!" );
+ }
+ catch(...)
+ {
+ OSL_ASSERT(! "wrong unknown exception !" );
+ }
+}
+
+void testSequenceOfCalls( const Reference< XCallMe > & rRCallMe )
+{
+ printf( "Testing sequence of calls\n" );
+ for( sal_Int32 i = 0 ; i < 800 ; i ++ )
+ {
+ rRCallMe->callOneway( OUString( RTL_CONSTASCII_USTRINGPARAM("hifuj" )), 0 );
+ }
+}
+
+void testAllTypes( const Reference < XCallMe > & rRCallMe )
+{
+ printf( "Testing all types\n" );
+
+ for( sal_Int32 i = 0; i < 32 ; i ++ )
+ {
+
+ TestTypes types;
+ types.Bool = sal_True;
+ types.Char = L'i';
+ types.Byte = -12;
+ types.Short = -32000;
+ types.UShort = (sal_uInt16 ) (1 << i);
+ types.Long = -123;
+ types.ULong = 1 << i;
+ types.Hyper = 50;
+ types.UHyper = 1 << i*2;
+ types.Float = (float)123.239;
+ types.Double = 1279.12490012;
+ types.String = OUString( RTL_CONSTASCII_USTRINGPARAM("abcdefghijklmnopqrstuvwxyz"));
+ types.Interface = Reference< XInterface >( rRCallMe , UNO_QUERY);
+ types.Any <<= types.Double;
+
+ TestTypes retTypes = rRCallMe->transport( types );
+
+ OSL_ASSERT( ( types.Bool && retTypes.Bool ) || ( ! types.Bool && ! retTypes.Bool ) );
+ OSL_ASSERT( types.Char == retTypes.Char );
+ OSL_ASSERT( types.Byte == retTypes.Byte );
+ OSL_ASSERT( types.Short == retTypes.Short );
+ OSL_ASSERT( types.UShort == retTypes.UShort );
+ OSL_ASSERT( types.Long == retTypes.Long );
+ OSL_ASSERT( types.ULong == retTypes.ULong );
+ OSL_ASSERT( types.Hyper == retTypes.Hyper );
+ OSL_ASSERT( types.UHyper == retTypes.UHyper );
+ OSL_ASSERT( types.Float == retTypes.Float );
+ OSL_ASSERT( types.Double == retTypes.Double );
+ OSL_ASSERT( types.String == retTypes.String );
+ OSL_ASSERT( types.Interface == retTypes.Interface );
+ OSL_ASSERT( types.Any == retTypes.Any );
+ }
+
+}
+
+void testRemote( const Reference< XInterface > &rRemote )
+{
+ char a;
+ getCppuType( (sal_Int8*)&a );
+
+ Reference< XTestFactory > rRFact( rRemote , UNO_QUERY );
+ if( ! rRFact.is() )
+ {
+ printf( "remote object doesn't support XTestFactory\n" );
+ return;
+ }
+ OSL_ASSERT( rRFact.is() );
+ Reference< XCallMe > rLCallMe = (XCallMe * ) new OCallMe();
+ Reference< XCallMe > rRCallMe = rRFact->createCallMe();
+
+ testAllTypes( rLCallMe );
+ testAllTypes( rRCallMe );
+
+ printf( "Testing exception local ...\n" );
+ testException( rLCallMe );
+ printf( "Testing exception remote ...\n" );
+ testException( rRCallMe );
+
+ //--------------------
+ // Test attributes
+ //----------------------
+ OUString ow = OUString::createFromAscii( "dum didel dum dideldei" );
+ rLCallMe->setsAttribute( ow );
+ OSL_ASSERT( rLCallMe->getsAttribute() == ow );
+
+ rRCallMe->setsAttribute( ow );
+ OSL_ASSERT( rRCallMe->getsAttribute() == ow );
+
+ //-------------------
+ // Performance test
+ //-------------------
+ testPerformance( rRCallMe , rLCallMe );
+ testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe );
+
+ //----------------
+ // Test sequence
+ //----------------
+ testSequenceOfCalls( rRCallMe );
+
+
+ // test triple to check if transporting the same interface multiple
+ // times causes any problems
+ Reference< XInterfaceTest > rRTest = rRFact->createInterfaceTest();
+ Reference< XInterfaceTest > rRTest2 = rRFact->createInterfaceTest();
+ Reference< XInterfaceTest > rRTest3 = rRFact->createInterfaceTest();
+
+ rRTest->setIn( rRCallMe );
+ rRTest2->setIn( rRCallMe );
+ rRTest3->setIn( rRCallMe );
+
+ OSL_ASSERT( rRTest->get() == rRCallMe );
+ OSL_ASSERT( rRTest2->get() == rRCallMe );
+ OSL_ASSERT( rRTest3->get() == rRCallMe );
+
+ rRTest->setIn( rLCallMe );
+ rRTest2->setIn( rLCallMe );
+ rRTest3->setIn( rLCallMe );
+
+ {
+ Reference< XCallMe > rLCallMe1 = (XCallMe * ) new OCallMe();
+ Reference< XCallMe > rLCallMe2 = (XCallMe * ) new OCallMe();
+ Reference< XCallMe > rLCallMe3 = (XCallMe * ) new OCallMe();
+ rRTest->setIn( rLCallMe1 );
+ rRTest2->setIn( rLCallMe2 );
+ rRTest3->setIn( rLCallMe3 );
+ OSL_ASSERT( rRTest->get() == rLCallMe1 );
+ OSL_ASSERT( rRTest2->get() == rLCallMe2 );
+ OSL_ASSERT( rRTest3->get() == rLCallMe3 );
+
+ rRTest->setIn( rLCallMe );
+ rRTest2->setIn( rLCallMe );
+ rRTest3->setIn( rLCallMe );
+
+ OSL_ASSERT( rRTest->get() == rLCallMe );
+ OSL_ASSERT( rRTest2->get() == rLCallMe );
+ OSL_ASSERT( rRTest3->get() == rLCallMe );
+ }
+
+ Reference < XCallMe > r = rRCallMe;
+ rRTest->setInOut( r );
+ OSL_ASSERT( r == rLCallMe );
+ OSL_ASSERT( ! ( r == rRCallMe ) );
+
+ // test empty references
+ rRTest->setIn( Reference < XCallMe > () );
+
+ //--------------------------------
+ // test thread deadlocking
+ //--------------------------------
+ rLCallMe->callAgain( rRCallMe, 20 );
+
+}
+
+
+
+
+
+
+Reference <XInterface > createComponent( const ::rtl::OUString &sService ,
+ const ::rtl::OUString &sDllName,
+ const Reference < XMultiServiceFactory > &rSMgr )
+{
+ Reference< XInterface > rInterface;
+ rInterface = rSMgr->createInstance( sService );
+
+ if( ! rInterface.is() )
+ {
+ // erst registrieren
+ Reference < XImplementationRegistration > rReg (
+ rSMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" )),
+ UNO_QUERY );
+
+ OSL_ASSERT( rReg.is() );
+ OUString aDllName = sDllName;
+
+ try
+ {
+ rReg->registerImplementation(
+ OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
+ aDllName,
+ Reference< XSimpleRegistry > () );
+ rInterface = rSMgr->createInstance( sService );
+ }
+ catch( Exception & )
+ {
+ printf( "couldn't register dll %s\n" ,
+ OUStringToOString( aDllName, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ }
+ }
+ return rInterface;
+}
+
+
diff --git a/bridges/test/testcomp.h b/bridges/test/testcomp.h
new file mode 100644
index 000000000000..8a30a538247c
--- /dev/null
+++ b/bridges/test/testcomp.h
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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/bridge/XServer.hpp>
+//#include <com/sun/star/bridge/XClient.hpp>
+#include <stdio.h>
+
+#include <com/sun/star/bridge/XInstanceProvider.hpp>
+//#include <com/sun/star/bridge/XConnectionAdministration.hpp>
+#include <osl/thread.hxx>
+
+
+void parseCommandLine( char *argv[] ,
+ ::rtl::OUString *pProtocol , ::rtl::OUString *pConnection ,
+ sal_Bool *pbLatency , sal_Bool *pbReverse);
+
+
+Reference< XInterface > createComponent(
+ const ::rtl::OUString &sServiceName,
+ const ::rtl::OUString &sDllName,
+ const Reference < XMultiServiceFactory > & rSMgr );
+
+class OInterfaceTest :
+ public ::cppu::OWeakObject,
+ public XInterfaceTest
+{
+public:
+ OInterfaceTest() {}
+ ~OInterfaceTest() {}
+
+public:
+ // XInterface
+ Any SAL_CALL queryInterface( const com::sun::star::uno::Type & aType) throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+public:
+ virtual void SAL_CALL setIn( const ::com::sun::star::uno::Reference< ::test::XCallMe >& callback ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInOut( ::com::sun::star::uno::Reference< ::test::XCallMe >& callback ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getOut( ::com::sun::star::uno::Reference< ::test::XCallMe >& callback ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::test::XCallMe > SAL_CALL get( ) throw(::com::sun::star::uno::RuntimeException);
+private:
+ void call();
+
+private:
+ Reference < XCallMe > m_rCallMe;
+};
+
+
+class OCallMe :
+ public ::cppu::OWeakObject,
+ public XCallMe
+{
+public:
+ OCallMe() : m_nLastToDos(-1) {}
+ ~OCallMe() {}
+
+public:
+ // XInterface
+ Any SAL_CALL queryInterface( const com::sun::star::uno::Type & aType) throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL acquire()throw() { OWeakObject::acquire(); }
+ void SAL_CALL release()throw() { OWeakObject::release(); }
+public:
+ // XCallMe
+ virtual void SAL_CALL call( const ::rtl::OUString& s, sal_Int32 nToDo )
+ throw(::com::sun::star::uno::RuntimeException,
+ ::test::TestBridgeException);
+ virtual void SAL_CALL callOneway( const ::rtl::OUString& s, sal_Int32 nToDo )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL drawLine( sal_Int32 x1, sal_Int32 y1 , sal_Int32 x2 , sal_Int32 y2 )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getsAttribute() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setsAttribute( const ::rtl::OUString& _sattribute ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL callAgain( const ::com::sun::star::uno::Reference< ::test::XCallMe >& callAgain,
+ sal_Int32 nToCall ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::test::TestTypes SAL_CALL transport( const ::test::TestTypes& types )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ ::osl::Mutex m_mutex;
+ ::rtl::OUString m_sAttribute;
+ sal_Int32 m_nLastToDos;
+};
+
+class OTestFactory :
+ public ::cppu::OWeakObject,
+ public XTestFactory
+{
+public:
+ OTestFactory() {}
+ ~OTestFactory() {}
+
+public:
+ // XInterface
+ Any SAL_CALL queryInterface( const com::sun::star::uno::Type & aType ) throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+public:
+ virtual ::com::sun::star::uno::Reference< ::test::XCallMe > SAL_CALL createCallMe( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::test::XInterfaceTest > SAL_CALL createInterfaceTest( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+
+class OInstanceProvider :
+ public ::cppu::OWeakObject,
+ public XInstanceProvider
+{
+public:
+ OInstanceProvider( ){}
+ OInstanceProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & r ) :
+ m_rSMgr( r )
+ {}
+ ~OInstanceProvider(){ printf( "instance provider dies\n" );}
+public:
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & aType)throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL acquire()throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+public:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ getInstance( const ::rtl::OUString& sObjectName )
+ throw( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_rSMgr;
+};
+
+void testRemote( const Reference< XInterface > &rRemote );
diff --git a/bridges/test/testoffice.cxx b/bridges/test/testoffice.cxx
new file mode 100644
index 000000000000..1d0619028c3a
--- /dev/null
+++ b/bridges/test/testoffice.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+#include <osl/time.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+
+#include <cppuhelper/servicefactory.hxx>
+
+#include <com/sun/star/connection/XConnector.hpp>
+
+#include <com/sun/star/bridge/XBridgeFactory.hpp>
+
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/frame/XComponentLoader.hpp>
+
+#include <cppuhelper/weak.hxx>
+
+#include <test/XTestFactory.hpp>
+
+using namespace ::test;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::bridge;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::connection;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::text;
+
+#include "testcomp.h"
+
+#ifdef SAL_W32
+#include <conio.h>
+#endif
+
+
+void mygetchar()
+{
+#ifdef SAL_W32
+ _getch();
+#else
+ getchar();
+#endif
+}
+
+
+void testPipe( const Reference < XMultiServiceFactory > & rSmgr )
+{
+ Reference < XOutputStream > rOut(
+ rSmgr->createInstance( OUString::createFromAscii( "com.sun.star.io.Pipe" ) ),
+ UNO_QUERY );
+
+ OSL_ASSERT( rOut.is() );
+
+ {
+ Sequence < sal_Int8 > seq( 10 );
+ seq.getArray()[0] = 42;
+ rOut->writeBytes( seq );
+ }
+
+
+ {
+ Sequence < sal_Int8 > seq;
+ Reference < XInputStream > rIn( rOut , UNO_QUERY );
+ if( ! ( rIn->available() == 10) )
+ printf( "wrong bytes available\n" );
+ if( ! ( rIn->readBytes( seq , 10 ) == 10 ) )
+ printf( "wrong bytes read\n" );
+ if( ! ( 42 == seq.getArray()[0] ) )
+ printf( "wrong element in sequence\n" );
+
+// OSL_ASSERT( 0 );
+ }
+}
+#include<stdio.h>
+#include<string.h>
+
+void testWriter( const Reference < XComponent > & rCmp )
+{
+
+ Reference< XTextDocument > rTextDoc( rCmp , UNO_QUERY );
+
+ Reference< XText > rText = rTextDoc->getText();
+ Reference< XTextCursor > rCursor = rText->createTextCursor();
+ Reference< XTextRange > rRange ( rCursor , UNO_QUERY );
+
+ char pcText[1024];
+ pcText[0] = 0;
+ printf( "pleast type any text\n" );
+ while( sal_True )
+ {
+ scanf( "%s" , pcText );
+
+ if( !strcmp( pcText , "end" ) )
+ {
+ break;
+ }
+
+ if ( strlen( pcText ) < sizeof(pcText)-1 )
+ strcat( pcText , " " ); // #100211# - checked
+
+ rText->insertString( rRange , OUString::createFromAscii( pcText ) , sal_False );
+ }
+}
+
+void testDocument( const Reference < XMultiServiceFactory > & rSmgr )
+{
+ Reference < XComponentLoader > rLoader(
+ rSmgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ))),
+ UNO_QUERY );
+
+ OSL_ASSERT( rLoader.is() );
+
+ sal_Char *urls[] = {
+ "private:factory/swriter",
+ "private:factory/scalc",
+ "private:factory/sdraw",
+ "http://www.heise.de",
+ "file://h|/remote_interfaces.sdw"
+ };
+
+ sal_Char *docu[]= {
+ "a new writer document ...\n",
+ "a new calc document ...\n",
+ "a new draw document ...\n",
+ "www.heise.de\n",
+ "the remote_interfaces.sdw doc\n"
+ };
+
+ sal_Int32 i;
+ for( i = 0 ; i < 1 ; i ++ )
+ {
+ printf( "press any key to open %s\n" , docu[i] );
+ mygetchar();
+
+ Reference< XComponent > rComponent =
+ rLoader->loadComponentFromURL(
+ OUString::createFromAscii( urls[i] ) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("_blank")),
+ 0 ,
+ Sequence < ::com::sun::star::beans::PropertyValue >() );
+
+ testWriter( rComponent );
+ printf( "press any key to close the document\n" );
+ mygetchar();
+ rComponent->dispose();
+ }
+
+}
+
+void doSomething( const Reference < XInterface > &r )
+{
+ Reference < XNamingService > rName( r, UNO_QUERY );
+ if( rName.is() )
+ {
+ printf( "got the remote naming service !\n" );
+ Reference < XInterface > rXsmgr = rName->getRegisteredObject(
+ OUString::createFromAscii( "StarOffice.ServiceManager" ) );
+
+ Reference < XMultiServiceFactory > rSmgr( rXsmgr , UNO_QUERY );
+ if( rSmgr.is() )
+ {
+ printf( "got the remote service manager !\n" );
+ testPipe( rSmgr );
+ testDocument( rSmgr );
+ }
+ }
+}
+
+
+int main( int argc, char *argv[] )
+{
+ if( argc < 2 )
+ {
+ printf( "usage : testclient host:port" );
+ return 0;
+ }
+
+ OUString sConnectionString;
+ OUString sProtocol;
+ sal_Bool bLatency = sal_False;
+ sal_Bool bReverse = sal_False;
+ parseCommandLine( argv , &sConnectionString , &sProtocol , &bLatency , &bReverse );
+ {
+ Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "client.rdb" ) ) );
+
+ // just ensure that it is registered
+
+ Reference < XConnector > rConnector(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("connector.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.Bridge.iiop")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("remotebridge.uno" SAL_DLLEXTENSION)),
+ rSMgr );
+
+ Reference < XBridgeFactory > rFactory(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bridgefac.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+ try
+ {
+ if( rFactory.is() && rConnector.is() )
+ {
+ Reference < XConnection > rConnection =
+ rConnector->connect( sConnectionString );
+
+ Reference < XBridge > rBridge = rFactory->createBridge(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bla blub")),
+ sProtocol,
+ rConnection,
+ Reference < XInstanceProvider > () );
+
+ Reference < XInterface > rInitialObject
+ = rBridge->getInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("NamingService")) );
+
+ if( rInitialObject.is() )
+ {
+ printf( "got the remote object\n" );
+ doSomething( rInitialObject );
+ }
+ TimeValue value={2,0};
+ osl_waitThread( &value );
+ }
+ }
+ catch (... ) {
+ printf( "Exception thrown\n" );
+ }
+
+ Reference < XComponent > rComp( rSMgr , UNO_QUERY );
+ rComp->dispose();
+ }
+ //_getch();
+ return 0;
+}
diff --git a/bridges/test/testsameprocess.cxx b/bridges/test/testsameprocess.cxx
new file mode 100644
index 000000000000..6ce2f59873a7
--- /dev/null
+++ b/bridges/test/testsameprocess.cxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+#include <osl/time.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.hxx>
+
+#include <cppuhelper/servicefactory.hxx>
+
+#include <com/sun/star/bridge/XBridgeFactory.hpp>
+#include <com/sun/star/connection/XAcceptor.hpp>
+#include <com/sun/star/connection/XConnector.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <cppuhelper/weak.hxx>
+
+#include <test/XTestFactory.hpp>
+
+
+using namespace ::test;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::bridge;
+using namespace ::com::sun::star::connection;
+
+#ifdef SAL_W32
+#include <conio.h>
+#endif
+
+#include "testcomp.h"
+#include "osl/mutex.h"
+
+/*********
+ *
+ ********/
+
+class MyThread :
+ public Thread
+{
+public:
+ MyThread( const Reference< XAcceptor > &r ,
+ const Reference< XBridgeFactory > &rFactory,
+ const OUString &sConnectionDescription) :
+ m_rAcceptor( r ),
+ m_rBridgeFactory ( rFactory ),
+ m_sConnectionDescription( sConnectionDescription )
+ {}
+ virtual void SAL_CALL run();
+
+private:
+ Reference < XAcceptor > m_rAcceptor;
+ Reference < XBridgeFactory > m_rBridgeFactory;
+ OUString m_sConnectionDescription;
+};
+
+
+
+void MyThread::run()
+{
+
+ while ( sal_True )
+ {
+ try
+ {
+ Reference < XConnection > rConnection =
+ m_rAcceptor->accept( m_sConnectionDescription );
+
+ if( ! rConnection.is() )
+ {
+ break;
+ }
+
+ Reference < XBridge > rBridge =
+ m_rBridgeFactory->createBridge(
+ OUString() ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("iiop")) ,
+ rConnection ,
+ (XInstanceProvider * ) new OInstanceProvider );
+
+
+ }
+ catch ( ... )
+ {
+ printf( "Exception was thrown by acceptor thread\n" );
+ break;
+ }
+ }
+}
+
+
+int main( int argc, char *argv[] )
+{
+ if( argc < 2 )
+ {
+ printf( "usage : testsamprocess host:port\n" );
+ return 0;
+ }
+
+ {
+ Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "client.rdb" ) ) );
+
+ Reference < XConnector > rConnector(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("connector.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+ Reference < XAcceptor > rAcceptor(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Acceptor")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("acceptor.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+ // just ensure that it is registered
+// createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.Bridge.iiop")),
+// OUString( RTL_CONSTASCII_USTRINGPARAM("iiopbrdg" SAL_DLLEXTENSION)),
+// rSMgr );
+
+ Reference < XBridgeFactory > rFactory(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bridgefac.uno" SAL_DLLEXTENSION)),
+ rSMgr ),
+ UNO_QUERY );
+
+
+ MyThread threadAcceptor( rAcceptor , rFactory , OUString::createFromAscii( argv[1] ) );
+
+ threadAcceptor.create();
+ TimeValue value={2,0};
+ osl_waitThread( &value );
+
+ try
+ {
+ Reference < XConnection > rConnection =
+ rConnector->connect( OUString::createFromAscii( argv[1] ) );
+
+ printf( "%s\n" , OUStringToOString( rConnection->getDescription(),
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+
+ if( rFactory.is() )
+ {
+
+ Reference < XBridge > rBridge = rFactory->createBridge(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bla blub")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("iiop")),
+ rConnection,
+ Reference < XInstanceProvider > () );
+
+ Reference < XInterface > rInitialObject
+ = rBridge->getInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("bla")) );
+
+ if( rInitialObject.is() )
+ {
+ printf( "got the remote object\n" );
+ testRemote( rInitialObject );
+ }
+ printf( "Closing...\n" );
+ TimeValue timeValue={2,0};
+ osl_waitThread( &timeValue );
+ }
+
+ Reference < XBridge > rBridge = rFactory->getBridge(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bla blub")) );
+ OSL_ASSERT( ! rBridge.is() );
+
+ }
+ catch( Exception & )
+ {
+ printf( "Login failed, got an Exception !\n" );
+ }
+
+ rAcceptor->stopAccepting();
+ threadAcceptor.join();
+
+ Reference < XComponent > rComp( rFactory , UNO_QUERY );
+ rComp->dispose();
+
+
+ rComp = Reference < XComponent > ( rSMgr , UNO_QUERY );
+ rComp->dispose();
+ }
+ return 0;
+}
diff --git a/bridges/test/testserver.cxx b/bridges/test/testserver.cxx
new file mode 100644
index 000000000000..17b40c123cc1
--- /dev/null
+++ b/bridges/test/testserver.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_bridges.hxx"
+#include <string.h>
+#include <osl/time.h>
+
+#include <osl/mutex.hxx>
+#include <osl/conditn.h>
+
+#include <osl/thread.hxx>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <com/sun/star/connection/XAcceptor.hpp>
+#include <com/sun/star/connection/XConnection.hpp>
+
+#include <com/sun/star/bridge/XInstanceProvider.hpp>
+#include <com/sun/star/bridge/XBridgeFactory.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+
+#include <test/XTestFactory.hpp>
+
+#include <cppuhelper/weak.hxx>
+
+using namespace ::test;
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::bridge;
+using namespace ::com::sun::star::connection;
+#include "testcomp.h"
+#ifdef SAL_W32
+#include <conio.h>
+#endif
+
+/*********
+ *
+ ********/
+
+
+
+class MyThread :
+ public Thread
+{
+public:
+ MyThread( const Reference< XAcceptor > &r ,
+ const Reference< XBridgeFactory > &rFactory,
+ const Reference< XMultiServiceFactory > &rSMgr,
+ const OUString &sConnectionDescription,
+ const OUString &sProtocol,
+ sal_Bool bReverse,
+ sal_Bool bLatency ) :
+ m_rAcceptor( r ),
+ m_rBridgeFactory ( rFactory ),
+ m_rSMgr( rSMgr ),
+ m_sConnectionDescription( sConnectionDescription ),
+ m_sProtocol( sProtocol ),
+ m_bReverse( bReverse ),
+ m_bLatency( bLatency )
+ {}
+ virtual void SAL_CALL run();
+
+ void latencyTest( const Reference< XConnection > &r );
+
+private:
+ Reference < XAcceptor > m_rAcceptor;
+ Reference < XBridgeFactory > m_rBridgeFactory;
+ Reference < XMultiServiceFactory > m_rSMgr;
+ OUString m_sConnectionDescription;
+ OUString m_sProtocol;
+ sal_Bool m_bReverse;
+ sal_Bool m_bLatency;
+};
+
+
+void MyThread::latencyTest( const Reference< XConnection > &r )
+{
+ Sequence < sal_Int8 > s;
+ while( 12 == r->read( s , 12 ) )
+ {
+ r->read( s , 188 );
+ s = Sequence < sal_Int8 >(60);
+ r->write( s );
+ }
+}
+
+void MyThread::run()
+{
+
+ while ( sal_True )
+ {
+ try
+ {
+ Reference < XConnection > rConnection =
+ m_rAcceptor->accept( m_sConnectionDescription );
+
+ if( ! rConnection.is() )
+ {
+ break;
+ }
+ if( m_bLatency )
+ {
+ latencyTest( rConnection );
+ }
+ else
+ {
+
+ Reference < XBridge > rBridge =
+ m_rBridgeFactory->createBridge(
+ OUString() ,
+ m_sProtocol,
+ rConnection ,
+ (XInstanceProvider * ) new OInstanceProvider(m_rSMgr) );
+
+
+ if( m_bReverse )
+ {
+ printf( "doing reverse callme test (test is ok, when on each line a +- appears\n" );
+ Reference < XInterface > r = rBridge->getInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("blubber" )));
+ Reference < XTestFactory > rFactory( r , UNO_QUERY );
+ Reference < XCallMe > rCallMe = rFactory->createCallMe();
+
+ for( sal_Int32 i = 0 ; i < 1 ; i ++ )
+ {
+ rCallMe->callOneway(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("my test string")) , 2 );
+ }
+ printf( "all oneway are send\n" );
+ rCallMe->call( OUString::createFromAscii( "reverse call me test finished" ) , 0 );
+ printf( "revers callme test finished\n" );
+ }
+ }
+ }
+ catch ( Exception & e )
+ {
+ printf( "Exception was thrown by acceptor \n" );
+ OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
+ printf( "%s\n" , o.getStr() );
+ break;
+ }
+ catch ( ... )
+ {
+ printf( "Exception was thrown by acceptor thread\n" );
+ break;
+ }
+ }
+}
+
+
+int main( int argc, char *argv[] )
+{
+// testserver();
+
+ if( argc < 2 )
+ {
+ printf( "usage : testserver [-r] connectionstring\n"
+ " -r does a reverse test (server calls client)\n" );
+ return 0;
+ }
+
+ OUString sConnectionString;
+ OUString sProtocol;
+ sal_Bool bReverse = sal_False;
+ sal_Bool bLatency = sal_False;
+
+ parseCommandLine( argv , &sConnectionString , &sProtocol , &bLatency , &bReverse );
+
+ {
+ Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "server.rdb" ) ) );
+
+ Reference < XBridgeFactory > rBridgeFactory ( createComponent(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bridgefac.uno" SAL_DLLEXTENSION )),
+ rSMgr ),
+ UNO_QUERY );
+
+
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.Bridge.iiop")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("remotebridge.uno" SAL_DLLEXTENSION)),
+ rSMgr );
+
+
+ Reference < XAcceptor > rAcceptor(
+ createComponent( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Acceptor")),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("acceptor.uno" SAL_DLLEXTENSION)),
+ rSMgr ) ,
+ UNO_QUERY );
+
+ MyThread thread( rAcceptor ,
+ rBridgeFactory,
+ rSMgr,
+ sConnectionString,
+ sProtocol,
+ bReverse,
+ bLatency);
+ thread.create();
+
+#ifdef SAL_W32
+ _getch();
+#elif SOLARIS
+ getchar();
+#elif LINUX
+ TimeValue value={360,0};
+ osl_waitThread( &value );
+#endif
+ printf( "Closing...\n" );
+
+ rAcceptor->stopAccepting();
+ thread.join();
+
+ printf( "Closed\n" );
+
+ Reference < XComponent > rComp2( rBridgeFactory , UNO_QUERY );
+ rComp2->dispose();
+ Reference < XComponent > rComp( rSMgr, UNO_QUERY );
+ rComp->dispose();
+ }
+ return 0;
+}