summaryrefslogtreecommitdiff
path: root/jurt/test/com/sun/star
diff options
context:
space:
mode:
Diffstat (limited to 'jurt/test/com/sun/star')
-rw-r--r--jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java106
-rw-r--r--jurt/test/com/sun/star/comp/bridgefactory/makefile.mk36
-rw-r--r--jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java147
-rw-r--r--jurt/test/com/sun/star/comp/connections/makefile.mk36
-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
-rw-r--r--jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java83
-rw-r--r--jurt/test/com/sun/star/lib/util/makefile.mk36
-rw-r--r--jurt/test/com/sun/star/uno/AnyConverter_Test.java905
-rw-r--r--jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java96
-rw-r--r--jurt/test/com/sun/star/uno/WeakReference_Test.java118
-rw-r--r--jurt/test/com/sun/star/uno/makefile.mk39
32 files changed, 0 insertions, 4533 deletions
diff --git a/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java b/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
deleted file mode 100644
index 781f97e69..000000000
--- a/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
+++ /dev/null
@@ -1,106 +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.comp.bridgefactory;
-
-import com.sun.star.bridge.BridgeExistsException;
-import com.sun.star.bridge.XBridge;
-import com.sun.star.comp.connections.PipedConnection;
-import com.sun.star.connection.XConnection;
-import com.sun.star.lang.XComponent;
-import com.sun.star.uno.UnoRuntime;
-import complexlib.ComplexTestCase;
-
-public final class BridgeFactory_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() throws Exception {
- PipedConnection rightSide = new PipedConnection(new Object[0]);
- PipedConnection leftSide = new PipedConnection(new Object[]{rightSide});
-
- BridgeFactory bridgeFactory = new BridgeFactory(); // create the needed bridgeFactory
-
- // create a bridge
- XBridge xBridge = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
-
- // test that we get the same bridge
- assure("", UnoRuntime.areSame(xBridge,
- bridgeFactory.getBridge("testbridge")));
-
- // test that we can not create another bridge with same name
- try {
- XBridge dummy = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
-
- failed("");
- }
- catch(BridgeExistsException bridgeExistsException) {
- }
-
-
- // test getExistingBridges
- XBridge xBridges[] = bridgeFactory.getExistingBridges();
- assure("", UnoRuntime.areSame(xBridge, xBridges[0]));
-
- // dispose the bridge
- XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xBridge);
- xComponent.dispose();
-
-
- // test that the bridge has been removed
- assure("", bridgeFactory.getBridge("testbridge") == null);
-
-
-
- rightSide = new PipedConnection(new Object[0]);
- leftSide = new PipedConnection(new Object[]{rightSide});
-
-
- // test that we really get a new bridge
- XBridge xBridge_new = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
- assure("", !UnoRuntime.areSame(xBridge, xBridge_new));
-
- for(int i = 0; i <10000; ++ i) {
- Object x[] = new Object[100];
- }
-
- // test getExistingBridges
- xBridges = bridgeFactory.getExistingBridges();
- assure("",
- xBridges.length == 1
- && UnoRuntime.areSame(xBridge_new, xBridges[0]));
-
- // dispose the new bridge
- XComponent xComponent_new = UnoRuntime.queryInterface(XComponent.class, xBridge_new);
- xComponent_new.dispose();
- }
-}
diff --git a/jurt/test/com/sun/star/comp/bridgefactory/makefile.mk b/jurt/test/com/sun/star/comp/bridgefactory/makefile.mk
deleted file mode 100644
index 6de5c582e..000000000
--- a/jurt/test/com/sun/star/comp/bridgefactory/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_comp_bridgefactory
-
-PACKAGE := com$/sun$/star$/comp$/bridgefactory
-JAVATESTFILES := BridgeFactory_Test.java
-JARFILES := ridl.jar
-
-.INCLUDE: javaunittest.mk
diff --git a/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java b/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java
deleted file mode 100644
index 41a2e56f3..000000000
--- a/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java
+++ /dev/null
@@ -1,147 +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.comp.connections;
-
-import complexlib.ComplexTestCase;
-
-public final class PipedConnection_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() throws Exception {
- PipedConnection rightSide = new PipedConnection(new Object[0]);
- PipedConnection leftSide = new PipedConnection(new Object[]{rightSide});
-
- byte theByte[] = new byte[1];
-
- Reader reader = new Reader(rightSide, theByte);
- Writer writer = new Writer(leftSide, theByte, reader);
-
- reader.start();
- writer.start();
-
- Thread.sleep(2000);
-
- writer.term();
- writer.join();
-
- reader.join();
-
- assure("", writer._state && reader._state);
- }
-
- static class Reader extends Thread {
- PipedConnection _pipedConnection;
- byte _theByte[];
- boolean _quit;
- boolean _state = false;
-
- Reader(PipedConnection pipedConnection, byte theByte[]) {
- _pipedConnection = pipedConnection;
- _theByte = theByte;
- }
-
- public void run() {
- try {
- byte bytes[][] = new byte[1][];
-
- while(!_quit) {
- int read = _pipedConnection.read(bytes, 1);
-
- if(read == 1) {
-// System.err.println("read :" + bytes[0][0]);
-
- if(_theByte[0] != bytes[0][0])
- throw new NullPointerException();
-
- synchronized(this) {
- notifyAll();
- }
- }
- else
- _quit = true; // EOF
- }
-
- _pipedConnection.close();
- _state = true;
- }
- catch(com.sun.star.io.IOException ioException) {
- System.err.println("#### Reader - unexpected:" + ioException);
- }
-
- }
- }
-
- static class Writer extends Thread {
- PipedConnection _pipedConnection;
- byte _theByte[];
- Reader _reader;
- boolean _quit;
- boolean _state = false;
-
- Writer(PipedConnection pipedConnection, byte theByte[], Reader reader) {
- _pipedConnection = pipedConnection;
- _reader = reader;
- _theByte = theByte;
- }
-
- public void run() {
- try {
- while(!_quit) {
- synchronized(_reader) {
- _pipedConnection.write(_theByte);
- _pipedConnection.flush();
-// System.err.println("written :" + _theByte[0]);
-
- _reader.wait();
- }
- ++ _theByte[0];
- }
-
- _pipedConnection.close();
-
- _state = true;
- }
- catch(com.sun.star.io.IOException ioException) {
- System.err.println("#### Writer:" + ioException);
- }
- catch(InterruptedException interruptedException) {
- System.err.println("#### Writer:" + interruptedException);
- }
- }
-
- public void term() {
- _quit = true;
- }
- }
-}
diff --git a/jurt/test/com/sun/star/comp/connections/makefile.mk b/jurt/test/com/sun/star/comp/connections/makefile.mk
deleted file mode 100644
index d311cd0b9..000000000
--- a/jurt/test/com/sun/star/comp/connections/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_comp_connections
-
-PACKAGE := com$/sun$/star$/comp$/connections
-JAVATESTFILES := PipedConnection_Test.java
-JARFILES := ridl.jar
-
-.INCLUDE: javaunittest.mk
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
diff --git a/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java b/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java
deleted file mode 100644
index 6c5ca0659..000000000
--- a/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java
+++ /dev/null
@@ -1,83 +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.util;
-
-import complexlib.ComplexTestCase;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public final class NativeLibraryLoader_Test extends ComplexTestCase {
- public String[] getTestMethodNames() {
- return new String[] { "testEncoded", "testUnencoded" };
- }
-
- public void testEncoded() throws MalformedURLException {
- File dir = new File(System.getProperty("user.dir"));
- File subdir = new File(dir, "with space");
- File file1 = new File(subdir, "file");
-
- String fileUrl = dir.toURI().toURL().toString();
- if (!fileUrl.endsWith("/")) {
- fileUrl += "/";
- }
- fileUrl += "with%20space/file";
- final URL url = new URL(fileUrl);
-
- File file2 = NativeLibraryLoader.getResource(
- new ClassLoader() {
- public URL getResource(String name) {
- return url;
- }
- },
- "dummy");
- assure("Files are equal", file2.equals(file1));
- }
-
- public void testUnencoded() throws MalformedURLException {
- File dir = new File(System.getProperty("user.dir"));
- File subdir = new File(dir, "with space");
- File file1 = new File(subdir, "file");
-
- String fileUrl = dir.toURI().toURL().toString();
- if (!fileUrl.endsWith("/")) {
- fileUrl += "/";
- }
- fileUrl += "with space/file";
- final URL url = new URL(fileUrl);
-
- File file2 = NativeLibraryLoader.getResource(
- new ClassLoader() {
- public URL getResource(String name) {
- return url;
- }
- },
- "dummy");
- assure("Files are equal", file2.equals(file1));
- }
-}
diff --git a/jurt/test/com/sun/star/lib/util/makefile.mk b/jurt/test/com/sun/star/lib/util/makefile.mk
deleted file mode 100644
index dd4110623..000000000
--- a/jurt/test/com/sun/star/lib/util/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_util
-
-PACKAGE := com$/sun$/star$/lib$/util
-JAVATESTFILES := \
- NativeLibraryLoader_Test.java
-
-.INCLUDE: javaunittest.mk
diff --git a/jurt/test/com/sun/star/uno/AnyConverter_Test.java b/jurt/test/com/sun/star/uno/AnyConverter_Test.java
deleted file mode 100644
index 73c972867..000000000
--- a/jurt/test/com/sun/star/uno/AnyConverter_Test.java
+++ /dev/null
@@ -1,905 +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.uno;
-
-import com.sun.star.lang.XTypeProvider;
-import complexlib.ComplexTestCase;
-
-public final class AnyConverter_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] {
- "test_toBoolean", "test_toChar", "test_toByte", "test_toShort",
- "test_toInt", "test_toLong", "test_toFloat", "test_toDouble",
- "test_toObject", "test_toString", "test_toType", "test_toArray",
- "test_isBoolean", "test_isChar", "test_isByte", "test_isShort",
- "test_isInt", "test_isLong", "test_isFloat", "test_isDouble",
- "test_isObject", "test_isString", "test_isType", "test_isArray",
- "test_isVoid" };
- }
-
- Any anyBool; //
- Any anyChar; //
- Any anyByte; //
- Any anyShort; //
- Any anyInt; //
- Any anyLong; //
- Any anyFloat; //
- Any anyDouble; //
- Any anyStr; //
- Any anyType; //
- Any anyArByte; //
- Any anyVoid; //
- Any anyXTypeProvider;
-
- Boolean aBool= new Boolean(true);
- Character aChar= new Character('A');
- Byte aByte= new Byte((byte) 111);
- Short aShort= new Short((short) 11111);
- Integer aInt= new Integer( 1111111);
- Long aLong= new Long( 0xffffffff);
- Float aFloat= new Float( 3.14);
- Double aDouble= new Double( 3.145);
- Object aObj= new ATypeProvider();
- String aStr= new String("I am a string");
- Type aType= new Type(String.class);
- byte[] arByte= new byte[] {1,2,3};
-
- public AnyConverter_Test() {
- anyVoid= new Any(new Type(void.class), null);
- anyBool= new Any(new Type(Boolean.TYPE), aBool);
- anyChar= new Any(new Type(Character.TYPE), aChar);
- anyByte= new Any(new Type(Byte.TYPE), aByte);
- anyShort= new Any(new Type(Short.TYPE), aShort);
- anyInt= new Any(new Type(Integer.TYPE), aInt);
- anyLong= new Any(new Type(Long.TYPE), aLong);
- anyFloat= new Any(new Type(Float.TYPE), aFloat);
- anyDouble= new Any(new Type(Double.TYPE), aDouble);
- anyStr= new Any(new Type(String.class), aStr);
- anyType= new Any(new Type(Type.class), aType);
- anyArByte= new Any(new Type(byte[].class), arByte);
- anyXTypeProvider= new Any(new Type(XTypeProvider.class), aObj);
- }
-
- public void test_toBoolean()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- boolean b= AnyConverter.toBoolean(aBool);
- assure("", b == aBool.booleanValue());
- b= AnyConverter.toBoolean(anyBool);
- assure("", b == ((Boolean)anyBool.getObject()).booleanValue());
-
- // must fail
- try { AnyConverter.toBoolean(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toBoolean(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toChar()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- char b= AnyConverter.toChar(aChar);
- assure("", b == aChar.charValue());
- b= AnyConverter.toChar(anyChar);
- assure("", b == ((Character)anyChar.getObject()).charValue());
-
- // must fail
- try { AnyConverter.toChar(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toByte()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- byte val= AnyConverter.toByte(aByte);
- assure("", val == aByte.byteValue());
- val= AnyConverter.toByte(anyByte);
- assure("", val == ((Byte)anyByte.getObject()).byteValue());
-
- // must fail
- try { AnyConverter.toByte(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toByte(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toShort()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- short sh= AnyConverter.toShort(aByte);
- assure("", sh == aByte.byteValue());
- sh= AnyConverter.toShort(aShort);
- assure("", sh == aShort.shortValue());
- sh= AnyConverter.toShort(anyByte);
- assure("", sh == ((Byte)anyByte.getObject()).byteValue());
- sh= AnyConverter.toShort(anyShort);
- assure("", sh == ((Short) anyShort.getObject()).shortValue());
- Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) );
- assure("", 5 == AnyConverter.toUnsignedShort( a ));
-
- // must fail
- try { AnyConverter.toShort(a); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toUnsignedShort(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toChar(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toShort(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toInt()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- int val= AnyConverter.toInt(aByte);
- assure("", val == aByte.byteValue());
- val= AnyConverter.toInt(aShort);
- assure("", val == aShort.shortValue());
- val= AnyConverter.toInt(aInt);
- assure("", val == aInt.intValue());
- val= AnyConverter.toInt(anyByte);
- assure("", val == ((Byte)anyByte.getObject()).byteValue());
- val= AnyConverter.toInt(anyShort);
- assure("", val == ((Short) anyShort.getObject()).shortValue());
- val= AnyConverter.toInt(anyInt);
- assure("", val == ((Integer) anyInt.getObject()).intValue());
- Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) );
- assure("", 5 == AnyConverter.toInt(a));
- assure("", 5 == AnyConverter.toUnsignedInt(a));
- a = new Any( Type.UNSIGNED_LONG, new Integer(5) );
- assure("", 5 == AnyConverter.toUnsignedInt(a));
-
- // must fail
- try { AnyConverter.toUnsignedInt(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(a); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toUnsignedInt(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toInt(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toLong()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- long val= AnyConverter.toLong(aByte);
- assure("", val == aByte.byteValue());
- val= AnyConverter.toLong(aShort);
- assure("", val == aShort.shortValue());
- val= AnyConverter.toLong(aInt);
- assure("", val == aInt.intValue());
- val= AnyConverter.toLong(aLong);
- assure("", val == aLong.longValue());
- val= AnyConverter.toLong(anyByte);
- assure("", val == ((Byte)anyByte.getObject()).byteValue());
- val= AnyConverter.toLong(anyShort);
- assure("", val == ((Short) anyShort.getObject()).shortValue());
- val= AnyConverter.toLong(anyInt);
- assure("", val == ((Integer) anyInt.getObject()).intValue());
- val= AnyConverter.toLong(anyLong);
- assure("", val == ((Long) anyLong.getObject()).longValue());
- Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) );
- assure("", 5 == AnyConverter.toLong(a));
- assure("", 5 == AnyConverter.toUnsignedLong(a));
- a = new Any( Type.UNSIGNED_LONG, new Integer(5) );
- assure("", 5 == AnyConverter.toUnsignedLong(a));
- assure("", 5 == AnyConverter.toLong(a));
- a = new Any( Type.UNSIGNED_HYPER, new Long(5) );
- assure("", 5 == AnyConverter.toUnsignedLong(a));
-
- // must fail
- try { AnyConverter.toUnsignedLong(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toUnsignedLong(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(a); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toUnsignedLong(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toLong(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toFloat()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- float val= AnyConverter.toFloat(aByte);
- assure("", val == aByte.byteValue()); // 111 = 111.0
- val= AnyConverter.toFloat(anyByte);
- assure("", val == ((Byte)anyByte.getObject()).byteValue());
- val= AnyConverter.toFloat(aShort);
- assure("", val == aShort.shortValue()); //11111 = 11111.0
- val= AnyConverter.toFloat(anyShort);
- assure("", val == ((Short) anyShort.getObject()).shortValue());
- val= AnyConverter.toFloat(aFloat);
- assure("", val == aFloat.floatValue());
- val= AnyConverter.toFloat(anyFloat);
- assure("", val == ((Float) anyFloat.getObject()).floatValue());
-
- // must fail
- try { AnyConverter.toFloat(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toFloat(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toDouble()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- double val= AnyConverter.toDouble(aByte);
- assure("", val == aByte.byteValue()); // 111 = 111.0
- val= AnyConverter.toDouble(anyByte);
- assure("", val == ((Byte)anyByte.getObject()).byteValue());
- val= AnyConverter.toDouble(aShort);
- assure("", val == aShort.shortValue()); //11111 = 11111.0
- val= AnyConverter.toDouble(anyShort);
- assure("", val == ((Short) anyShort.getObject()).shortValue());
- val= AnyConverter.toDouble(aInt);
- assure("", val == aInt.intValue());
- val= AnyConverter.toDouble(anyInt);
- assure("", val == ((Integer) anyInt.getObject()).intValue());
- val= AnyConverter.toDouble(aFloat);
- assure("", val == aFloat.floatValue());
- val= AnyConverter.toDouble(anyFloat);
- float float1= ((Float) anyFloat.getObject()).floatValue();
- assure("", val <= (float1 + 0.1) || val >= (float1 - 0.1));
- val= AnyConverter.toDouble(aDouble);
- assure("", val == aDouble.doubleValue());
- val= AnyConverter.toDouble(anyDouble);
- assure("", val == ((Double) anyDouble.getObject()).doubleValue());
-
- // must fail
- try { AnyConverter.toDouble(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toDouble(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toObject()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- Type _type= new Type(XTypeProvider.class);
- Object val= AnyConverter.toObject(_type, aObj);
- assure("", UnoRuntime.areSame(val, aObj));
- val= AnyConverter.toObject(
- _type, new Any( new Type(XTypeProvider.class), null));
- assure("", val == null);
-
- // structs, exceptions
- com.sun.star.lang.IllegalArgumentException exc =
- new com.sun.star.lang.IllegalArgumentException();
- Any any_exc = new Any(
- new Type("com.sun.star.lang.IllegalArgumentException",
- TypeClass.EXCEPTION), exc);
- assure("",
- AnyConverter.toObject(
- new Type(com.sun.star.lang.IllegalArgumentException.class),
- any_exc).equals(exc));
- assure("",
- AnyConverter.toObject(
- new Type(com.sun.star.uno.Exception.class), any_exc).equals(
- exc));
- try {
- AnyConverter.toObject(
- new Type(com.sun.star.uno.RuntimeException.class), any_exc);
- failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {};
- any_exc = new Any(com.sun.star.lang.IllegalArgumentException.class,
- exc);
- assure("",
- AnyConverter.toObject(
- new Type(com.sun.star.lang.IllegalArgumentException.class),
- any_exc).equals(exc));
- assure("",
- AnyConverter.toObject(new Type(com.sun.star.uno.Exception.class),
- any_exc).equals(exc));
- try {
- AnyConverter.toObject(
- new Type(com.sun.star.uno.RuntimeException.class), any_exc);
- failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {};
-
- // must fail
- try { AnyConverter.toObject(_type, aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toObject(_type, anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toObject(_type, anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toObject(_type, new Object()); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toString()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- String val= AnyConverter.toString(aStr);
- assure("", aStr.equals(val));
- val= AnyConverter.toString(anyStr);
- assure("", ((String)anyStr.getObject()).equals(val));
-
- // must fail
- try { AnyConverter.toString(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(aType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyType); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toString(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toType()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- Type val= AnyConverter.toType(aType);
- assure("", val == aType);
- val= AnyConverter.toType(anyType);
- assure("", val == anyType.getObject());
-
- // must fail
- try { AnyConverter.toType(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_toArray()
- throws com.sun.star.lang.IllegalArgumentException
- {
- // must work
- Object val= AnyConverter.toArray(arByte);
- assure("", val == arByte);
- val= AnyConverter.toArray(anyArByte);
- assure("", val == anyArByte.getObject());
-
- // must fail
- try { AnyConverter.toType(aBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyBool); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyChar); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyShort); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyInt); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyLong); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyFloat); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyDouble); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aObj); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(aStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyStr); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyVoid); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(arByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- try { AnyConverter.toType(anyArByte); failed("");
- } catch (com.sun.star.lang.IllegalArgumentException ie) {}
- }
-
- public void test_isBoolean() {
- assure("", AnyConverter.isBoolean(aBool));
- assure("", AnyConverter.isBoolean(anyBool));
- assure("", !AnyConverter.isBoolean(aChar));
- }
-
- public void test_isChar() {
- assure("", AnyConverter.isChar(aChar));
- assure("", AnyConverter.isChar(anyChar));
- assure("", !AnyConverter.isChar(aBool));
- }
-
- public void test_isByte() {
- assure("", AnyConverter.isByte(aByte));
- assure("", AnyConverter.isByte(anyByte));
- assure("", !AnyConverter.isByte(aBool));
- }
-
- public void test_isShort() {
- assure("", AnyConverter.isShort(aShort));
- assure("", AnyConverter.isShort(anyShort));
- assure("", Type.SHORT.equals(AnyConverter.getType(anyShort)));
- Any a = new Any( Type.UNSIGNED_SHORT, new Short((short)5) );
- assure("", Type.UNSIGNED_SHORT.equals(AnyConverter.getType(a)));
- assure("", !AnyConverter.isShort(a));
- assure("", !Type.SHORT.equals(AnyConverter.getType(a)));
- assure("", !AnyConverter.isShort(aBool));
- }
-
- public void test_isInt() {
- assure("", AnyConverter.isInt(aInt));
- assure("", AnyConverter.isInt(anyInt));
- assure("", Type.LONG.equals(AnyConverter.getType(anyInt)));
- Any a = new Any(Type.UNSIGNED_LONG, new Integer(5));
- assure("", Type.UNSIGNED_LONG.equals(AnyConverter.getType(a)));
- assure("", !AnyConverter.isInt(a));
- assure("", !Type.LONG.equals(AnyConverter.getType(a)));
- assure("", !AnyConverter.isInt(aBool));
- }
-
- public void test_isLong() {
- assure("", AnyConverter.isLong(aLong));
- assure("", AnyConverter.isLong(anyLong));
- assure("", Type.HYPER.equals(AnyConverter.getType(anyLong)));
- Any a = new Any( Type.UNSIGNED_HYPER, new Long(5) );
- assure("", Type.UNSIGNED_HYPER.equals( AnyConverter.getType(a) ));
- assure("", !AnyConverter.isLong(a));
- assure("", !Type.HYPER.equals( AnyConverter.getType(a) ));
- assure("", !AnyConverter.isLong(aBool));
- }
-
- public void test_isFloat() {
- assure("", AnyConverter.isFloat(aFloat));
- assure("", AnyConverter.isFloat(anyFloat));
- assure("", !AnyConverter.isFloat(aDouble));
- }
-
- public void test_isDouble() {
- assure("", AnyConverter.isDouble(aDouble));
- assure("", AnyConverter.isDouble(anyDouble));
- assure("", !AnyConverter.isDouble(aFloat));
- }
-
- public void test_isObject() {
- assure("", AnyConverter.isObject(aObj));
- assure("", AnyConverter.isObject( new Any( XInterface.class, null)));
- assure("", !AnyConverter.isObject(new Object()));
- }
-
- public void test_isString() {
- assure("", AnyConverter.isString(aStr));
- assure("", AnyConverter.isString(anyStr));
- assure("", !AnyConverter.isString(new Object()));
- }
-
- public void test_isType() {
- assure("", AnyConverter.isType(aType));
- assure("", AnyConverter.isType(anyType));
- assure("", !AnyConverter.isType(new Object()));
- }
-
- public void test_isArray() {
- assure("", AnyConverter.isArray(arByte));
- assure("", AnyConverter.isArray(anyArByte));
- assure("", !AnyConverter.isArray(new Object()));
- }
-
- public void test_isVoid() {
- assure("", AnyConverter.isVoid(anyVoid));
- assure("", !AnyConverter.isVoid(new Object()));
- }
-}
-
-
-class ATypeProvider implements com.sun.star.lang.XTypeProvider
-{
-
- public byte[] getImplementationId()
- {
- return new byte[]{1,2,3};
- }
-
- public com.sun.star.uno.Type[] getTypes()
- {
- return new Type[]{new Type(XTypeProvider.class)};
- }
-
-}
diff --git a/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java b/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java
deleted file mode 100644
index eef51f5bb..000000000
--- a/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java
+++ /dev/null
@@ -1,96 +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.uno;
-
-import com.sun.star.comp.connections.PipedConnection;
-import complexlib.ComplexTestCase;
-import util.WaitUnreachable;
-
-public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "test_getEnvironment", "test_getBridge" };
- }
-
- public void test_getEnvironment() throws java.lang.Exception {
- Object o1 = new Object();
- Object o2 = new Object();
-
- // get two environments with different contexts
- WaitUnreachable java_environment1 = new WaitUnreachable(
- UnoRuntime.getEnvironment("java", o1));
- WaitUnreachable java_environment2 = new WaitUnreachable(
- UnoRuntime.getEnvironment("java", o2));
-
- // ensure that the environments are different
- assure("", java_environment1.get() != java_environment2.get());
-
- // test if we get the same environment when we reget it
- assure("",
- UnoRuntime.areSame(java_environment1.get(),
- UnoRuntime.getEnvironment("java", o1)));
- assure("",
- UnoRuntime.areSame(java_environment2.get(),
- UnoRuntime.getEnvironment("java", o2)));
-
- // drop the environments and wait until they are gc
- java_environment1.waitUnreachable();
- java_environment2.waitUnreachable();
- }
-
- public void test_getBridge() throws java.lang.Exception {
- PipedConnection conn = new PipedConnection(new Object[0]);
- new PipedConnection(new Object[] { conn });
-
- // get a bridge
- IBridge iBridge = UnoRuntime.getBridgeByName(
- "java", null, "remote", "testname",
- new Object[] { "urp", conn, null });
-
- // reget the bridge, it must be the same as above
- IBridge iBridge_tmp = UnoRuntime.getBridgeByName(
- "java", null, "remote", "testname",
- new Object[] { "urp", conn, null });
- assure("", UnoRuntime.areSame(iBridge_tmp, iBridge));
-
- // dispose the bridge, this removes the entry from the runtime
- iBridge.dispose();
-
- conn = new PipedConnection(new Object[0]);
- new PipedConnection(new Object[] { conn });
-
- // reget the bridge, it must be a different one
- iBridge_tmp = UnoRuntime.getBridgeByName(
- "java", null, "remote", "testname",
- new Object[]{ "urp", conn, null });
- assure("", !UnoRuntime.areSame(iBridge_tmp, iBridge));
- }
-}
diff --git a/jurt/test/com/sun/star/uno/WeakReference_Test.java b/jurt/test/com/sun/star/uno/WeakReference_Test.java
deleted file mode 100644
index bc81141dd..000000000
--- a/jurt/test/com/sun/star/uno/WeakReference_Test.java
+++ /dev/null
@@ -1,118 +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.uno;
-
-import complexlib.ComplexTestCase;
-import java.util.ArrayList;
-import java.util.Iterator;
-import util.WaitUnreachable;
-
-public final class WeakReference_Test extends ComplexTestCase {
- public String getTestObjectName() {
- return getClass().getName();
- }
-
- public String[] getTestMethodNames() {
- return new String[] { "test" };
- }
-
- public void test() {
- Object o = new MockWeak();
- WeakReference r1 = new WeakReference(o);
- WeakReference r2 = new WeakReference(r1);
- assure("", r1.get() == o);
- assure("", r2.get() == o);
- WaitUnreachable u = new WaitUnreachable(o);
- o = null;
- u.waitUnreachable();
- assure("a3", r1.get() == null);
- assure("a4", r2.get() == null);
- }
-
- private static final class MockWeak implements XWeak {
- public XAdapter queryAdapter() {
- return adapter;
- }
-
- protected void finalize() {
- adapter.dispose();
- }
-
- private static final class Adapter implements XAdapter {
- public Adapter(Object obj) {
- ref = new java.lang.ref.WeakReference(obj);
- }
-
- public Object queryAdapted() {
- return ref.get();
- }
-
- public void addReference(XReference ref) {
- synchronized (this) {
- if (listeners != null) {
- listeners.add(ref);
- return;
- }
- }
- ref.dispose();
- }
-
- public synchronized void removeReference(XReference ref) {
- if (listeners != null) {
- listeners.remove(ref);
- }
- }
-
- public void dispose() {
- ArrayList l;
- synchronized (this){
- l = listeners;
- listeners = null;
- }
- if (l != null) {
- java.lang.RuntimeException ex = null;
- for (Iterator i = l.iterator(); i.hasNext();) {
- try {
- ((XReference) i.next()).dispose();
- } catch (java.lang.RuntimeException e) {
- ex = e;
- }
- }
- if (ex != null) {
- throw ex;
- }
- }
- }
-
- private final java.lang.ref.WeakReference ref;
- private ArrayList listeners = new ArrayList();
- }
-
- private final Adapter adapter = new Adapter(this);
- }
-}
diff --git a/jurt/test/com/sun/star/uno/makefile.mk b/jurt/test/com/sun/star/uno/makefile.mk
deleted file mode 100644
index ecf0115c3..000000000
--- a/jurt/test/com/sun/star/uno/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_uno
-
-PACKAGE := com$/sun$/star$/uno
-JAVATESTFILES := \
- AnyConverter_Test.java \
- UnoRuntime_EnvironmentTest.java \
- WeakReference_Test.java
-JARFILES := ridl.jar
-
-.INCLUDE: javaunittest.mk