summaryrefslogtreecommitdiff
path: root/jurt/test/com/sun/star/lib
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-02-06 08:40:43 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-02-10 09:48:05 +0100
commitfaa59a82cebd69ba4d5b665f00983b9d374ac15c (patch)
treef0fdc147ad79d2926f04700eb552e1f9fad4525a /jurt/test/com/sun/star/lib
parent57eee86bab2efd63b7eec9d73a86b1cc0422de29 (diff)
Cleanup: Move unit tests to ridljar
Follow-up cleanup for ae855bf48163ff64d94cfc34aff8e37abdb5518d Change-Id: Ibec2fe89d70d6001af7d75c5eb4081b5b2af30e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88073 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'jurt/test/com/sun/star/lib')
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java64
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java131
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java239
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java55
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java48
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java263
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java43
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java27
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java81
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java57
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java437
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java134
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java353
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java311
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java106
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java63
-rw-r--r--jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl101
-rw-r--r--jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java76
18 files changed, 0 insertions, 2589 deletions
diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java
deleted file mode 100644
index e7dc9c0e19c9..000000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-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 org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class BridgedObject_Test {
- @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));
- assertNull(BridgedObject.getBridge(object0));
- assertSame(bridge1, BridgedObject.getBridge(object1));
- assertSame(bridge2, BridgedObject.getBridge(object2));
- }
-
- private static final class TestBridge implements XBridge {
- public Object getInstance(String instanceName) {
- return null;
- }
-
- public String getName() {
- return null;
- }
-
- public String getDescription() {
- return null;
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 45fc02f89989..000000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-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 java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class ProxyFactory_Test {
- @Test public void testQueryInterface() {
- TestRequestHandler handler = new TestRequestHandler();
- Type type = new Type(XNamingService.class);
- Object proxy = new ProxyFactory(handler, null).create("TestOID", type);
- assertSame(proxy, ((IQueryInterface) proxy).queryInterface(type));
- assertSame(proxy, UnoRuntime.queryInterface(type, proxy));
- }
-
- @Test 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);
- assertNull(exception);
- } catch (InvocationTargetException e) {
- assertNotNull(exception);
- assertTrue(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;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 53e150527187..000000000000
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-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 org.junit.Test;
-import util.WaitUnreachable;
-import static org.junit.Assert.*;
-
-public final class java_remote_bridge_Test {
- @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) {
- assertNull(bridgeB.getInstance(TestInstanceProvider.NAME_NULL));
-
- try {
- bridgeB.getInstance(TestInstanceProvider.NAME_RUNTIME_EXCEPTION);
- fail("throw RuntimeException");
- } catch (com.sun.star.uno.RuntimeException e) {
- assertTrue(
- e.getMessage().indexOf(
- TestInstanceProvider.NAME_RUNTIME_EXCEPTION)
- != -1);
- }
-
- try {
- bridgeB.getInstance(
- TestInstanceProvider.NAME_NO_SUCH_ELEMENT_EXCEPTION);
- fail("throw NoSuchElementException");
- } catch (com.sun.star.uno.RuntimeException e) {
- assertTrue(
- e.getMessage().indexOf(
- TestInstanceProvider.NAME_NO_SUCH_ELEMENT_EXCEPTION)
- != -1);
- }
-
- try {
- bridgeA.getInstance(TestInstanceProvider.NAME_ANYTHING);
- fail("no instance provider");
- } catch (com.sun.star.uno.RuntimeException e) {
- assertTrue(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();
- }
-
- assertEquals(3 * COUNT, TestProxy.getCount());
-
- // The following checks rely on the implementation detail that mapping
- // different facets of a UNO object (XInterface and TestInterface) leads
- // to different proxies:
-
- assertEquals("bridge A life count", 2 * COUNT, bridgeA.getLifeCount());
- assertEquals("bridge B life count", 2 * COUNT, bridgeB.getLifeCount());
-/*TODO: below test fails with "expected:<200> but was:<204>":
- assertEquals("proxy count", 2 * COUNT, ProxyFactory.getDebugCount());
-*/
-
- 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 assert is executed:
- Thread.sleep(1000);
-
- assertEquals("proxy count", 0, ProxyFactory.getDebugCount());
-
- System.out.println("waiting for pending messages to be done");
- while (bridgeA.getLifeCount() != 0 || bridgeB.getLifeCount() != 0) {
- Thread.sleep(100);
- }
-
- assertEquals("Zero bridge A life count", 0, bridgeA.getLifeCount());
- assertEquals("Zero bridge B life count", 0, bridgeB.getLifeCount());
- assertEquals("Zero proxy count", 0, ProxyFactory.getDebugCount());
- }
-
- 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,
- 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;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 9381e2af437c..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.environments.java;
-
-import com.sun.star.uno.Type;
-import com.sun.star.uno.XInterface;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class java_environment_Test {
- @Test public void test() {
- java_environment env = new java_environment(null);
-
- Object obj = Integer.valueOf(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));
- // Register ordinary interface twice:
- assertSame(obj, obj2);
- assertSame(obj, obj3);
-
- // Ask for registered interface:
- assertSame(
- obj,
- env.getRegisteredInterface(oid[0], new Type(XInterface.class)));
-
- env.revokeInterface(oid[0], new Type(XInterface.class));
- env.revokeInterface(oid[0], new Type(XInterface.class));
- // Revoke interface:
- assertNull(
- env.getRegisteredInterface(oid[0], new Type(XInterface.class)));
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 2d2264f06060..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.environments.remote;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class JavaThreadPoolFactory_Test {
- @Test public void test() throws InterruptedException {
- ThreadId i1 = JavaThreadPoolFactory.getThreadId();
- assertEquals(i1, JavaThreadPoolFactory.getThreadId());
- final ThreadId[] i2 = new ThreadId[1];
- new Thread() {
- @Override
- public void run() {
- synchronized (i2) {
- i2[0] = JavaThreadPoolFactory.getThreadId();
- i2.notify();
- }
- }
- }.start();
- synchronized (i2) {
- while (i2[0] == null) {
- i2.wait();
- }
- }
- assertFalse(i1.equals(i2[0]));
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a63c9c7ed6ba..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.environments.remote;
-
-import com.sun.star.lib.uno.typedesc.TypeDescription;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class JobQueue_Test {
- @Test public void testThreadLeavesJobQueueOnDispose0()
- throws InterruptedException
- {
- testThreadLeavesJobQueueOnDispose(0);
- }
-
- @Test 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();
-/*TODO: below test fails with "expected:<xcxxxxxxxx> but was:<null>":
- assertEquals(msg, t._message);
-*/
- }
-
- @Test public void testThreadLeavesJobQueueOnReply0()
- throws InterruptedException
- {
- testThreadLeavesJobQueueOnReply(0);
- }
-
- @Test 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();
- assertTrue(true); // TODO! ???
- }
-
- @Test public void testStaticThreadExecutesJobs0()
- throws InterruptedException
- {
- testStaticThreadExecutesJobs(0);
- }
-
- @Test 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();
- }
-
- @Test public void testDynamicThreadExecutesJob() throws InterruptedException
- {
- testExecuteJobs(
- new JobQueue(
- __javaThreadPoolFactory, ThreadId.createFresh(), true));
- }
-
- @Test public void testStaticThreadExecutesAsyncs()
- throws InterruptedException
- {
- TestThread t = new TestThread();
- JobQueue async_jobQueue = new JobQueue(__javaThreadPoolFactory,
- t._threadId);
- assertEquals(1, async_jobQueue._ref_count);
- t._jobQueue = __javaThreadPoolFactory.getJobQueue(t._threadId);
- assertEquals(1, t._jobQueue._ref_count);
- t.waitToStart();
- TestWorkAt workAt = new TestWorkAt();
- testAsyncJobQueue(workAt, async_jobQueue, t._threadId);
- t._jobQueue.dispose(t._disposeId,
- new RuntimeException("xxxxxxxxxxxxx"));
- t.waitToTerminate();
- assertEquals(TestWorkAt.MESSAGES, workAt._async_counter);
- assertEquals(TestWorkAt.MESSAGES, workAt._sync_counter);
- }
-
- @Test 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);
- assertEquals(TestWorkAt.MESSAGES, workAt._async_counter);
- assertEquals(TestWorkAt.MESSAGES, workAt._sync_counter);
- }
-
- 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,
- __workAt_td.getMethodDescription(
- "notifyme"),
- true, null, false, null, null)),
- null);
- while (!workAt._notified) {
- workAt.wait();
- }
- }
- assertEquals(TestWorkAt.MESSAGES, workAt._counter);
- }
-
- 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,
- __workAt_td.getMethodDescription("notifyme"),
- true, null, false, null, null)),
- null);
- while (!workAt._notified) {
- workAt.wait();
- }
- }
- assertTrue(workAt.passedAsyncTest());
- }
-
- private void testSendRequests(TestWorkAt workAt, String operation,
- JobQueue jobQueue) {
- Message iMessage = new Message(
- null, true, "oid", __workAt_td,
- __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 TestThread(int waitTime) {
- this.waitTime = waitTime;
- _jobQueue = new JobQueue(__javaThreadPoolFactory, _threadId, false);
- }
-
- public TestThread() {
- waitTime = 0;
- }
-
- @Override
- public void run() {
- synchronized (lock) {
- state = STATE_STARTED;
- lock.notifyAll();
- }
- try {
- if (waitTime != 0) {
- Thread.sleep(waitTime);
- }
- _jobQueue.enter(_disposeId);
- } catch (Throwable e) {
- }
- 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);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 7bb71a80e970..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-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();
-
- TypeInfo UNOTYPEINFO[] = {
- new MethodTypeInfo("increment", 0, 0),
- new MethodTypeInfo("notifyme", 1, 0),
- new MethodTypeInfo("syncCall", 2, 0),
- new MethodTypeInfo("asyncCall", 3, 0)
- };
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 6c8f36885752..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.environments.remote;
-
-final class TestReceiver implements IReceiver {
- public void sendReply(boolean exception, ThreadId threadId, Object result) {
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 93297815cb9e..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.environments.remote;
-
-import static org.junit.Assert.*;
-
-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;
-
- private boolean _passedAsync = true;
- boolean _notified = false;
-
- public synchronized void syncCall() throws Throwable {
- ++ _sync_counter;
-
- // at least in currently run tests this should never fire, so don't
- // defer the check until passedAsyncTest and assert here
- assertEquals(MESSAGES, _async_counter);
- if(_async_counter != MESSAGES)
- _passedAsync = false;
-
- if(DEBUG) System.err.println("syncCall:" + _sync_counter + " " + _passedAsync + " " + Thread.currentThread());
- }
-
- public synchronized void asyncCall() throws Throwable {
- ++ _async_counter;
-
- 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 synchronized boolean passedAsyncTest() {
- assertEquals(MESSAGES, _sync_counter);
- assertTrue(_passedAsync);
- return _passedAsync && (_sync_counter == MESSAGES);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 8ee7f4a4c264..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.environments.remote;
-
-import java.util.Arrays;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class ThreadId_Test {
- @Test public void test() {
- ThreadId i1 = ThreadId.createFresh();
- assertTrue(i1.equals(i1));
- assertFalse(i1.equals(null));
- assertFalse(i1.equals(new Object()));
- assertEquals(i1.hashCode(), i1.hashCode());
- byte[] i1bytes = i1.getBytes();
- assertNotNull(i1bytes);
- assertTrue(i1bytes.length >= 5);
- assertEquals('j', i1bytes[0]);
- assertEquals('a', i1bytes[1]);
- assertEquals('v', i1bytes[2]);
- assertEquals('a', i1bytes[3]);
- assertEquals(':', i1bytes[4]);
- assertArrayEquals(i1bytes, i1.getBytes());
-
- ThreadId i2 = ThreadId.createFresh();
- assertFalse(i1.equals(i2));
- assertFalse(i2.equals(i1));
- assertFalse(Arrays.equals(i1bytes, i2.getBytes()));
-
- ThreadId i3 = new ThreadId(i1bytes);
- assertTrue(i3.equals(i1));
- assertFalse(i3.equals(i2));
- assertTrue(i1.equals(i3));
- assertEquals(i1.hashCode(), i3.hashCode());
- assertArrayEquals(i1bytes, i3.getBytes());
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 7da68db23f0e..000000000000
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-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 org.junit.Test;
-import static org.junit.Assert.*;
-
-public class ThreadPool_Test {
- @Test 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();
-
-/*TODO: below test fails with "expected:<blabla> but was:<null>":
- assertEquals(message, testThread._message);
-*/
- }
-
- @Test 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();
- }
- }
-
- assertEquals(TestWorkAt.MESSAGES, workAt._counter);
- }
-
- @Test 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();
- }
- }
-
- assertEquals(TestWorkAt.MESSAGES, workAt._counter);
- }
-
- @Test 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();
-
- assertEquals(TestWorkAt.MESSAGES, workAt._counter);
- }
-
- @Test 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();
- }
- }
-
- assertTrue(workAt.passedAsyncTest());
- }
-
- @Test 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();
-
- assertTrue(workAt.passedAsyncTest());
- }
-
- @Test 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 {
- private Stress(int count) {
- this.count = count;
- }
-
- @Override
- 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) {
- @Override
- protected void runTest() throws InterruptedException {
- testThreadAsync();
- }
- };
- stress1.start();
-
- Stress stress2 = new Stress(50) {
- @Override
- protected void runTest() throws InterruptedException {
- testDynamicThreadSync();
- }
- };
- stress2.start();
-
- Stress stress3 = new Stress(50) {
- @Override
- protected void runTest() throws InterruptedException {
- testStaticThreadSync();
- }
- };
- stress3.start();
-
- Stress stress4 = new Stress(50) {
- @Override
- protected void runTest() throws InterruptedException {
- testDynamicThreadAsyncSyncOrder();
- }
- };
- stress4.start();
-
- Stress stress5 = new Stress(50) {
- @Override
- protected void runTest() throws InterruptedException {
- testStaticThreadAsyncSyncOrder();
- }
- };
- stress5.start();
-
- Stress stress6 = new Stress(500) {
- @Override
- protected void runTest() throws InterruptedException {
- testDispose();
- }
- };
- stress6.start();
-
- stress1.join();
- stress2.join();
- stress3.join();
- stress4.join();
- stress5.join();
- stress6.join();
- }
-
- @Test 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();
- }
- }
-
- assertEquals(TestWorkAt.MESSAGES, workAt._async_counter);
- assertTrue(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;
- IThreadPool _iThreadPool;
-
- TestThread() {
- this(__iThreadPool);
- }
-
- TestThread(IThreadPool iThreadPool) {
- _iThreadPool = iThreadPool;
- }
-
- @Override
- 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) {
- }
-
- _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);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a7d93733d79c..000000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-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;
- }
- }
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 5cf5f73e6554..000000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-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.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[]{Integer.valueOf(1), new Double(2) };
-
-
- Object data[] = new Object[] {
- new com.sun.star.uno.RuntimeException("testRuntimeException"),
- new com.sun.star.uno.Exception("testException"),
- Boolean.TRUE,
- Byte.valueOf((byte)47),
- new Character('k'),
- new Double(0.12345),
- TestEnum.B,
- new Float(0.5678),
- Integer.valueOf(0),
- Integer.valueOf(128),
- Integer.valueOf(0x0f00),
- Integer.valueOf(0x0f0000),
- Integer.valueOf(0x0f000000),
- Integer.valueOf(-128),
- Integer.valueOf(0xff00),
- Integer.valueOf(0xff0000),
- Integer.valueOf(0xff000000),
- Long.valueOf(666L),
- Short.valueOf((short)444),
- "blabla",
- Integer.valueOf(10), // Any as object
- Integer.valueOf(10), // Any as object
- new Any(new Type(Integer.class), Integer.valueOf(10)), // Any as Any
- new Any(new Type(Integer.class), Integer.valueOf(10)), // Any as Any
- null,
- new TestPrimitiveStruct(),
- x,
- new byte[]{1,2,3,4,5,6,7}, // primitive sequence
- new int[]{7,6,5,4,3,2,1}, // primitive sequence
- new Object[]{Integer.valueOf(123), "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)))
- {
- 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(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;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 cda58aad8f62..000000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-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", 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", 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 }), Integer.valueOf(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() {
- @Override
- 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<Object> queue = new LinkedList<Object>();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 acd1b3948de7..000000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.lib.uno.protocols.urp;
-
-import java.io.IOException;
-
-import java.util.HashMap;
-
-
-import com.sun.star.uno.IBridge;
-import com.sun.star.uno.IEnvironment;
-import com.sun.star.uno.Type;
-
-
-class TestBridge implements IBridge {
- private static final boolean DEBUG = false;
-
- private final HashMap<String,Object> _hashtable = new HashMap<String,Object>();
-
- private IEnvironment _source ;//= new com.sun.star.lib.uno.environments.java.java_environment(null);
-
-
- private 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 dispose() throws InterruptedException, IOException {}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 f36710e1d232..000000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-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";
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 4ea1c8ebc2f8..000000000000
--- a/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <com/sun/star/uno/XInterface.idl>
-#include <com/sun/star/beans/XPropertySet.idl>
-#include <com/sun/star/uno/Exception.idl>
-#include <com/sun/star/uno/Any.idl>
-
-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
- };
-
-}; }; }; }; }; }; };
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 e4101f2dd713..000000000000
--- a/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.util;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public final class NativeLibraryLoader_Test {
- @Test 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() {
- @Override
- public URL getResource(String name) {
- return url;
- }
- },
- "dummy");
- assertEquals("Files are equal", file1, file2);
- }
-
- @Test 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() {
- @Override
- public URL getResource(String name) {
- return url;
- }
- },
- "dummy");
- assertEquals("Files are equal", file1, file2);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */