summaryrefslogtreecommitdiff
path: root/jurt/test/com/sun/star/lib/uno
diff options
context:
space:
mode:
Diffstat (limited to 'jurt/test/com/sun/star/lib/uno')
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java73
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java145
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java251
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk39
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java66
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/java/makefile.mk36
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java56
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java274
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java49
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java89
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java33
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java97
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java63
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java443
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/makefile.mk44
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java140
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java362
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java316
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java115
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java70
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl119
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk51
22 files changed, 0 insertions, 2931 deletions
diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java
deleted file mode 100644
index f56ab6679..000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * 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.java_remote;
-
-import com.sun.star.bridge.XBridge;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.XInterface;
-import complexlib.ComplexTestCase;
-
-public final class BridgedObject_Test extends ComplexTestCase {
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() {
- RequestHandler handler = new RequestHandler() {
- public Object sendRequest(
- String oid, Type type, String operation, Object[] args)
- {
- return null;
- }
- };
- XBridge bridge1 = new TestBridge();
- ProxyFactory factory1 = new ProxyFactory(handler, bridge1);
- XBridge bridge2 = new TestBridge();
- ProxyFactory factory2 = new ProxyFactory(handler, bridge2);
- Object object0 = new Object();
- Object object1 = factory1.create("", new Type(XInterface.class));
- Object object2 = factory2.create("", new Type(XInterface.class));
- assure(BridgedObject.getBridge(object0) == null);
- assure(BridgedObject.getBridge(object1) == bridge1);
- assure(BridgedObject.getBridge(object2) == bridge2);
- }
-
- private static final class TestBridge implements XBridge {
- public Object getInstance(String instanceName) {
- return null;
- }
-
- public String getName() {
- return null;
- }
-
- public String getDescription() {
- return null;
- }
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java
deleted file mode 100644
index a83131c0b..000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*************************************************************************
- *
- * 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.java_remote;
-
-import com.sun.star.uno.IQueryInterface;
-import com.sun.star.uno.MappingException;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-import com.sun.star.uno.XNamingService;
-import complexlib.ComplexTestCase;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-
-public final class ProxyFactory_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "testQueryInterface", "testExceptionHandling" };
- }
-
- public void testQueryInterface() {
- TestRequestHandler handler = new TestRequestHandler();
- Type type = new Type(XNamingService.class);
- Object proxy = new ProxyFactory(handler, null).create("TestOID", type);
- assure("", proxy == ((IQueryInterface) proxy).queryInterface(type));
- assure("", proxy == UnoRuntime.queryInterface(type, proxy));
- }
-
- public void testExceptionHandling() throws Exception {
- TestRequestHandler handler = new TestRequestHandler();
- Object proxy = new ProxyFactory(handler, null).create(
- "TestOID", new Type(XNamingService.class));
- testExceptions(
- handler,
- proxy.getClass().getMethod("queryInterface",
- new Class[] { Type.class }),
- proxy, new Object[] { new Type(XInterface.class) },
- new Class[] { null, MappingException.class,
- com.sun.star.uno.RuntimeException.class,
- UndeclaredThrowableException.class,
- NullPointerException.class,
- UndeclaredThrowableException.class });
- testExceptions(
- handler,
- proxy.getClass().getMethod("getRegisteredObject",
- new Class[] { String.class }),
- proxy, new Object[] { "TestName" },
- new Class[] { null, MappingException.class,
- com.sun.star.uno.RuntimeException.class,
- com.sun.star.uno.Exception.class,
- NullPointerException.class, Exception.class });
- }
-
- private void testExceptions(TestRequestHandler handler, Method method,
- Object obj, Object[] args, Class[] exceptions)
- throws Exception
- {
- for (int i = 0; i < exceptions.length; ++i) {
- handler.setModus(i);
- testExceptionType(method, obj, args, exceptions[i]);
- }
- }
-
- private void testExceptionType(Method method, Object obj, Object[] args,
- Class exception) throws Exception {
- try {
- method.invoke(obj, args);
- assure("expected exception: " + exception, exception == null);
- } catch (InvocationTargetException e) {
- assure("unexpected exception: " + e.getTargetException(),
- exception != null
- && exception.isInstance(e.getTargetException()));
- // TODO check stack trace
- }
- }
-
- private static final class TestRequestHandler implements RequestHandler {
- public Object sendRequest(String oid, Type type, String operation,
- Object[] args)
- throws Throwable
- {
- if (operation.equals("release")) {
- return null;
- }
- int m;
- synchronized (lock) {
- m = modus;
- }
- switch (m) {
- case 0:
- return operation.equals("getInstance") ? "TestResult" : null;
- case 1:
- // TODO What is this test, with an obviously obsoleted
- // MappingException, good for?
- throw new MappingException();
- case 2:
- throw new com.sun.star.uno.RuntimeException();
- case 3:
- throw new com.sun.star.uno.Exception();
- case 4:
- throw new NullPointerException();
- default:
- throw new Throwable();
- }
- }
-
- public void setModus(int modus) {
- synchronized (lock) {
- this.modus = modus;
- }
- }
-
- private final Object lock = new Object();
- private int modus = 0;
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
deleted file mode 100644
index 040cf7063..000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*************************************************************************
- *
- * 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.java_remote;
-
-import com.sun.star.bridge.XBridge;
-import com.sun.star.bridge.XInstanceProvider;
-import com.sun.star.comp.connections.PipedConnection;
-import com.sun.star.connection.XConnection;
-import com.sun.star.container.NoSuchElementException;
-import com.sun.star.lib.uno.environments.java.java_environment;
-import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
-import com.sun.star.lib.uno.typeinfo.TypeInfo;
-import com.sun.star.uno.IQueryInterface;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-import complexlib.ComplexTestCase;
-import util.WaitUnreachable;
-
-public final class java_remote_bridge_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() throws Exception {
- String protocol = "urp";
-
- XConnection connectionA = new PipedConnection(new Object[0]);
- XConnection connectionB = new PipedConnection(
- new Object[] { connectionA });
- java_remote_bridge bridgeA = new java_remote_bridge(
- new java_environment(null), null,
- new Object[] { protocol, connectionA, new TestInstanceProvider() });
- java_remote_bridge bridgeB = new java_remote_bridge(
- new java_environment(null), null,
- new Object[] { protocol, connectionB, null });
-
- testGetInstance(bridgeA, bridgeB);
- testLifeCycle(bridgeA, bridgeB);
- }
-
- private void testGetInstance(XBridge bridgeA, XBridge bridgeB) {
- assure("return null",
- bridgeB.getInstance(TestInstanceProvider.NAME_NULL) == null);
-
- try {
- bridgeB.getInstance(TestInstanceProvider.NAME_RUNTIME_EXCEPTION);
- failed("throw RuntimeException");
- } catch (com.sun.star.uno.RuntimeException e) {
- assure("throw RuntimeException",
- e.getMessage().indexOf(
- TestInstanceProvider.NAME_RUNTIME_EXCEPTION) != -1);
- }
-
- try {
- bridgeB.getInstance(
- TestInstanceProvider.NAME_NO_SUCH_ELEMENT_EXCEPTION);
- failed("throw NoSuchElementException");
- } catch (com.sun.star.uno.RuntimeException e) {
- assure("throw NoSuchElementException",
- e.getMessage().indexOf(
- TestInstanceProvider.NAME_NO_SUCH_ELEMENT_EXCEPTION)
- != -1);
- }
-
- try {
- bridgeA.getInstance(TestInstanceProvider.NAME_ANYTHING);
- failed("no instance provider");
- } catch (com.sun.star.uno.RuntimeException e) {
- assure("no instance provider",
- e.getMessage().startsWith("unknown OID "));
- }
- }
-
- private void testLifeCycle(java_remote_bridge bridgeA,
- java_remote_bridge bridgeB)
- throws InterruptedException
- {
- // Repeatedly, objects are mapped from bridgeA to bridgeB, where proxies
- // for those objects (for the XInterface and TestInterface facets) are
- // created. The proxies at bridgeB keep both bridges alive; after those
- // proxies have been garbage-collected, both bridges should be disposed.
- // It does not work to map a local object from bridgeA to bridgeB, as
- // bridgeB would find this object as a local one, too (via the shared,
- // static localObjects Registry in java_environment): bridgeB would not
- // create a proxy, would rather send back a "release" to bridgeA, and
- // both bridges would be disposed while the first object is being
- // mapped. Therefore, a HACK is used to install TestProxy objects
- // (which behave as if they got mapped in to bridgeA from somewhere
- // else) at bridgeA and map those.
-
- final int COUNT = 100;
- XInterface[] proxyBXInterface = new XInterface[COUNT];
- TestInterface[] proxyBTestInterface = new TestInterface[COUNT];
- for (int i = 0; i < COUNT; ++i) {
- String name = "TestOID" + i;
- Object proxyA = new TestProxy(name);
- bridgeA.getSourceEnvironment().registerInterface(
- proxyA, new String[] { name }, new Type(XInterface.class));
-
- proxyBXInterface[i] = (XInterface) bridgeB.getInstance(name);
-
- // map object:
- proxyBTestInterface[i] = UnoRuntime.queryInterface(
- TestInterface.class, proxyBXInterface[i]);
- proxyBTestInterface[i].function();
-
- // remap object once:
- TestInterface remapped = UnoRuntime.queryInterface(
- TestInterface.class, proxyBXInterface[i]);
- remapped.function();
-
- // remap object twice:
- remapped = UnoRuntime.queryInterface(
- TestInterface.class, proxyBXInterface[i]);
- remapped.function();
- }
-
- assure("calls of object method", TestProxy.getCount() == 3 * COUNT);
-
- // The following checks rely on the implementation detail that mapping
- // different facets of a UNO object (XInterface and TestInterface) leads
- // to different proxies:
-
- assure("bridge A life count", bridgeA.getLifeCount() == 2 * COUNT);
- assure("bridge B life count", bridgeB.getLifeCount() == 2 * COUNT);
- assure("proxy count", ProxyFactory.getDebugCount() == 2 * COUNT);
-
- System.out.println("waiting for proxies to become unreachable:");
- for (int i = 0; i < COUNT; ++i) {
- WaitUnreachable u1 = new WaitUnreachable(proxyBXInterface[i]);
- WaitUnreachable u2 = new WaitUnreachable(proxyBTestInterface[i]);
- proxyBXInterface[i] = null;
- proxyBTestInterface[i] = null;
- u1.waitUnreachable();
- u2.waitUnreachable();
- }
- // For whatever strange reason, this sleep seems to be necessary to
- // reliably ensure that even the last proxy's finalization is over
- // before the following assure is executed:
- Thread.sleep(1000);
-
- assure("proxy count", ProxyFactory.getDebugCount() == 0);
-
- System.out.println("waiting for pending messages to be done");
- while (bridgeA.getLifeCount() != 0 || bridgeB.getLifeCount() != 0) {
- Thread.sleep(100);
- }
-
- assure("Zero bridge A life count", bridgeA.getLifeCount() == 0);
- assure("Zero bridge B life count", bridgeB.getLifeCount() == 0);
- assure("Zero proxy count", ProxyFactory.getDebugCount() == 0);
- }
-
- public interface TestInterface extends XInterface {
- void function();
-
- TypeInfo[] UNOTYPEINFO = new TypeInfo[] {
- new MethodTypeInfo("function", 0, 0) };
- }
-
- private static final class TestInstanceProvider
- implements XInstanceProvider
- {
- public Object getInstance(String name) throws NoSuchElementException {
- if (name.equals(NAME_NULL)) {
- return null;
- } else if (name.equals(NAME_RUNTIME_EXCEPTION)) {
- throw new com.sun.star.uno.RuntimeException(
- getClass().getName() + ", throwing: " + name);
- } else if (name.equals(NAME_NO_SUCH_ELEMENT_EXCEPTION)) {
- throw new NoSuchElementException(
- getClass().getName() + ", throwing: " + name);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public static final String NAME_NULL = "return null";
- public static final String NAME_RUNTIME_EXCEPTION
- = "throw RuntimeException";
- public static final String NAME_NO_SUCH_ELEMENT_EXCEPTION
- = "throw NoSuchElementException";
- public static final String NAME_ANYTHING = "anything";
- }
-
- private static final class TestProxy
- implements com.sun.star.lib.uno.Proxy, IQueryInterface, XInterface,
- TestInterface
- {
- public TestProxy(String oid) {
- this.oid = oid;
- }
-
- public Object queryInterface(Type type) {
- // type should be either XInterface or TestInterface...
- return this;
- }
-
- public boolean isSame(Object object) {
- return object instanceof TestProxy
- && oid.equals(((TestProxy) object).oid);
- }
-
- public String getOid() {
- return oid;
- }
-
- public void function() {
- synchronized (getClass()) {
- ++count;
- }
- }
-
- public static synchronized int getCount() {
- return count;
- }
-
- private final String oid;
-
- private static int count = 0;
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk
deleted file mode 100644
index 49ae7f408..000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/makefile.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#*************************************************************************
-#
-# 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 := jurt
-TARGET := test_com_sun_star_lib_uno_bridges_java_remote
-
-PACKAGE := com$/sun$/star$/lib$/uno$/bridges$/java_remote
-JAVATESTFILES := \
- BridgedObject_Test.java \
- ProxyFactory_Test.java \
- java_remote_bridge_Test.java
-JARFILES := ridl.jar
-
-.INCLUDE: javaunittest.mk
diff --git a/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java b/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java
deleted file mode 100644
index 80896445e..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.java;
-
-import com.sun.star.uno.Type;
-import com.sun.star.uno.XInterface;
-import complexlib.ComplexTestCase;
-
-public final class java_environment_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() {
- java_environment env = new java_environment(null);
-
- Object obj = new Integer(3);
- String[] oid = new String[1];
-
- Object obj2 = env.registerInterface(obj, oid,
- new Type(XInterface.class));
- Object obj3 = env.registerInterface(obj, oid,
- new Type(XInterface.class));
- assure("register ordinary interface twice",
- obj2 == obj && obj3 == obj);
-
- assure("ask for registered interface",
- env.getRegisteredInterface(oid[0], new Type(XInterface.class))
- == obj);
-
- env.revokeInterface(oid[0], new Type(XInterface.class));
- env.revokeInterface(oid[0], new Type(XInterface.class));
- assure("revoke interface",
- env.getRegisteredInterface(oid[0], new Type(XInterface.class))
- == null);
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/java/makefile.mk b/jurt/test/com/sun/star/lib/uno/environments/java/makefile.mk
deleted file mode 100644
index ad49dccef..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/java/makefile.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#*************************************************************************
-#
-# 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 := jurt
-TARGET := test_com_sun_star_lib_uno_environments_java
-
-PACKAGE := com$/sun$/star$/lib$/uno$/environments$/java
-JAVATESTFILES := java_environment_Test.java
-JARFILES := ridl.jar
-
-.INCLUDE: javaunittest.mk
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java
deleted file mode 100644
index 1434caed3..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-import complexlib.ComplexTestCase;
-
-public final class JavaThreadPoolFactory_Test extends ComplexTestCase {
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() throws InterruptedException {
- ThreadId i1 = JavaThreadPoolFactory.getThreadId();
- assure(i1.equals(JavaThreadPoolFactory.getThreadId()));
- final ThreadId[] i2 = new ThreadId[1];
- new Thread() {
- public void run() {
- synchronized (i2) {
- i2[0] = JavaThreadPoolFactory.getThreadId();
- i2.notify();
- }
- }
- }.start();
- synchronized (i2) {
- while (i2[0] == null) {
- i2.wait();
- }
- }
- assure(!i1.equals(i2[0]));
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
deleted file mode 100644
index 83829cd95..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-import com.sun.star.lib.uno.typedesc.MethodDescription;
-import com.sun.star.lib.uno.typedesc.TypeDescription;
-import complexlib.ComplexTestCase;
-
-public final class JobQueue_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "testThreadLeavesJobQueueOnDispose0",
- "testThreadLeavesJobQueueOnDispose5000",
- "testThreadLeavesJobQueueOnReply0",
- "testThreadLeavesJobQueueOnReply5000",
- "testStaticThreadExecutesJobs0",
- "testStaticThreadExecutesJobs5000",
- "testDynamicThreadExecutesJob",
- "testStaticThreadExecutesAsyncs",
- "testDynamicThreadExecutesAsyncs" };
- }
-
- public void testThreadLeavesJobQueueOnDispose0() throws InterruptedException
- {
- testThreadLeavesJobQueueOnDispose(0);
- }
-
- public void testThreadLeavesJobQueueOnDispose5000()
- throws InterruptedException
- {
- testThreadLeavesJobQueueOnDispose(5000);
- }
-
- private void testThreadLeavesJobQueueOnDispose(int waitTime)
- throws InterruptedException
- {
- TestThread t = new TestThread(waitTime);
- t.waitToStart();
- String msg = "xcxxxxxxxx";
- t._jobQueue.dispose(t._disposeId, new RuntimeException (msg));
- t.waitToTerminate();
- assure("", t._message.equals(msg));
- }
-
- public void testThreadLeavesJobQueueOnReply0() throws InterruptedException {
- testThreadLeavesJobQueueOnReply(0);
- }
-
- public void testThreadLeavesJobQueueOnReply5000()
- throws InterruptedException
- {
- testThreadLeavesJobQueueOnReply(5000);
- }
-
- private void testThreadLeavesJobQueueOnReply(int waitTime)
- throws InterruptedException
- {
- TestThread t = new TestThread(waitTime);
- t.waitToStart();
- // put reply job:
- t._jobQueue.putJob(
- new Job(null, __iReceiver,
- new Message(
- null, false, "oid", __workAt_td, null, false, null,
- false, null, null)),
- null);
- t.waitToTerminate();
- assure("", true); // TODO! ???
- }
-
- public void testStaticThreadExecutesJobs0() throws InterruptedException {
- testStaticThreadExecutesJobs(0);
- }
-
- public void testStaticThreadExecutesJobs5000() throws InterruptedException {
- testStaticThreadExecutesJobs(5000);
- }
-
- private void testStaticThreadExecutesJobs(int waitTime)
- throws InterruptedException
- {
- TestThread t = new TestThread(waitTime);
- t.waitToStart();
- testExecuteJobs(t._jobQueue);
- t._jobQueue.dispose(t._disposeId,
- new RuntimeException("xxxxxxxxxxxxx"));
- t.waitToTerminate();
- }
-
- public void testDynamicThreadExecutesJob() throws InterruptedException {
- testExecuteJobs(
- new JobQueue(
- __javaThreadPoolFactory, ThreadId.createFresh(), true));
- }
-
- public void testStaticThreadExecutesAsyncs() throws InterruptedException {
- TestThread t = new TestThread();
- JobQueue async_jobQueue = new JobQueue(__javaThreadPoolFactory,
- t._threadId);
- assure("", async_jobQueue._ref_count == 1);
- t._jobQueue = __javaThreadPoolFactory.getJobQueue(t._threadId);
- assure("", t._jobQueue._ref_count == 1);
- t.waitToStart();
- TestWorkAt workAt = new TestWorkAt();
- testAsyncJobQueue(workAt, async_jobQueue, t._threadId);
- t._jobQueue.dispose(t._disposeId,
- new RuntimeException("xxxxxxxxxxxxx"));
- t.waitToTerminate();
- assure("", workAt._async_counter == TestWorkAt.MESSAGES);
- assure("", workAt._sync_counter == TestWorkAt.MESSAGES);
- }
-
- public void testDynamicThreadExecutesAsyncs() throws InterruptedException {
- ThreadId threadId = ThreadId.createFresh();
- JobQueue async_jobQueue = new JobQueue(__javaThreadPoolFactory,
- threadId);
- TestWorkAt workAt = new TestWorkAt();
- testAsyncJobQueue(workAt, async_jobQueue, threadId);
- assure("", workAt._async_counter == TestWorkAt.MESSAGES);
- assure("", workAt._sync_counter == TestWorkAt.MESSAGES);
- }
-
- private void testExecuteJobs(JobQueue jobQueue) throws InterruptedException
- {
- TestWorkAt workAt = new TestWorkAt();
- testSendRequests(workAt, "increment", jobQueue);
- synchronized (workAt) {
- jobQueue.putJob(new Job(workAt, __iReceiver,
- new Message(
- null, true, "oid", __workAt_td,
- ((MethodDescription)
- __workAt_td.getMethodDescription(
- "notifyme")),
- true, null, false, null, null)),
- null);
- while (!workAt._notified) {
- workAt.wait();
- }
- }
- assure("", workAt._counter == TestWorkAt.MESSAGES);
- }
-
- private void testAsyncJobQueue(TestWorkAt workAt, JobQueue async_jobQueue,
- ThreadId threadId)
- throws InterruptedException
- {
- // put slow async calls first, followed by fast sync calls:
- testSendRequests(workAt, "asyncCall", async_jobQueue);
- testSendRequests(workAt, "syncCall",
- __javaThreadPoolFactory.getJobQueue(threadId));
- synchronized (workAt) {
- async_jobQueue._sync_jobQueue.putJob(
- new Job(workAt, __iReceiver,
- new Message(
- null, true, "oid", __workAt_td,
- ((MethodDescription)
- __workAt_td.getMethodDescription("notifyme")),
- true, null, false, null, null)),
- null);
- while (!workAt._notified) {
- workAt.wait();
- }
- }
- assure("", workAt.passedAsyncTest());
- }
-
- private void testSendRequests(TestWorkAt workAt, String operation,
- JobQueue jobQueue) {
- Message iMessage = new Message(
- null, true, "oid", __workAt_td,
- (MethodDescription) __workAt_td.getMethodDescription(operation),
- true, null, false, null, null);
- for (int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- jobQueue.putJob(new Job(workAt, __iReceiver, iMessage),
- new Object());
- }
- }
-
- private static final class TestThread extends Thread {
- public final ThreadId _threadId = JavaThreadPoolFactory.getThreadId();
- public final Object _disposeId = new Object();
- public JobQueue _jobQueue = null;
- public String _message;
-
- public TestThread(int waitTime) {
- this.waitTime = waitTime;
- _jobQueue = new JobQueue(__javaThreadPoolFactory, _threadId, false);
- }
-
- public TestThread() {
- waitTime = 0;
- }
-
- public void run() {
- synchronized (lock) {
- state = STATE_STARTED;
- lock.notifyAll();
- }
- try {
- if (waitTime != 0) {
- Thread.sleep(waitTime);
- }
- _jobQueue.enter(_disposeId);
- } catch (Throwable e) {
- _message = e.getMessage();
- }
- synchronized (lock) {
- state = STATE_DONE;
- lock.notifyAll();
- }
- }
-
- public void waitToStart() throws InterruptedException {
- start();
- synchronized (lock) {
- while (state == STATE_INITIAL) {
- lock.wait();
- }
- }
- }
-
- public void waitToTerminate() throws InterruptedException {
- synchronized (lock) {
- while (state != STATE_DONE) {
- lock.wait();
- }
- }
- join();
- }
-
- private final int waitTime;
-
- private final Object lock = new Object();
- private int state = STATE_INITIAL;
- private static final int STATE_INITIAL = 0;
- private static final int STATE_STARTED = 1;
- private static final int STATE_DONE = 2;
- }
-
- private static final JavaThreadPoolFactory __javaThreadPoolFactory
- = new JavaThreadPoolFactory();
- private static final IReceiver __iReceiver = new TestReceiver();
- private static final TypeDescription __workAt_td
- = TypeDescription.getTypeDescription(TestIWorkAt.class);
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java
deleted file mode 100644
index c4946208f..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-
-import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
-import com.sun.star.lib.uno.typeinfo.TypeInfo;
-import com.sun.star.uno.XInterface;
-
-public interface TestIWorkAt extends XInterface {
- void syncCall() throws Throwable ;
- void asyncCall() throws Throwable ;
-
- void increment() throws Throwable;
-
- void notifyme();
-
- public static final TypeInfo UNOTYPEINFO[] = {
- new MethodTypeInfo("increment", 0, 0),
- new MethodTypeInfo("notifyme", 1, 0),
- new MethodTypeInfo("syncCall", 2, 0),
- new MethodTypeInfo("asyncCall", 3, 0)
- };
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java
deleted file mode 100644
index c4bc55696..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-
-import com.sun.star.uno.Type;
-
-import com.sun.star.uno.ITypeDescription;
-
-
-class TestMessage implements IMessage {
- boolean _synchron;
- ITypeDescription _iTypeDescription;
- String _oid;
- ThreadId _threadId;
- Object _result;
- String _operation;
- Object _params[];
-
- TestMessage(boolean synchron, ITypeDescription iTypeDescription, String oid, ThreadId threadId, Object result, String operation, Object params[]) {
- _synchron = synchron;
- _iTypeDescription = iTypeDescription;
- _oid = oid;
- _threadId = threadId;
- _result = result;
- _operation = operation;
- _params = params;
- }
-
- public String getOperation() {
- return _operation;
- }
-
- public ThreadId getThreadId() {
- return _threadId;
- }
-
- public ITypeDescription getInterface() {
- return _iTypeDescription;
- }
-
- public boolean isSynchron() {
- return _synchron;
- }
-
- public boolean mustReply() {
- return _synchron;
- }
-
- public boolean isException() {
- return false;
- }
-
- public String getOid() {
- return _oid;
- }
-
- public Object getData(Object params[][]) {
- params[0] = _params;
- return _result;
-// return new Integer(_requestId);
- }
-}
-
-
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java
deleted file mode 100644
index 0a42d4f2d..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-final class TestReceiver implements IReceiver {
- public void sendReply(boolean exception, ThreadId threadId, Object result) {
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java
deleted file mode 100644
index c45b020da..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-class TestWorkAt implements TestIWorkAt {
- /**
- * When set to true, enables various debugging output.
- */
- private static final boolean DEBUG = false;
-
- static final int MESSAGES = 35;
-
-
- int _counter;
-
- int _sync_counter;
- int _async_counter;
-
- Thread _sync_thread;
- Thread _async_thread;
-
- boolean _passedAync = true;
- boolean _notified = false;
-
- public void syncCall() throws Throwable {
- ++ _sync_counter;
-
- if(_async_counter != MESSAGES)
- _passedAync = false;
-
- if(_sync_thread == null)
- _sync_thread = Thread.currentThread();
-
-// if(_sync_thread != Thread.currentThread())
-// _passedAync = false;
-
- if(DEBUG) System.err.println("syncCall:" + _sync_counter + " " + _passedAync + " " + Thread.currentThread());
- }
-
- public void asyncCall() throws Throwable {
-// Thread.sleep(50);
-
- ++ _async_counter;
-
- if(_async_thread == null)
- _async_thread = Thread.currentThread();
-
-// if(_async_thread != Thread.currentThread())
-// _passedAync = false;
-
- if(DEBUG) System.err.println("asyncCall:" + _async_counter + " " + Thread.currentThread());
- }
-
- public synchronized void increment() throws Throwable {
- if(DEBUG) System.err.println("increment - " + Thread.currentThread());
-
- ++ _counter;
- notifyAll();
- }
-
- public synchronized void notifyme() {
- if(DEBUG) System.err.println("\t\t\tnotifying me" + Thread.currentThread());
-
- notifyAll();
-
- _notified = true;
- }
-
- public boolean passedAsyncTest() {
- return _passedAync && (_sync_counter == MESSAGES);
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java
deleted file mode 100644
index b3ff1c757..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-import complexlib.ComplexTestCase;
-import java.util.Arrays;
-
-public final class ThreadId_Test extends ComplexTestCase {
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() {
- ThreadId i1 = ThreadId.createFresh();
- assure(i1.equals(i1));
- assure(!i1.equals(null));
- assure(!i1.equals(new Object()));
- assure(i1.hashCode() == i1.hashCode());
- byte[] i1bytes = i1.getBytes();
- assure(i1bytes != null);
- assure(
- i1bytes.length >= 5 && i1bytes[0] == 'j' && i1bytes[1] == 'a'
- && i1bytes[2] == 'v' && i1bytes[3] == 'a' && i1bytes[4] == ':');
- assure(Arrays.equals(i1bytes, i1.getBytes()));
-
- ThreadId i2 = ThreadId.createFresh();
- assure(!i1.equals(i2));
- assure(!i2.equals(i1));
- assure(!Arrays.equals(i1bytes, i2.getBytes()));
-
- ThreadId i3 = new ThreadId(i1bytes);
- assure(i3.equals(i1));
- assure(!i3.equals(i2));
- assure(i1.equals(i3));
- assure(i1.hashCode() == i3.hashCode());
- assure(Arrays.equals(i1bytes, i3.getBytes()));
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
deleted file mode 100644
index 45c05e72d..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*************************************************************************
- *
- * 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.environments.remote;
-
-import com.sun.star.lib.uno.typedesc.MethodDescription;
-import com.sun.star.lib.uno.typedesc.TypeDescription;
-import complexlib.ComplexTestCase;
-
-public class ThreadPool_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "testDispose",
- "testThreadAsync",
- "testDynamicThreadSync",
- "testStaticThreadSync",
- "testDynamicThreadAsyncSyncOrder",
- "testStaticThreadAsyncSyncOrder",
- "testStress",
- "testAsyncSync" };
- }
-
- public void testDispose() throws InterruptedException {
- IThreadPool iThreadPool = ThreadPoolManager.create();
- TestThread testThread = new TestThread(iThreadPool);
-
- ThreadId threadId = null;
-
- // start the test thread
- synchronized(testThread) {
- testThread.start();
-
- testThread.wait();
-
- threadId = testThread._threadId;
-
- // let the thread attach and enter the threadpool
- testThread.notifyAll();
- }
-
- String message = "blabla";
-
- // terminate the test thread
- synchronized(testThread) {
- // put reply job
- iThreadPool.dispose(new RuntimeException(message));
-
- testThread.wait();
- }
-
- testThread.join();
-
- assure("", testThread._message.equals(message));
- }
-
- public void testThreadAsync() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
-
- ThreadId threadId = ThreadId.createFresh();
-
- // queue asyncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, false, threadId, "increment");
- }
-
- synchronized(workAt) {
- putJob(workAt, false, threadId, "notifyme");
-
- while(!workAt._notified)
- workAt.wait();
- }
-
- assure("", workAt._counter == TestWorkAt.MESSAGES);
- }
-
- public void testDynamicThreadSync() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
-
- ThreadId threadId = ThreadId.createFresh();
-
- // queue asyncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, true, threadId, "increment");
- }
-
- synchronized(workAt) {
- putJob(workAt, true, threadId, "notifyme");
-
- while(!workAt._notified)
- workAt.wait();
- }
-
- assure("", workAt._counter == TestWorkAt.MESSAGES);
- }
-
- public void testStaticThreadSync() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
-
- TestThread testThread = new TestThread();
-
- ThreadId threadId = null;
-
- // start the test thread
- synchronized(testThread) {
- testThread.start();
-
- testThread.wait();
-
- threadId = testThread._threadId;
-
- // let the thread attach and enter the threadpool
- testThread.notifyAll();
- }
-
- // queue syncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, true, threadId, "increment");
- }
-
- // terminate the test thread
- synchronized(testThread) {
- // put reply job
- putJob(workAt, true, threadId, null);
-
- testThread.wait();
- }
-
- testThread.join();
-
- assure("", workAt._counter == TestWorkAt.MESSAGES);
- }
-
- public void testDynamicThreadAsyncSyncOrder() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
-
- ThreadId threadId = ThreadId.createFresh();
-
- // queue asyncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, false, threadId, "asyncCall");
- }
-
- // queue syncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, true, threadId, "syncCall");
- }
-
- synchronized(workAt) {
- putJob(workAt, true, threadId, "notifyme");
-
- while(!workAt._notified)
- workAt.wait();
- }
-
- assure("", workAt.passedAsyncTest());
- }
-
- public void testStaticThreadAsyncSyncOrder() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
-
- TestThread testThread = new TestThread();
-
- // start the test thread
- synchronized(testThread) {
- testThread.start();
-
- testThread.wait();
- }
-
- ThreadId threadId = testThread._threadId;
-
- // queue asyncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, false, threadId, "asyncCall");
- }
-
- // let the thread attach and enter the threadpool
- synchronized(testThread) {
- testThread.notifyAll();
- }
-
- // queue syncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- Thread.yield(); // force scheduling
- putJob(workAt, true, threadId, "syncCall");
- }
-
- // terminate the test thread
- synchronized(testThread) {
- // put reply job
- putJob(workAt, true, threadId, null);
-
- testThread.wait();
- }
-
- testThread.join();
-
- assure("", workAt.passedAsyncTest());
- }
-
- public void testStress() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
- for (int i = 0; i < TestWorkAt.MESSAGES; ++i) {
- Thread.yield(); // force scheduling
- ThreadId threadID = ThreadId.createFresh();
- putJob(workAt, true, threadID, "increment");
- putJob(workAt, false, threadID, "increment");
- }
- synchronized (workAt) {
- while (workAt._counter < 2 * TestWorkAt.MESSAGES) {
- workAt.wait();
- }
- }
-
- abstract class Stress extends Thread {
- public Stress(int count) {
- this.count = count;
- }
-
- public void run() {
- try {
- for (int i = 0; i < count; ++i) {
- runTest();
- }
- } catch (Throwable e) {
- e.printStackTrace(System.err);
- }
- }
-
- protected abstract void runTest() throws InterruptedException;
-
- private final int count;
- };
-
- Stress stress1 = new Stress(50) {
- protected void runTest() throws InterruptedException {
- testThreadAsync();
- }
- };
- stress1.start();
-
- Stress stress2 = new Stress(50) {
- protected void runTest() throws InterruptedException {
- testDynamicThreadSync();
- }
- };
- stress2.start();
-
- Stress stress3 = new Stress(50) {
- protected void runTest() throws InterruptedException {
- testStaticThreadSync();
- }
- };
- stress3.start();
-
- Stress stress4 = new Stress(50) {
- protected void runTest() throws InterruptedException {
- testDynamicThreadAsyncSyncOrder();
- }
- };
- stress4.start();
-
- Stress stress5 = new Stress(50) {
- protected void runTest() throws InterruptedException {
- testStaticThreadAsyncSyncOrder();
- }
- };
- stress5.start();
-
- Stress stress6 = new Stress(500) {
- protected void runTest() throws InterruptedException {
- testDispose();
- }
- };
- stress6.start();
-
- stress1.join();
- stress2.join();
- stress3.join();
- stress4.join();
- stress5.join();
- stress6.join();
- }
-
- public void testAsyncSync() throws InterruptedException {
- TestWorkAt workAt = new TestWorkAt();
- ThreadId threadId = ThreadId.createFresh();
- MyWorkAt myWorkAt = new MyWorkAt( workAt );
-
- // queue asyncs
- for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
- if( i == 2 )
- {
- putJob( myWorkAt, false , threadId, "asyncCall" );
- }
- putJob(workAt, false, threadId, "asyncCall");
- }
-
- synchronized(workAt) {
- putJob(workAt, false, threadId, "notifyme");
-
- while(!workAt._notified)
- workAt.wait();
- }
-
- assure("",
- workAt._async_counter == TestWorkAt.MESSAGES
- && myWorkAt._success);
- }
-
- private static void putJob(TestIWorkAt iWorkAt, boolean synchron,
- ThreadId threadId, String operation) {
- __iThreadPool.putJob(
- new Job(iWorkAt, __iReceiver,
- new Message(
- threadId, operation != null, "oid", __workAt_td,
- (operation == null
- ? null
- : ((MethodDescription)
- __workAt_td.getMethodDescription(operation))),
- synchron, null, false, null, null)));
- }
-
- private static final class TestThread extends Thread {
- ThreadId _threadId;
- Object _disposeId = new Object();
- String _message;
- IThreadPool _iThreadPool;
-
- TestThread() {
- this(__iThreadPool);
- }
-
- TestThread(IThreadPool iThreadPool) {
- _iThreadPool = iThreadPool;
- }
-
- public void run() {
- _threadId = _iThreadPool.getThreadId();
-
-
- try {
- synchronized(this) {
- // notify that we are running
- notify();
-
- _iThreadPool.attach();
-
- // wait until we should continue
- wait();
- }
-
- _iThreadPool.enter();
- }
- catch(Throwable throwable) {
- _message = throwable.getMessage();
- }
-
- _iThreadPool.detach();
-
- synchronized(this) {
- // notify the listeners that we are dying
- notifyAll();
- }
- }
- }
-
- private static final class MyWorkAt implements TestIWorkAt {
- public MyWorkAt( TestWorkAt async_WorkAt ) {
- _async_WorkAt = async_WorkAt;
- }
-
- public void syncCall() throws Throwable
- {
- Message iMessage = new Message(
- __iThreadPool.getThreadId(), false, "oid", __workAt_td, null,
- false, null, false, null, null);
-
- // marshal reply
- ThreadPool_Test.__iThreadPool.putJob(
- new Job(this, ThreadPool_Test. __iReceiver, iMessage));
- }
-
- public void asyncCall() throws Throwable {
- for (int i = 0 ; i < 5 ; ++i) {
- ThreadPool_Test.__iThreadPool.attach();
- ThreadPool_Test.putJob(this, true, __iThreadPool.getThreadId(),
- "syncCall");
- // wait for reply
- ThreadPool_Test.__iThreadPool.enter();
- ThreadPool_Test.__iThreadPool.detach();
- }
- // async must have waited for this call
- _success = _async_WorkAt._async_counter == 2;
- }
-
- public void increment() throws Throwable {}
-
- public void notifyme() {}
-
- public boolean _success = false;
-
- private final TestWorkAt _async_WorkAt;
- }
-
- private static final IThreadPool __iThreadPool = ThreadPoolManager.create();
- private static final IReceiver __iReceiver = new TestReceiver();
- private static final TypeDescription __workAt_td
- = TypeDescription.getTypeDescription(TestIWorkAt.class);
-}
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/makefile.mk b/jurt/test/com/sun/star/lib/uno/environments/remote/makefile.mk
deleted file mode 100644
index e2323a54b..000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/makefile.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#*************************************************************************
-#
-# 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 := jurt
-TARGET := test_com_sun_star_lib_uno_environments_remote
-
-PACKAGE := com$/sun$/star$/lib$/uno$/environments$/remote
-JAVATESTFILES := \
- JavaThreadPoolFactory_Test.java \
- JobQueue_Test.java \
- ThreadId_Test.java \
- ThreadPool_Test.java
-JAVAFILES := \
- TestIWorkAt.java \
- TestReceiver.java \
- TestWorkAt.java
-JARFILES := ridl.jar
-
-.INCLUDE: javaunittest.mk
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java
deleted file mode 100644
index a82c1aecc..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*************************************************************************
- *
- * 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.protocols.urp;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class Cache_Test {
- @Test public void test0() {
- Cache c = new Cache(0);
- boolean[] f = new boolean[1];
- int i;
- i = c.add(f, "a");
- assertTrue(i == Cache.NOT_CACHED && !f[0]);
- i = c.add(f, "a");
- assertTrue(i == Cache.NOT_CACHED && !f[0]);
- i = c.add(f, "b");
- assertTrue(i == Cache.NOT_CACHED && !f[0]);
- i = c.add(f, "a");
- assertTrue(i == Cache.NOT_CACHED && !f[0]);
- }
-
- @Test public void test1() {
- Cache c = new Cache(1);
- boolean[] f = new boolean[1];
- int i;
- i = c.add(f, "a");
- assertTrue(i == 0 && !f[0]);
- i = c.add(f, "a");
- assertTrue(i == 0 && f[0]);
- i = c.add(f, "b");
- assertTrue(i == 0 && !f[0]);
- i = c.add(f, "b");
- assertTrue(i == 0 && f[0]);
- i = c.add(f, "a");
- assertTrue(i == 0 && !f[0]);
- }
-
- @Test public void test2() {
- Cache c = new Cache(2);
- boolean[] f = new boolean[1];
- int i;
- i = c.add(f, "a");
- assertTrue(i == 0 && !f[0]);
- i = c.add(f, "a");
- assertTrue(i == 0 && f[0]);
- i = c.add(f, "b");
- assertTrue(i == 1 && !f[0]);
- i = c.add(f, "b");
- assertTrue(i == 1 && f[0]);
- i = c.add(f, "a");
- assertTrue(i == 0 && f[0]);
- i = c.add(f, "c");
- assertTrue(i == 1 && !f[0]);
- i = c.add(f, "b");
- assertTrue(i == 0 && !f[0]);
- }
-
- @Test public void test3() {
- Cache c = new Cache(3);
- boolean[] f = new boolean[1];
- int i;
- i = c.add(f, "a");
- assertTrue(i == 0 && !f[0]);
- i = c.add(f, "a");
- assertTrue(i == 0 && f[0]);
- i = c.add(f, "b");
- assertTrue(i == 1 && !f[0]);
- i = c.add(f, "a");
- assertTrue(i == 0 && f[0]);
- i = c.add(f, "c");
- assertTrue(i == 2 && !f[0]);
- i = c.add(f, "d");
- assertTrue(i == 1 && !f[0]);
- i = c.add(f, "d");
- assertTrue(i == 1 && f[0]);
- }
-
- @Test public void testNothingLostFromLruList() {
- // Regardless in what order arbitrary values from 0, ..., 3 are inserted
- // into a size-4 cache, afterwards adding -1, ..., -4 must return each
- // possible index in the range from 0, ..., 3 exactly once (so their sum
- // must be 6); this code systematically tests all such arbitrary ways up
- // to length 8 (the code arguably violates recommendations for writing
- // good tests, but actually helped track down an error in the Cache
- // implementation):
- int[] a = new int[8];
- for (int i = 0; i < a.length; ++i) {
- for (int j = 0; j < i; ++j) {
- a[j] = 0;
- }
- for (;;) {
- Cache c = new Cache(4);
- for (int k = 0; k < i; ++k) {
- c.add(new boolean[1], a[k]);
- }
- assertEquals(
- 6,
- (c.add(new boolean[1], -1) + c.add(new boolean[1], -2) +
- c.add(new boolean[1], -3) + c.add(new boolean[1], -4)));
- int j = i - 1;
- while (j >= 0 && a[j] == 3) {
- --j;
- }
- if (j < 0) {
- break;
- }
- ++a[j];
- for (int k = j + 1; k < i; ++k) {
- a[k] = 0;
- }
- }
- }
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java
deleted file mode 100644
index edd567c50..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*************************************************************************
- *
- * 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.protocols.urp;
-
-import com.sun.star.lib.uno.typedesc.TypeDescription;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.IBridge;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.TypeClass;
-import com.sun.star.uno.XInterface;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class Marshaling_Test {
- @Test public void test() throws Exception {
- short cacheSize = (short)256;
- TestBridge testBridge = new TestBridge();
- Marshal marshal = new Marshal(testBridge, cacheSize);
-
- TestObject testObject = new TestObject();
-
- TestPrimitiveSeqStruct x = new TestPrimitiveSeqStruct();
- x.zAny = new Object[]{new Integer(1), new Double(2) };
-
-
- Object data[] = new Object[] {
- new com.sun.star.uno.RuntimeException("testRuntimeException"),
- new com.sun.star.uno.Exception("testException"),
- new Boolean(true),
- new Byte((byte)47),
- new Character('k'),
- new Double(0.12345),
- TestEnum.B,
- new Float(0.5678),
- new Integer(0),
- new Integer(128),
- new Integer(0x0f00),
- new Integer(0x0f0000),
- new Integer(0x0f000000),
- new Integer(-128),
- new Integer(0xff00),
- new Integer(0xff0000),
- new Integer(0xff000000),
- new Long(666L),
- new Short((short)444),
- new String("blabla"),
- new Integer(10), // Any as object
- new Integer(10), // Any as object
- new Any(new Type(Integer.class), new Integer(10)), // Any as Any
- new Any(new Type(Integer.class), new Integer(10)), // Any as Any
- null,
- new TestPrimitiveStruct(),
- x, //new TestPrimitiveSeqStruct(),
- new byte[]{1,2,3,4,5,6,7}, // primitive sequence
- new int[]{7,6,5,4,3,2,1}, // primitive sequence
- new Object[]{new Integer(123), new String("hallo")}, // any sequence
- new TestPrimitiveStruct[]{new TestPrimitiveStruct(), new TestPrimitiveStruct()}, // sequence of primitive structs
- new TestPrimitiveSeqStruct[]{new TestPrimitiveSeqStruct(), new TestPrimitiveSeqStruct()}, // sequence of primitive structs
- new TestNestedStruct(),
- new TestNestedSeqStruct(),
- new Type(Void.class),
- new Type(String.class),
- new Type(Object.class),
- new Type(Byte.class),
- new Type(Integer.class),
- new Type(Double.class),
- new Type(Float.class),
- new Type(Character.class),
- new Type(Short.class),
- new Type(Boolean.class),
- new Type(void.class),
- new Type(byte.class),
- new Type(int.class),
- new Type(double.class),
- new Type(float.class),
- new Type(char.class),
- new Type(short.class),
- new Type(boolean.class),
- new Type(Class.forName("[Ljava.lang.String;")),
- new Type(Class.forName("[Ljava.lang.Object;")),
- new Type(Class.forName("[B")),
- new Type(Class.forName("[Z")),
- new Type("boolean"),
- new Type("byte"),
- new Type("char"),
- new Type("short"),
- new Type("long"),
- new Type("hyper"),
- new Type("float"),
- new Type("double"),
- new Type("string"),
- new Type("void"),
- new Type("any"),
- new Type(
- "com.sun.star.lib.uno.protocols.urp.TestEnum", TypeClass.ENUM),
- new Type("[]boolean", TypeClass.SEQUENCE),
- new Type("[][]byte", TypeClass.SEQUENCE),
- new Type("[][][]char", TypeClass.SEQUENCE),
- new Type("[][][][]short", TypeClass.SEQUENCE),
- new Type("[][][][][]any", TypeClass.SEQUENCE),
- new Type("com.sun.star.uno.XInterface", TypeClass.INTERFACE),
- new Type("[]com.sun.star.uno.XInterface", TypeClass.SEQUENCE),
- testObject,
- testObject,
- new TestInterfaceStruct(testObject, null)
- };
-
- TypeDescription dataTypes[] = new TypeDescription[] {
- TypeDescription.getTypeDescription(com.sun.star.uno.RuntimeException.class),
- TypeDescription.getTypeDescription(com.sun.star.uno.Exception.class),
- TypeDescription.getTypeDescription(Boolean.class),
- TypeDescription.getTypeDescription(Byte.class),
- TypeDescription.getTypeDescription(Character.class),
- TypeDescription.getTypeDescription(Double.class),
- TypeDescription.getTypeDescription(TestEnum.class),
- TypeDescription.getTypeDescription(Float.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Integer.class),
- TypeDescription.getTypeDescription(Long.class),
- TypeDescription.getTypeDescription(Short.class),
- TypeDescription.getTypeDescription(String.class),
- TypeDescription.getTypeDescription(Object.class),
- TypeDescription.getTypeDescription(Any.class),
- TypeDescription.getTypeDescription(Any.class),
- TypeDescription.getTypeDescription(Object.class),
- TypeDescription.getTypeDescription(XInterface.class),
- TypeDescription.getTypeDescription(TestPrimitiveStruct.class),
- TypeDescription.getTypeDescription(TestPrimitiveSeqStruct.class),
- TypeDescription.getTypeDescription(Class.forName("[B")),
- TypeDescription.getTypeDescription(Class.forName("[I")),
- TypeDescription.getTypeDescription(Class.forName("[Lcom.sun.star.uno.Any;")),
- TypeDescription.getTypeDescription(
- Class.forName(
- "[Lcom.sun.star.lib.uno.protocols.urp."
- + "TestPrimitiveStruct;")),
- TypeDescription.getTypeDescription(
- Class.forName(
- "[Lcom.sun.star.lib.uno.protocols.urp."
- + "TestPrimitiveSeqStruct;")),
- TypeDescription.getTypeDescription(TestNestedStruct.class),
- TypeDescription.getTypeDescription(TestNestedSeqStruct.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(Type.class),
- TypeDescription.getTypeDescription(XInterface.class),
- TypeDescription.getTypeDescription(XInterface.class),
- TypeDescription.getTypeDescription(TestInterfaceStruct.class),
- };
-
-
- Unmarshal unmarshal = new Unmarshal(testBridge, cacheSize);
- for(int i = 0; i < dataTypes.length; ++ i) {
- Object op1 = data[i];
- marshal.writeValue(dataTypes[i], data[i]);
-
- unmarshal.reset(marshal.reset());
-
- Object op2 = unmarshal.readValue(dataTypes[i]);
-
- if(op1 instanceof Any)
- op1 = ((Any)op1).getObject();
-
- assertTrue(compareObjects(op1, op2));
- }
- }
-
- private static boolean compareArrays(Object op1, Object op2) throws Exception {
- boolean result = true;
- if((op1.getClass().getComponentType() == op2.getClass().getComponentType())
- && (Array.getLength(op1) == Array.getLength(op2)))
- {
- Class zClass = op1.getClass().getComponentType();
-
- for(int i = 0; i < Array.getLength(op1); ++ i)
- result = result & compareObjects(Array.get(op1, i), Array.get(op2, i));
- }
-
- return result;
- }
-
- private static boolean compareInterfaces(XInterface op1, XInterface op2) {
- return op1 == op2;
- }
-
- private static boolean compareStructs(Class zClass, Object op1, Object op2) throws Exception {
- boolean result = true;
-
- Field fields[] = zClass.getFields();
-
- for(int i = 0; i < fields.length && result; ++ i) {
- if((fields[i].getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) == 0) { // neither static nor transient ?
- result = result & compareObjects(fields[i].get(op1), fields[i].get(op2));
-
- if(!result)
- System.err.println("blabal :" + fields[i]);
- }
- }
-
- return result;
- }
-
- private static boolean compareStructs(Object op1, Object op2) throws Exception {
- boolean result = true;
-
- if(op1.getClass() != op2.getClass())
- result = false;
- else {
- result = compareStructs(op1.getClass(), op1, op2);
- }
-
- return result;
- }
-
- private static boolean compareThrowable(Throwable op1, Throwable op2) throws Exception {
- boolean result = true;
-
- if(op1.getClass() != op2.getClass())
- result = false;
- else {
- result = compareStructs(op1.getClass(), op1, op2);
-
- result = result & op1.getMessage().equals(op2.getMessage());
- }
-
- return result;
- }
-
- private static boolean compareObjects(Object op1, Object op2) throws Exception {
- boolean result = false;
-
- if(op1 == op2)
- result = true;
-
- else if(op1.getClass().isPrimitive() && op2.getClass().isPrimitive())
- result = op1.equals(op2);
-
- else if(op1.getClass() == Byte.class && op2.getClass() == Byte.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Type.class && op2.getClass() == Type.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Boolean.class && op2.getClass() == Boolean.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Short.class && op2.getClass() == Short.class)
- result = op1.equals(op2);
-
- else if(Throwable.class.isAssignableFrom(op1.getClass()) && Throwable.class.isAssignableFrom(op2.getClass()))
- result = compareThrowable((Throwable)op1, (Throwable)op2);
-
- else if(op1.getClass() == Integer.class && op2.getClass() == Integer.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Character.class && op2.getClass() == Character.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Long.class && op2.getClass() == Long.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Void.class && op2.getClass() == Void.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Float.class && op2.getClass() == Float.class)
- result = op1.equals(op2);
-
- else if(op1.getClass() == Double.class && op2.getClass() == Double.class)
- result = op1.equals(op2);
-
- else if(op1.getClass().isArray() && op2.getClass().isArray())
- result = compareArrays(op1, op2);
-
- else if(op1.getClass() == Void.class || op2.getClass() == void.class) // write nothing ?
- result = true;
-
- else if(XInterface.class.isAssignableFrom(op1.getClass()) && XInterface.class.isAssignableFrom(op2.getClass()))
- result = compareInterfaces((XInterface)op1, (XInterface)op2);
-
- else if(op1.getClass() == String.class && op2.getClass() == String.class) // is it a String ?
- result = ((String)op1).equals((String)op2);
-
- else if(op1.getClass() == Type.class && op2.getClass() == Type.class) // types?
- result = op1.equals(op2);
-
- else // otherwise it must be a struct
- result = compareStructs(op1, op2);
-
- return result;
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java
deleted file mode 100644
index 3da9c9f3a..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*************************************************************************
- *
- * 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.protocols.urp;
-
-import com.sun.star.lib.uno.environments.remote.Message;
-import com.sun.star.lib.uno.environments.remote.IProtocol;
-import com.sun.star.lib.uno.environments.remote.ThreadId;
-import com.sun.star.lib.uno.typedesc.TypeDescription;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.IBridge;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.XInterface;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.LinkedList;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class Protocol_Test {
- @Test public void test() throws Exception {
- IBridge iBridge = new TestBridge();
- PipedInputStream inA = new PipedInputStream();
- PipedOutputStream outA = new PipedOutputStream(inA);
- PipedInputStream inB = new PipedInputStream();
- PipedOutputStream outB = new PipedOutputStream(inB);
- Endpoint iSender = new Endpoint(iBridge, inA, outB);
- Endpoint iReceiver = new Endpoint(iBridge, inB, outA);
-
- TestObject testObject = new TestObject();
- String oId = (String)iBridge.mapInterfaceTo(testObject, new Type(XInterface.class));
-
- testCall(iSender, iReceiver, oId);
- testCallWithInParameter(iSender, iReceiver, oId);
- testCallWithOutParameter(iSender, iReceiver, oId);
- testCallWithInOutParameter(iSender, iReceiver, oId);
- testCallWithResult(iSender, iReceiver, oId);
- testCallWhichRaisesException(iSender, iReceiver, oId);
- testCallWithIn_Out_InOut_Paramters_and_result(iSender, iReceiver, oId);
- testCallWhichReturnsAny(iSender, iReceiver, oId);
- }
-
- public void testCall(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- // send an ordinary request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "method", new ThreadId(new byte[] { 0, 1 }), new Object[0]);
- iReceiver.readMessage();
-
- // send a reply
- iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null);
- iSender.readMessage();
- }
-
- public void testCallWithInParameter(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- // send an ordinary request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "methodWithInParameter", new ThreadId(new byte[] { 0, 1 }),
- new Object[] { "hallo" });
- Message iMessage = iReceiver.readMessage();
- Object[] t_params = iMessage.getArguments();
- assertEquals("hallo", (String)t_params[0]);
-
- // send a reply
- iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null);
- iMessage = iSender.readMessage();
- }
-
- public void testCallWithOutParameter(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- Object params[] = new Object[]{new String[1]};
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "methodWithOutParameter", new ThreadId(new byte[] { 0, 1 }),
- params);
- Message iMessage = iReceiver.readMessage();
-
-
- Object[] t_params = iMessage.getArguments();
- ((String [])t_params[0])[0] = "testString";
-
- // send an exception as reply
- iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null);
- iSender.readMessage();
-
- assertEquals("testString", ((String [])params[0])[0]);
- }
-
- public void testCallWithInOutParameter(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- Object params[] = new Object[]{new String[]{"inString"}};
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "methodWithInOutParameter", new ThreadId(new byte[] { 0, 1 }),
- params);
- Message iMessage = iReceiver.readMessage();
-
-
- Object[] t_params = iMessage.getArguments();
- assertEquals("inString", ((String [])t_params[0])[0]);
-
- // provide reply
- ((String [])t_params[0])[0] = "outString";
-
- // send an exception as reply
- iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null);
- iSender.readMessage();
-
- assertEquals("outString", ((String [])params[0])[0]);
- }
-
- public void testCallWithResult(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- // send an ordinary request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "methodWithResult", new ThreadId(new byte[] { 0, 1 }),
- new Object[0]);
- iReceiver.readMessage();
-
- // send a reply
- iReceiver.writeReply(
- false, new ThreadId(new byte[] { 0, 1 }), "resultString");
- Message iMessage = iSender.readMessage();
- Object result = iMessage.getResult();
-
- assertEquals("resultString", result);
- }
-
- public void testCallWhichRaisesException(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- // send a second request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "method", new ThreadId(new byte[] { 0, 1 }), new Object[0]);
- iReceiver.readMessage();
-
- // send an exception as reply
- iReceiver.writeReply(
- true, new ThreadId(new byte[] { 0, 1 }),
- new com.sun.star.uno.RuntimeException("test the exception"));
- Message iMessage = iSender.readMessage();
-
- Object result = iMessage.getResult();
-
- assertTrue(result instanceof com.sun.star.uno.RuntimeException);
- }
-
- public void testCallWithIn_Out_InOut_Paramters_and_result(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- Object params[] = new Object[]{"hallo", new String[1], new String[]{"inOutString"}};
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "MethodWithIn_Out_InOut_Paramters_and_result",
- new ThreadId(new byte[] { 0, 1 }), params);
- Message iMessage = iReceiver.readMessage();
-
- Object[] t_params = iMessage.getArguments();
-
- assertEquals("hallo", (String)t_params[0]);
-
- assertEquals("inOutString", ((String [])t_params[2])[0]);
-
- ((String [])t_params[1])[0] = "outString";
- ((String [])t_params[2])[0] = "inOutString_res";
-
- // send an exception as reply
- iReceiver.writeReply(
- false, new ThreadId(new byte[] { 0, 1 }), "resultString");
- iMessage = iSender.readMessage();
-
- Object result = iMessage.getResult();
- assertEquals("outString", ((String [])params[1])[0]);
-
- assertEquals("inOutString_res", ((String [])params[2])[0]);
-
- assertEquals("resultString", result);
- }
-
- public void testCallWhichReturnsAny(
- Endpoint iSender, Endpoint iReceiver, String oId) throws Exception
- {
- // send an ordinary request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "returnAny", new ThreadId(new byte[] { 0, 1 }), null);
- iReceiver.readMessage();
- // send a reply
- iReceiver.writeReply(
- false, new ThreadId(new byte[] { 0, 1 }), Any.VOID);
- Message iMessage = iSender.readMessage();
- Object result = iMessage.getResult();
- assertTrue(
- result instanceof Any &&
- ((TypeDescription.getTypeDescription(((Any) result).getType()).
- getZClass()) ==
- void.class));
-
- // send an ordinary request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "returnAny", new ThreadId(new byte[] { 0, 1 }), null);
- iReceiver.readMessage();
- // send a reply
- iReceiver.writeReply(
- false, new ThreadId(new byte[] { 0, 1 }),
- new Any(XInterface.class, null));
- iMessage = iSender.readMessage();
- result = iMessage.getResult();
- assertNull(result);
-
- // send an ordinary request
- iSender.writeRequest(
- oId, TypeDescription.getTypeDescription(TestXInterface.class),
- "returnAny", new ThreadId(new byte[] { 0, 1 }), null);
- iReceiver.readMessage();
- // send a reply
- iReceiver.writeReply(
- false, new ThreadId(new byte[] { 0, 1 }), new Integer(501));
- iMessage = iSender.readMessage();
- result = iMessage.getResult();
- assertEquals(501, result);
- }
-
- private static final class Endpoint {
- public Endpoint(IBridge bridge, InputStream input, OutputStream output)
- throws IOException
- {
- protocol = new urp(bridge, null, input, output);
- new Thread() {
- public void run() {
- for (;;) {
- Object o;
- try {
- o = protocol.readMessage();
- } catch (IOException e) {
- o = e;
- }
- synchronized (queue) {
- queue.addLast(o);
- }
- }
- }
- }.start();
- protocol.init();
- }
-
- public Message readMessage() throws IOException {
- for (;;) {
- synchronized (queue) {
- if (!queue.isEmpty()) {
- Object o = queue.removeFirst();
- if (o instanceof Message) {
- return (Message) o;
- } else {
- throw (IOException) o;
- }
- }
- }
- }
- }
-
- public boolean writeRequest(
- String oid, TypeDescription type, String function, ThreadId tid,
- Object[] arguments)
- throws IOException
- {
- return protocol.writeRequest(oid, type, function, tid, arguments);
- }
-
- public void writeReply(boolean exception, ThreadId tid, Object result)
- throws IOException
- {
- protocol.writeReply(exception, tid, result);
- }
-
- private final IProtocol protocol;
- private final LinkedList queue = new LinkedList();
- }
-}
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java
deleted file mode 100644
index ab84a983f..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************
- *
- * 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.protocols.urp;
-
-import java.io.IOException;
-
-import java.util.Hashtable;
-
-
-import com.sun.star.uno.IBridge;
-import com.sun.star.uno.IEnvironment;
-import com.sun.star.uno.Type;
-
-
-class TestBridge implements IBridge {
- static public final boolean DEBUG = false;
-
- Hashtable _hashtable = new Hashtable();
-
- IEnvironment _source ;//= new com.sun.star.lib.uno.environments.java.java_environment(null);
-
-
- class MyEnv implements IEnvironment {
- public Object getContext() {
- return null;
- }
-
- public String getName() {
- return null;
- }
-
- public Object registerInterface(Object object, String oId[], Type type) {
- return null;
- }
-
- public void revokeInterface(String oId, Type type) {
- }
-
- public Object getRegisteredInterface(String oid, Type type) {
- Object object = _hashtable.get(oid);
-
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".getRegisteredInterface:" + oid + " " + object);
-
- return object;
- }
-
- public String getRegisteredObjectIdentifier(Object object) {
- return null;
- }
-
- public void list() {
- }
- }
-
- TestBridge() {
- _source = new MyEnv();
- }
-
- public Object mapInterfaceTo(Object object, Type type) {
- if (object == null) {
- return null;
- } else {
- String oid = ">" + object.toString() + type.toString() + "<";
- _hashtable.put(oid, object);
- return oid;
- }
- }
-
- public Object mapInterfaceFrom(Object object, Type type) {
- String oid = (String)object;
-
- return _hashtable.get(oid);
- }
-
- public IEnvironment getSourceEnvironment() {
- return _source;
- }
-
- public IEnvironment getTargetEnvironment() {
- return null;
- }
-
- public void acquire() {}
-
- public void release() {}
-
- public void reset() throws IOException {}
-
- public void dispose() throws InterruptedException, IOException {}
-}
-
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java
deleted file mode 100644
index c2ff8a58d..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*************************************************************************
- *
- * 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.protocols.urp;
-
-
-
-class TestObject implements TestXInterface {
- public void method1( /*IN*/java.lang.Object itf ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public void method2( /*OUT*/java.lang.Object[] itf ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public void method3( /*INOUT*/java.lang.Object[] itf ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public Object method4( ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- return null;
- }
-
- public Object returnAny( ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- return null;
- }
-
-
- public void method() throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public void methodWithInParameter( /*IN*/String text ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public void methodWithOutParameter( /*OUT*/String[] text ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public void methodWithInOutParameter( /*INOUT*/String[] text ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- }
-
- public String methodWithResult( ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- return "TestObject_resultString";
- }
-
- public String MethodWithIn_Out_InOut_Paramters_and_result( /*IN*/String text, /*OUT*/String[] outtext, /*INOUT*/String[] inouttext ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- return "TestObject_resultString";
- }
-}
-
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl b/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl
deleted file mode 100644
index b1aba4cf7..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl
+++ /dev/null
@@ -1,119 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef __com_sun_star_uno_XInterface_idl__
-#include <com/sun/star/uno/XInterface.idl>
-#endif
-
-#ifndef __com_sun_star_beans_XPropertySet_idl_
-#include <com/sun/star/beans/XPropertySet.idl>
-#endif
-
-#ifndef __com_sun_star_uno_Exception_idl__
-#include <com/sun/star/uno/Exception.idl>
-#endif
-
-#ifndef __com_sun_star_uno_Exception_idl__
-#include <com/sun/star/uno/Any.idl>
-#endif
-
-
-module com { module sun { module star { module lib { module uno {
-module protocols { module urp {
-
- struct TestPrimitiveStruct {
- boolean zBool;
- short zShort;
- unsigned short zUShort;
- long zLong;
- unsigned long zULong;
- hyper zHyper;
- unsigned hyper zUHyper;
- float zFloat;
- double zDouble;
- char zChar;
- byte zByte;
- string zString;
- any zAny;
- };
-
- struct TestPrimitiveSeqStruct {
- sequence<boolean> zBool;
- sequence<short> zShort;
- sequence<unsigned short> zUShort;
- sequence<long> zLong;
- sequence<unsigned long> zULong;
- sequence<hyper> zHyper;
- sequence<unsigned hyper> zUHyper;
- sequence<float> zFloat;
- sequence<double> zDouble;
- sequence<char> zChar;
- sequence<byte> zByte;
- sequence<string> zString;
- sequence<any> zAny;
- };
-
- struct TestNestedStruct {
- TestPrimitiveStruct primitiveStruct;
- TestPrimitiveSeqStruct primitiveSeqStruct;
- };
-
- struct TestNestedSeqStruct {
- sequence< sequence< long > > val;
- };
-
- interface TestXInterface : com::sun::star::uno::XInterface {
- void method1([in] com::sun::star::uno::XInterface itf) raises( com::sun::star::uno::Exception );
- void method2([out] com::sun::star::uno::XInterface itf) raises( com::sun::star::uno::Exception );
- void method3([inout] com::sun::star::uno::XInterface itf) raises( com::sun::star::uno::Exception );
- com::sun::star::uno::XInterface method4() raises( com::sun::star::uno::Exception );
-
- any returnAny() raises( com::sun::star::uno::Exception );
-
- void method() raises( com::sun::star::uno::Exception );
- void methodWithInParameter([in] string text) raises( com::sun::star::uno::Exception );
- void methodWithOutParameter([out] string text) raises( com::sun::star::uno::Exception );
- void methodWithInOutParameter([inout] string text) raises( com::sun::star::uno::Exception );
- string methodWithResult() raises( com::sun::star::uno::Exception );
-
- string MethodWithIn_Out_InOut_Paramters_and_result([in] string text, [out] string outtext, [inout] string inouttext) raises( com::sun::star::uno::Exception );
- };
-
- struct TestInterfaceStruct
- {
- com::sun::star::uno::XInterface hallo;
-
- com::sun::star::beans::XPropertySet hallo2;
- };
-
- enum TestEnum {
- A = 7,
- B = 8,
- C = 11
- };
-
-}; }; }; }; }; }; };
diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk
deleted file mode 100644
index 8403b2bd7..000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-#*************************************************************************
-
-.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
-nothing .PHONY:
-.ELSE
-
-PRJ := ..$/..$/..$/..$/..$/..$/..$/..
-PRJNAME := jurt
-TARGET := test_com_sun_star_lib_uno_protocols_urp
-
-.IF "$(OOO_JUNIT_JAR)" != ""
-PACKAGE := com$/sun$/star$/lib$/uno$/protocols$/urp
-JAVATESTFILES := \
- Cache_Test.java \
- Marshaling_Test.java \
- Protocol_Test.java
-JAVAFILES := \
- TestBridge.java \
- TestObject.java
-JARFILES := ridl.jar
-IDLTESTFILES := interfaces.idl
-.END
-
-.INCLUDE: javaunittest.mk
-
-.END