From 4cf87913dbb3fdf336e518e8cae9b4bff56edf6a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 9 Jan 2016 20:39:48 +0000 Subject: this dir has lain unused for years now Change-Id: Ia6638f316b9d7c67e45a30b5808c68b54fdb1680 --- bridges/test/inter_libs_exc/inter.cxx | 55 - bridges/test/inter_libs_exc/makefile.mk | 71 - bridges/test/inter_libs_exc/share.h | 25 - bridges/test/inter_libs_exc/starter.cxx | 54 - bridges/test/inter_libs_exc/starter.map | 25 - bridges/test/inter_libs_exc/thrower.cxx | 37 - bridges/test/inter_libs_exc/thrower.map | 25 - bridges/test/java_remote/Bug107753_Test.java | 383 ---- bridges/test/java_remote/Bug108825_Test.java | 159 -- bridges/test/java_remote/Bug110892_Test.java | 117 - bridges/test/java_remote/Bug111153_Test.java | 96 - bridges/test/java_remote/Bug114133_Test.java | 69 - bridges/test/java_remote/Bug51323_Test.java | 76 - bridges/test/java_remote/Bug92174_Test.java | 92 - bridges/test/java_remote/Bug97697_Test.java | 99 - bridges/test/java_remote/Bug98508_Test.idl | 31 - bridges/test/java_remote/Bug98508_Test.java | 99 - bridges/test/java_remote/MethodIdTest.java | 466 ---- bridges/test/java_remote/PolyStructTest.idl | 46 - bridges/test/java_remote/PolyStructTest.java | 247 --- .../java_remote/StopMessageDispatcherTest.java | 100 - bridges/test/java_remote/makefile.mk | 42 - bridges/test/java_uno/acquire/TestAcquire.java | 295 --- bridges/test/java_uno/acquire/makefile.mk | 108 - bridges/test/java_uno/acquire/readme.txt | 21 - bridges/test/java_uno/acquire/testacquire.cxx | 543 ----- bridges/test/java_uno/acquire/types.idl | 62 - bridges/test/java_uno/any/TestAny.java | 2246 -------------------- bridges/test/java_uno/any/TestJni.java | 42 - bridges/test/java_uno/any/TestRemote.java | 59 - bridges/test/java_uno/any/makefile.mk | 118 - bridges/test/java_uno/any/test_javauno_any.map | 24 - bridges/test/java_uno/any/transport.cxx | 99 - bridges/test/java_uno/any/types.idl | 36 - bridges/test/java_uno/equals/TestEquals.java | 1297 ----------- bridges/test/java_uno/equals/makefile.mk | 87 - bridges/test/java_uno/equals/testequals.cxx | 202 -- bridges/test/java_uno/equals/types.idl | 41 - bridges/test/java_uno/nativethreadpool/Relay.java | 116 - bridges/test/java_uno/nativethreadpool/makefile.mk | 112 - bridges/test/java_uno/nativethreadpool/readme | 30 - .../test/java_uno/nativethreadpool/relay.manifest | 2 - .../testnativethreadpoolclient.cxx | 157 -- .../testnativethreadpoolserver.cxx | 121 -- bridges/test/java_uno/nativethreadpool/types.idl | 34 - bridges/test/java_uno/nativethreadpool/version.map | 24 - bridges/test/lib/TestBed.java | 216 -- bridges/test/lib/makefile.mk | 27 - bridges/test/makefile.mk | 166 -- bridges/test/performance/makefile.mk | 52 - bridges/test/performance/testperformance.cxx | 179 -- bridges/test/test_bridge.idl | 76 - bridges/test/testclient.cxx | 237 --- bridges/test/testclient.java | 134 -- bridges/test/testcomp.cxx | 738 ------- bridges/test/testcomp.h | 148 -- bridges/test/testoffice.cxx | 261 --- bridges/test/testsameprocess.cxx | 206 -- bridges/test/testserver.cxx | 243 --- 59 files changed, 10973 deletions(-) delete mode 100644 bridges/test/inter_libs_exc/inter.cxx delete mode 100644 bridges/test/inter_libs_exc/makefile.mk delete mode 100644 bridges/test/inter_libs_exc/share.h delete mode 100644 bridges/test/inter_libs_exc/starter.cxx delete mode 100644 bridges/test/inter_libs_exc/starter.map delete mode 100644 bridges/test/inter_libs_exc/thrower.cxx delete mode 100644 bridges/test/inter_libs_exc/thrower.map delete mode 100644 bridges/test/java_remote/Bug107753_Test.java delete mode 100644 bridges/test/java_remote/Bug108825_Test.java delete mode 100644 bridges/test/java_remote/Bug110892_Test.java delete mode 100644 bridges/test/java_remote/Bug111153_Test.java delete mode 100644 bridges/test/java_remote/Bug114133_Test.java delete mode 100644 bridges/test/java_remote/Bug51323_Test.java delete mode 100644 bridges/test/java_remote/Bug92174_Test.java delete mode 100644 bridges/test/java_remote/Bug97697_Test.java delete mode 100644 bridges/test/java_remote/Bug98508_Test.idl delete mode 100644 bridges/test/java_remote/Bug98508_Test.java delete mode 100644 bridges/test/java_remote/MethodIdTest.java delete mode 100644 bridges/test/java_remote/PolyStructTest.idl delete mode 100644 bridges/test/java_remote/PolyStructTest.java delete mode 100644 bridges/test/java_remote/StopMessageDispatcherTest.java delete mode 100644 bridges/test/java_remote/makefile.mk delete mode 100644 bridges/test/java_uno/acquire/TestAcquire.java delete mode 100644 bridges/test/java_uno/acquire/makefile.mk delete mode 100644 bridges/test/java_uno/acquire/readme.txt delete mode 100644 bridges/test/java_uno/acquire/testacquire.cxx delete mode 100644 bridges/test/java_uno/acquire/types.idl delete mode 100644 bridges/test/java_uno/any/TestAny.java delete mode 100644 bridges/test/java_uno/any/TestJni.java delete mode 100644 bridges/test/java_uno/any/TestRemote.java delete mode 100644 bridges/test/java_uno/any/makefile.mk delete mode 100644 bridges/test/java_uno/any/test_javauno_any.map delete mode 100644 bridges/test/java_uno/any/transport.cxx delete mode 100644 bridges/test/java_uno/any/types.idl delete mode 100644 bridges/test/java_uno/equals/TestEquals.java delete mode 100644 bridges/test/java_uno/equals/makefile.mk delete mode 100644 bridges/test/java_uno/equals/testequals.cxx delete mode 100644 bridges/test/java_uno/equals/types.idl delete mode 100644 bridges/test/java_uno/nativethreadpool/Relay.java delete mode 100644 bridges/test/java_uno/nativethreadpool/makefile.mk delete mode 100644 bridges/test/java_uno/nativethreadpool/readme delete mode 100644 bridges/test/java_uno/nativethreadpool/relay.manifest delete mode 100644 bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx delete mode 100644 bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx delete mode 100644 bridges/test/java_uno/nativethreadpool/types.idl delete mode 100644 bridges/test/java_uno/nativethreadpool/version.map delete mode 100644 bridges/test/lib/TestBed.java delete mode 100644 bridges/test/lib/makefile.mk delete mode 100644 bridges/test/makefile.mk delete mode 100644 bridges/test/performance/makefile.mk delete mode 100644 bridges/test/performance/testperformance.cxx delete mode 100644 bridges/test/test_bridge.idl delete mode 100644 bridges/test/testclient.cxx delete mode 100644 bridges/test/testclient.java delete mode 100644 bridges/test/testcomp.cxx delete mode 100644 bridges/test/testcomp.h delete mode 100644 bridges/test/testoffice.cxx delete mode 100644 bridges/test/testsameprocess.cxx delete mode 100644 bridges/test/testserver.cxx (limited to 'bridges') diff --git a/bridges/test/inter_libs_exc/inter.cxx b/bridges/test/inter_libs_exc/inter.cxx deleted file mode 100644 index 0e8a85c7bc62..000000000000 --- a/bridges/test/inter_libs_exc/inter.cxx +++ /dev/null @@ -1,55 +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 -#include "share.h" - -#include -#include - - -using namespace ::osl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -extern "C" int main( int argc, char const * argv [] ) -{ -#ifdef SAL_W32 -#define SAL_DLLPREFIX "" -#endif - Module mod_starter( - SAL_DLLPREFIX "starter" SAL_DLLEXTENSION, - SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); - Module mod_thrower( - SAL_DLLPREFIX "thrower" SAL_DLLEXTENSION, - SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); - - typedef t_throws_exc (SAL_CALL * t_get_thrower)(); - t_get_thrower get_thrower = (t_get_thrower)mod_thrower.getSymbol( "get_thrower" ); - t_throws_exc thrower = (*get_thrower)(); - - typedef void (SAL_CALL * t_starter)( t_throws_exc ); - t_starter start = (t_starter)mod_starter.getSymbol( "start" ); - - (*start)( thrower ); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/inter_libs_exc/makefile.mk b/bridges/test/inter_libs_exc/makefile.mk deleted file mode 100644 index 1555fac17bad..000000000000 --- a/bridges/test/inter_libs_exc/makefile.mk +++ /dev/null @@ -1,71 +0,0 @@ -# -# 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 . -# -PRJ=..$/.. - -PRJNAME=bridges -TARGET=inter -LIBTARGET=NO -TARGETTYPE=CUI -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -UNOUCRDEP=$(SOLARBINDIR)$/udkapi.rdb -UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb - -# output directory (one dir for each project) -UNOUCROUT=$(OUT)$/inc$/$(TARGET) - -# adding to inludeoath -INCPRE+=$(UNOUCROUT) - -UNOTYPESTYPES := \ - com.sun.star.lang.IllegalArgumentException \ - com.sun.star.uno.DeploymentException - -SLOFILES=$(SLO)$/starter.obj $(SLO)$/thrower.obj - -SHL1TARGET=starter -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1IMPLIB=i$(SHL1TARGET) -SHL1OBJS=$(SLO)$/starter.obj -DEF1NAME=$(SHL1TARGET) -SHL1STDLIBS+= $(CPPULIB) $(SALLIB) -SHL1VERSIONMAP=$(SHL1TARGET).map - -SHL2TARGET=thrower -SHL2DEF=$(MISC)$/$(SHL2TARGET).def -SHL2IMPLIB=i$(SHL2TARGET) -SHL2OBJS=$(SLO)$/thrower.obj -DEF2NAME=$(SHL2TARGET) -SHL2STDLIBS+= $(CPPULIB) $(SALLIB) -SHL2VERSIONMAP=$(SHL2TARGET).map - -OBJFILES=$(OBJ)$/inter.obj -APP1TARGET=inter -APP1OBJS=$(OBJ)$/inter.obj -APP1STDLIBS+=\ - $(SALLIB) - -.INCLUDE : target.mk - diff --git a/bridges/test/inter_libs_exc/share.h b/bridges/test/inter_libs_exc/share.h deleted file mode 100644 index 260883df0a04..000000000000 --- a/bridges/test/inter_libs_exc/share.h +++ /dev/null @@ -1,25 +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 -#include - -typedef void (SAL_CALL * t_throws_exc)(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/inter_libs_exc/starter.cxx b/bridges/test/inter_libs_exc/starter.cxx deleted file mode 100644 index f9fcf88474f2..000000000000 --- a/bridges/test/inter_libs_exc/starter.cxx +++ /dev/null @@ -1,54 +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 -#include "share.h" - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -static void some_more( t_throws_exc p ) -{ - (*p)(); -} - -extern "C" void SAL_CALL start( t_throws_exc p ) -{ - try - { - some_more( p ); - } - catch (lang::IllegalArgumentException & exc) - { - OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - printf( "starter.cxx: caught IllegalArgumentException: %s\n", msg.getStr() ); - } - catch (Exception & exc) - { - OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - printf( "starter.cxx: caught some UNO exc: %s\n", msg.getStr() ); - } - catch (...) - { - printf( "starter.cxx: caught something\n" ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/inter_libs_exc/starter.map b/bridges/test/inter_libs_exc/starter.map deleted file mode 100644 index dc361ce8dc06..000000000000 --- a/bridges/test/inter_libs_exc/starter.map +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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 . -# - -UDK_3_0_0 { - global: - start; - local: - *; -}; - diff --git a/bridges/test/inter_libs_exc/thrower.cxx b/bridges/test/inter_libs_exc/thrower.cxx deleted file mode 100644 index b9794a05c4e6..000000000000 --- a/bridges/test/inter_libs_exc/thrower.cxx +++ /dev/null @@ -1,37 +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 "share.h" - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -static void SAL_CALL throws_exc() -{ - throw lang::IllegalArgumentException( - "bla", Reference< XInterface >(), 0 ); -} - -extern "C" t_throws_exc SAL_CALL get_thrower() -{ - return throws_exc; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/inter_libs_exc/thrower.map b/bridges/test/inter_libs_exc/thrower.map deleted file mode 100644 index 7227e34f561e..000000000000 --- a/bridges/test/inter_libs_exc/thrower.map +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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 . -# - -UDK_3_0_0 { - global: - get_thrower; - local: - *; -}; - diff --git a/bridges/test/java_remote/Bug107753_Test.java b/bridges/test/java_remote/Bug107753_Test.java deleted file mode 100644 index 46ff857a3248..000000000000 --- a/bridges/test/java_remote/Bug107753_Test.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #107753#. - * - *

Bug #107753# "Java UNO: Proxies should implement intuitive semantics of - * equals and hashCode" requests that two proxies are equal iff they represent - * the same UNO object. This implies that if two proxies represent the same UNO - * object, they must have the same hash code.

- */ -public final class Bug107753_Test extends ComplexTestCase { - @Override - public String getTestObjectName() { - return getClass().getName(); - } - - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - TestBed t = new TestBed(); - assure("test", t.execute(new Provider(), false, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - boolean success = true; - XTransport transport = UnoRuntime.queryInterface( - XTransport.class, getBridge(context).getInstance("Transport")); - - Object obj1a = new XType1() {}; - XType1 obj1b = UnoRuntime.queryInterface(XType1.class, obj1a); - success &= test("obj1a == obj1b", obj1a == obj1b); - - Object obj2a = new XType2() {}; - XType2 obj2b = UnoRuntime.queryInterface(XType2.class, obj2a); - success &= test("obj2a == obj2b", obj2a == obj2b); - - Object obj3a = transport.getType1(); - XType1 obj3b = UnoRuntime.queryInterface(XType1.class, obj3a); - success &= test( - "obj3a != obj3b; only meaningful as long as different proxy" - + " instances are used for different UNO interfaces of one UNO" - + " object", - obj3a != obj3b); - - Object obj4a = transport.getType2(); - XType2 obj4b = UnoRuntime.queryInterface(XType2.class, obj4a); - success &= test( - "obj4a != obj4b; only meaningful as long as different proxy" - + " instances are used for different UNO interfaces of one UNO" - + " object", - obj4a != obj4b); - - success &= test("UnoRuntime.areSame(null, null)", - UnoRuntime.areSame(null, null)); - success &= test("!UnoRuntime.areSame(null, obj1a)", - !UnoRuntime.areSame(null, obj1a)); - success &= test("!UnoRuntime.areSame(null, obj1b)", - !UnoRuntime.areSame(null, obj1b)); - success &= test("!UnoRuntime.areSame(null, obj2a)", - !UnoRuntime.areSame(null, obj2a)); - success &= test("!UnoRuntime.areSame(null, obj2b)", - !UnoRuntime.areSame(null, obj2b)); - success &= test("!UnoRuntime.areSame(null, obj3a)", - !UnoRuntime.areSame(null, obj3a)); - success &= test("!UnoRuntime.areSame(null, obj3b)", - !UnoRuntime.areSame(null, obj3b)); - success &= test("!UnoRuntime.areSame(null, obj4a)", - !UnoRuntime.areSame(null, obj4a)); - success &= test("!UnoRuntime.areSame(null, obj4b)", - !UnoRuntime.areSame(null, obj4b)); - - success &= test("!obj1a.equals(null)", !obj1a.equals(null)); - success &= test("!UnoRuntime.areSame(obj1a, null)", - !UnoRuntime.areSame(obj1a, null)); - success &= test("obj1a.equals(obj1a)", obj1a.equals(obj1a)); - success &= test("UnoRuntime.areSame(obj1a, obj1a)", - UnoRuntime.areSame(obj1a, obj1a)); - success &= test("obj1a.equals(obj1b)", obj1a.equals(obj1b)); - success &= test("UnoRuntime.areSame(obj1a, obj1b)", - UnoRuntime.areSame(obj1a, obj1b)); - success &= test("!obj1a.equals(obj2a)", !obj1a.equals(obj2a)); - success &= test("!UnoRuntime.areSame(obj1a, obj2a)", - !UnoRuntime.areSame(obj1a, obj2a)); - success &= test("!obj1a.equals(obj2b)", !obj1a.equals(obj2b)); - success &= test("!UnoRuntime.areSame(obj1a, obj2b)", - !UnoRuntime.areSame(obj1a, obj2b)); - success &= test("!obj1a.equals(obj3a)", !obj1a.equals(obj3a)); - success &= test("!UnoRuntime.areSame(obj1a, obj3a)", - !UnoRuntime.areSame(obj1a, obj3a)); - success &= test("!obj1a.equals(obj3b)", !obj1a.equals(obj3b)); - success &= test("!UnoRuntime.areSame(obj1a, obj3b)", - !UnoRuntime.areSame(obj1a, obj3b)); - success &= test("!obj1a.equals(obj4a)", !obj1a.equals(obj4a)); - success &= test("!UnoRuntime.areSame(obj1a, obj4a)", - !UnoRuntime.areSame(obj1a, obj4a)); - success &= test("!obj1a.equals(obj4b)", !obj1a.equals(obj4b)); - success &= test("!UnoRuntime.areSame(obj1a, obj4b)", - !UnoRuntime.areSame(obj1a, obj4b)); - - success &= test("!obj1b.equals(null)", !obj1b.equals(null)); - success &= test("!UnoRuntime.areSame(obj1b, null)", - !UnoRuntime.areSame(obj1b, null)); - success &= test("obj1b.equals(obj1a)", obj1b.equals(obj1a)); - success &= test("UnoRuntime.areSame(obj1b, obj1a)", - UnoRuntime.areSame(obj1b, obj1a)); - success &= test("obj1b.equals(obj1b)", obj1b.equals(obj1b)); - success &= test("UnoRuntime.areSame(obj1b, obj1b)", - UnoRuntime.areSame(obj1b, obj1b)); - success &= test("!obj1b.equals(obj2a)", !obj1b.equals(obj2a)); - success &= test("!UnoRuntime.areSame(obj1b, obj2a)", - !UnoRuntime.areSame(obj1b, obj2a)); - success &= test("!obj1b.equals(obj2b)", !obj1b.equals(obj2b)); - success &= test("!UnoRuntime.areSame(obj1b, obj2b)", - !UnoRuntime.areSame(obj1b, obj2b)); - success &= test("!obj1b.equals(obj3a)", !obj1b.equals(obj3a)); - success &= test("!UnoRuntime.areSame(obj1b, obj3a)", - !UnoRuntime.areSame(obj1b, obj3a)); - success &= test("!obj1b.equals(obj3b)", !obj1b.equals(obj3b)); - success &= test("!UnoRuntime.areSame(obj1b, obj3b)", - !UnoRuntime.areSame(obj1b, obj3b)); - success &= test("!obj1b.equals(obj4a)", !obj1b.equals(obj4a)); - success &= test("!UnoRuntime.areSame(obj1b, obj4a)", - !UnoRuntime.areSame(obj1b, obj4a)); - success &= test("!obj1b.equals(obj4b)", !obj1b.equals(obj4b)); - success &= test("!UnoRuntime.areSame(obj1b, obj4b)", - !UnoRuntime.areSame(obj1b, obj4b)); - - success &= test("!obj2a.equals(null)", !obj2a.equals(null)); - success &= test("!UnoRuntime.areSame(obj2a, null)", - !UnoRuntime.areSame(obj2a, null)); - success &= test("!obj2a.equals(obj1a)", !obj2a.equals(obj1a)); - success &= test("!UnoRuntime.areSame(obj2a, obj1a)", - !UnoRuntime.areSame(obj2a, obj1a)); - success &= test("!obj2a.equals(obj1b)", !obj2a.equals(obj1b)); - success &= test("!UnoRuntime.areSame(obj2a, obj1b)", - !UnoRuntime.areSame(obj2a, obj1b)); - success &= test("obj2a.equals(obj2a)", obj2a.equals(obj2a)); - success &= test("UnoRuntime.areSame(obj2a, obj2a)", - UnoRuntime.areSame(obj2a, obj2a)); - success &= test("obj2a.equals(obj2b)", obj2a.equals(obj2b)); - success &= test("UnoRuntime.areSame(obj2a, obj2b)", - UnoRuntime.areSame(obj2a, obj2b)); - success &= test("!obj2a.equals(obj3a)", !obj2a.equals(obj3a)); - success &= test("!UnoRuntime.areSame(obj2a, obj3a)", - !UnoRuntime.areSame(obj2a, obj3a)); - success &= test("!obj2a.equals(obj3b)", !obj2a.equals(obj3b)); - success &= test("!UnoRuntime.areSame(obj2a, obj3b)", - !UnoRuntime.areSame(obj2a, obj3b)); - success &= test("!obj2a.equals(obj4a)", !obj2a.equals(obj4a)); - success &= test("!UnoRuntime.areSame(obj2a, obj4a)", - !UnoRuntime.areSame(obj2a, obj4a)); - success &= test("!obj2a.equals(obj4b)", !obj2a.equals(obj4b)); - success &= test("!UnoRuntime.areSame(obj2a, obj4b)", - !UnoRuntime.areSame(obj2a, obj4b)); - - success &= test("!obj2b.equals(null)", !obj2b.equals(null)); - success &= test("!UnoRuntime.areSame(obj2b, null)", - !UnoRuntime.areSame(obj2b, null)); - success &= test("!obj2b.equals(obj1a)", !obj2b.equals(obj1a)); - success &= test("!UnoRuntime.areSame(obj2b, obj1a)", - !UnoRuntime.areSame(obj2b, obj1a)); - success &= test("!obj2b.equals(obj1b)", !obj2b.equals(obj1b)); - success &= test("!UnoRuntime.areSame(obj2b, obj1b)", - !UnoRuntime.areSame(obj2b, obj1b)); - success &= test("obj2b.equals(obj2a)", obj2b.equals(obj2a)); - success &= test("UnoRuntime.areSame(obj2b, obj2a)", - UnoRuntime.areSame(obj2b, obj2a)); - success &= test("obj2b.equals(obj2b)", obj2b.equals(obj2b)); - success &= test("UnoRuntime.areSame(obj2b, obj2b)", - UnoRuntime.areSame(obj2b, obj2b)); - success &= test("!obj2b.equals(obj3a)", !obj2b.equals(obj3a)); - success &= test("!UnoRuntime.areSame(obj2b, obj3a)", - !UnoRuntime.areSame(obj2b, obj3a)); - success &= test("!obj2b.equals(obj3b)", !obj2b.equals(obj3b)); - success &= test("!UnoRuntime.areSame(obj2b, obj3b)", - !UnoRuntime.areSame(obj2b, obj3b)); - success &= test("!obj2b.equals(obj4a)", !obj2b.equals(obj4a)); - success &= test("!UnoRuntime.areSame(obj2b, obj4a)", - !UnoRuntime.areSame(obj2b, obj4a)); - success &= test("!obj2b.equals(obj4b)", !obj2b.equals(obj4b)); - success &= test("!UnoRuntime.areSame(obj2b, obj4b)", - !UnoRuntime.areSame(obj2b, obj4b)); - - success &= test("!obj3a.equals(null)", !obj3a.equals(null)); - success &= test("!UnoRuntime.areSame(obj3a, null)", - !UnoRuntime.areSame(obj3a, null)); - success &= test("!obj3a.equals(obj1a)", !obj3a.equals(obj1a)); - success &= test("!UnoRuntime.areSame(obj3a, obj1a)", - !UnoRuntime.areSame(obj3a, obj1a)); - success &= test("!obj3a.equals(obj1b)", !obj3a.equals(obj1b)); - success &= test("!UnoRuntime.areSame(obj3a, obj1b)", - !UnoRuntime.areSame(obj3a, obj1b)); - success &= test("!obj3a.equals(obj2a)", !obj3a.equals(obj2a)); - success &= test("!UnoRuntime.areSame(obj3a, obj2a)", - !UnoRuntime.areSame(obj3a, obj2a)); - success &= test("!obj3a.equals(obj2b)", !obj3a.equals(obj2b)); - success &= test("!UnoRuntime.areSame(obj3a, obj2b)", - !UnoRuntime.areSame(obj3a, obj2b)); - success &= test("obj3a.equals(obj3a)", obj3a.equals(obj3a)); - success &= test("UnoRuntime.areSame(obj3a, obj3a)", - UnoRuntime.areSame(obj3a, obj3a)); - success &= test("obj3a.equals(obj3b)", obj3a.equals(obj3b)); - success &= test("UnoRuntime.areSame(obj3a, obj3b)", - UnoRuntime.areSame(obj3a, obj3b)); - success &= test("!obj3a.equals(obj4a)", !obj3a.equals(obj4a)); - success &= test("!UnoRuntime.areSame(obj3a, obj4a)", - !UnoRuntime.areSame(obj3a, obj4a)); - success &= test("!obj3a.equals(obj4b)", !obj3a.equals(obj4b)); - success &= test("!UnoRuntime.areSame(obj3a, obj4b)", - !UnoRuntime.areSame(obj3a, obj4b)); - - success &= test("!obj3b.equals(null)", !obj3b.equals(null)); - success &= test("!UnoRuntime.areSame(obj3b, null)", - !UnoRuntime.areSame(obj3b, null)); - success &= test("!obj3b.equals(obj1a)", !obj3b.equals(obj1a)); - success &= test("!UnoRuntime.areSame(obj3b, obj1a)", - !UnoRuntime.areSame(obj3b, obj1a)); - success &= test("!obj3b.equals(obj1b)", !obj3b.equals(obj1b)); - success &= test("!UnoRuntime.areSame(obj3b, obj1b)", - !UnoRuntime.areSame(obj3b, obj1b)); - success &= test("!obj3b.equals(obj2a)", !obj3b.equals(obj2a)); - success &= test("!UnoRuntime.areSame(obj3b, obj2a)", - !UnoRuntime.areSame(obj3b, obj2a)); - success &= test("!obj3b.equals(obj2b)", !obj3b.equals(obj2b)); - success &= test("!UnoRuntime.areSame(obj3b, obj2b)", - !UnoRuntime.areSame(obj3b, obj2b)); - success &= test("obj3b.equals(obj3a)", obj3b.equals(obj3a)); - success &= test("UnoRuntime.areSame(obj3b, obj3a)", - UnoRuntime.areSame(obj3b, obj3a)); - success &= test("obj3b.equals(obj3b)", obj3b.equals(obj3b)); - success &= test("UnoRuntime.areSame(obj3b, obj3b)", - UnoRuntime.areSame(obj3b, obj3b)); - success &= test("!obj3b.equals(obj4a)", !obj3b.equals(obj4a)); - success &= test("!UnoRuntime.areSame(obj3b, obj4a)", - !UnoRuntime.areSame(obj3b, obj4a)); - success &= test("!obj3b.equals(obj4b)", !obj3b.equals(obj4b)); - success &= test("!UnoRuntime.areSame(obj3b, obj4b)", - !UnoRuntime.areSame(obj3b, obj4b)); - - success &= test("!obj4a.equals(null)", !obj4a.equals(null)); - success &= test("!UnoRuntime.areSame(obj4a, null)", - !UnoRuntime.areSame(obj4a, null)); - success &= test("!obj4a.equals(obj1a)", !obj4a.equals(obj1a)); - success &= test("!UnoRuntime.areSame(obj4a, obj1a)", - !UnoRuntime.areSame(obj4a, obj1a)); - success &= test("!obj4a.equals(obj1b)", !obj4a.equals(obj1b)); - success &= test("!UnoRuntime.areSame(obj4a, obj1b)", - !UnoRuntime.areSame(obj4a, obj1b)); - success &= test("!obj4a.equals(obj2a)", !obj4a.equals(obj2a)); - success &= test("!UnoRuntime.areSame(obj4a, obj2a)", - !UnoRuntime.areSame(obj4a, obj2a)); - success &= test("!obj4a.equals(obj2b)", !obj4a.equals(obj2b)); - success &= test("!UnoRuntime.areSame(obj4a, obj2b)", - !UnoRuntime.areSame(obj4a, obj2b)); - success &= test("!obj4a.equals(obj3a)", !obj4a.equals(obj3a)); - success &= test("!UnoRuntime.areSame(obj4a, obj3a)", - !UnoRuntime.areSame(obj4a, obj3a)); - success &= test("!obj4a.equals(obj3b)", !obj4a.equals(obj3b)); - success &= test("!UnoRuntime.areSame(obj4a, obj3b)", - !UnoRuntime.areSame(obj4a, obj3b)); - success &= test("obj4a.equals(obj4a)", obj4a.equals(obj4a)); - success &= test("UnoRuntime.areSame(obj4a, obj4a)", - UnoRuntime.areSame(obj4a, obj4a)); - success &= test("obj4a.equals(obj4b)", obj4a.equals(obj4b)); - success &= test("UnoRuntime.areSame(obj4a, obj4b)", - UnoRuntime.areSame(obj4a, obj4b)); - - success &= test("!obj4b.equals(null)", !obj4b.equals(null)); - success &= test("!UnoRuntime.areSame(obj4b, null)", - !UnoRuntime.areSame(obj4b, null)); - success &= test("!obj4b.equals(obj1a)", !obj4b.equals(obj1a)); - success &= test("!UnoRuntime.areSame(obj4b, obj1a)", - !UnoRuntime.areSame(obj4b, obj1a)); - success &= test("!obj4b.equals(obj1b)", !obj4b.equals(obj1b)); - success &= test("!UnoRuntime.areSame(obj4b, obj1b)", - !UnoRuntime.areSame(obj4b, obj1b)); - success &= test("!obj4b.equals(obj2a)", !obj4b.equals(obj2a)); - success &= test("!UnoRuntime.areSame(obj4b, obj2a)", - !UnoRuntime.areSame(obj4b, obj2a)); - success &= test("!obj4b.equals(obj2b)", !obj4b.equals(obj2b)); - success &= test("!UnoRuntime.areSame(obj4b, obj2b)", - !UnoRuntime.areSame(obj4b, obj2b)); - success &= test("!obj4b.equals(obj3a)", !obj4b.equals(obj3a)); - success &= test("!UnoRuntime.areSame(obj4b, obj3a)", - !UnoRuntime.areSame(obj4b, obj3a)); - success &= test("!obj4b.equals(obj3b)", !obj4b.equals(obj3b)); - success &= test("!UnoRuntime.areSame(obj4b, obj3b)", - !UnoRuntime.areSame(obj4b, obj3b)); - success &= test("obj4b.equals(obj4a)", obj4b.equals(obj4a)); - success &= test("UnoRuntime.areSame(obj4b, obj4a)", - UnoRuntime.areSame(obj4b, obj4a)); - success &= test("obj4b.equals(obj4b)", obj4b.equals(obj4b)); - success &= test("UnoRuntime.areSame(obj4b, obj4b)", - UnoRuntime.areSame(obj4b, obj4b)); - - success &= test("obj1a.hashCode() == obj1b.hashCode()", - obj1a.hashCode() == obj1b.hashCode()); - success &= test("obj2a.hashCode() == obj2b.hashCode()", - obj2a.hashCode() == obj2b.hashCode()); - success &= test("obj3a.hashCode() == obj3b.hashCode()", - obj3a.hashCode() == obj3b.hashCode()); - success &= test("obj4a.hashCode() == obj4b.hashCode()", - obj4a.hashCode() == obj4b.hashCode()); - - return success; - } - - private static boolean test(String message, boolean condition) { - if (!condition) { - System.err.println("Failed: " + message); - } - return condition; - } - } - - private static final class Provider implements XInstanceProvider { - - public Object getInstance(String instanceName) { - return new XTransport() { - public Object getType1() { - return new XType1() {}; - } - - public Object getType2() { - return new XType2() {}; - } - }; - } - } - - public interface XTransport extends XInterface { - Object getType1(); - - Object getType2(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getType1", 0, 0), - new MethodTypeInfo("getType2", 1, 0) }; - } - - public interface XType1 extends XInterface { - TypeInfo[] UNOTYPEINFO = null; - } - - public interface XType2 extends XInterface { - TypeInfo[] UNOTYPEINFO = null; - } -} diff --git a/bridges/test/java_remote/Bug108825_Test.java b/bridges/test/java_remote/Bug108825_Test.java deleted file mode 100644 index 182ae35abad3..000000000000 --- a/bridges/test/java_remote/Bug108825_Test.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #108825#. - * - *

Bug #108825# "Java UNO Remote Bridge: Mapped-out Objects Not Held" shows - * that local objects that are mapped out via a remote bridge, but not held - * locally, might be garbage collected while there are still remote references - * to them. This test is not guaranteed to always work reliably, see comment in - * the code.

- */ -public final class Bug108825_Test extends ComplexTestCase { - @Override - public String getTestObjectName() { - return getClass().getName(); - } - - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - TestBed t = new TestBed(); - assure("test", t.execute(new Provider(t), true, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTest test = UnoRuntime.queryInterface( - XTest.class, getBridge(context).getInstance("Test")); - // Send the XObject that is held on the server side amidst two - // dummies that are not held on the server side; then wait for the - // dummies to be garbage collected, hoping that the XObject, if it - // is erroneously not held on the client side, will be garbage - // collected, too. Obviously, this is not guaranteed to always work - // (the VM might chose not to garbage collect the dummies, hanging - // the test forever; or the VM might chose to garbage collect the - // dummies but not the XObject, making the test pass erroneously). - test.offer(new Dummy(), new XObject() { public void call() {} }, - new Dummy()); - System.out.println("Client waiting for garbage collection..."); - for (;;) { - synchronized (lock) { - if (finalizedCount == 2) { - break; - } - } - test.remoteGc(); - gc(); - } - System.out.println("Client garbage collection done."); - test.notification(); - return true; - } - - private final class Dummy implements XDummy { - @Override - protected void finalize() throws Throwable { - synchronized (lock) { - ++finalizedCount; - } - super.finalize(); - } - } - - private final Object lock = new Object(); - private int finalizedCount = 0; - } - - // Make it as likely as possible that the VM reclaims all garbage: - private static void gc() { - System.gc(); - System.runFinalization(); - byte[] garbage = new byte[1024 * 1024]; - } - - private static final class Provider implements XInstanceProvider { - public Provider(TestBed testBed) { - this.testBed = testBed; - } - - public Object getInstance(String instanceName) { - return new XTest() { - public void offer(XDummy dummy1, XObject obj, XDummy dummy2) - { - this.obj = obj; - } - - public void remoteGc() { - gc(); - } - - public void notification() { - obj.call(); - testBed.serverDone(true); - } - - private XObject obj; - }; - } - - private final TestBed testBed; - } - - public interface XDummy extends XInterface { - TypeInfo[] UNOTYPEINFO = null; - } - - public interface XObject extends XInterface { - void call(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) }; - } - - public interface XTest extends XInterface { - void offer(XDummy dummy1, XObject obj, XDummy dummy2); - - void remoteGc(); - - void notification(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("offer", 0, 0), - new MethodTypeInfo("remoteGc", 1, 0), - new MethodTypeInfo("notification", 2, 0) }; - } -} diff --git a/bridges/test/java_remote/Bug110892_Test.java b/bridges/test/java_remote/Bug110892_Test.java deleted file mode 100644 index e43ea5a0830e..000000000000 --- a/bridges/test/java_remote/Bug110892_Test.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import util.WaitUnreachable; -import test.lib.TestBed; - -/** - * Test case for bug #110892#. - * - *

Bug #110892# "Java URP bridge holds objects indefinitely" applies to cases - * where an object is sent from server to client, then recursively back from - * client to server. In such a case, the client should not increment its - * internal reference count for the object, as the server will never send back a - * corresponding release message.

- * - *

This test has to detect whether the spawned client process fails to - * garbage-collect an object, which can not be done reliably. As an - * approximation, it waits for 10 sec and considers the process failing if it - * has not garbage-collected the object by then.

- */ -public final class Bug110892_Test extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure("test", - new TestBed().execute(new Provider(), false, Client.class, - 10000)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTest test = UnoRuntime.queryInterface( - XTest.class, getBridge(context).getInstance("Test")); - test.start(new ClientObject()); - synchronized (lock) { - unreachable.waitUnreachable(); - } - return true; - } - - private final class ClientObject implements XClientObject { - public void call(XServerObject server, XInterface object) { - synchronized (lock) { - unreachable = new WaitUnreachable(object); - } - server.call(object); - } - } - - private final Object lock = new Object(); - private WaitUnreachable unreachable = null; - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTest() { - public void start(XClientObject client) { - client.call( - new XServerObject() { - public void call(XInterface object) {} - }, - new XInterface() {}); - } - }; - } - } - - public interface XClientObject extends XInterface { - void call(XServerObject server, XInterface object); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) }; - } - - public interface XServerObject extends XInterface { - void call(XInterface object); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) }; - } - - public interface XTest extends XInterface { - void start(XClientObject client); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("start", 0, 0) }; - } -} diff --git a/bridges/test/java_remote/Bug111153_Test.java b/bridges/test/java_remote/Bug111153_Test.java deleted file mode 100644 index 8fe8be0e7314..000000000000 --- a/bridges/test/java_remote/Bug111153_Test.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #111153#. - * - *

Bug #111153# "jni_uno bridge sometimes fails to map objects - * correctly" describes that mapping a local object out with type XDerived and - * then mapping it back in with type XBase produces a proxy, instead of - * short-cutting to the local object.

- */ -public final class Bug111153_Test extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure("test", new TestBed().execute(new Provider(), false, - Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTransport t = UnoRuntime.queryInterface( - XTransport.class, getBridge(context).getInstance("Transport")); - XDerived d = new XDerived() {}; - t.setDerived(d); - return t.getBase() == d; - } - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTransport() { - public synchronized void setDerived(XDerived derived) { - this.derived = derived; - } - - public synchronized XBase getBase() { - return this.derived; - } - - private XDerived derived = null; - }; - } - } - - public interface XBase extends XInterface { - TypeInfo[] UNOTYPEINFO = null; - } - - public interface XDerived extends XBase { - TypeInfo[] UNOTYPEINFO = null; - } - - public interface XTransport extends XInterface { - void setDerived(XDerived derived); - - XBase getBase(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("setDerived", 0, 0), - new MethodTypeInfo("getBase", 1, 0) }; - } -} diff --git a/bridges/test/java_remote/Bug114133_Test.java b/bridges/test/java_remote/Bug114133_Test.java deleted file mode 100644 index 84088839bef5..000000000000 --- a/bridges/test/java_remote/Bug114133_Test.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import util.WaitUnreachable; -import test.lib.TestBed; - -/** - * Test case for bug #114133#. - * - *

Bug #114133# "Java UNO: UnoRuntime.getBride and disposed bridges." The - * client calls UnoRuntime.getBridge to get a bridge to the server, uses the - * bridge, waits until it terminates itself (when all bridged objects have been - * garbage-collected), then calls UnoRuntime.getBridge again. This must return - * a fresh, unterminated bridge.

- */ -public final class Bug114133_Test extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure( - "test", - new TestBed().execute(new Provider(), false, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - new WaitUnreachable(getBridge(context).getInstance("Test")). - waitUnreachable(); - new WaitUnreachable(getBridge(context).getInstance("Test")). - waitUnreachable(); - return true; - } - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XInterface() {}; - } - } -} diff --git a/bridges/test/java_remote/Bug51323_Test.java b/bridges/test/java_remote/Bug51323_Test.java deleted file mode 100644 index dc59be6c9551..000000000000 --- a/bridges/test/java_remote/Bug51323_Test.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.connection.Connector; -import com.sun.star.connection.XConnection; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #i51323#. - * - *

Bug #i51323# "jurt: BridgeFactory.createBridge creates bridge names." - * Make sure that multiple calls to BridgeFactory.getBridge with empty names - * create different bridges.

- */ -public final class Bug51323_Test extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure( - "test", - new TestBed().execute(new Provider(), false, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XConnection connection = - Connector.create(context).connect(getConnectionDescription()); - XBridgeFactory factory = UnoRuntime.queryInterface( - XBridgeFactory.class, - context.getServiceManager().createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", context)); - return !UnoRuntime.areSame( - factory.createBridge( - "", getProtocolDescription(), connection, null), - factory.createBridge( - "", getProtocolDescription(), connection, null)); - } - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XInterface() {}; - } - } -} diff --git a/bridges/test/java_remote/Bug92174_Test.java b/bridges/test/java_remote/Bug92174_Test.java deleted file mode 100644 index 5ddf4b323c52..000000000000 --- a/bridges/test/java_remote/Bug92174_Test.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -public final class Bug92174_Test extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure("test", - new TestBed().execute(new Provider(), false, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTransport t = UnoRuntime.queryInterface( - XTransport.class, getBridge(context).getInstance("Transport")); - t.setDerived(new XDerived() { - public void fn() {} - }); - t.getBase().fn(); - return true; - } - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTransport() { - public XBase getBase() { - return derived; - } - - public synchronized void setDerived(XDerived derived) { - this.derived = derived; - } - - private XDerived derived = null; - }; - } - } - - public interface XBase extends XInterface { - void fn(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("fn", 0, 0) }; - } - - public interface XDerived extends XBase { - TypeInfo[] UNOTYPEINFO = null; - } - - public interface XTransport extends XInterface { - XBase getBase(); - - void setDerived(XDerived derived); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getBase", 0, 0), - new MethodTypeInfo("setDerived", 1, 0) }; - } -} diff --git a/bridges/test/java_remote/Bug97697_Test.java b/bridges/test/java_remote/Bug97697_Test.java deleted file mode 100644 index 233efe116ebf..000000000000 --- a/bridges/test/java_remote/Bug97697_Test.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lang.DisposedException; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #97697#. - * - *

Bug #97697# "GPF in java-uno bridge in bugdoc scenario" shows that sending - * a plain Object as an Any over the URP bridge lead - * to a StackOverflowError on the writer thread, which was silently - * discarded (and the bridge was not disposed).

- * - *

This test has to detect whether the spawned client process indeed hangs, - * which can not be done reliably. As an approximation, it waits for 10 sec and - * considers the process hanging if it has not completed by then.

- */ -public final class Bug97697_Test extends ComplexTestCase { - @Override - public String getTestObjectName() { - return getClass().getName(); - } - - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - TestBed t = new TestBed(); - assure("test", t.execute(new Provider(t), true, Client.class, 10000)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTransport transport = UnoRuntime.queryInterface( - XTransport.class, getBridge(context).getInstance("Transport")); - try { - transport.getAny(); - } catch (DisposedException e) { - return true; - } - return false; - } - } - - private static final class Provider implements XInstanceProvider { - public Provider(TestBed testBed) { - this.testBed = testBed; - } - - public Object getInstance(String instanceName) { - return new XTransport() { - public Object getAny() { - testBed.serverDone(true); - return new Object(); - } - }; - } - - private final TestBed testBed; - } - - public interface XTransport extends XInterface { - Object getAny(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getAny", 0, 0) }; - } -} diff --git a/bridges/test/java_remote/Bug98508_Test.idl b/bridges/test/java_remote/Bug98508_Test.idl deleted file mode 100644 index c2636b628253..000000000000 --- a/bridges/test/java_remote/Bug98508_Test.idl +++ /dev/null @@ -1,31 +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 - -module com { module sun { module star { module lib { module uno { -module bridges { module javaremote { - -struct Test98508Struct { T member; }; - -interface Test98508Interface { Test98508Struct get(); }; - -}; }; }; }; }; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_remote/Bug98508_Test.java b/bridges/test/java_remote/Bug98508_Test.java deleted file mode 100644 index ea0fa7c9a62b..000000000000 --- a/bridges/test/java_remote/Bug98508_Test.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lang.DisposedException; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #98508#. - * - *

Bug #98508# "JAVA UNO bridge is not disposed when Exception occurs during - * sendReply()" states that the server returning null instead of a - * valid String from XServiceName.getServiceName - * causes an exception when sending the reply, but this exception did not cause - * the bridge to be disposed, it rather caused both client and server to - * hang.

- * - *

Since null instead of a String no longer causes an exception - * in the bridge, this test has been redesigned to send a value of a wrong - * instantiated polymorphic struct type instead.

- * - *

This test has to detect whether the spawned client process indeed hangs, - * which can not be done reliably. As an approximation, it waits for 10 sec and - * considers the process hanging if it has not completed by then.

- */ -public final class Bug98508_Test extends ComplexTestCase { - @Override - public String getTestObjectName() { - return getClass().getName(); - } - - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - TestBed t = new TestBed(); - assure("test", t.execute(new Provider(t), true, Client.class, 10000)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - Test98508Interface ifc - = UnoRuntime.queryInterface( - Test98508Interface.class, - getBridge(context).getInstance("")); - try { - ifc.get(); - } catch (DisposedException e) { - return true; - } - return false; - } - } - - private static final class Provider implements XInstanceProvider { - public Provider(TestBed testBed) { - this.testBed = testBed; - } - - public Object getInstance(String instanceName) { - return new Test98508Interface() { - @Override - public Test98508Struct get() { - testBed.serverDone(true); - return new Test98508Struct(Boolean.FALSE); - } - }; - } - - private final TestBed testBed; - } -} diff --git a/bridges/test/java_remote/MethodIdTest.java b/bridges/test/java_remote/MethodIdTest.java deleted file mode 100644 index 212fc3b7ecc8..000000000000 --- a/bridges/test/java_remote/MethodIdTest.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/** - * Test case for bug #111153#. - * - *

Bug #111153# "jni_uno bridge sometimes fails to map objects - * correctly" describes that mapping a local object out with type XDerived and - * then mapping it back in with type XBase produces a proxy, instead of - * short-cutting to the local object.

- */ -public final class MethodIdTest extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure( - "test", - new TestBed().execute(new Provider(), false, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTest t = UnoRuntime.queryInterface( - XTest.class, getBridge(context).getInstance("Test")); - return t.f129() == 129; - } - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTest() { - public int f0() { return 0; } - public int f1() { return 1; } - public int f2() { return 2; } - public int f3() { return 3; } - public int f4() { return 4; } - public int f5() { return 5; } - public int f6() { return 6; } - public int f7() { return 7; } - public int f8() { return 8; } - public int f9() { return 9; } - public int f10() { return 10; } - public int f11() { return 11; } - public int f12() { return 12; } - public int f13() { return 13; } - public int f14() { return 14; } - public int f15() { return 15; } - public int f16() { return 16; } - public int f17() { return 17; } - public int f18() { return 18; } - public int f19() { return 19; } - public int f20() { return 20; } - public int f21() { return 21; } - public int f22() { return 22; } - public int f23() { return 23; } - public int f24() { return 24; } - public int f25() { return 25; } - public int f26() { return 26; } - public int f27() { return 27; } - public int f28() { return 28; } - public int f29() { return 29; } - public int f30() { return 30; } - public int f31() { return 31; } - public int f32() { return 32; } - public int f33() { return 33; } - public int f34() { return 34; } - public int f35() { return 35; } - public int f36() { return 36; } - public int f37() { return 37; } - public int f38() { return 38; } - public int f39() { return 39; } - public int f40() { return 40; } - public int f41() { return 41; } - public int f42() { return 42; } - public int f43() { return 43; } - public int f44() { return 44; } - public int f45() { return 45; } - public int f46() { return 46; } - public int f47() { return 47; } - public int f48() { return 48; } - public int f49() { return 49; } - public int f50() { return 50; } - public int f51() { return 51; } - public int f52() { return 52; } - public int f53() { return 53; } - public int f54() { return 54; } - public int f55() { return 55; } - public int f56() { return 56; } - public int f57() { return 57; } - public int f58() { return 58; } - public int f59() { return 59; } - public int f60() { return 60; } - public int f61() { return 61; } - public int f62() { return 62; } - public int f63() { return 63; } - public int f64() { return 64; } - public int f65() { return 65; } - public int f66() { return 66; } - public int f67() { return 67; } - public int f68() { return 68; } - public int f69() { return 69; } - public int f70() { return 70; } - public int f71() { return 71; } - public int f72() { return 72; } - public int f73() { return 73; } - public int f74() { return 74; } - public int f75() { return 75; } - public int f76() { return 76; } - public int f77() { return 77; } - public int f78() { return 78; } - public int f79() { return 79; } - public int f80() { return 80; } - public int f81() { return 81; } - public int f82() { return 82; } - public int f83() { return 83; } - public int f84() { return 84; } - public int f85() { return 85; } - public int f86() { return 86; } - public int f87() { return 87; } - public int f88() { return 88; } - public int f89() { return 89; } - public int f90() { return 90; } - public int f91() { return 91; } - public int f92() { return 92; } - public int f93() { return 93; } - public int f94() { return 94; } - public int f95() { return 95; } - public int f96() { return 96; } - public int f97() { return 97; } - public int f98() { return 98; } - public int f99() { return 99; } - public int f100() { return 100; } - public int f101() { return 101; } - public int f102() { return 102; } - public int f103() { return 103; } - public int f104() { return 104; } - public int f105() { return 105; } - public int f106() { return 106; } - public int f107() { return 107; } - public int f108() { return 108; } - public int f109() { return 109; } - public int f110() { return 110; } - public int f111() { return 111; } - public int f112() { return 112; } - public int f113() { return 113; } - public int f114() { return 114; } - public int f115() { return 115; } - public int f116() { return 116; } - public int f117() { return 117; } - public int f118() { return 118; } - public int f119() { return 119; } - public int f120() { return 120; } - public int f121() { return 121; } - public int f122() { return 122; } - public int f123() { return 123; } - public int f124() { return 124; } - public int f125() { return 125; } - public int f126() { return 126; } - public int f127() { return 127; } - public int f128() { return 128; } - public int f129() { return 129; } - public int f130() { return 130; } - }; - } - } - - public interface XTest extends XInterface { - int f0(); - int f1(); - int f2(); - int f3(); - int f4(); - int f5(); - int f6(); - int f7(); - int f8(); - int f9(); - int f10(); - int f11(); - int f12(); - int f13(); - int f14(); - int f15(); - int f16(); - int f17(); - int f18(); - int f19(); - int f20(); - int f21(); - int f22(); - int f23(); - int f24(); - int f25(); - int f26(); - int f27(); - int f28(); - int f29(); - int f30(); - int f31(); - int f32(); - int f33(); - int f34(); - int f35(); - int f36(); - int f37(); - int f38(); - int f39(); - int f40(); - int f41(); - int f42(); - int f43(); - int f44(); - int f45(); - int f46(); - int f47(); - int f48(); - int f49(); - int f50(); - int f51(); - int f52(); - int f53(); - int f54(); - int f55(); - int f56(); - int f57(); - int f58(); - int f59(); - int f60(); - int f61(); - int f62(); - int f63(); - int f64(); - int f65(); - int f66(); - int f67(); - int f68(); - int f69(); - int f70(); - int f71(); - int f72(); - int f73(); - int f74(); - int f75(); - int f76(); - int f77(); - int f78(); - int f79(); - int f80(); - int f81(); - int f82(); - int f83(); - int f84(); - int f85(); - int f86(); - int f87(); - int f88(); - int f89(); - int f90(); - int f91(); - int f92(); - int f93(); - int f94(); - int f95(); - int f96(); - int f97(); - int f98(); - int f99(); - int f100(); - int f101(); - int f102(); - int f103(); - int f104(); - int f105(); - int f106(); - int f107(); - int f108(); - int f109(); - int f110(); - int f111(); - int f112(); - int f113(); - int f114(); - int f115(); - int f116(); - int f117(); - int f118(); - int f119(); - int f120(); - int f121(); - int f122(); - int f123(); - int f124(); - int f125(); - int f126(); - int f127(); - int f128(); - int f129(); - int f130(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("f0", 0, 0), - new MethodTypeInfo("f1", 1, 0), - new MethodTypeInfo("f2", 2, 0), - new MethodTypeInfo("f3", 3, 0), - new MethodTypeInfo("f4", 4, 0), - new MethodTypeInfo("f5", 5, 0), - new MethodTypeInfo("f6", 6, 0), - new MethodTypeInfo("f7", 7, 0), - new MethodTypeInfo("f8", 8, 0), - new MethodTypeInfo("f9", 9, 0), - new MethodTypeInfo("f10", 10, 0), - new MethodTypeInfo("f11", 11, 0), - new MethodTypeInfo("f12", 12, 0), - new MethodTypeInfo("f13", 13, 0), - new MethodTypeInfo("f14", 14, 0), - new MethodTypeInfo("f15", 15, 0), - new MethodTypeInfo("f16", 16, 0), - new MethodTypeInfo("f17", 17, 0), - new MethodTypeInfo("f18", 18, 0), - new MethodTypeInfo("f19", 19, 0), - new MethodTypeInfo("f20", 20, 0), - new MethodTypeInfo("f21", 21, 0), - new MethodTypeInfo("f22", 22, 0), - new MethodTypeInfo("f23", 23, 0), - new MethodTypeInfo("f24", 24, 0), - new MethodTypeInfo("f25", 25, 0), - new MethodTypeInfo("f26", 26, 0), - new MethodTypeInfo("f27", 27, 0), - new MethodTypeInfo("f28", 28, 0), - new MethodTypeInfo("f29", 29, 0), - new MethodTypeInfo("f30", 30, 0), - new MethodTypeInfo("f31", 31, 0), - new MethodTypeInfo("f32", 32, 0), - new MethodTypeInfo("f33", 33, 0), - new MethodTypeInfo("f34", 34, 0), - new MethodTypeInfo("f35", 35, 0), - new MethodTypeInfo("f36", 36, 0), - new MethodTypeInfo("f37", 37, 0), - new MethodTypeInfo("f38", 38, 0), - new MethodTypeInfo("f39", 39, 0), - new MethodTypeInfo("f40", 40, 0), - new MethodTypeInfo("f41", 41, 0), - new MethodTypeInfo("f42", 42, 0), - new MethodTypeInfo("f43", 43, 0), - new MethodTypeInfo("f44", 44, 0), - new MethodTypeInfo("f45", 45, 0), - new MethodTypeInfo("f46", 46, 0), - new MethodTypeInfo("f47", 47, 0), - new MethodTypeInfo("f48", 48, 0), - new MethodTypeInfo("f49", 49, 0), - new MethodTypeInfo("f50", 50, 0), - new MethodTypeInfo("f51", 51, 0), - new MethodTypeInfo("f52", 52, 0), - new MethodTypeInfo("f53", 53, 0), - new MethodTypeInfo("f54", 54, 0), - new MethodTypeInfo("f55", 55, 0), - new MethodTypeInfo("f56", 56, 0), - new MethodTypeInfo("f57", 57, 0), - new MethodTypeInfo("f58", 58, 0), - new MethodTypeInfo("f59", 59, 0), - new MethodTypeInfo("f60", 60, 0), - new MethodTypeInfo("f61", 61, 0), - new MethodTypeInfo("f62", 62, 0), - new MethodTypeInfo("f63", 63, 0), - new MethodTypeInfo("f64", 64, 0), - new MethodTypeInfo("f65", 65, 0), - new MethodTypeInfo("f66", 66, 0), - new MethodTypeInfo("f67", 67, 0), - new MethodTypeInfo("f68", 68, 0), - new MethodTypeInfo("f69", 69, 0), - new MethodTypeInfo("f70", 70, 0), - new MethodTypeInfo("f71", 71, 0), - new MethodTypeInfo("f72", 72, 0), - new MethodTypeInfo("f73", 73, 0), - new MethodTypeInfo("f74", 74, 0), - new MethodTypeInfo("f75", 75, 0), - new MethodTypeInfo("f76", 76, 0), - new MethodTypeInfo("f77", 77, 0), - new MethodTypeInfo("f78", 78, 0), - new MethodTypeInfo("f79", 79, 0), - new MethodTypeInfo("f80", 80, 0), - new MethodTypeInfo("f81", 81, 0), - new MethodTypeInfo("f82", 82, 0), - new MethodTypeInfo("f83", 83, 0), - new MethodTypeInfo("f84", 84, 0), - new MethodTypeInfo("f85", 85, 0), - new MethodTypeInfo("f86", 86, 0), - new MethodTypeInfo("f87", 87, 0), - new MethodTypeInfo("f88", 88, 0), - new MethodTypeInfo("f89", 89, 0), - new MethodTypeInfo("f90", 90, 0), - new MethodTypeInfo("f91", 91, 0), - new MethodTypeInfo("f92", 92, 0), - new MethodTypeInfo("f93", 93, 0), - new MethodTypeInfo("f94", 94, 0), - new MethodTypeInfo("f95", 95, 0), - new MethodTypeInfo("f96", 96, 0), - new MethodTypeInfo("f97", 97, 0), - new MethodTypeInfo("f98", 98, 0), - new MethodTypeInfo("f99", 99, 0), - new MethodTypeInfo("f100", 100, 0), - new MethodTypeInfo("f101", 101, 0), - new MethodTypeInfo("f102", 102, 0), - new MethodTypeInfo("f103", 103, 0), - new MethodTypeInfo("f104", 104, 0), - new MethodTypeInfo("f105", 105, 0), - new MethodTypeInfo("f106", 106, 0), - new MethodTypeInfo("f107", 107, 0), - new MethodTypeInfo("f108", 108, 0), - new MethodTypeInfo("f109", 109, 0), - new MethodTypeInfo("f110", 110, 0), - new MethodTypeInfo("f111", 111, 0), - new MethodTypeInfo("f112", 112, 0), - new MethodTypeInfo("f113", 113, 0), - new MethodTypeInfo("f114", 114, 0), - new MethodTypeInfo("f115", 115, 0), - new MethodTypeInfo("f116", 116, 0), - new MethodTypeInfo("f117", 117, 0), - new MethodTypeInfo("f118", 118, 0), - new MethodTypeInfo("f119", 119, 0), - new MethodTypeInfo("f120", 120, 0), - new MethodTypeInfo("f121", 121, 0), - new MethodTypeInfo("f122", 122, 0), - new MethodTypeInfo("f123", 123, 0), - new MethodTypeInfo("f124", 124, 0), - new MethodTypeInfo("f125", 125, 0), - new MethodTypeInfo("f126", 126, 0), - new MethodTypeInfo("f127", 127, 0), - new MethodTypeInfo("f128", 128, 0), - new MethodTypeInfo("f129", 129, 0), - new MethodTypeInfo("f130", 130, 0) }; - } -} diff --git a/bridges/test/java_remote/PolyStructTest.idl b/bridges/test/java_remote/PolyStructTest.idl deleted file mode 100644 index ec9977c98a51..000000000000 --- a/bridges/test/java_remote/PolyStructTest.idl +++ /dev/null @@ -1,46 +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 - -module com { module sun { module star { module lib { module uno { -module bridges { module javaremote { - -enum TestEnum { VALUE1 = 100, VALUE2 = -100 }; - -struct TestPolyStruct { T member; }; - -interface TestTransport { - TestPolyStruct transportBoolean([in] TestPolyStruct arg); - TestPolyStruct transportByte([in] TestPolyStruct arg); - TestPolyStruct transportShort([in] TestPolyStruct arg); - TestPolyStruct transportLong([in] TestPolyStruct arg); - TestPolyStruct transportHyper([in] TestPolyStruct arg); - TestPolyStruct transportFloat([in] TestPolyStruct arg); - TestPolyStruct transportDouble([in] TestPolyStruct arg); - TestPolyStruct transportChar([in] TestPolyStruct arg); - TestPolyStruct transportString([in] TestPolyStruct arg); - TestPolyStruct transportType([in] TestPolyStruct arg); - TestPolyStruct transportAny([in] TestPolyStruct arg); - TestPolyStruct transportEnum([in] TestPolyStruct arg); -}; - -}; }; }; }; }; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_remote/PolyStructTest.java b/bridges/test/java_remote/PolyStructTest.java deleted file mode 100644 index bf4fdf57df83..000000000000 --- a/bridges/test/java_remote/PolyStructTest.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.uno.Any; -import com.sun.star.uno.Type; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -public final class PolyStructTest extends ComplexTestCase { - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure( - "test", - new TestBed().execute(new Provider(), false, Client.class, 0)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - TestTransport t = UnoRuntime.queryInterface( - TestTransport.class, getBridge(context).getInstance("")); - - assertEquals( - Boolean.FALSE, t.transportBoolean(new TestPolyStruct()).member); - assertEquals( - Boolean.FALSE, - t.transportBoolean(new TestPolyStruct(Boolean.FALSE)).member); - assertEquals( - Boolean.TRUE, - t.transportBoolean(new TestPolyStruct(Boolean.TRUE)).member); - - assertEquals( - Byte.valueOf((byte) 0), - t.transportByte(new TestPolyStruct()).member); - assertEquals( - Byte.valueOf(Byte.MIN_VALUE), - t.transportByte( - new TestPolyStruct(Byte.valueOf(Byte.MIN_VALUE))).member); - assertEquals( - Byte.valueOf(Byte.MAX_VALUE), - t.transportByte( - new TestPolyStruct(Byte.valueOf(Byte.MAX_VALUE))).member); - - assertEquals( - Short.valueOf((short) 0), - t.transportShort(new TestPolyStruct()).member); - assertEquals( - Short.valueOf(Short.MIN_VALUE), - t.transportShort( - new TestPolyStruct(Short.valueOf(Short.MIN_VALUE))).member); - assertEquals( - Short.valueOf(Short.MAX_VALUE), - t.transportShort( - new TestPolyStruct(Short.valueOf(Short.MAX_VALUE))).member); - - assertEquals( - Integer.valueOf(0), t.transportLong(new TestPolyStruct()).member); - assertEquals( - Integer.valueOf(Integer.MIN_VALUE), - t.transportLong( - new TestPolyStruct(Integer.valueOf(Integer.MIN_VALUE))).member); - assertEquals( - Integer.valueOf(Integer.MAX_VALUE), - t.transportLong( - new TestPolyStruct(Integer.valueOf(Integer.MAX_VALUE))).member); - - assertEquals( - Long.valueOf(0L), t.transportHyper(new TestPolyStruct()).member); - assertEquals( - Long.valueOf(Long.MIN_VALUE), - t.transportHyper( - new TestPolyStruct(Long.valueOf(Long.MIN_VALUE))).member); - assertEquals( - Long.valueOf(Long.MAX_VALUE), - t.transportHyper( - new TestPolyStruct(Long.valueOf(Long.MAX_VALUE))).member); - - assertEquals( - new Float(0.0f), t.transportFloat(new TestPolyStruct()).member); - assertEquals( - new Float(Float.MIN_VALUE), - t.transportFloat( - new TestPolyStruct(new Float(Float.MIN_VALUE))).member); - assertEquals( - new Float(Float.MAX_VALUE), - t.transportFloat( - new TestPolyStruct(new Float(Float.MAX_VALUE))).member); - - assertEquals( - new Double(0.0), - t.transportDouble(new TestPolyStruct()).member); - assertEquals( - new Double(Double.MIN_VALUE), - t.transportDouble( - new TestPolyStruct(new Double(Double.MIN_VALUE))).member); - assertEquals( - new Double(Double.MAX_VALUE), - t.transportDouble( - new TestPolyStruct(new Double(Double.MAX_VALUE))).member); - - assertEquals( - new Character(Character.MIN_VALUE), - t.transportChar(new TestPolyStruct()).member); - assertEquals( - new Character(Character.MIN_VALUE), - t.transportChar( - new TestPolyStruct( - new Character(Character.MIN_VALUE))).member); - assertEquals( - new Character(Character.MAX_VALUE), - t.transportChar( - new TestPolyStruct( - new Character(Character.MAX_VALUE))).member); - - assertEquals("", t.transportString(new TestPolyStruct()).member); - assertEquals( - "ABC", t.transportString(new TestPolyStruct("ABC")).member); - - assertEquals( - Type.VOID, t.transportType(new TestPolyStruct()).member); - assertEquals( - new Type( - "[]com.sun.star.lib.uno.bridges.javaremote.TestPolyStruct" - + ""), - t.transportType( - new TestPolyStruct( - new Type( - "[]com.sun.star.lib.uno.bridges.javaremote." - + "TestPolyStruct"))).member); - - assertEquals(null, t.transportAny(new TestPolyStruct()).member); - assertEquals( - Any.VOID, t.transportAny(new TestPolyStruct(Any.VOID)).member); - assertEquals(null, t.transportAny(new TestPolyStruct(null)).member); - assertEquals( - new Any(Type.UNSIGNED_LONG, Integer.valueOf(5)), - t.transportAny( - new TestPolyStruct( - new Any(Type.UNSIGNED_LONG, Integer.valueOf(5)))).member); - - assertEquals( - TestEnum.VALUE1, t.transportEnum(new TestPolyStruct()).member); - assertEquals( - TestEnum.VALUE1, - t.transportEnum(new TestPolyStruct(TestEnum.VALUE1)).member); - assertEquals( - TestEnum.VALUE2, - t.transportEnum(new TestPolyStruct(TestEnum.VALUE2)).member); - - return success; - } - - private void assertEquals(Object expected, Object actual) { - if (!(expected == null ? actual == null : expected.equals(actual))) - { - new RuntimeException( - "failed; expected " + expected + ", got " + actual). - printStackTrace(); - success = false; - } - } - - private boolean success = true; - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new TestTransport() { - public TestPolyStruct transportBoolean(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportByte(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportShort(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportLong(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportHyper(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportFloat(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportDouble(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportChar(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportString(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportType(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportAny(TestPolyStruct s) { - return s; - } - - public TestPolyStruct transportEnum(TestPolyStruct s) { - return s; - } - }; - } - } -} diff --git a/bridges/test/java_remote/StopMessageDispatcherTest.java b/bridges/test/java_remote/StopMessageDispatcherTest.java deleted file mode 100644 index ed7999e765c3..000000000000 --- a/bridges/test/java_remote/StopMessageDispatcherTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 test.java_remote; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.lang.DisposedException; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; -import test.lib.TestBed; - -/* This test has to detect whether the spawned client process hangs, which can - * not be done reliably. As an approximation, it waits for 10 sec and considers - * the process hanging if it has not terminated by then. - */ -public final class StopMessageDispatcherTest extends ComplexTestCase { - - @Override - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { - assure( - "test", - new TestBed().execute(new Provider(), false, Client.class, 10000)); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTest test = UnoRuntime.queryInterface( - XTest.class, getBridge(context).getInstance("Test")); - Thread[] threads = new Thread[101]; - int n = Thread.enumerate(threads); - if (n > 100) { - System.err.println("ERROR: too many threads"); - return false; - } - boolean stopped = false; - for (int i = 0; i < n; ++i) { - if (threads[i].getName().equals("MessageDispatcher")) { - threads[i].stop(); - stopped = true; - break; - } - } - if (!stopped) { - System.err.println("ERROR: thread not found"); - return false; - } - try { - test.call(); - System.err.println("ERROR: no DisposedException"); - return false; - } catch (DisposedException e) { - return true; - } - } - - private Client() {} - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTest() { - public void call() {} - }; - } - } - - public interface XTest extends XInterface { - void call(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("call", 0, 0) }; - } -} diff --git a/bridges/test/java_remote/makefile.mk b/bridges/test/java_remote/makefile.mk deleted file mode 100644 index dd418b488722..000000000000 --- a/bridges/test/java_remote/makefile.mk +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 . -# - -PRJ := ..$/..$/..$/..$/..$/..$/..$/.. -PRJNAME := bridges -TARGET := test_com_sun_star_lib_uno_bridges_javaremote - -PACKAGE := test$/javaremote -JAVATESTFILES := \ - Bug51323_Test.java \ - Bug92174_Test.java \ - Bug97697_Test.java \ - Bug98508_Test.java \ - Bug107753_Test.java \ - Bug108825_Test.java \ - Bug110892_Test.java \ - Bug111153_Test.java \ - Bug114133_Test.java \ - MethodIdTest.java \ - PolyStructTest.java \ - StopMessageDispatcherTest.java -IDLTESTFILES := \ - Bug98508_Test.idl \ - PolyStructTest.idl -JARFILES := juh.jar jurt.jar ridl.jar - -.INCLUDE: javaunittest.mk diff --git a/bridges/test/java_uno/acquire/TestAcquire.java b/bridges/test/java_uno/acquire/TestAcquire.java deleted file mode 100644 index 0aa2b0f639e7..000000000000 --- a/bridges/test/java_uno/acquire/TestAcquire.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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 test.java_uno.acquire; - -import com.sun.star.bridge.UnoUrlResolver; -import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.comp.helper.Bootstrap; -import com.sun.star.connection.Acceptor; -import com.sun.star.connection.XAcceptor; -import com.sun.star.connection.XConnection; -import com.sun.star.lib.uno.helper.UnoUrl; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; -import util.WaitUnreachable; - -public final class TestAcquire { - public static void main(String[] arguments) throws Exception { - // - arguments[0] must be "client" or "server" - // - arguments[1] must be the UNO URL to connect to (client) or accept - // on (server) - XComponentContext context - = Bootstrap.createInitialComponentContext(null); - if (arguments[0].equals("client")) { - execClient(context, arguments[1]); - } else { - execServer(context, arguments[1]); - } - } - - private static void assertNotNull(Object obj) { - if (obj == null) { - throw new RuntimeException("assertNotNull failed"); - } - } - - private static void receive(Object obj) { - assertNotNull(obj); - WaitUnreachable.ensureFinalization(obj); - } - - private static void execClient(XComponentContext context, String url) - throws Exception - { - XTest test = UnoRuntime.queryInterface( - XTest.class, UnoUrlResolver.create(context).resolve(url)); - - WaitUnreachable u; - - u = new WaitUnreachable(new XInterface() {}); - test.setInterfaceToInterface(u.get()); - receive(test.getInterfaceFromInterface()); - test.clearInterface(); - u.waitUnreachable(); - u = new WaitUnreachable(new XBase() {}); - test.setInterfaceToInterface(u.get()); - receive(test.getInterfaceFromInterface()); - test.clearInterface(); - u.waitUnreachable(); - u = new WaitUnreachable(new XDerived() {}); - test.setInterfaceToInterface(u.get()); - receive(test.getInterfaceFromInterface()); - test.clearInterface(); - u.waitUnreachable(); - - u = new WaitUnreachable(new XBase() {}); - test.setBaseToInterface((XBase) u.get()); - receive(test.getInterfaceFromInterface()); - test.clearInterface(); - u.waitUnreachable(); - u = new WaitUnreachable(new XDerived() {}); - test.setBaseToInterface((XDerived) u.get()); - receive(test.getInterfaceFromInterface()); - test.clearInterface(); - u.waitUnreachable(); - - u = new WaitUnreachable(new XDerived() {}); - test.setDerivedToInterface((XDerived) u.get()); - receive(test.getInterfaceFromInterface()); - test.clearInterface(); - u.waitUnreachable(); - - u = new WaitUnreachable(new XBase() {}); - test.setBaseToBase((XBase) u.get()); - receive(test.getInterfaceFromBase()); - receive(test.getBaseFromBase()); - test.clearBase(); - u.waitUnreachable(); - u = new WaitUnreachable(new XDerived() {}); - test.setBaseToBase((XDerived) u.get()); - receive(test.getInterfaceFromBase()); - receive(test.getBaseFromBase()); - test.clearBase(); - u.waitUnreachable(); - - u = new WaitUnreachable(new XDerived() {}); - test.setDerivedToBase((XDerived) u.get()); - receive(test.getInterfaceFromBase()); - receive(test.getBaseFromBase()); - test.clearBase(); - u.waitUnreachable(); - - u = new WaitUnreachable(new XDerived() {}); - test.setDerivedToDerived((XDerived) u.get()); - receive(test.getInterfaceFromDerived()); - receive(test.getBaseFromDerived()); - receive(test.getDerivedFromDerived()); - test.clearDerived(); - u.waitUnreachable(); - - u = new WaitUnreachable(new XInterface() {}); - receive(test.roundTripInterfaceToInterface(u.get())); - u.waitUnreachable(); - u = new WaitUnreachable(new XBase() {}); - receive(test.roundTripInterfaceToInterface(u.get())); - u.waitUnreachable(); - u = new WaitUnreachable(new XDerived() {}); - receive(test.roundTripInterfaceToInterface(u.get())); - u.waitUnreachable(); - - u = new WaitUnreachable(new XBase() {}); - receive(test.roundTripBaseToInterface((XBase) u.get())); - u.waitUnreachable(); - u = new WaitUnreachable(new XDerived() {}); - receive(test.roundTripBaseToInterface((XDerived) u.get())); - u.waitUnreachable(); - - u = new WaitUnreachable(new XDerived() {}); - receive(test.roundTripDerivedToInterface((XDerived) u.get())); - u.waitUnreachable(); - - u = new WaitUnreachable(new XBase() {}); - receive(test.roundTripBaseToBase((XBase) u.get())); - u.waitUnreachable(); - u = new WaitUnreachable(new XDerived() {}); - receive(test.roundTripBaseToBase((XDerived) u.get())); - u.waitUnreachable(); - - u = new WaitUnreachable(new XDerived() {}); - receive(test.roundTripDerivedToBase((XDerived) u.get())); - u.waitUnreachable(); - - u = new WaitUnreachable(new XDerived() {}); - receive(test.roundTripDerivedToDerived((XDerived) u.get())); - u.waitUnreachable(); - - u = new WaitUnreachable(test); - test = null; - u.waitUnreachable(); - System.out.println( - "Client and server both cleanly terminate now: Success"); - } - - private static void execServer(XComponentContext context, String url) - throws Exception - { - XAcceptor acceptor = Acceptor.create(context); - XBridgeFactory factory = UnoRuntime.queryInterface( - XBridgeFactory.class, - context.getServiceManager().createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", context)); - UnoUrl unoUrl = UnoUrl.parseUnoUrl(url); - System.out.println("Server: Accepting..."); - XConnection connection = acceptor.accept( - unoUrl.getConnectionAndParametersAsString()); - System.out.println("Server: ...connected..."); - factory.createBridge( - "", unoUrl.getProtocolAndParametersAsString(), connection, - new Provider()); - System.out.println("Server: ...bridged."); - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTest() { - public void setInterfaceToInterface(Object obj) { - iface = obj; - } - - public void setBaseToInterface(XBase obj) { - iface = obj; - } - - public void setDerivedToInterface(XDerived obj) { - iface = obj; - } - - public Object getInterfaceFromInterface() { - return iface; - } - - public void clearInterface() { - WaitUnreachable u = new WaitUnreachable(iface); - iface = null; - u.waitUnreachable(); - } - - public void setBaseToBase(XBase obj) { - base = obj; - } - - public void setDerivedToBase(XDerived obj) { - base = obj; - } - - public Object getInterfaceFromBase() { - return base; - } - - public XBase getBaseFromBase() { - return base; - } - - public void clearBase() { - WaitUnreachable u = new WaitUnreachable(base); - base = null; - u.waitUnreachable(); - } - - public void setDerivedToDerived(XDerived obj) { - derived = obj; - } - - public Object getInterfaceFromDerived() { - return derived; - } - - public XBase getBaseFromDerived() { - return derived; - } - - public XDerived getDerivedFromDerived() { - return derived; - } - - public void clearDerived() { - WaitUnreachable u = new WaitUnreachable(derived); - derived = null; - u.waitUnreachable(); - } - - public Object roundTripInterfaceToInterface(Object obj) { - WaitUnreachable.ensureFinalization(obj); - return obj; - } - - public Object roundTripBaseToInterface(XBase obj) { - WaitUnreachable.ensureFinalization(obj); - return obj; - } - - public Object roundTripDerivedToInterface(XDerived obj) { - WaitUnreachable.ensureFinalization(obj); - return obj; - } - - public XBase roundTripBaseToBase(XBase obj) { - WaitUnreachable.ensureFinalization(obj); - return obj; - } - - public XBase roundTripDerivedToBase(XDerived obj) { - WaitUnreachable.ensureFinalization(obj); - return obj; - } - - public XDerived roundTripDerivedToDerived(XDerived obj) { - WaitUnreachable.ensureFinalization(obj); - return obj; - } - - private Object iface; - private XBase base; - private XDerived derived; - }; - } - } -} diff --git a/bridges/test/java_uno/acquire/makefile.mk b/bridges/test/java_uno/acquire/makefile.mk deleted file mode 100644 index e38f9e8fa20e..000000000000 --- a/bridges/test/java_uno/acquire/makefile.mk +++ /dev/null @@ -1,108 +0,0 @@ -# -# 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 . -# - -PRJ := ..$/..$/.. -PRJNAME := bridges - -TARGET := test_javauno_acquire -PACKAGE := test$/java_uno$/acquire - -ENABLE_EXCEPTIONS := TRUE - -.INCLUDE: settings.mk - -DLLPRE = # no leading "lib" on .so files -INCPRE += $(MISC)$/$(TARGET)$/inc - -SLOFILES = $(SLO)$/testacquire.obj - -SHL1TARGET = $(ENFORCEDSHLPREFIX)testacquire.uno -SHL1OBJS = $(SLOFILES) -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL1VERSIONMAP = $(SOLARENV)/src/component.map -SHL1IMPLIB = itestacquire - -JAVAFILES = TestAcquire.java -JARFILES = OOoRunner.jar juh.jar jurt.jar ridl.jar - -.INCLUDE: target.mk - -ALLTAR: \ - $(BIN)$/testacquire-java-client \ - $(BIN)$/testacquire-java-server \ - $(BIN)$/testacquire-native-client \ - $(BIN)$/testacquire-native-server - -.IF "$(OS)" == "WNT" -GIVE_EXEC_RIGHTS = @echo -.ELSE # GUI, WNT -GIVE_EXEC_RIGHTS = chmod +x -.ENDIF # GUI, WNT - -EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i) -EXEC_CLASSPATH = \ - $(strip $(subst,!,$(LIBO_PATH_SEPARATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) - -$(BIN)$/$(TARGET).rdb: types.idl - - rm $@ - - $(MKDIR) $(MISC)$/$(TARGET) - - $(MKDIR) $(MISC)$/$(TARGET)$/inc - $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $< - $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/types.urd - $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb - $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb - $(REGMERGE) $@ / $(SOLARBINDIR)$/types.rdb - $(REGCOMP) -register -r $@ -c acceptor.uno$(DLLPOST) \ - -c bridgefac.uno$(DLLPOST) -c connector.uno$(DLLPOST) \ - -c remotebridge.uno$(DLLPOST) -c uuresolver.uno$(DLLPOST) - -$(SLOFILES) $(JAVACLASSFILES): $(BIN)$/$(TARGET).rdb - -# Use "127.0.0.1" instead of "localhost", see #i32281#: -TEST_JAVAUNO_ACQUIRE_UNO_URL := \ - \"'uno:socket,host=127.0.0.1,port=2002;urp;test'\" - -$(BIN)$/testacquire-java-client: - echo java -classpath \ - ..$/class$/test$(LIBO_PATH_SEPARATOR)..$/class$(LIBO_PATH_SEPARATOR)\ -..$/class$/java_uno.jar$(LIBO_PATH_SEPARATOR)$(EXEC_CLASSPATH) \ - test.javauno.acquire.TestAcquire client \ - $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ - $(GIVE_EXEC_RIGHTS) $@ - -$(BIN)$/testacquire-java-server: - echo java -classpath \ - ..$/class$/test$(LIBO_PATH_SEPARATOR)..$/class$(LIBO_PATH_SEPARATOR)\ -..$/class$/java_uno.jar$(LIBO_PATH_SEPARATOR)$(EXEC_CLASSPATH) \ - test.javauno.acquire.TestAcquire server \ - $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ - $(GIVE_EXEC_RIGHTS) $@ - -$(BIN)$/testacquire-native-client: - echo '$(AUGMENT_LIBRARY_PATH)' uno \ - -c com.sun.star.test.bridges.testacquire.impl \ - -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb -- \ - $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ - $(GIVE_EXEC_RIGHTS) $@ - -$(BIN)$/testacquire-native-server: - echo '$(AUGMENT_LIBRARY_PATH)' uno \ - -c com.sun.star.test.bridges.testacquire.impl \ - -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb \ - -u $(TEST_JAVAUNO_ACQUIRE_UNO_URL) --singleaccept > $@ - $(GIVE_EXEC_RIGHTS) $@ diff --git a/bridges/test/java_uno/acquire/readme.txt b/bridges/test/java_uno/acquire/readme.txt deleted file mode 100644 index 40bdf645c295..000000000000 --- a/bridges/test/java_uno/acquire/readme.txt +++ /dev/null @@ -1,21 +0,0 @@ -Test scenarios: - -> cd .../bridges//bin -> ./testacquire-java-server & -> sleep 3 # wait for server to accept connection -> ./testacquire-java-client - -> cd .../bridges//bin -> ./testacquire-java-server & -> sleep 3 # wait for server to accept connection -> ./testacquire-native-client - -> cd .../bridges//bin -> ./testacquire-native-server & -> sleep 3 # wait for server to accept connection -> ./testacquire-java-client - -> cd .../bridges//bin -> ./testacquire-native-server & -> sleep 3 # wait for server to accept connection -> ./testacquire-native-client diff --git a/bridges/test/java_uno/acquire/testacquire.cxx b/bridges/test/java_uno/acquire/testacquire.cxx deleted file mode 100644 index c3dd6144c23c..000000000000 --- a/bridges/test/java_uno/acquire/testacquire.cxx +++ /dev/null @@ -1,543 +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/bridge/UnoUrlResolver.hpp" -#include "com/sun/star/bridge/XUnoUrlResolver.hpp" -#include "com/sun/star/lang/XMain.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" -#include "com/sun/star/registry/InvalidRegistryException.hpp" -#include "com/sun/star/registry/XRegistryKey.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/Type.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase.hxx" -#include -#include "cppuhelper/weak.hxx" -#include "osl/conditn.hxx" -#include "osl/interlck.h" -#include "rtl/string.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "test/javauno/acquire/XBase.hpp" -#include "test/javauno/acquire/XDerived.hpp" -#include "test/javauno/acquire/XTest.hpp" -#include "uno/environment.h" - -#include -#include - -namespace { - -class WaitCondition { -public: - WaitCondition() {} - - ~WaitCondition(); - - osl::Condition & get() { return m_condition; } - -private: - WaitCondition(WaitCondition &); // not implemented - void operator =(WaitCondition); // not implemented - - osl::Condition m_condition; -}; - -} - -WaitCondition::~WaitCondition() { - std::cout << "waiting for condition\n"; - if (m_condition.wait() != osl::Condition::result_ok) { - std::cerr << "osl::Condition::wait failed\n"; - std::abort() - } -} - -namespace { - -class Interface: public css::uno::XInterface { -public: - explicit Interface(osl::Condition & condition): - m_condition(condition), m_refCount(0) {} - - virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw () - { osl_atomic_increment(&m_refCount); } - - virtual void SAL_CALL release() throw (); - -protected: - virtual ~Interface() { m_condition.set(); } - -private: - Interface(Interface &); // not implemented - void operator =(Interface); // not implemented - - osl::Condition & m_condition; - oslInterlockedCount m_refCount; -}; - -} - -css::uno::Any Interface::queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException) -{ - return type.getTypeName() == "com.sun.star.uno.XInterface" - ? css::uno::makeAny(css::uno::Reference< css::uno::XInterface >(this)) - : css::uno::Any(); -} - -void Interface::release() throw () { - if (osl_atomic_decrement(&m_refCount) == 0) { - delete this; - } -} - -namespace { - -class Base: public Interface, public test::javauno::acquire::XBase { -public: - explicit Base(osl::Condition & condition): Interface(condition) {} - - virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw () { Interface::acquire(); } - - virtual void SAL_CALL release() throw () { Interface::release(); } - -protected: - virtual ~Base() {} -}; - -} - -css::uno::Any Base::queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException) -{ - return type.getTypeName() == "test.javauno.acquire.XBase" - ? css::uno::makeAny(css::uno::Reference< test::javauno::acquire::XBase >(this)) - : Interface::queryInterface(type); -} - -namespace { - -class Derived: public Base, public test::javauno::acquire::XDerived { -public: - explicit Derived(osl::Condition & condition): Base(condition) {} - - virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw () { Base::acquire(); } - - virtual void SAL_CALL release() throw () { Base::release(); } - -private: - virtual ~Derived() {} -}; - -} - -css::uno::Any Derived::queryInterface(css::uno::Type const & type) - throw (css::uno::RuntimeException) -{ - return ( type.getTypeName() == "test.javauno.acquire.XDerived" ) - ? css::uno::makeAny( - css::uno::Reference< test::javauno::acquire::XDerived >(this)) - : Interface::queryInterface(type); -} - -namespace { - -class Service: public cppu::WeakImplHelper< - css::lang::XServiceInfo, css::lang::XMain, test::javauno::acquire::XTest > -{ -public: - virtual OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException) - { return getImplementationName_static(); } - - virtual sal_Bool SAL_CALL supportsService(OUString const & serviceName) - throw (css::uno::RuntimeException); - - virtual css::uno::Sequence< OUString > SAL_CALL - getSupportedServiceNames() throw (css::uno::RuntimeException) - { return getSupportedServiceNames_static(); } - - virtual sal_Int32 SAL_CALL - run(css::uno::Sequence< OUString > const & arguments) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL setInterfaceToInterface( - css::uno::Reference< css::uno::XInterface > const & obj) - throw (css::uno::RuntimeException) - { m_interface = obj; } - - virtual void SAL_CALL setBaseToInterface( - css::uno::Reference< test::javauno::acquire::XBase > const & obj) - throw (css::uno::RuntimeException) - { m_interface = obj; } - - virtual void SAL_CALL setDerivedToInterface( - css::uno::Reference< test::javauno::acquire::XDerived > const & obj) - throw (css::uno::RuntimeException) - { m_interface = obj; } - - virtual css::uno::Reference< css::uno::XInterface > - SAL_CALL getInterfaceFromInterface() throw (css::uno::RuntimeException) - { return m_interface; } - - virtual void SAL_CALL clearInterface() throw (css::uno::RuntimeException) - { m_interface.clear(); } - - virtual void SAL_CALL setBaseToBase( - css::uno::Reference< test::javauno::acquire::XBase > const & obj) - throw (css::uno::RuntimeException) - { m_base = obj; } - - virtual void SAL_CALL setDerivedToBase( - css::uno::Reference< test::javauno::acquire::XDerived > const & obj) - throw (css::uno::RuntimeException) - { m_base = obj.get(); } - - virtual css::uno::Reference< css::uno::XInterface > - SAL_CALL getInterfaceFromBase() throw (css::uno::RuntimeException) - { return m_base; } - - virtual css::uno::Reference< test::javauno::acquire::XBase > - SAL_CALL getBaseFromBase() throw (css::uno::RuntimeException) - { return m_base; } - - virtual void SAL_CALL clearBase() throw (css::uno::RuntimeException) - { m_base.clear(); } - - virtual void SAL_CALL setDerivedToDerived( - css::uno::Reference< test::javauno::acquire::XDerived > const & obj) - throw (css::uno::RuntimeException) - { m_derived = obj; } - - virtual css::uno::Reference< css::uno::XInterface > - SAL_CALL getInterfaceFromDerived() throw (css::uno::RuntimeException) - { return m_derived; } - - virtual css::uno::Reference< test::javauno::acquire::XBase > - SAL_CALL getBaseFromDerived() throw (css::uno::RuntimeException) - { return m_derived.get(); } - - virtual css::uno::Reference< test::javauno::acquire::XDerived > - SAL_CALL getDerivedFromDerived() throw (css::uno::RuntimeException) - { return m_derived; } - - virtual void SAL_CALL clearDerived() throw (css::uno::RuntimeException) - { m_derived.clear(); } - - virtual css::uno::Reference< css::uno::XInterface > - SAL_CALL roundTripInterfaceToInterface( - css::uno::Reference< css::uno::XInterface > const & obj) - throw (css::uno::RuntimeException) - { return obj; } - - virtual css::uno::Reference< css::uno::XInterface > - SAL_CALL roundTripBaseToInterface( - css::uno::Reference< test::javauno::acquire::XBase > const & obj) - throw (css::uno::RuntimeException) - { return obj; } - - virtual css::uno::Reference< css::uno::XInterface > - SAL_CALL roundTripDerivedToInterface( - css::uno::Reference< test::javauno::acquire::XDerived > const & obj) - throw (css::uno::RuntimeException) - { return obj; } - - virtual css::uno::Reference< test::javauno::acquire::XBase > - SAL_CALL roundTripBaseToBase( - css::uno::Reference< test::javauno::acquire::XBase > const & obj) - throw (css::uno::RuntimeException) - { return obj; } - - virtual css::uno::Reference< test::javauno::acquire::XBase > - SAL_CALL roundTripDerivedToBase( - css::uno::Reference< test::javauno::acquire::XDerived > const & obj) - throw (css::uno::RuntimeException) - { return obj.get(); } - - virtual css::uno::Reference< test::javauno::acquire::XDerived > - SAL_CALL roundTripDerivedToDerived( - css::uno::Reference< test::javauno::acquire::XDerived > const & obj) - throw (css::uno::RuntimeException) - { return obj; } - - static OUString getImplementationName_static(); - - static css::uno::Sequence< OUString > - getSupportedServiceNames_static(); - - static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( - css::uno::Reference< css::uno::XComponentContext > const & context) - throw (css::uno::Exception); - -private: - explicit Service( - css::uno::Reference< css::uno::XComponentContext > const & context): - m_context(context) {} - - css::uno::Reference< css::uno::XComponentContext > m_context; - css::uno::Reference< css::uno::XInterface > m_interface; - css::uno::Reference< test::javauno::acquire::XBase > m_base; - css::uno::Reference< test::javauno::acquire::XDerived > m_derived; -}; - -} - -sal_Bool Service::supportsService(OUString const & serviceName) - throw (css::uno::RuntimeException) -{ - return cppu::supportsService(this, serviceName); -} - -namespace { - -template< typename T > void assertNotNull(css::uno::Reference< T > const & ref) -{ - if (!ref.is()) { - std::cerr << "assertNotNull failed\n"; - std::abort(); - } -} - -} - -sal_Int32 Service::run(css::uno::Sequence< OUString > const & arguments) - throw (css::uno::RuntimeException) -{ - // - arguments[0] must be the UNO URL to connect to: - css::uno::Reference< XTest > test( - css::bridge::UnoUrlResolver::create(m_context)->resolve(arguments[0]), - css::uno::UNO_QUERY_THROW); - - { - WaitCondition c; - test->setInterfaceToInterface(new Interface(c.get())); - assertNotNull(test->getInterfaceFromInterface()); - test->clearInterface(); - } - { - WaitCondition c; - test->setInterfaceToInterface( - static_cast< Interface * >(new Base(c.get()))); - assertNotNull(test->getInterfaceFromInterface()); - test->clearInterface(); - } - { - WaitCondition c; - test->setInterfaceToInterface( - static_cast< Interface * >(new Derived(c.get()))); - assertNotNull(test->getInterfaceFromInterface()); - test->clearInterface(); - } - - { - WaitCondition c; - test->setBaseToInterface(new Base(c.get())); - assertNotNull(test->getInterfaceFromInterface()); - test->clearInterface(); - } - { - WaitCondition c; - test->setBaseToInterface(static_cast< Base * >(new Derived(c.get()))); - assertNotNull(test->getInterfaceFromInterface()); - test->clearInterface(); - } - - { - WaitCondition c; - test->setDerivedToInterface(new Derived(c.get())); - assertNotNull(test->getInterfaceFromInterface()); - test->clearInterface(); - } - - { - WaitCondition c; - test->setBaseToBase(new Base(c.get())); - assertNotNull(test->getInterfaceFromBase()); - assertNotNull(test->getBaseFromBase()); - test->clearBase(); - } - { - WaitCondition c; - test->setBaseToBase(static_cast< Base * >(new Derived(c.get()))); - assertNotNull(test->getInterfaceFromBase()); - assertNotNull(test->getBaseFromBase()); - test->clearBase(); - } - - { - WaitCondition c; - test->setDerivedToBase(new Derived(c.get())); - assertNotNull(test->getInterfaceFromBase()); - assertNotNull(test->getBaseFromBase()); - test->clearBase(); - } - - { - WaitCondition c; - test->setDerivedToDerived(new Derived(c.get())); - assertNotNull(test->getInterfaceFromDerived()); - assertNotNull(test->getBaseFromDerived()); - assertNotNull(test->getDerivedFromDerived()); - test->clearDerived(); - } - - { - WaitCondition c; - assertNotNull( - test->roundTripInterfaceToInterface(new Interface(c.get()))); - } - { - WaitCondition c; - assertNotNull(test->roundTripInterfaceToInterface( - static_cast< Interface * >(new Base(c.get())))); - } - { - WaitCondition c; - assertNotNull(test->roundTripInterfaceToInterface( - static_cast< Interface * >(new Derived(c.get())))); - } - - { - WaitCondition c; - assertNotNull(test->roundTripBaseToInterface(new Base(c.get()))); - } - { - WaitCondition c; - assertNotNull(test->roundTripBaseToInterface( - static_cast< Base * >(new Derived(c.get())))); - } - - { - WaitCondition c; - assertNotNull(test->roundTripDerivedToInterface(new Derived(c.get()))); - } - - { - WaitCondition c; - assertNotNull(test->roundTripBaseToBase(new Base(c.get()))); - } - { - WaitCondition c; - assertNotNull(test->roundTripBaseToBase( - static_cast< Base * >(new Derived(c.get())))); - } - - { - WaitCondition c; - assertNotNull(test->roundTripDerivedToBase(new Derived(c.get()))); - } - - { - WaitCondition c; - assertNotNull(test->roundTripDerivedToDerived(new Derived(c.get()))); - } - - std::cout << "Client and server both cleanly terminate now: Success\n"; - return 0; -} - -OUString Service::getImplementationName_static() { - return OUString( "com.sun.star.test.bridges.testacquire.impl" ); -} - -css::uno::Sequence< OUString > Service::getSupportedServiceNames_static() { - css::uno::Sequence< OUString > names { "com.sun.star.test.bridges.testacquire" }; - return names; -} - -css::uno::Reference< css::uno::XInterface > Service::createInstance( - css::uno::Reference< css::uno::XComponentContext > const & context) - throw (css::uno::Exception) -{ - return static_cast< cppu::OWeakObject * >(new Service(context)); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(char const * implName, - void * serviceManager, void *) { - void * p = 0; - if (serviceManager != 0) { - css::uno::Reference< css::lang::XSingleComponentFactory > f; - if (Service::getImplementationName_static().equalsAscii(implName)) { - f = cppu::createSingleComponentFactory( - &Service::createInstance, - Service::getImplementationName_static(), - Service::getSupportedServiceNames_static()); - } - if (f.is()) { - f->acquire(); - p = f.get(); - } - } - return p; -} - -namespace { - -bool writeInfo(void * registryKey, OUString const & implementationName, - css::uno::Sequence< OUString > const & serviceNames) { - OUString keyName( "/" ); - keyName += implementationName; - keyName += "/UNO/SERVICES"; - css::uno::Reference< css::registry::XRegistryKey > key; - try { - key = static_cast< css::registry::XRegistryKey * >(registryKey)-> - createKey(keyName); - } catch (css::registry::InvalidRegistryException &) {} - if (!key.is()) { - return false; - } - bool bSuccess = true; - for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) { - try { - key->createKey(serviceNames[i]); - } catch (css::registry::InvalidRegistryException &) { - bSuccess = false; - break; - } - } - return bSuccess; -} - -} - -extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) { - return registryKey - && writeInfo(registryKey, Service::getImplementationName_static(), - Service::getSupportedServiceNames_static()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/acquire/types.idl b/bridges/test/java_uno/acquire/types.idl deleted file mode 100644 index 295b52257d96..000000000000 --- a/bridges/test/java_uno/acquire/types.idl +++ /dev/null @@ -1,62 +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 - -module test { module java_uno { module acquire { - -interface XBase: com::sun::star::uno::XInterface {}; - -interface XDerived: XBase {}; - -interface XTest: com::sun::star::uno::XInterface -{ - void setInterfaceToInterface([in] com::sun::star::uno::XInterface obj); - void setBaseToInterface([in] XBase obj); - void setDerivedToInterface([in] XDerived obj); - com::sun::star::uno::XInterface getInterfaceFromInterface(); - void clearInterface(); - - void setBaseToBase([in] XBase obj); - void setDerivedToBase([in] XDerived obj); - com::sun::star::uno::XInterface getInterfaceFromBase(); - XBase getBaseFromBase(); - void clearBase(); - - void setDerivedToDerived([in] XDerived obj); - com::sun::star::uno::XInterface getInterfaceFromDerived(); - XBase getBaseFromDerived(); - XDerived getDerivedFromDerived(); - void clearDerived(); - - com::sun::star::uno::XInterface roundTripInterfaceToInterface( - [in] com::sun::star::uno::XInterface obj); - com::sun::star::uno::XInterface roundTripBaseToInterface([in] XBase obj); - com::sun::star::uno::XInterface roundTripDerivedToInterface( - [in] XDerived obj); - - XBase roundTripBaseToBase([in] XBase obj); - XBase roundTripDerivedToBase([in] XDerived obj); - - XDerived roundTripDerivedToDerived([in] XDerived obj); -}; - -}; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/any/TestAny.java b/bridges/test/java_uno/any/TestAny.java deleted file mode 100644 index dcc77fd5c2fb..000000000000 --- a/bridges/test/java_uno/any/TestAny.java +++ /dev/null @@ -1,2246 +0,0 @@ -/* - * 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 test.java_uno.any; - -import com.sun.star.uno.Any; -import com.sun.star.uno.Enum; -import com.sun.star.uno.Type; -import com.sun.star.uno.TypeClass; -import com.sun.star.uno.XInterface; -import java.lang.reflect.Array; -// "any" is a reserved word in IDL, so we need to use a different packagename -import test.java_uno.anytest.*; - -final class TestAny { - public static boolean test(XTransport transport, boolean createTypes) { - boolean success = true; - - // Sanity check for com.sun.star.uno.Type: - success &= testType(void.class, TypeClass.VOID, "void"); - success &= testType(boolean.class, TypeClass.BOOLEAN, "boolean"); - success &= testType(byte.class, TypeClass.BYTE, "byte"); - success &= testType(short.class, TypeClass.SHORT, "short"); - success &= testType(int.class, TypeClass.LONG, "long"); - success &= testType(long.class, TypeClass.HYPER, "hyper"); - success &= testType(float.class, TypeClass.FLOAT, "float"); - success &= testType(double.class, TypeClass.DOUBLE, "double"); - success &= testType(char.class, TypeClass.CHAR, "char"); - success &= testType(String.class, TypeClass.STRING, "string"); - success &= testType(Type.class, TypeClass.TYPE, "type"); - success &= testType(Any.class, TypeClass.ANY, "any"); - success &= testType(boolean[].class, TypeClass.SEQUENCE, "[]boolean"); - success &= testType(byte[].class, TypeClass.SEQUENCE, "[]byte"); - success &= testType(short[].class, TypeClass.SEQUENCE, "[]short"); - success &= testType(int[].class, TypeClass.SEQUENCE, "[]long"); - success &= testType(long[].class, TypeClass.SEQUENCE, "[]hyper"); - success &= testType(float[].class, TypeClass.SEQUENCE, "[]float"); - success &= testType(double[].class, TypeClass.SEQUENCE, "[]double"); - success &= testType(char[].class, TypeClass.SEQUENCE, "[]char"); - success &= testType(String[].class, TypeClass.SEQUENCE, "[]string"); - success &= testType(Type[].class, TypeClass.SEQUENCE, "[]type"); - success &= testType(Any[].class, TypeClass.SEQUENCE, "[]any"); - success &= testType(Enum1[].class, TypeClass.SEQUENCE, - "[]" + Enum1.class.getName()); - success &= testType(BaseStruct[].class, TypeClass.SEQUENCE, - "[]" + BaseStruct.class.getName()); - success &= testType(DerivedStruct[].class, TypeClass.SEQUENCE, - "[]" + DerivedStruct.class.getName()); - success &= testType(XInterface[].class, TypeClass.SEQUENCE, - "[]" + XInterface.class.getName()); - success &= testType(BaseInterface[].class, TypeClass.SEQUENCE, - "[]" + BaseInterface.class.getName()); - success &= testType(DerivedInterface[].class, TypeClass.SEQUENCE, - "[]" + DerivedInterface.class.getName()); - success &= testType(boolean[][].class, TypeClass.SEQUENCE, - "[][]boolean"); - success &= testType(byte[][].class, TypeClass.SEQUENCE, "[][]byte"); - success &= testType(short[][].class, TypeClass.SEQUENCE, "[][]short"); - success &= testType(int[][].class, TypeClass.SEQUENCE, "[][]long"); - success &= testType(long[][].class, TypeClass.SEQUENCE, "[][]hyper"); - success &= testType(float[][].class, TypeClass.SEQUENCE, "[][]float"); - success &= testType(double[][].class, TypeClass.SEQUENCE, "[][]double"); - success &= testType(char[][].class, TypeClass.SEQUENCE, "[][]char"); - success &= testType(String[][].class, TypeClass.SEQUENCE, "[][]string"); - success &= testType(Type[][].class, TypeClass.SEQUENCE, "[][]type"); - success &= testType(Any[][].class, TypeClass.SEQUENCE, "[][]any"); - success &= testType(Enum1[][].class, TypeClass.SEQUENCE, - "[][]" + Enum1.class.getName()); - success &= testType(BaseStruct[][].class, TypeClass.SEQUENCE, - "[][]" + BaseStruct.class.getName()); - success &= testType(DerivedStruct[][].class, TypeClass.SEQUENCE, - "[][]" + DerivedStruct.class.getName()); - success &= testType(XInterface[][].class, TypeClass.SEQUENCE, - "[][]" + XInterface.class.getName()); - success &= testType(BaseInterface[][].class, TypeClass.SEQUENCE, - "[][]" + BaseInterface.class.getName()); - success &= testType(DerivedInterface[][].class, TypeClass.SEQUENCE, - "[][]" + DerivedInterface.class.getName()); - success &= testType(Enum1.class, TypeClass.ENUM, Enum1.class.getName()); - success &= testType(BaseStruct.class, TypeClass.STRUCT, - BaseStruct.class.getName()); - success &= testType(DerivedStruct.class, TypeClass.STRUCT, - DerivedStruct.class.getName()); - success &= testType(com.sun.star.uno.Exception.class, - TypeClass.EXCEPTION, - com.sun.star.uno.Exception.class.getName()); - success &= testType(com.sun.star.uno.RuntimeException.class, - TypeClass.EXCEPTION, - com.sun.star.uno.RuntimeException.class.getName()); - success &= testType(XInterface.class, TypeClass.INTERFACE, - XInterface.class.getName()); - success &= testType(BaseInterface.class, TypeClass.INTERFACE, - BaseInterface.class.getName()); - success &= testType(DerivedInterface.class, TypeClass.INTERFACE, - DerivedInterface.class.getName()); - - // VOID: - success &= testMapAny(transport, Any.VOID, new CompareBoxed()); - - // BOOLEAN: - success &= testMapAny(transport, Boolean.FALSE, new CompareBoxed()); - success &= testMapAny(transport, Boolean.TRUE, new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.BOOLEAN, Boolean.FALSE), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.BOOLEAN, Boolean.TRUE), - new CompareUnboxed()); - - // BYTE: - success &= testMapAny(transport, Byte.valueOf((byte) -128), - new CompareBoxed()); - success &= testMapAny(transport, Byte.valueOf((byte) 0), - new CompareBoxed()); - success &= testMapAny(transport, Byte.valueOf((byte) 127), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.BYTE, Byte.valueOf((byte) -128)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.BYTE, Byte.valueOf((byte) 0)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.BYTE, Byte.valueOf((byte) 127)), - new CompareUnboxed()); - - // SHORT: - success &= testMapAny(transport, Short.valueOf((short) -32768), - new CompareBoxed()); - success &= testMapAny(transport, Short.valueOf((short) 0), - new CompareBoxed()); - success &= testMapAny(transport, Short.valueOf((short) 32767), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.SHORT, - Short.valueOf((short) -32768)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.SHORT, Short.valueOf((short) 0)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.SHORT, Short.valueOf((short) 32767)), - new CompareUnboxed()); - - // UNSIGNED SHORT: - success &= testMapAny(transport, - new Any(Type.UNSIGNED_SHORT, - Short.valueOf((short) 0)), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.UNSIGNED_SHORT, - Short.valueOf((short) -32768)), - new CompareBoxed()); - - // LONG: - success &= testMapAny(transport, Integer.valueOf(-2147483648), - new CompareBoxed()); - success &= testMapAny(transport, Integer.valueOf(0), - new CompareBoxed()); - success &= testMapAny(transport, Integer.valueOf(2147483647), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.LONG, Integer.valueOf(-2147483648)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.LONG, Integer.valueOf(0)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.LONG, Integer.valueOf(2147483647)), - new CompareUnboxed()); - - // UNSIGNED LONG: - success &= testMapAny(transport, - new Any(Type.UNSIGNED_LONG, Integer.valueOf(0)), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.UNSIGNED_LONG, - Integer.valueOf(-2147483648)), - new CompareBoxed()); - - // HYPER: - success &= testMapAny(transport, Long.valueOf(-9223372036854775808L), - new CompareBoxed()); - success &= testMapAny(transport, Long.valueOf(0L), new CompareBoxed()); - success &= testMapAny(transport, Long.valueOf(9223372036854775807L), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.HYPER, - Long.valueOf(-9223372036854775808L)), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.HYPER, Long.valueOf(0L)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.HYPER, - Long.valueOf(9223372036854775807L)), - new CompareUnboxed()); - - // UNSIGNED HYPER: - success &= testMapAny(transport, - new Any(Type.UNSIGNED_HYPER, Long.valueOf(0L)), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.UNSIGNED_HYPER, - Long.valueOf(-9223372036854775808L)), - new CompareBoxed()); - - // FLOAT: - success &= testMapAny(transport, new Float(Float.NEGATIVE_INFINITY), - new CompareBoxed()); - success &= testMapAny(transport, new Float(Float.MIN_VALUE), - new CompareBoxed()); - success &= testMapAny(transport, new Float(-0.0f), - new CompareBoxed()); - success &= testMapAny(transport, new Float(0.0f), - new CompareBoxed()); - success &= testMapAny(transport, new Float(Float.MAX_VALUE), - new CompareBoxed()); - success &= testMapAny(transport, new Float(Float.POSITIVE_INFINITY), - new CompareBoxed()); - success &= testMapAny(transport, new Float(Float.NaN), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, - new Float(Float.NEGATIVE_INFINITY)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, - new Float(Float.MIN_VALUE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, new Float(-0.0f)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, new Float(0.0f)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, - new Float(Float.MAX_VALUE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, - new Float(Float.POSITIVE_INFINITY)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.FLOAT, new Float(Float.NaN)), - new CompareUnboxed()); - - // DOUBLE: - success &= testMapAny(transport, - new Double(Double.NEGATIVE_INFINITY), - new CompareBoxed()); - success &= testMapAny(transport, new Double(Double.MIN_VALUE), - new CompareBoxed()); - success &= testMapAny(transport, new Double(-0.0f), - new CompareBoxed()); - success &= testMapAny(transport, new Double(0.0f), - new CompareBoxed()); - success &= testMapAny(transport, new Double(Double.MAX_VALUE), - new CompareBoxed()); - success &= testMapAny(transport, - new Double(Double.POSITIVE_INFINITY), - new CompareBoxed()); - success &= testMapAny(transport, new Double(Double.NaN), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, - new Double(Double.NEGATIVE_INFINITY)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, - new Double(Double.MIN_VALUE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, new Double(-0.0)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, new Double(0.0)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, - new Double(Double.MAX_VALUE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, - new Double(Double.POSITIVE_INFINITY)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.DOUBLE, new Double(Double.NaN)), - new CompareUnboxed()); - - // CHAR: - success &= testMapAny(transport, new Character('\u0000'), - new CompareBoxed()); - success &= testMapAny(transport, new Character('\uDBFF'), - new CompareBoxed()); - success &= testMapAny(transport, new Character('\uFFFD'), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(Type.CHAR, new Character('\u0000')), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.CHAR, new Character('\uDBFF')), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.CHAR, new Character('\uFFFD')), - new CompareUnboxed()); - - // STRING: - success &= testMapAny(transport, "", new CompareBoxed()); - success &= testMapAny(transport, "\uD800\uDC00", - new CompareBoxed()); - success &= testMapAny(transport, "Test", new CompareBoxed()); - success &= testMapAny(transport, new Any(Type.STRING, ""), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.STRING, "\uD800\uDC00"), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.STRING, "Test"), - new CompareUnboxed()); - - // TYPE: - success &= testMapAny(transport, Type.VOID, new CompareBoxed()); - success &= testMapAny(transport, Type.BOOLEAN, new CompareBoxed()); - success &= testMapAny(transport, Type.BYTE, new CompareBoxed()); - success &= testMapAny(transport, Type.SHORT, new CompareBoxed()); - success &= testMapAny(transport, Type.UNSIGNED_SHORT, - new CompareBoxed()); - success &= testMapAny(transport, Type.LONG, new CompareBoxed()); - success &= testMapAny(transport, Type.UNSIGNED_LONG, - new CompareBoxed()); - success &= testMapAny(transport, Type.HYPER, new CompareBoxed()); - success &= testMapAny(transport, Type.UNSIGNED_HYPER, - new CompareBoxed()); - success &= testMapAny(transport, Type.FLOAT, new CompareBoxed()); - success &= testMapAny(transport, Type.DOUBLE, new CompareBoxed()); - success &= testMapAny(transport, Type.CHAR, new CompareBoxed()); - success &= testMapAny(transport, Type.STRING, new CompareBoxed()); - success &= testMapAny(transport, Type.TYPE, new CompareBoxed()); - success &= testMapAny(transport, Type.ANY, new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]boolean", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]byte", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]short", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]unsigned short", - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]long", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]unsigned long", - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]hyper", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]unsigned hyper", - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]float", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]double", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]char", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]string", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]type", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]any", TypeClass.SEQUENCE), - new CompareBoxed()); - if (createTypes) { - success &= testMapAny(transport, - new Type("[]" + Enum1.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]" + BaseStruct.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]" + DerivedStruct.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - } - success &= testMapAny(transport, - new Type("[]" + XInterface.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]" + BaseInterface.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[]" - + DerivedInterface.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]boolean", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]byte", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]short", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]unsigned short", - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]long", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]unsigned long", - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]hyper", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]unsigned hyper", - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]float", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]double", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]char", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]string", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]type", TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]any", TypeClass.SEQUENCE), - new CompareBoxed()); - if (createTypes) { - success &= testMapAny(transport, - new Type("[][]" + Enum1.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]" + BaseStruct.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]" - + DerivedStruct.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - } - success &= testMapAny(transport, - new Type("[][]" + XInterface.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]" - + BaseInterface.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type("[][]" - + DerivedInterface.class.getName(), - TypeClass.SEQUENCE), - new CompareBoxed()); - if (createTypes) { - success &= testMapAny(transport, new Type(Enum1.class.getName(), - TypeClass.ENUM), - new CompareBoxed()); - success &= testMapAny(transport, - new Type(BaseStruct.class.getName(), - TypeClass.STRUCT), - new CompareBoxed()); - success &= testMapAny(transport, - new Type(DerivedStruct.class.getName(), - TypeClass.STRUCT), - new CompareBoxed()); - } - success &= testMapAny(transport, - new Type( - com.sun.star.uno.Exception.class. - getName(), - TypeClass.EXCEPTION), - new CompareBoxed()); - if (createTypes) { - success &= testMapAny(transport, - new Type(BaseException.class.getName(), - TypeClass.EXCEPTION), - new CompareBoxed()); - success &= testMapAny(transport, - new Type(DerivedException.class.getName(), - TypeClass.EXCEPTION), - new CompareBoxed()); - } - success &= testMapAny(transport, - new Type( - com.sun.star.uno.RuntimeException.class. - getName(), - TypeClass.EXCEPTION), - new CompareBoxed()); - if (createTypes) { - success &= testMapAny(transport, - new Type( - BaseRuntimeException.class.getName(), - TypeClass.EXCEPTION), - new CompareBoxed()); - success &= testMapAny(transport, - new Type( - DerivedRuntimeException.class. - getName(), - TypeClass.EXCEPTION), - new CompareBoxed()); - } - success &= testMapAny(transport, - new Type(XInterface.class.getName(), - TypeClass.INTERFACE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type(BaseInterface.class.getName(), - TypeClass.INTERFACE), - new CompareBoxed()); - success &= testMapAny(transport, - new Type(DerivedInterface.class.getName(), - TypeClass.INTERFACE), - new CompareBoxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.VOID), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.BOOLEAN), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.BYTE), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.SHORT), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, Type.UNSIGNED_SHORT), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.LONG), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, Type.UNSIGNED_LONG), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.HYPER), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, Type.UNSIGNED_HYPER), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.FLOAT), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.DOUBLE), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.CHAR), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.STRING), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.TYPE), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(Type.TYPE, Type.ANY), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]boolean", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]byte", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]short", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]unsigned short", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]long", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]unsigned long", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]hyper", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]unsigned hyper", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]float", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]double", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]char", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]string", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]type", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]any", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - if (createTypes) { - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]" + Enum1.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]" - + BaseStruct.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - "[]" - + DerivedStruct.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[]" - + XInterface.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - "[]" - + BaseInterface.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - "[]" - + DerivedInterface.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]boolean", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]byte", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]short", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]unsigned short", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]long", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]unsigned long", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]hyper", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]unsigned hyper", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]float", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]double", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]char", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]string", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]type", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]any", - TypeClass.SEQUENCE)), - new CompareUnboxed()); - if (createTypes) { - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]" - + Enum1.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]" - + BaseStruct.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - "[][]" - + DerivedStruct.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type("[][]" - + XInterface.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - "[][]" - + BaseInterface.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - "[][]" - + DerivedInterface.class.getName(), - TypeClass.SEQUENCE)), - new CompareUnboxed()); - if (createTypes) { - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type(Enum1.class.getName(), - TypeClass.ENUM)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type(BaseStruct.class.getName(), - TypeClass.STRUCT)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - DerivedStruct.class.getName(), - TypeClass.STRUCT)), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - com.sun.star.uno.Exception.class. - getName(), - TypeClass.EXCEPTION)), - new CompareUnboxed()); - if (createTypes) { - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - BaseException.class.getName(), - TypeClass.EXCEPTION)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - DerivedException.class.getName(), - TypeClass.EXCEPTION)), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - com.sun.star.uno.RuntimeException. - class.getName(), - TypeClass.EXCEPTION)), - new CompareUnboxed()); - if (createTypes) { - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - BaseRuntimeException.class. - getName(), - TypeClass.EXCEPTION)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - Type.TYPE, - new Type( - DerivedRuntimeException.class. - getName(), - TypeClass.EXCEPTION)), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type(XInterface.class.getName(), - TypeClass.INTERFACE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - BaseInterface.class.getName(), - TypeClass.INTERFACE)), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(Type.TYPE, - new Type( - DerivedInterface.class.getName(), - TypeClass.INTERFACE)), - new CompareUnboxed()); - - // Sequence Types: - success &= testMapAny(transport, new boolean[] {}, - new CompareBoxed()); - success &= testMapAny(transport, new boolean[] { false, true }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(boolean[].class), - new boolean[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(boolean[].class), - new boolean[] { false, true }), - new CompareUnboxed()); - success &= testMapAny(transport, new byte[] {}, - new CompareBoxed()); - success &= testMapAny(transport, new byte[] { -128, 0, 127 }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(byte[].class), - new byte[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(byte[].class), - new byte[] { -128, 0, 127 }), - new CompareUnboxed()); - success &= testMapAny(transport, new short[] {}, - new CompareBoxed()); - success &= testMapAny(transport, new short[] { -32768, 0, 32767 }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(short[].class), - new short[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(short[].class), - new short[] { -32768, 0, 32767 }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type("[]unsigned short", - TypeClass.SEQUENCE), - new short[] {}), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type("[]unsigned short", - TypeClass.SEQUENCE), - new short[] { 0, -32768 }), - new CompareBoxed()); - success &= testMapAny(transport, new int[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new int[] { -2147483648, 0, 2147483647 }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(int[].class), - new int[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(int[].class), - new int[] { -2147483648, 0, - 2147483647 }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type("[]unsigned long", - TypeClass.SEQUENCE), - new int[] {}), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type("[]unsigned long", - TypeClass.SEQUENCE), - new int[] { 0, -2147483648 }), - new CompareBoxed()); - success &= testMapAny(transport, new long[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new long[] { -9223372036854775808L, 0L, - 9223372036854775807L }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(long[].class), - new long[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(long[].class), - new long[] { -9223372036854775808L, - 0L, - 9223372036854775807L }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type("[]unsigned hyper", - TypeClass.SEQUENCE), - new long[] {}), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type("[]unsigned hyper", - TypeClass.SEQUENCE), - new long[] { 0L, - -9223372036854775808L }), - new CompareBoxed()); - success &= testMapAny(transport, new float[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new float[] { Float.NEGATIVE_INFINITY, - Float.MIN_VALUE, -0.0f, 0.0f, - Float.MAX_VALUE, - Float.POSITIVE_INFINITY, - Float.NaN }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(float[].class), - new float[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(float[].class), - new float[] { Float.NEGATIVE_INFINITY, - Float.MIN_VALUE, -0.0f, - 0.0f, Float.MAX_VALUE, - Float.POSITIVE_INFINITY, - Float.NaN }), - new CompareUnboxed()); - success &= testMapAny(transport, new double[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new double[] { Double.NEGATIVE_INFINITY, - Double.MIN_VALUE, -0.0, 0.0, - Double.MAX_VALUE, - Double.POSITIVE_INFINITY, - Double.NaN }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(double[].class), - new double[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(double[].class), - new double[] { - Double.NEGATIVE_INFINITY, - Double.MIN_VALUE, -0.0, 0.0, - Double.MAX_VALUE, - Double.POSITIVE_INFINITY, - Double.NaN }), - new CompareUnboxed()); - success &= testMapAny(transport, new char[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new char[] { '\u0000', '\uDBFF', '\uFFFD' }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(char[].class), - new char[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(char[].class), - new char[] { '\u0000', '\uDBFF', - '\uFFFD' }), - new CompareUnboxed()); - success &= testMapAny(transport, new String[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new String[] { "", "\uD800\uDC00", "Test" }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(String[].class), - new String[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(String[].class), - new String[] { "", "\uD800\uDC00", - "Test" }), - new CompareUnboxed()); - success &= testMapAny(transport, new Type[] {}, new CompareBoxed()); - success &= testMapAny(transport, - new Type[] { - Type.VOID, - new Type(DerivedInterface.class.getName(), - TypeClass.INTERFACE) }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(Type[].class), - new Type[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(Type[].class), - new Type[] { - Type.VOID, - new Type( - DerivedInterface.class.getName(), - TypeClass.INTERFACE) }), - new CompareUnboxed()); - success &= testMapAny(transport, new Object[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new Object[] { Any.VOID, Boolean.FALSE }, - new CompareBoxed()); - success &= testMapAny(transport, - new Object[] { - Boolean.FALSE, - new Any(Type.BOOLEAN, Boolean.TRUE) }, - new CompareBoxed(true)); - success &= testMapAny(transport, - new Any(new Type(Any[].class), - new Object[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(Any[].class), - new Object[] { Any.VOID, - Boolean.FALSE }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(Any[].class), - new Object[] { - Boolean.FALSE, - new Any(Type.BOOLEAN, - Boolean.TRUE) }), - new CompareUnboxed(true)); - success &= testMapAny(transport, new Any[] {}, - new CompareSpecific(new Object[] {})); - success &= testMapAny(transport, - new Any[] { Any.VOID, - new Any(Type.BOOLEAN, - Boolean.TRUE) }, - new CompareSpecific( - new Object[] { Any.VOID, Boolean.TRUE })); - success &= testMapAny(transport, - new Any(new Type(Any[].class), new Any[] {}), - new CompareSpecific(new Object[] {})); - success &= testMapAny(transport, - new Any(new Type(Any[].class), - new Any[] { Any.VOID, - new Any(Type.BOOLEAN, - Boolean.TRUE) }), - new CompareSpecific( - new Object[] { Any.VOID, Boolean.TRUE })); - success &= testMapAny(transport, - new Any(new Type(Any[].class), - new Boolean[] {}), - new CompareSpecific(new Object[] {})); - success &= testMapAny(transport, - new Any(new Type(Any[].class), - new Boolean[] { Boolean.FALSE }), - new CompareSpecific( - new Object[] { Boolean.FALSE })); - if (createTypes) { - success &= testMapAny(transport, new Enum1[] {}, - new CompareBoxed()); - success &= testMapAny(transport, new Enum1[] { new Enum1(), - new Enum2() }, - new CompareSpecific( - new Enum1[] { new Enum1(), - new Enum1() })); - success &= testMapAny(transport, - new Any(new Type(Enum1[].class), - new Enum1[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(Enum1[].class), - new Enum1[] { new Enum1(), - new Enum2() }), - new CompareSpecific( - new Enum1[] { new Enum1(), - new Enum1() })); - success &= testMapAny(transport, - new Any(new Type(Enum1[].class), - new Enum2[] {}), - new CompareSpecific(new Enum1[] {})); - success &= testMapAny(transport, - new Any(new Type(Enum1[].class), - new Enum2[] { new Enum2() }), - new CompareSpecific( - new Enum1[] { new Enum1() })); - success &= testMapAny(transport, new BaseStruct[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new BaseStruct[] { new BaseStruct(), - new DerivedStruct() }, - new CompareSpecific( - new BaseStruct[] { new BaseStruct(), - new BaseStruct() })); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[].class), - new BaseStruct[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[].class), - new BaseStruct[] { - new BaseStruct(), - new DerivedStruct() }), - new CompareSpecific( - new BaseStruct[] { new BaseStruct(), - new BaseStruct() })); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[].class), - new DerivedStruct[] {}), - new CompareSpecific(new BaseStruct[] {})); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[].class), - new DerivedStruct[] { - new DerivedStruct() }), - new CompareSpecific( - new BaseStruct[] { new BaseStruct() })); - success &= testMapAny(transport, new DerivedStruct[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new DerivedStruct[] { new DerivedStruct() }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedStruct[].class), - new DerivedStruct[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedStruct[].class), - new DerivedStruct[] { - new DerivedStruct() }), - new CompareUnboxed()); - } - success &= testMapAny(transport, new XInterface[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new XInterface[] { - null, new XInterface() {}, - new BaseInterface() {}, - new DerivedInterface() {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new XInterface[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new XInterface[] { - null, new XInterface() {}, - new BaseInterface() {}, - new DerivedInterface() {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new Object[] {}), - new CompareSpecific(new XInterface[] {})); - { - XInterface if1 = new XInterface() {}; - XInterface if2 = new BaseInterface() {}; - XInterface if3 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new Object[] { null, if1, if2, - if3 }), - new CompareSpecific( - new XInterface[] { null, if1, if2, - if3 })); - } - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new BaseInterface[] {}), - new CompareSpecific(new XInterface[] {})); - { - BaseInterface if1 = new BaseInterface() {}; - BaseInterface if2 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new BaseInterface[] { null, if1, - if2 }), - new CompareSpecific( - new XInterface[] { null, if1, if2 })); - } - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new DerivedInterface[] {}), - new CompareSpecific(new XInterface[] {})); - { - DerivedInterface if1 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(XInterface[].class), - new DerivedInterface[] { null, - if1 }), - new CompareSpecific( - new XInterface[] { null, if1 })); - } - success &= testMapAny(transport, new BaseInterface[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new BaseInterface[] { - null, new BaseInterface() {}, - new DerivedInterface() {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface[].class), - new BaseInterface[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface[].class), - new BaseInterface[] { - null, new BaseInterface() {}, - new DerivedInterface() {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface[].class), - new DerivedInterface[] {}), - new CompareSpecific(new BaseInterface[] {})); - { - DerivedInterface if1 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(BaseInterface[].class), - new DerivedInterface[] { null, - if1 }), - new CompareSpecific( - new BaseInterface[] { null, if1 })); - } - success &= testMapAny(transport, new DerivedInterface[] {}, - new CompareBoxed()); - success &= testMapAny(transport, - new DerivedInterface[] { - null, new DerivedInterface() {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedInterface[].class), - new DerivedInterface[] {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedInterface[].class), - new DerivedInterface[] { - null, - new DerivedInterface() {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new boolean[][] { new boolean[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new boolean[][] { - new boolean[] { false, true } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(boolean[][].class), - new boolean[][] { new boolean[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(boolean[][].class), - new boolean[][] { - new boolean[] { false, true } }), - new CompareUnboxed()); - success &= testMapAny(transport, new byte[][] { new byte[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new byte[][] { new byte[] { -128, 0, 127 } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(byte[][].class), - new byte[][] { new byte[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(byte[][].class), - new byte[][] { - new byte[] { -128, 0, 127 } }), - new CompareUnboxed()); - success &= testMapAny(transport, new short[][] { new short[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new short[][] { - new short[] { -32768, 0, 32767 } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(short[][].class), - new short[][] { new short[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(short[][].class), - new short[][] { - new short[] { -32768, 0, - 32767 } }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type("[][]unsigned short", - TypeClass.SEQUENCE), - new short[][] { new short[] {} }), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type("[][]unsigned short", - TypeClass.SEQUENCE), - new short[][] { - new short[] { 0, -32768 } }), - new CompareBoxed()); - success &= testMapAny(transport, new int[][] { new int[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new int[][] { new int[] { -2147483648, 0, - 2147483647 } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(int[][].class), - new int[][] { new int[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(int[][].class), - new int[][] { - new int[] { -2147483648, 0, - 2147483647 } }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type("[][]unsigned long", - TypeClass.SEQUENCE), - new int[][] { new int[] {} }), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type("[][]unsigned long", - TypeClass.SEQUENCE), - new int[][] { - new int[] { 0, -2147483648 } }), - new CompareBoxed()); - success &= testMapAny(transport, new long[][] { new long[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new long[][] { - new long[] { -9223372036854775808L, 0L, - 9223372036854775807L } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(long[][].class), - new long[][] { new long[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(long[][].class), - new long[][] { - new long[] { - -9223372036854775808L, 0L, - 9223372036854775807L } }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type("[][]unsigned hyper", - TypeClass.SEQUENCE), - new long[][] { new long[] {} }), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type("[][]unsigned hyper", - TypeClass.SEQUENCE), - new long[][] { - new long[] { - 0L, - -9223372036854775808L } }), - new CompareBoxed()); - success &= testMapAny(transport, new float[][] { new float[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new float[][] { - new float[] { Float.NEGATIVE_INFINITY, - Float.MIN_VALUE, -0.0f, - 0.0f, Float.MAX_VALUE, - Float.POSITIVE_INFINITY, - Float.NaN } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(float[][].class), - new float[][] { new float[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(float[][].class), - new float[][] { - new float[] { - Float.NEGATIVE_INFINITY, - Float.MIN_VALUE, -0.0f, 0.0f, - Float.MAX_VALUE, - Float.POSITIVE_INFINITY, - Float.NaN } }), - new CompareUnboxed()); - success &= testMapAny(transport, new double[][] { new double[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new double[][] { - new double[] { Double.NEGATIVE_INFINITY, - Double.MIN_VALUE, -0.0, - 0.0, Double.MAX_VALUE, - Double.POSITIVE_INFINITY, - Double.NaN } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(double[][].class), - new double[][] { new double[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(double[][].class), - new double[][] { - new double[] { - Double.NEGATIVE_INFINITY, - Double.MIN_VALUE, -0.0, 0.0, - Double.MAX_VALUE, - Double.POSITIVE_INFINITY, - Double.NaN } }), - new CompareUnboxed()); - success &= testMapAny(transport, new char[][] { new char[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new char[][] { - new char[] { '\u0000', '\uDBFF', - '\uFFFD' } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(char[][].class), - new char[][] { new char[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(char[][].class), - new char[][] { - new char[] { '\u0000', '\uDBFF', - '\uFFFD' } }), - new CompareUnboxed()); - success &= testMapAny(transport, new String[][] { new String[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new String[][] { - new String[] { "", "\uD800\uDC00", - "Test" } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(String[][].class), - new String[][] { new String[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(String[][].class), - new String[][] { - new String[] { "", "\uD800\uDC00", - "Test" } }), - new CompareUnboxed()); - success &= testMapAny(transport, new Type[][] { new Type[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new Type[][] { - new Type[] { - Type.VOID, - new Type( - DerivedInterface.class.getName(), - TypeClass.INTERFACE) } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(Type[][].class), - new Type[][] { new Type[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(Type[][].class), - new Type[][] { - new Type[] { - Type.VOID, - new Type( - DerivedInterface.class. - getName(), - TypeClass.INTERFACE) } }), - new CompareUnboxed()); - success &= testMapAny(transport, new Object[][] { new Object[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new Object[][] { - new Object[] { Any.VOID, - Boolean.FALSE } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Object[][] { - new Object[] { - Boolean.FALSE, - new Any(Type.BOOLEAN, - Boolean.TRUE) } }, - new CompareBoxed(true)); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Object[][] { new Object[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Object[][] { - new Object[] { Any.VOID, - Boolean.FALSE } }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Object[][] { - new Object[] { - Boolean.FALSE, - new Any(Type.BOOLEAN, - Boolean.TRUE) } }), - new CompareUnboxed(true)); - success &= testMapAny(transport, new Any[][] { new Any[] {} }, - new CompareSpecific( - new Object[][] { new Object[] {} })); - success &= testMapAny(transport, - new Any[][] { - new Any[] { Any.VOID, - new Any(Type.BOOLEAN, - Boolean.TRUE) } }, - new CompareSpecific( - new Object[][] { - new Object[] { Any.VOID, - Boolean.TRUE } })); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Any[][] { new Any[] {} }), - new CompareSpecific( - new Object[][] { new Object[] {} })); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Any[][] { - new Any[] { - Any.VOID, - new Any(Type.BOOLEAN, - Boolean.TRUE) } }), - new CompareSpecific( - new Object[][] { - new Object[] { Any.VOID, - Boolean.TRUE } })); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Boolean[][] { new Boolean[] {} }), - new CompareSpecific( - new Object[][] { new Object[] {} })); - success &= testMapAny(transport, - new Any(new Type(Any[][].class), - new Boolean[][] { - new Boolean[] { - Boolean.FALSE } }), - new CompareSpecific( - new Object[][] { - new Object[] { Boolean.FALSE } })); - if (createTypes) { - success &= testMapAny(transport, new Enum1[][] { new Enum1[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new Enum1[][] { - new Enum1[] { new Enum1(), - new Enum2() } }, - new CompareSpecific( - new Enum1[][] { - new Enum1[] { new Enum1(), - new Enum1() } })); - success &= testMapAny(transport, - new Any(new Type(Enum1[][].class), - new Enum1[][] { new Enum1[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(Enum1[][].class), - new Enum1[][] { - new Enum1[] { new Enum1(), - new Enum2() } }), - new CompareSpecific( - new Enum1[][] { - new Enum1[] { new Enum1(), - new Enum1() } })); - success &= testMapAny(transport, - new Any(new Type(Enum1[][].class), - new Enum2[][] { new Enum2[] {} }), - new CompareSpecific( - new Enum1[][] { new Enum1[] {} })); - success &= testMapAny(transport, - new Any(new Type(Enum1[][].class), - new Enum2[][] { - new Enum2[] { new Enum2() } }), - new CompareSpecific( - new Enum1[][] { - new Enum1[] { new Enum1() } })); - success &= testMapAny(transport, - new BaseStruct[][] { new BaseStruct[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new BaseStruct[][] { - new BaseStruct[] { - new BaseStruct(), - new DerivedStruct() } }, - new CompareSpecific( - new BaseStruct[][] { - new BaseStruct[] { - new BaseStruct(), - new BaseStruct() } })); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[][].class), - new BaseStruct[][] { - new BaseStruct[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[][].class), - new BaseStruct[][] { - new BaseStruct[] { - new BaseStruct(), - new DerivedStruct() } }), - new CompareSpecific( - new BaseStruct[][] { - new BaseStruct[] { - new BaseStruct(), - new BaseStruct() } })); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[][].class), - new DerivedStruct[][] { - new DerivedStruct[] {} }), - new CompareSpecific( - new BaseStruct[][] { - new BaseStruct[] {} })); - success &= testMapAny(transport, - new Any(new Type(BaseStruct[][].class), - new DerivedStruct[][] { - new DerivedStruct[] { - new DerivedStruct() } }), - new CompareSpecific( - new BaseStruct[][] { - new BaseStruct[] { - new BaseStruct() } })); - success &= testMapAny(transport, - new DerivedStruct[][] { - new DerivedStruct[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new DerivedStruct[][] { - new DerivedStruct[] { - new DerivedStruct() } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedStruct[][].class), - new DerivedStruct[][] { - new DerivedStruct[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedStruct[][].class), - new DerivedStruct[][] { - new DerivedStruct[] { - new DerivedStruct() } }), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new XInterface[][] { new XInterface[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new XInterface[][] { - new XInterface[] { - null, new XInterface() {}, - new BaseInterface() {}, - new DerivedInterface() {} } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new XInterface[][] { - new XInterface[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(XInterface[][].class), - new XInterface[][] { - new XInterface[] { - null, new XInterface() {}, - new BaseInterface() {}, - new DerivedInterface() {} } }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new Object[][] { new Object[] {} }), - new CompareSpecific( - new XInterface[][] { - new XInterface[] {} })); - { - XInterface if1 = new XInterface() {}; - XInterface if2 = new BaseInterface() {}; - XInterface if3 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new Object[][] { - new Object[] { null, if1, if2, - if3 } }), - new CompareSpecific( - new XInterface[][] { - new XInterface[] { null, if1, if2, - if3 } })); - } - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new BaseInterface[][] { - new BaseInterface[] {} }), - new CompareSpecific( - new XInterface[][] { - new XInterface[] {} })); - { - BaseInterface if1 = new BaseInterface() {}; - BaseInterface if2 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new BaseInterface[][] { - new BaseInterface[] { - null, if1, if2 } }), - new CompareSpecific( - new XInterface[][] { - new XInterface[] { - null, if1, if2 } })); - } - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new DerivedInterface[][] { - new DerivedInterface[] {} }), - new CompareSpecific( - new XInterface[][] { - new XInterface[] {} })); - { - DerivedInterface if1 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(XInterface[][].class), - new DerivedInterface[][] { - new DerivedInterface[] { - null, if1 } }), - new CompareSpecific( - new XInterface[][] { - new XInterface[] { - null, if1 } })); - } - success &= testMapAny(transport, - new BaseInterface[][] { - new BaseInterface[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new BaseInterface[][] { - new BaseInterface[] { - null, new BaseInterface() {}, - new DerivedInterface() {} } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface[][].class), - new BaseInterface[][] { - new BaseInterface[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(BaseInterface[][].class), - new BaseInterface[][] { - new BaseInterface[] { - null, new BaseInterface() {}, - new DerivedInterface() {} } }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface[][].class), - new DerivedInterface[][] { - new DerivedInterface[] {} }), - new CompareSpecific( - new BaseInterface[][] { - new BaseInterface[] {} })); - { - DerivedInterface if1 = new DerivedInterface() {}; - success &= testMapAny(transport, - new Any(new Type(BaseInterface[][].class), - new DerivedInterface[][] { - new DerivedInterface[] { - null, if1 } }), - new CompareSpecific( - new BaseInterface[][] { - new BaseInterface[] { - null, if1 } })); - } - success &= testMapAny(transport, - new DerivedInterface[][] { - new DerivedInterface[] {} }, - new CompareBoxed()); - success &= testMapAny(transport, - new DerivedInterface[][] { - new DerivedInterface[] { - null, new DerivedInterface() {} } }, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedInterface[][].class), - new DerivedInterface[][] { - new DerivedInterface[] {} }), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any( - new Type(DerivedInterface[][].class), - new DerivedInterface[][] { - new DerivedInterface[] { - null, - new DerivedInterface() {} } }), - new CompareUnboxed()); - - // Enum Types: - if (createTypes) { - success &= testMapAny(transport, new Enum1(), new CompareBoxed()); - success &= testMapAny(transport, new Any(new Type(Enum1.class), - new Enum1()), - new CompareUnboxed()); - success &= testMapAny(transport, new Any(new Type(Enum1.class), - new Enum2()), - new CompareSpecific(new Enum1())); - } - - // Struct Types: - if (createTypes) { - success &= testMapAny(transport, new BaseStruct(), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(BaseStruct.class), - new BaseStruct()), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseStruct.class), - new DerivedStruct()), - new CompareSpecific(new BaseStruct())); - success &= testMapAny(transport, new DerivedStruct(), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedStruct.class), - new DerivedStruct()), - new CompareUnboxed()); - } - - // Exception Types: - success &= testMapAny(transport, new com.sun.star.uno.Exception(), - new CompareClass( - com.sun.star.uno.Exception.class)); - success &= testMapAny(transport, - new Any(new Type( - com.sun.star.uno.Exception.class), - new com.sun.star.uno.Exception()), - new CompareClass( - com.sun.star.uno.Exception.class)); - success &= testMapAny(transport, - new Any(new Type( - com.sun.star.uno.Exception.class), - new BaseException()), - new CompareClass( - com.sun.star.uno.Exception.class)); - success &= testMapAny(transport, - new Any(new Type( - com.sun.star.uno.Exception.class), - new DerivedException()), - new CompareClass( - com.sun.star.uno.Exception.class)); - if (createTypes) { - success &= testMapAny(transport, new BaseException(), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(BaseException.class), - new BaseException()), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseException.class), - new DerivedException()), - new CompareSpecific(new BaseException())); - success &= testMapAny(transport, new DerivedException(), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedException.class), - new DerivedException()), - new CompareUnboxed()); - } - success &= testMapAny(transport, - new com.sun.star.uno.RuntimeException(), - new CompareClass( - com.sun.star.uno.RuntimeException.class)); - success &= testMapAny(transport, - new Any( - new Type( - com.sun.star.uno.RuntimeException. - class), - new com.sun.star.uno.RuntimeException()), - new CompareClass( - com.sun.star.uno.RuntimeException.class)); - success &= testMapAny(transport, - new Any( - new Type( - com.sun.star.uno.RuntimeException. - class), - new BaseRuntimeException()), - new CompareClass( - com.sun.star.uno.RuntimeException.class)); - success &= testMapAny(transport, - new Any( - new Type( - com.sun.star.uno.RuntimeException. - class), - new DerivedRuntimeException()), - new CompareClass( - com.sun.star.uno.RuntimeException.class)); - if (createTypes) { - success &= testMapAny(transport, new BaseRuntimeException(), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type( - BaseRuntimeException.class), - new BaseRuntimeException()), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type( - BaseRuntimeException.class), - new DerivedRuntimeException()), - new CompareSpecific( - new BaseRuntimeException())); - success &= testMapAny(transport, new DerivedRuntimeException(), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type( - DerivedRuntimeException.class), - new DerivedRuntimeException()), - new CompareUnboxed()); - } - - // Interface Types: - success &= testMapAny(transport, null, new CompareBoxed()); - success &= testMapAny(transport, new XInterface() {}, - new CompareBoxed()); - success &= testMapAny(transport, new BaseInterface() {}, - new CompareBoxed()); - success &= testMapAny(transport, new DerivedInterface() {}, - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface.class), null), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface.class), - new XInterface() {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface.class), - new BaseInterface() {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(XInterface.class), - new DerivedInterface() {}), - new CompareUnboxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface.class), null), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface.class), - new BaseInterface() {}), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(BaseInterface.class), - new DerivedInterface() {}), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedInterface.class), - null), - new CompareBoxed()); - success &= testMapAny(transport, - new Any(new Type(DerivedInterface.class), - new DerivedInterface() {}), - new CompareBoxed()); - - // Misc: - try { - transport.mapAny(new Object()); - System.out.println("BAD mapAny(Object), no exception"); - success = false; - } catch (StackOverflowError e) { - System.out.println("BAD mapAny(Object): " + e); - success = false; - } catch (RuntimeException e) {} - - return success; - } - - private TestAny() {} // do not instantiate - - private static boolean testType(Class zclass, TypeClass tclass, - String tname) { - Type t1 = new Type(zclass); - Type t2 = new Type(tname, tclass); - boolean ok = true; - if (t1.getTypeClass() != tclass) { - ok = false; - System.out.println("BAD Type(" + zclass + ").getTypeClass() = " - + t1.getTypeClass() + " != " + tclass); - } - if (!t1.getTypeName().equals(tname)) { - ok = false; - System.out.println("BAD Type(" + zclass + ").getTypeName() = " - + t1.getTypeName() + " != " + tname); - } - if (!t1.equals(t2)) { - ok = false; - System.out.println("BAD Type(" + zclass + ") != Type(" + tname - + ", " + tclass + ")"); - } - return ok; - } - - private static boolean testMapAny(XTransport transport, Object any, - Compare compare) { - Object any2 = transport.mapAny(any); - boolean eq = compare.equal(any, any2); - if (!eq) { - System.out.println("BAD mapAny(" + any + ") -> " + any2); - } - return eq; - } - - private static abstract class Compare { - public abstract boolean equal(Object o1, Object o2); - } - - private static final class CompareBoxed extends Compare { - public CompareBoxed() { - this(false); - } - - public CompareBoxed(boolean unboxInner) { - this.unboxInner = unboxInner; - } - - @Override - public boolean equal(Object o1, Object o2) { - if (o1 instanceof Any) { - return o2 instanceof Any - && ((Any) o1).getType().equals(((Any) o2).getType()) - && equalValues(((Any) o1).getObject(), - ((Any) o2).getObject()); - } else { - return equalValues(o1, o2); - } - } - - private boolean equalValues(Object o1, Object o2) { - if (o1 == null) { - return o2 == null; - } else if (o1.getClass().isArray()) { - if (!(o2 != null && o1.getClass() == o2.getClass() - && Array.getLength(o1) == Array.getLength(o2))) { - return false; - } - for (int i = 0; i < Array.getLength(o1); ++i) { - Object oo1 = Array.get(o1, i); - if (unboxInner && oo1 instanceof Any) { - oo1 = ((Any) oo1).getObject(); - } - if (!equal(oo1, Array.get(o2, i))) { - return false; - } - } - return true; - } else { - return o1.equals(o2); - } - } - - private final boolean unboxInner; - } - - private static final class CompareUnboxed extends Compare { - public CompareUnboxed() { - this(false); - } - - public CompareUnboxed(boolean unboxInner) { - this.unboxInner = unboxInner; - } - - @Override - public boolean equal(Object o1, Object o2) { - return new CompareBoxed(unboxInner).equal(((Any) o1).getObject(), - o2); - } - - private final boolean unboxInner; - } - - private static final class CompareSpecific extends Compare { - public CompareSpecific(Object specific) { - this.specific = specific; - } - - @Override - public boolean equal(Object o1, Object o2) { - return new CompareBoxed().equal(specific, o2); - } - - private final Object specific; - } - - private static final class CompareClass extends Compare { - public CompareClass(Class clazz) { - this.clazz = clazz; - } - - @Override - public boolean equal(Object o1, Object o2) { - return o2 != null && o2.getClass() == clazz; - } - - private final Class clazz; - } - - private static class Enum1 extends Enum { - public Enum1() { - super(0); - } - - @Override - public boolean equals(Object obj) { - return obj != null && obj.getClass() == Enum1.class; - } - } - - private static class Enum2 extends Enum1 { - @Override - public boolean equals(Object obj) { - return obj != null && obj.getClass() == Enum2.class; - } - } - - private static class BaseStruct { - @Override - public boolean equals(Object obj) { - return obj != null && obj.getClass() == BaseStruct.class; - } - } - - private static class DerivedStruct extends BaseStruct { - @Override - public boolean equals(Object obj) { - return obj != null && obj.getClass() == DerivedStruct.class; - } - } - - private static class BaseException extends com.sun.star.uno.Exception { - - @Override - public boolean equals(Object obj) { - return obj != null && obj.getClass() == BaseException.class; - } - } - - private static class DerivedException extends BaseException { - - @Override - public boolean equals(Object obj) { - return obj != null && obj.getClass() == DerivedException.class; - } - } - - private static class BaseRuntimeException - extends com.sun.star.uno.RuntimeException - { - @Override - public boolean equals(Object obj) { - return obj != null - && obj.getClass() == BaseRuntimeException.class; - } - } - - private static class DerivedRuntimeException extends BaseRuntimeException - { - @Override - public boolean equals(Object obj) { - return obj != null - && obj.getClass() == DerivedRuntimeException.class; - } - } -} diff --git a/bridges/test/java_uno/any/TestJni.java b/bridges/test/java_uno/any/TestJni.java deleted file mode 100644 index 93a69ad90966..000000000000 --- a/bridges/test/java_uno/any/TestJni.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 test.java_uno.any; - -//"any" is a reserved word in IDL, so we need to use a different packagename -import test.java_uno.anytest.*; - -public class TestJni -{ - static { System.loadLibrary( "test_javauno_any" ); } - private static native XTransport create_jni_transport(ClassLoader loader); - - public static void main( String args [] ) - { - if (TestAny.test( - create_jni_transport(TestJni.class.getClassLoader()), false )) - { - System.out.println( "jni any test succeeded." ); - } - else - { - System.err.println( "jni any test failed!" ); - System.exit( 1 ); - } - } -} diff --git a/bridges/test/java_uno/any/TestRemote.java b/bridges/test/java_uno/any/TestRemote.java deleted file mode 100644 index 15226c37e295..000000000000 --- a/bridges/test/java_uno/any/TestRemote.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 test.java_uno.any; - -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import test.lib.TestBed; - -//"any" is a reserved word in IDL, so we need to use a different packagename -import test.java_uno.anytest.*; - -public final class TestRemote { - public static void main(String[] args) throws Exception { - boolean success = new TestBed().execute( - new Provider(), false, Client.class, 0); - System.out.println("success? " + success); - System.exit(success ? 0 : 1); - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTransport transport = UnoRuntime.queryInterface( - XTransport.class, getBridge(context).getInstance("Transport")); - return TestAny.test(transport, true); - } - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - return new XTransport() { - public Object mapAny(Object any) { - return any; - } - }; - } - } -} diff --git a/bridges/test/java_uno/any/makefile.mk b/bridges/test/java_uno/any/makefile.mk deleted file mode 100644 index b942e546ff69..000000000000 --- a/bridges/test/java_uno/any/makefile.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -# 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 . -# - -PRJ = ..$/..$/.. -PRJNAME = bridges -TARGET = test_javauno_any - -PACKAGE = test$/java_uno$/any - -ENABLE_EXCEPTIONS = TRUE - -.INCLUDE: settings.mk - -.IF "$(OS)" == "WNT" -GIVE_EXEC_RIGHTS = @echo -.ELSE -GIVE_EXEC_RIGHTS = chmod +x -.ENDIF - -JAVAFILES = \ - $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) - -# Make sure TestBed.class is found under $(CLASSDIR)$/test: -.IF "$(XCLASSPATH)" == "" -XCLASSPATH := $(CLASSDIR)$/test -.ELSE -XCLASSPATH !:= $(XCLASSPATH)$(LIBO_PATH_SEPARATOR)$(CLASSDIR)$/test -.ENDIF - -EXEC_CLASSPATH_TMP = \ - $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i)$(LIBO_PATH_SEPARATOR)$(XCLASSPATH) -EXEC_CLASSPATH = \ - $(strip $(subst,!,$(LIBO_PATH_SEPARATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) - -JARFILES = juh.jar jurt.jar ridl.jar -JAVACLASSFILES = \ - $(CLASSDIR)$/$(PACKAGE)$/TestAny.class \ - $(CLASSDIR)$/$(PACKAGE)$/TestRemote.class \ - $(CLASSDIR)$/$(PACKAGE)$/TestJni.class - -#-------------------------------------------------- - -USE_DEFFILE = TRUE -ENABLE_EXCEPTIONS = TRUE -INCPRE += $(OUT)$/inc$/test - -.IF "$(debug)" != "" -.IF "$(COM)" == "MSC" -CFLAGS += -Ob0 -.ENDIF -.ENDIF - -SLOFILES= \ - $(SLO)$/transport.obj - -SHL1TARGET=$(TARGET) - -SHL1STDLIBS= \ - $(CPPUHELPERLIB) \ - $(SALHELPERLIB) \ - $(JVMACCESSLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=$(TARGET).map -SHL1IMPLIB=i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -.INCLUDE: target.mk - -#-------------------------------------------------- - -$(SLOFILES) : $(MISC)$/gen_files.flag -$(JAVACLASSFILES) : $(MISC)$/gen_files.flag - -ALLTAR : \ - $(OUT)$/bin$/TestRemote \ - $(OUT)$/bin$/TestJni - -$(OUT)$/bin$/TestRemote : $(JAVACLASSFILES) - -rm -f $@ - echo java -classpath ..$/class$/test$(LIBO_PATH_SEPARATOR)..$/class$(LIBO_PATH_SEPARATOR)$(EXEC_CLASSPATH) \ - test.java_uno.anytest.TestRemote > $@ - $(GIVE_EXEC_RIGHTS) $@ - -$(OUT)$/bin$/TestJni : $(JAVACLASSFILES) - -rm -f $@ - echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \ - .$(LIBO_PATH_SEPARATOR)..$/class$(LIBO_PATH_SEPARATOR)$(EXEC_CLASSPATH) \ - -Djava.library.path=..$/lib test.java_uno.anytest.TestJni >> $@ - $(GIVE_EXEC_RIGHTS) $@ - -$(BIN)$/test_java_uno_anytest.rdb : types.idl - $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $? - $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} - -$(MISC)$/gen_files.flag : $(BIN)$/test_java_uno_anytest.rdb - $(CPPUMAKER) -C -BUCR -O $(OUT)$/inc$/test -X $(SOLARBINDIR)$/udkapi.rdb $? - $(CPPUMAKER) -C -BUCR -O $(OUT)$/inc$/test -T com.sun.star.uno.XInterface $(SOLARBINDIR)$/udkapi.rdb - $(JAVAMAKER) -nD -BUCR -O $(CLASSDIR) -X $(SOLARBINDIR)$/udkapi.rdb $? - $(TOUCH) $@ diff --git a/bridges/test/java_uno/any/test_javauno_any.map b/bridges/test/java_uno/any/test_javauno_any.map deleted file mode 100644 index 6696764b2b2b..000000000000 --- a/bridges/test/java_uno/any/test_javauno_any.map +++ /dev/null @@ -1,24 +0,0 @@ -# -# 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 . -# - -UDK_3_0_0 { - global: - Java_test_java_1uno_anytest_TestJni_create_1jni_1transport; - local: - *; -}; diff --git a/bridges/test/java_uno/any/transport.cxx b/bridges/test/java_uno/any/transport.cxx deleted file mode 100644 index e8015c70e6f7..000000000000 --- a/bridges/test/java_uno/any/transport.cxx +++ /dev/null @@ -1,99 +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 "jni.h" - -#include -#include "uno/mapping.hxx" -#include "uno/environment.hxx" -#include "jvmaccess/virtualmachine.hxx" -#include "jvmaccess/unovirtualmachine.hxx" -#include "cppuhelper/implbase.hxx" - -#include "test/java_uno/anytest/XTransport.hpp" -#include "test/java_uno/anytest/DerivedInterface.hpp" - - -using namespace ::com::sun::star::uno; -using ::test::java_uno::anytest::XTransport; - -namespace -{ - -class Transport : public ::cppu::WeakImplHelper< XTransport > -{ -public: - virtual Any SAL_CALL mapAny( Any const & any ) - throw (RuntimeException); -}; - -Any Transport::mapAny( Any const & any ) - throw (RuntimeException) -{ - return any; -} -} - -extern "C" SAL_JNI_EXPORT jobject JNICALL Java_test_java_1uno_anytest_TestJni_create_1jni_1transport( - JNIEnv * jni_env, jclass, jobject loader ) - SAL_THROW_EXTERN_C() -{ - // publish some idl types - cppu::UnoType< XTransport >::get(); - cppu::UnoType::get(); - - Reference< XTransport > xRet( new Transport() ); - - // get java vm - JavaVM * java_vm; - OSL_VERIFY( 0 == jni_env->GetJavaVM( &java_vm ) ); - // create jvmaccess vm - ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > vm; - try { - vm = new ::jvmaccess::UnoVirtualMachine( - new ::jvmaccess::VirtualMachine( - java_vm, JNI_VERSION_1_2, false, jni_env ), - loader ); - } catch ( ::jvmaccess::UnoVirtualMachine::CreationException & ) { - OSL_ASSERT( false ); - throw; - } - // create uno envs - OUString java_name( UNO_LB_JAVA ); - OUString cpp_name( CPPU_CURRENT_LANGUAGE_BINDING_NAME ); - Environment java_env, cpp_env; - uno_getEnvironment( (uno_Environment **)&java_env, java_name.pData, vm.get() ); - OSL_ASSERT( java_env.is() ); - uno_getEnvironment( (uno_Environment **)&cpp_env, cpp_name.pData, 0 ); - OSL_ASSERT( cpp_env.is() ); - - // map interface - Mapping mapping( cpp_env.get(), java_env.get() ); - OSL_ASSERT( mapping.is() ); - jobject jo_global = (jobject)mapping.mapInterface( xRet.get(), cppu::UnoType::get() ); - OSL_ASSERT( 0 != jo_global ); - - // return - jobject jo_ret = jni_env->NewLocalRef( jo_global ); - jni_env->DeleteGlobalRef( jo_global ); - return jo_ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/any/types.idl b/bridges/test/java_uno/any/types.idl deleted file mode 100644 index 828201bc5196..000000000000 --- a/bridges/test/java_uno/any/types.idl +++ /dev/null @@ -1,36 +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 - - -module test { module java_uno { module anytest { - -interface XTransport : com::sun::star::uno::XInterface -{ - any mapAny([in] any a); -}; - -interface BaseInterface : com::sun::star::uno::XInterface {}; - -interface DerivedInterface : BaseInterface {}; - -}; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/equals/TestEquals.java b/bridges/test/java_uno/equals/TestEquals.java deleted file mode 100644 index 5b9cbecd7f0a..000000000000 --- a/bridges/test/java_uno/equals/TestEquals.java +++ /dev/null @@ -1,1297 +0,0 @@ -/* - * 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 test.java_uno.equals; - -import java.io.File; -import java.net.MalformedURLException; -import java.util.HashMap; - -import test.lib.TestBed; - -import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.comp.helper.Bootstrap; -import com.sun.star.connection.Acceptor; -import com.sun.star.connection.XAcceptor; -import com.sun.star.connection.XConnection; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XSingleComponentFactory; -import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; -import com.sun.star.lib.uno.typeinfo.TypeInfo; -import com.sun.star.loader.XImplementationLoader; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.XInterface; - -// In this test scenario, the Java server (see implementation of method -// notifyAccepting) has a remote bridge to the Java client and a local JNI -// bridge to a C++ com.sun.star.test.bridges.testequals.impl service. The C++ -// service and the Java client are also connected via a remote bridge. -// -// The Java server gets two objects (INSTANCE1, INSTANCE2), once directly from -// the Java client via the remote bridge (proxies test1A, test2A), and once -// through the C++ service via the JNI bridge (proxies test1B, test2B). -// Exhaustive tests on the proxies' equals and hashCode methods are done. - -public final class TestEquals { - // args[0] must be a file system path to a types.rdb, - // args[1] must be a file system path to a services.rdb - public static void main(String[] args) throws Exception { - TestBed t = new TestBed(); - boolean success = t.execute( - new Provider(t, toFileUrl(args[0]), toFileUrl(args[1])), true, - Client.class, 0); - System.out.println("success? " + success); - System.exit(success ? 0 : 1); - } - - private static String toFileUrl(String path) throws MalformedURLException { - String url = new File(path).toURI().toURL().toString(); - String prefix = "file:/"; - if (url.startsWith(prefix) - && (url.length() == prefix.length() - || url.charAt(prefix.length()) != '/')) { - url = url.substring(0, prefix.length()) + "//" - + url.substring(prefix.length()); - } - return url; - } - - public static final class Client extends TestBed.Client { - public static void main(String[] args) { - new Client().execute(); - } - - @Override - protected boolean run(XComponentContext context) throws Throwable { - XTestFrame f = UnoRuntime.queryInterface( - XTestFrame.class, getBridge(context).getInstance("TestFrame")); - XAcceptor acceptor = Acceptor.create(context); - XBridgeFactory factory = UnoRuntime.queryInterface( - XBridgeFactory.class, - context.getServiceManager().createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", context)); - System.out.println("Client, 2nd connection: Accepting..."); - XInstanceProvider prov = new Provider(); - f.notifyAccepting(new Done(), prov.getInstance(INSTANCE1), - prov.getInstance(INSTANCE2)); - XConnection connection = acceptor.accept(CONNECTION_DESCRIPTION); - System.out.println("Client, 2nd connection: ...connected..."); - factory.createBridge( - "", PROTOCOL_DESCRIPTION, connection, prov); - System.out.println("Client, 2nd connection: ...bridged."); - synchronized (lock) { - while (!done) { - lock.wait(); - } - } - return true; - } - - private static final class Provider implements XInstanceProvider { - public Object getInstance(String instanceName) { - synchronized (map) { - Object o = map.get(instanceName); - if (o == null) { - o = new XDerived() {}; - map.put(instanceName, o); - } - return o; - } - } - - private final HashMap map = new HashMap(); - } - - private final class Done implements XDone { - public void notifyDone() { - synchronized (lock) { - done = true; - lock.notifyAll(); - } - } - } - - private final Object lock = new Object(); - private boolean done = false; - } - - private static final class Provider implements XInstanceProvider { - public Provider(TestBed testBed, String unoTypes, String unoServices) { - this.testBed = testBed; - this.unoTypes = unoTypes; - this.unoServices = unoServices; - } - - public Object getInstance(String instanceName) { - return new XTestFrame() { - public void notifyAccepting( - final XDone done, final Object object1, - final Object object2) - { - new Thread() { - @Override - public void run() { - try { - Object test1Aa = object1; - XBase test1Ab = UnoRuntime.queryInterface( - XBase.class, test1Aa); - XDerived test1Ac = - UnoRuntime.queryInterface( - XDerived.class, test1Aa); - Object test2Aa = object2; - XBase test2Ab = UnoRuntime.queryInterface( - XBase.class, test2Aa); - XDerived test2Ac = - UnoRuntime.queryInterface( - XDerived.class, test2Aa); - - HashMap params = new HashMap(); - params.put("UNO_TYPES", unoTypes); - params.put("UNO_SERVICES", unoServices); - XComponentContext context = Bootstrap. - defaultBootstrap_InitialComponentContext( - null, params); - XMultiComponentFactory factory - = context.getServiceManager(); - XImplementationLoader loader = - UnoRuntime.queryInterface( - XImplementationLoader.class, - factory.createInstanceWithContext( - "com.sun.star.loader." - + "SharedLibrary", - context)); - XSingleComponentFactory factory2 = - UnoRuntime.queryInterface( - XSingleComponentFactory.class, - loader.activate( - "com.sun.star.test.bridges." - + "testequals.impl", - "", "../lib/testequals.uno", - null)); - XTestInterface test = - UnoRuntime.queryInterface( - XTestInterface.class, - factory2.createInstanceWithContext( - context)); - // allow client to start accepting: - Thread.sleep(3000); - test.connect( - CONNECTION_DESCRIPTION, - PROTOCOL_DESCRIPTION); - - Object test1Ba = test.get(INSTANCE1); - XBase test1Bb = UnoRuntime.queryInterface( - XBase.class, test1Ba); - XDerived test1Bc = - UnoRuntime.queryInterface( - XDerived.class, test1Ba); - Object test2Ba = test.get(INSTANCE2); - XBase test2Bb = UnoRuntime.queryInterface( - XBase.class, test2Ba); - XDerived test2Bc = - UnoRuntime.queryInterface( - XDerived.class, test2Ba); - - boolean success = true; - - success &= test( - "UnoRumtime.areSame(null, null)", - UnoRuntime.areSame(null, null)); - success &= test( - "!UnoRumtime.areSame(null, test1Aa)", - !UnoRuntime.areSame(null, test1Aa)); - success &= test( - "!UnoRumtime.areSame(null, test1Ab)", - !UnoRuntime.areSame(null, test1Ab)); - success &= test( - "!UnoRumtime.areSame(null, test1Ac)", - !UnoRuntime.areSame(null, test1Ac)); - success &= test( - "!UnoRumtime.areSame(null, test1Ba)", - !UnoRuntime.areSame(null, test1Ba)); - success &= test( - "!UnoRumtime.areSame(null, test1Bb)", - !UnoRuntime.areSame(null, test1Bb)); - success &= test( - "!UnoRumtime.areSame(null, test1Bc)", - !UnoRuntime.areSame(null, test1Bc)); - success &= test( - "!UnoRumtime.areSame(null, test2Aa)", - !UnoRuntime.areSame(null, test2Aa)); - success &= test( - "!UnoRumtime.areSame(null, test2Ab)", - !UnoRuntime.areSame(null, test2Ab)); - success &= test( - "!UnoRumtime.areSame(null, test2Ac)", - !UnoRuntime.areSame(null, test2Ac)); - success &= test( - "!UnoRumtime.areSame(null, test2Ba)", - !UnoRuntime.areSame(null, test2Ba)); - success &= test( - "!UnoRumtime.areSame(null, test2Bb)", - !UnoRuntime.areSame(null, test2Bb)); - success &= test( - "!UnoRumtime.areSame(null, test2Bc)", - !UnoRuntime.areSame(null, test2Bc)); - - success &= test( - "!test1Aa.equals(null)", - !test1Aa.equals(null)); - success &= test( - "!UnoRuntime.areSame(test1Aa, null)", - !UnoRuntime.areSame(test1Aa, null)); - success &= test( - "test1Aa.equals(test1Aa)", - test1Aa.equals(test1Aa)); - success &= test( - "UnoRuntime.areSame(test1Aa, test1Aa)", - UnoRuntime.areSame(test1Aa, test1Aa)); - success &= test( - "test1Aa.equals(test1Ab)", - test1Aa.equals(test1Ab)); - success &= test( - "UnoRuntime.areSame(test1Aa, test1Ab)", - UnoRuntime.areSame(test1Aa, test1Ab)); - success &= test( - "test1Aa.equals(test1Ac)", - test1Aa.equals(test1Ac)); - success &= test( - "UnoRuntime.areSame(test1Aa, test1Ac)", - UnoRuntime.areSame(test1Aa, test1Ac)); - success &= test( - "test1Aa.equals(test1Ba)", - test1Aa.equals(test1Ba)); - success &= test( - "UnoRuntime.areSame(test1Aa, test1Ba)", - UnoRuntime.areSame(test1Aa, test1Ba)); - success &= test( - "test1Aa.equals(test1Bb)", - test1Aa.equals(test1Bb)); - success &= test( - "UnoRuntime.areSame(test1Aa, test1Bb)", - UnoRuntime.areSame(test1Aa, test1Bb)); - success &= test( - "test1Aa.equals(test1Bc)", - test1Aa.equals(test1Bc)); - success &= test( - "UnoRuntime.areSame(test1Aa, test1Bc)", - UnoRuntime.areSame(test1Aa, test1Bc)); - success &= test( - "!test1Aa.equals(test2Aa)", - !test1Aa.equals(test2Aa)); - success &= test( - "!UnoRuntime.areSame(test1Aa, test2Aa)", - !UnoRuntime.areSame(test1Aa, test2Aa)); - success &= test( - "!test1Aa.equals(test2Ab)", - !test1Aa.equals(test2Ab)); - success &= test( - "!UnoRuntime.areSame(test1Aa, test2Ab)", - !UnoRuntime.areSame(test1Aa, test2Ab)); - success &= test( - "!test1Aa.equals(test2Ac)", - !test1Aa.equals(test2Ac)); - success &= test( - "!UnoRuntime.areSame(test1Aa, test2Ac)", - !UnoRuntime.areSame(test1Aa, test2Ac)); - success &= test( - "!test1Aa.equals(test2Ba)", - !test1Aa.equals(test2Ba)); - success &= test( - "!UnoRuntime.areSame(test1Aa, test2Ba)", - !UnoRuntime.areSame(test1Aa, test2Ba)); - success &= test( - "!test1Aa.equals(test2Bb)", - !test1Aa.equals(test2Bb)); - success &= test( - "!UnoRuntime.areSame(test1Aa, test2Bb)", - !UnoRuntime.areSame(test1Aa, test2Bb)); - success &= test( - "!test1Aa.equals(test2Bc)", - !test1Aa.equals(test2Bc)); - success &= test( - "!UnoRuntime.areSame(test1Aa, test2Bc)", - !UnoRuntime.areSame(test1Aa, test2Bc)); - - success &= test( - "!test1Ab.equals(null)", - !test1Ab.equals(null)); - success &= test( - "!UnoRuntime.areSame(test1Ab, null)", - !UnoRuntime.areSame(test1Ab, null)); - success &= test( - "test1Ab.equals(test1Aa)", - test1Ab.equals(test1Aa)); - success &= test( - "UnoRuntime.areSame(test1Ab, test1Aa)", - UnoRuntime.areSame(test1Ab, test1Aa)); - success &= test( - "test1Ab.equals(test1Ab)", - test1Ab.equals(test1Ab)); - success &= test( - "UnoRuntime.areSame(test1Ab, test1Ab)", - UnoRuntime.areSame(test1Ab, test1Ab)); - success &= test( - "test1Ab.equals(test1Ac)", - test1Ab.equals(test1Ac)); - success &= test( - "UnoRuntime.areSame(test1Ab, test1Ac)", - UnoRuntime.areSame(test1Ab, test1Ac)); - success &= test( - "test1Ab.equals(test1Ba)", - test1Ab.equals(test1Ba)); - success &= test( - "UnoRuntime.areSame(test1Ab, test1Ba)", - UnoRuntime.areSame(test1Ab, test1Ba)); - success &= test( - "test1Ab.equals(test1Bb)", - test1Ab.equals(test1Bb)); - success &= test( - "UnoRuntime.areSame(test1Ab, test1Bb)", - UnoRuntime.areSame(test1Ab, test1Bb)); - success &= test( - "test1Ab.equals(test1Bc)", - test1Ab.equals(test1Bc)); - success &= test( - "UnoRuntime.areSame(test1Ab, test1Bc)", - UnoRuntime.areSame(test1Ab, test1Bc)); - success &= test( - "!test1Ab.equals(test2Aa)", - !test1Ab.equals(test2Aa)); - success &= test( - "!UnoRuntime.areSame(test1Ab, test2Aa)", - !UnoRuntime.areSame(test1Ab, test2Aa)); - success &= test( - "!test1Ab.equals(test2Ab)", - !test1Ab.equals(test2Ab)); - success &= test( - "!UnoRuntime.areSame(test1Ab, test2Ab)", - !UnoRuntime.areSame(test1Ab, test2Ab)); - success &= test( - "!test1Ab.equals(test2Ac)", - !test1Ab.equals(test2Ac)); - success &= test( - "!UnoRuntime.areSame(test1Ab, test2Ac)", - !UnoRuntime.areSame(test1Ab, test2Ac)); - success &= test( - "!test1Ab.equals(test2Ba)", - !test1Ab.equals(test2Ba)); - success &= test( - "!UnoRuntime.areSame(test1Ab, test2Ba)", - !UnoRuntime.areSame(test1Ab, test2Ba)); - success &= test( - "!test1Ab.equals(test2Bb)", - !test1Ab.equals(test2Bb)); - success &= test( - "!UnoRuntime.areSame(test1Ab, test2Bb)", - !UnoRuntime.areSame(test1Ab, test2Bb)); - success &= test( - "!test1Ab.equals(test2Bc)", - !test1Ab.equals(test2Bc)); - success &= test( - "!UnoRuntime.areSame(test1Ab, test2Bc)", - !UnoRuntime.areSame(test1Ab, test2Bc)); - - success &= test( - "!test1Ac.equals(null)", - !test1Ac.equals(null)); - success &= test( - "!UnoRuntime.areSame(test1Ac, null)", - !UnoRuntime.areSame(test1Ac, null)); - success &= test( - "test1Ac.equals(test1Aa)", - test1Ac.equals(test1Aa)); - success &= test( - "UnoRuntime.areSame(test1Ac, test1Aa)", - UnoRuntime.areSame(test1Ac, test1Aa)); - success &= test( - "test1Ac.equals(test1Ab)", - test1Ac.equals(test1Ab)); - success &= test( - "UnoRuntime.areSame(test1Ac, test1Ab)", - UnoRuntime.areSame(test1Ac, test1Ab)); - success &= test( - "test1Ac.equals(test1Ac)", - test1Ac.equals(test1Ac)); - success &= test( - "UnoRuntime.areSame(test1Ac, test1Ac)", - UnoRuntime.areSame(test1Ac, test1Ac)); - success &= test( - "test1Ac.equals(test1Ba)", - test1Ac.equals(test1Ba)); - success &= test( - "UnoRuntime.areSame(test1Ac, test1Ba)", - UnoRuntime.areSame(test1Ac, test1Ba)); - success &= test( - "test1Ac.equals(test1Bb)", - test1Ac.equals(test1Bb)); - success &= test( - "UnoRuntime.areSame(test1Ac, test1Bb)", - UnoRuntime.areSame(test1Ac, test1Bb)); - success &= test( - "test1Ac.equals(test1Bc)", - test1Ac.equals(test1Bc)); - success &= test( - "UnoRuntime.areSame(test1Ac, test1Bc)", - UnoRuntime.areSame(test1Ac, test1Bc)); - success &= test( - "!test1Ac.equals(test2Aa)", - !test1Ac.equals(test2Aa)); - success &= test( - "!UnoRuntime.areSame(test1Ac, test2Aa)", - !UnoRuntime.areSame(test1Ac, test2Aa)); - success &= test( - "!test1Ac.equals(test2Ab)", - !test1Ac.equals(test2Ab)); - success &= test( - "!UnoRuntime.areSame(test1Ac, test2Ab)", - !UnoRuntime.areSame(test1Ac, test2Ab)); - success &= test( - "!test1Ac.equals(test2Ac)", - !test1Ac.equals(test2Ac)); - success &= test( - "!UnoRuntime.areSame(test1Ac, test2Ac)", - !UnoRuntime.areSame(test1Ac, test2Ac)); - success &= test( - "!test1Ac.equals(test2Ba)", - !test1Ac.equals(test2Ba)); - success &= test( - "!UnoRuntime.areSame(test1Ac, test2Ba)", - !UnoRuntime.areSame(test1Ac, test2Ba)); - success &= test( - "!test1Ac.equals(test2Bb)", - !test1Ac.equals(test2Bb)); - success &= test( - "!UnoRuntime.areSame(test1Ac, test2Bb)", - !UnoRuntime.areSame(test1Ac, test2Bb)); - success &= test( - "!test1Ac.equals(test2Bc)", - !test1Ac.equals(test2Bc)); - success &= test( - "!UnoRuntime.areSame(test1Ac, test2Bc)", - !UnoRuntime.areSame(test1Ac, test2Bc)); - - success &= test( - "!test1Ba.equals(null)", - !test1Ba.equals(null)); - success &= test( - "!UnoRuntime.areSame(test1Ba, null)", - !UnoRuntime.areSame(test1Ba, null)); - success &= test( - "test1Ba.equals(test1Aa)", - test1Ba.equals(test1Aa)); - success &= test( - "UnoRuntime.areSame(test1Ba, test1Aa)", - UnoRuntime.areSame(test1Ba, test1Aa)); - success &= test( - "test1Ba.equals(test1Ab)", - test1Ba.equals(test1Ab)); - success &= test( - "UnoRuntime.areSame(test1Ba, test1Ab)", - UnoRuntime.areSame(test1Ba, test1Ab)); - success &= test( - "test1Ba.equals(test1Ac)", - test1Ba.equals(test1Ac)); - success &= test( - "UnoRuntime.areSame(test1Ba, test1Ac)", - UnoRuntime.areSame(test1Ba, test1Ac)); - success &= test( - "test1Ba.equals(test1Ba)", - test1Ba.equals(test1Ba)); - success &= test( - "UnoRuntime.areSame(test1Ba, test1Ba)", - UnoRuntime.areSame(test1Ba, test1Ba)); - success &= test( - "test1Ba.equals(test1Bb)", - test1Ba.equals(test1Bb)); - success &= test( - "UnoRuntime.areSame(test1Ba, test1Bb)", - UnoRuntime.areSame(test1Ba, test1Bb)); - success &= test( - "test1Ba.equals(test1Bc)", - test1Ba.equals(test1Bc)); - success &= test( - "UnoRuntime.areSame(test1Ba, test1Bc)", - UnoRuntime.areSame(test1Ba, test1Bc)); - success &= test( - "!test1Ba.equals(test2Aa)", - !test1Ba.equals(test2Aa)); - success &= test( - "!UnoRuntime.areSame(test1Ba, test2Aa)", - !UnoRuntime.areSame(test1Ba, test2Aa)); - success &= test( - "!test1Ba.equals(test2Ab)", - !test1Ba.equals(test2Ab)); - success &= test( - "!UnoRuntime.areSame(test1Ba, test2Ab)", - !UnoRuntime.areSame(test1Ba, test2Ab)); - success &= test( - "!test1Ba.equals(test2Ac)", - !test1Ba.equals(test2Ac)); - success &= test( - "!UnoRuntime.areSame(test1Ba, test2Ac)", - !UnoRuntime.areSame(test1Ba, test2Ac)); - success &= test( - "!test1Ba.equals(test2Ba)", - !test1Ba.equals(test2Ba)); - success &= test( - "!UnoRuntime.areSame(test1Ba, test2Ba)", - !UnoRuntime.areSame(test1Ba, test2Ba)); - success &= test( - "!test1Ba.equals(test2Bb)", - !test1Ba.equals(test2Bb)); - success &= test( - "!UnoRuntime.areSame(test1Ba, test2Bb)", - !UnoRuntime.areSame(test1Ba, test2Bb)); - success &= test( - "!test1Ba.equals(test2Bc)", - !test1Ba.equals(test2Bc)); - success &= test( - "!UnoRuntime.areSame(test1Ba, test2Bc)", - !UnoRuntime.areSame(test1Ba, test2Bc)); - - success &= test( - "!test1Bb.equals(null)", - !test1Bb.equals(null)); - success &= test( - "!UnoRuntime.areSame(test1Bb, null)", - !UnoRuntime.areSame(test1Bb, null)); - success &= test( - "test1Bb.equals(test1Aa)", - test1Bb.equals(test1Aa)); - success &= test( - "UnoRuntime.areSame(test1Bb, test1Aa)", - UnoRuntime.areSame(test1Bb, test1Aa)); - success &= test( - "test1Bb.equals(test1Ab)", - test1Bb.equals(test1Ab)); - success &= test( - "UnoRuntime.areSame(test1Bb, test1Ab)", - UnoRuntime.areSame(test1Bb, test1Ab)); - success &= test( - "test1Bb.equals(test1Ac)", - test1Bb.equals(test1Ac)); - success &= test( - "UnoRuntime.areSame(test1Bb, test1Ac)", - UnoRuntime.areSame(test1Bb, test1Ac)); - success &= test( - "test1Bb.equals(test1Ba)", - test1Bb.equals(test1Ba)); - success &= test( - "UnoRuntime.areSame(test1Bb, test1Ba)", - UnoRuntime.areSame(test1Bb, test1Ba)); - success &= test( - "test1Bb.equals(test1Bb)", - test1Bb.equals(test1Bb)); - success &= test( - "UnoRuntime.areSame(test1Bb, test1Bb)", - UnoRuntime.areSame(test1Bb, test1Bb)); - success &= test( - "test1Bb.equals(test1Bc)", - test1Bb.equals(test1Bc)); - success &= test( - "UnoRuntime.areSame(test1Bb, test1Bc)", - UnoRuntime.areSame(test1Bb, test1Bc)); - success &= test( - "!test1Bb.equals(test2Aa)", - !test1Bb.equals(test2Aa)); - success &= test( - "!UnoRuntime.areSame(test1Bb, test2Aa)", - !UnoRuntime.areSame(test1Bb, test2Aa)); - success &= test( - "!test1Bb.equals(test2Ab)", - !test1Bb.equals(test2Ab)); - success &= test( - "!UnoRuntime.areSame(test1Bb, test2Ab)", - !UnoRuntime.areSame(test1Bb, test2Ab)); - success &= test( - "!test1Bb.equals(test2Ac)", - !test1Bb.equals(test2Ac)); - success &= test( - "!UnoRuntime.areSame(test1Bb, test2Ac)", - !UnoRuntime.areSame(test1Bb, test2Ac)); - success &= test( - "!test1Bb.equals(test2Ba)", - !test1Bb.equals(test2Ba)); - success &= test( - "!UnoRuntime.areSame(test1Bb, test2Ba)", - !UnoRuntime.areSame(test1Bb, test2Ba)); - success &= test( - "!test1Bb.equals(test2Bb)", - !test1Bb.equals(test2Bb)); - success &= test( - "!UnoRuntime.areSame(test1Bb, test2Bb)", - !UnoRuntime.areSame(test1Bb, test2Bb)); - success &= test( - "!test1Bb.equals(test2Bc)", - !test1Bb.equals(test2Bc)); - success &= test( - "!UnoRuntime.areSame(test1Bb, test2Bc)", - !UnoRuntime.areSame(test1Bb, test2Bc)); - - success &= test( - "!test1Bc.equals(null)", - !test1Bc.equals(null)); - success &= test( - "!UnoRuntime.areSame(test1Bc, null)", - !UnoRuntime.areSame(test1Bc, null)); - success &= test( - "test1Bc.equals(test1Aa)", - test1Bc.equals(test1Aa)); - success &= test( - "UnoRuntime.areSame(test1Bc, test1Aa)", - UnoRuntime.areSame(test1Bc, test1Aa)); - success &= test( - "test1Bc.equals(test1Ab)", - test1Bc.equals(test1Ab)); - success &= test( - "UnoRuntime.areSame(test1Bc, test1Ab)", - UnoRuntime.areSame(test1Bc, test1Ab)); - success &= test( - "test1Bc.equals(test1Ac)", - test1Bc.equals(test1Ac)); - success &= test( - "UnoRuntime.areSame(test1Bc, test1Ac)", - UnoRuntime.areSame(test1Bc, test1Ac)); - success &= test( - "test1Bc.equals(test1Ba)", - test1Bc.equals(test1Ba)); - success &= test( - "UnoRuntime.areSame(test1Bc, test1Ba)", - UnoRuntime.areSame(test1Bc, test1Ba)); - success &= test( - "test1Bc.equals(test1Bb)", - test1Bc.equals(test1Bb)); - success &= test( - "UnoRuntime.areSame(test1Bc, test1Bb)", - UnoRuntime.areSame(test1Bc, test1Bb)); - success &= test( - "test1Bc.equals(test1Bc)", - test1Bc.equals(test1Bc)); - success &= test( - "UnoRuntime.areSame(test1Bc, test1Bc)", - UnoRuntime.areSame(test1Bc, test1Bc)); - success &= test( - "!test1Bc.equals(test2Aa)", - !test1Bc.equals(test2Aa)); - success &= test( - "!UnoRuntime.areSame(test1Bc, test2Aa)", - !UnoRuntime.areSame(test1Bc, test2Aa)); - success &= test( - "!test1Bc.equals(test2Ab)", - !test1Bc.equals(test2Ab)); - success &= test( - "!UnoRuntime.areSame(test1Bc, test2Ab)", - !UnoRuntime.areSame(test1Bc, test2Ab)); - success &= test( - "!test1Bc.equals(test2Ac)", - !test1Bc.equals(test2Ac)); - success &= test( - "!UnoRuntime.areSame(test1Bc, test2Ac)", - !UnoRuntime.areSame(test1Bc, test2Ac)); - success &= test( - "!test1Bc.equals(test2Ba)", - !test1Bc.equals(test2Ba)); - success &= test( - "!UnoRuntime.areSame(test1Bc, test2Ba)", - !UnoRuntime.areSame(test1Bc, test2Ba)); - success &= test( - "!test1Bc.equals(test2Bb)", - !test1Bc.equals(test2Bb)); - success &= test( - "!UnoRuntime.areSame(test1Bc, test2Bb)", - !UnoRuntime.areSame(test1Bc, test2Bb)); - success &= test( - "!test1Bc.equals(test2Bc)", - !test1Bc.equals(test2Bc)); - success &= test( - "!UnoRuntime.areSame(test1Bc, test2Bc)", - !UnoRuntime.areSame(test1Bc, test2Bc)); - - success &= test( - "!test2Aa.equals(null)", - !test2Aa.equals(null)); - success &= test( - "!UnoRuntime.areSame(test2Aa, null)", - !UnoRuntime.areSame(test2Aa, null)); - success &= test( - "!test2Aa.equals(test1Aa)", - !test2Aa.equals(test1Aa)); - success &= test( - "!UnoRuntime.areSame(test2Aa, test1Aa)", - !UnoRuntime.areSame(test2Aa, test1Aa)); - success &= test( - "!test2Aa.equals(test1Ab)", - !test2Aa.equals(test1Ab)); - success &= test( - "!UnoRuntime.areSame(test2Aa, test1Ab)", - !UnoRuntime.areSame(test2Aa, test1Ab)); - success &= test( - "!test2Aa.equals(test1Ac)", - !test2Aa.equals(test1Ac)); - success &= test( - "!UnoRuntime.areSame(test2Aa, test1Ac)", - !UnoRuntime.areSame(test2Aa, test1Ac)); - success &= test( - "!test2Aa.equals(test1Ba)", - !test2Aa.equals(test1Ba)); - success &= test( - "!UnoRuntime.areSame(test2Aa, test1Ba)", - !UnoRuntime.areSame(test2Aa, test1Ba)); - success &= test( - "!test2Aa.equals(test1Bb)", - !test2Aa.equals(test1Bb)); - success &= test( - "!UnoRuntime.areSame(test2Aa, test1Bb)", - !UnoRuntime.areSame(test2Aa, test1Bb)); - success &= test( - "!test2Aa.equals(test1Bc)", - !test2Aa.equals(test1Bc)); - success &= test( - "!UnoRuntime.areSame(test2Aa, test1Bc)", - !UnoRuntime.areSame(test2Aa, test1Bc)); - success &= test( - "test2Aa.equals(test2Aa)", - test2Aa.equals(test2Aa)); - success &= test( - "UnoRuntime.areSame(test2Aa, test2Aa)", - UnoRuntime.areSame(test2Aa, test2Aa)); - success &= test( - "test2Aa.equals(test2Ab)", - test2Aa.equals(test2Ab)); - success &= test( - "UnoRuntime.areSame(test2Aa, test2Ab)", - UnoRuntime.areSame(test2Aa, test2Ab)); - success &= test( - "test2Aa.equals(test2Ac)", - test2Aa.equals(test2Ac)); - success &= test( - "UnoRuntime.areSame(test2Aa, test2Ac)", - UnoRuntime.areSame(test2Aa, test2Ac)); - success &= test( - "test2Aa.equals(test2Ba)", - test2Aa.equals(test2Ba)); - success &= test( - "UnoRuntime.areSame(test2Aa, test2Ba)", - UnoRuntime.areSame(test2Aa, test2Ba)); - success &= test( - "test2Aa.equals(test2Bb)", - test2Aa.equals(test2Bb)); - success &= test( - "UnoRuntime.areSame(test2Aa, test2Bb)", - UnoRuntime.areSame(test2Aa, test2Bb)); - success &= test( - "test2Aa.equals(test2Bc)", - test2Aa.equals(test2Bc)); - success &= test( - "UnoRuntime.areSame(test2Aa, test2Bc)", - UnoRuntime.areSame(test2Aa, test2Bc)); - - success &= test( - "!test2Ab.equals(null)", - !test2Ab.equals(null)); - success &= test( - "!UnoRuntime.areSame(test2Ab, null)", - !UnoRuntime.areSame(test2Ab, null)); - success &= test( - "!test2Ab.equals(test1Aa)", - !test2Ab.equals(test1Aa)); - success &= test( - "!UnoRuntime.areSame(test2Ab, test1Aa)", - !UnoRuntime.areSame(test2Ab, test1Aa)); - success &= test( - "!test2Ab.equals(test1Ab)", - !test2Ab.equals(test1Ab)); - success &= test( - "!UnoRuntime.areSame(test2Ab, test1Ab)", - !UnoRuntime.areSame(test2Ab, test1Ab)); - success &= test( - "!test2Ab.equals(test1Ac)", - !test2Ab.equals(test1Ac)); - success &= test( - "!UnoRuntime.areSame(test2Ab, test1Ac)", - !UnoRuntime.areSame(test2Ab, test1Ac)); - success &= test( - "!test2Ab.equals(test1Ba)", - !test2Ab.equals(test1Ba)); - success &= test( - "!UnoRuntime.areSame(test2Ab, test1Ba)", - !UnoRuntime.areSame(test2Ab, test1Ba)); - success &= test( - "!test2Ab.equals(test1Bb)", - !test2Ab.equals(test1Bb)); - success &= test( - "!UnoRuntime.areSame(test2Ab, test1Bb)", - !UnoRuntime.areSame(test2Ab, test1Bb)); - success &= test( - "!test2Ab.equals(test1Bc)", - !test2Ab.equals(test1Bc)); - success &= test( - "!UnoRuntime.areSame(test2Ab, test1Bc)", - !UnoRuntime.areSame(test2Ab, test1Bc)); - success &= test( - "test2Ab.equals(test2Aa)", - test2Ab.equals(test2Aa)); - success &= test( - "UnoRuntime.areSame(test2Ab, test2Aa)", - UnoRuntime.areSame(test2Ab, test2Aa)); - success &= test( - "test2Ab.equals(test2Ab)", - test2Ab.equals(test2Ab)); - success &= test( - "UnoRuntime.areSame(test2Ab, test2Ab)", - UnoRuntime.areSame(test2Ab, test2Ab)); - success &= test( - "test2Ab.equals(test2Ac)", - test2Ab.equals(test2Ac)); - success &= test( - "UnoRuntime.areSame(test2Ab, test2Ac)", - UnoRuntime.areSame(test2Ab, test2Ac)); - success &= test( - "test2Ab.equals(test2Ba)", - test2Ab.equals(test2Ba)); - success &= test( - "UnoRuntime.areSame(test2Ab, test2Ba)", - UnoRuntime.areSame(test2Ab, test2Ba)); - success &= test( - "test2Ab.equals(test2Bb)", - test2Ab.equals(test2Bb)); - success &= test( - "UnoRuntime.areSame(test2Ab, test2Bb)", - UnoRuntime.areSame(test2Ab, test2Bb)); - success &= test( - "test2Ab.equals(test2Bc)", - test2Ab.equals(test2Bc)); - success &= test( - "UnoRuntime.areSame(test2Ab, test2Bc)", - UnoRuntime.areSame(test2Ab, test2Bc)); - - success &= test( - "!test2Ac.equals(null)", - !test2Ac.equals(null)); - success &= test( - "!UnoRuntime.areSame(test2Ac, null)", - !UnoRuntime.areSame(test2Ac, null)); - success &= test( - "!test2Ac.equals(test1Aa)", - !test2Ac.equals(test1Aa)); - success &= test( - "!UnoRuntime.areSame(test2Ac, test1Aa)", - !UnoRuntime.areSame(test2Ac, test1Aa)); - success &= test( - "!test2Ac.equals(test1Ab)", - !test2Ac.equals(test1Ab)); - success &= test( - "!UnoRuntime.areSame(test2Ac, test1Ab)", - !UnoRuntime.areSame(test2Ac, test1Ab)); - success &= test( - "!test2Ac.equals(test1Ac)", - !test2Ac.equals(test1Ac)); - success &= test( - "!UnoRuntime.areSame(test2Ac, test1Ac)", - !UnoRuntime.areSame(test2Ac, test1Ac)); - success &= test( - "!test2Ac.equals(test1Ba)", - !test2Ac.equals(test1Ba)); - success &= test( - "!UnoRuntime.areSame(test2Ac, test1Ba)", - !UnoRuntime.areSame(test2Ac, test1Ba)); - success &= test( - "!test2Ac.equals(test1Bb)", - !test2Ac.equals(test1Bb)); - success &= test( - "!UnoRuntime.areSame(test2Ac, test1Bb)", - !UnoRuntime.areSame(test2Ac, test1Bb)); - success &= test( - "!test2Ac.equals(test1Bc)", - !test2Ac.equals(test1Bc)); - success &= test( - "!UnoRuntime.areSame(test2Ac, test1Bc)", - !UnoRuntime.areSame(test2Ac, test1Bc)); - success &= test( - "test2Ac.equals(test2Aa)", - test2Ac.equals(test2Aa)); - success &= test( - "UnoRuntime.areSame(test2Ac, test2Aa)", - UnoRuntime.areSame(test2Ac, test2Aa)); - success &= test( - "test2Ac.equals(test2Ab)", - test2Ac.equals(test2Ab)); - success &= test( - "UnoRuntime.areSame(test2Ac, test2Ab)", - UnoRuntime.areSame(test2Ac, test2Ab)); - success &= test( - "test2Ac.equals(test2Ac)", - test2Ac.equals(test2Ac)); - success &= test( - "UnoRuntime.areSame(test2Ac, test2Ac)", - UnoRuntime.areSame(test2Ac, test2Ac)); - success &= test( - "test2Ac.equals(test2Ba)", - test2Ac.equals(test2Ba)); - success &= test( - "UnoRuntime.areSame(test2Ac, test2Ba)", - UnoRuntime.areSame(test2Ac, test2Ba)); - success &= test( - "test2Ac.equals(test2Bb)", - test2Ac.equals(test2Bb)); - success &= test( - "UnoRuntime.areSame(test2Ac, test2Bb)", - UnoRuntime.areSame(test2Ac, test2Bb)); - success &= test( - "test2Ac.equals(test2Bc)", - test2Ac.equals(test2Bc)); - success &= test( - "UnoRuntime.areSame(test2Ac, test2Bc)", - UnoRuntime.areSame(test2Ac, test2Bc)); - - success &= test( - "!test2Ba.equals(null)", - !test2Ba.equals(null)); - success &= test( - "!UnoRuntime.areSame(test2Ba, null)", - !UnoRuntime.areSame(test2Ba, null)); - success &= test( - "!test2Ba.equals(test1Aa)", - !test2Ba.equals(test1Aa)); - success &= test( - "!UnoRuntime.areSame(test2Ba, test1Aa)", - !UnoRuntime.areSame(test2Ba, test1Aa)); - success &= test( - "!test2Ba.equals(test1Ab)", - !test2Ba.equals(test1Ab)); - success &= test( - "!UnoRuntime.areSame(test2Ba, test1Ab)", - !UnoRuntime.areSame(test2Ba, test1Ab)); - success &= test( - "!test2Ba.equals(test1Ac)", - !test2Ba.equals(test1Ac)); - success &= test( - "!UnoRuntime.areSame(test2Ba, test1Ac)", - !UnoRuntime.areSame(test2Ba, test1Ac)); - success &= test( - "!test2Ba.equals(test1Ba)", - !test2Ba.equals(test1Ba)); - success &= test( - "!UnoRuntime.areSame(test2Ba, test1Ba)", - !UnoRuntime.areSame(test2Ba, test1Ba)); - success &= test( - "!test2Ba.equals(test1Bb)", - !test2Ba.equals(test1Bb)); - success &= test( - "!UnoRuntime.areSame(test2Ba, test1Bb)", - !UnoRuntime.areSame(test2Ba, test1Bb)); - success &= test( - "!test2Ba.equals(test1Bc)", - !test2Ba.equals(test1Bc)); - success &= test( - "!UnoRuntime.areSame(test2Ba, test1Bc)", - !UnoRuntime.areSame(test2Ba, test1Bc)); - success &= test( - "test2Ba.equals(test2Aa)", - test2Ba.equals(test2Aa)); - success &= test( - "UnoRuntime.areSame(test2Ba, test2Aa)", - UnoRuntime.areSame(test2Ba, test2Aa)); - success &= test( - "test2Ba.equals(test2Ab)", - test2Ba.equals(test2Ab)); - success &= test( - "UnoRuntime.areSame(test2Ba, test2Ab)", - UnoRuntime.areSame(test2Ba, test2Ab)); - success &= test( - "test2Ba.equals(test2Ac)", - test2Ba.equals(test2Ac)); - success &= test( - "UnoRuntime.areSame(test2Ba, test2Ac)", - UnoRuntime.areSame(test2Ba, test2Ac)); - success &= test( - "test2Ba.equals(test2Ba)", - test2Ba.equals(test2Ba)); - success &= test( - "UnoRuntime.areSame(test2Ba, test2Ba)", - UnoRuntime.areSame(test2Ba, test2Ba)); - success &= test( - "test2Ba.equals(test2Bb)", - test2Ba.equals(test2Bb)); - success &= test( - "UnoRuntime.areSame(test2Ba, test2Bb)", - UnoRuntime.areSame(test2Ba, test2Bb)); - success &= test( - "test2Ba.equals(test2Bc)", - test2Ba.equals(test2Bc)); - success &= test( - "UnoRuntime.areSame(test2Ba, test2Bc)", - UnoRuntime.areSame(test2Ba, test2Bc)); - - success &= test( - "!test2Bb.equals(null)", - !test2Bb.equals(null)); - success &= test( - "!UnoRuntime.areSame(test2Bb, null)", - !UnoRuntime.areSame(test2Bb, null)); - success &= test( - "!test2Bb.equals(test1Aa)", - !test2Bb.equals(test1Aa)); - success &= test( - "!UnoRuntime.areSame(test2Bb, test1Aa)", - !UnoRuntime.areSame(test2Bb, test1Aa)); - success &= test( - "!test2Bb.equals(test1Ab)", - !test2Bb.equals(test1Ab)); - success &= test( - "!UnoRuntime.areSame(test2Bb, test1Ab)", - !UnoRuntime.areSame(test2Bb, test1Ab)); - success &= test( - "!test2Bb.equals(test1Ac)", - !test2Bb.equals(test1Ac)); - success &= test( - "!UnoRuntime.areSame(test2Bb, test1Ac)", - !UnoRuntime.areSame(test2Bb, test1Ac)); - success &= test( - "!test2Bb.equals(test1Ba)", - !test2Bb.equals(test1Ba)); - success &= test( - "!UnoRuntime.areSame(test2Bb, test1Ba)", - !UnoRuntime.areSame(test2Bb, test1Ba)); - success &= test( - "!test2Bb.equals(test1Bb)", - !test2Bb.equals(test1Bb)); - success &= test( - "!UnoRuntime.areSame(test2Bb, test1Bb)", - !UnoRuntime.areSame(test2Bb, test1Bb)); - success &= test( - "!test2Bb.equals(test1Bc)", - !test2Bb.equals(test1Bc)); - success &= test( - "!UnoRuntime.areSame(test2Bb, test1Bc)", - !UnoRuntime.areSame(test2Bb, test1Bc)); - success &= test( - "test2Bb.equals(test2Aa)", - test2Bb.equals(test2Aa)); - success &= test( - "UnoRuntime.areSame(test2Bb, test2Aa)", - UnoRuntime.areSame(test2Bb, test2Aa)); - success &= test( - "test2Bb.equals(test2Ab)", - test2Bb.equals(test2Ab)); - success &= test( - "UnoRuntime.areSame(test2Bb, test2Ab)", - UnoRuntime.areSame(test2Bb, test2Ab)); - success &= test( - "test2Bb.equals(test2Ac)", - test2Bb.equals(test2Ac)); - success &= test( - "UnoRuntime.areSame(test2Bb, test2Ac)", - UnoRuntime.areSame(test2Bb, test2Ac)); - success &= test( - "test2Bb.equals(test2Ba)", - test2Bb.equals(test2Ba)); - success &= test( - "UnoRuntime.areSame(test2Bb, test2Ba)", - UnoRuntime.areSame(test2Bb, test2Ba)); - success &= test( - "test2Bb.equals(test2Bb)", - test2Bb.equals(test2Bb)); - success &= test( - "UnoRuntime.areSame(test2Bb, test2Bb)", - UnoRuntime.areSame(test2Bb, test2Bb)); - success &= test( - "test2Bb.equals(test2Bc)", - test2Bb.equals(test2Bc)); - success &= test( - "UnoRuntime.areSame(test2Bb, test2Bc)", - UnoRuntime.areSame(test2Bb, test2Bc)); - - success &= test( - "!test2Bc.equals(null)", - !test2Bc.equals(null)); - success &= test( - "!UnoRuntime.areSame(test2Bc, null)", - !UnoRuntime.areSame(test2Bc, null)); - success &= test( - "!test2Bc.equals(test1Aa)", - !test2Bc.equals(test1Aa)); - success &= test( - "!UnoRuntime.areSame(test2Bc, test1Aa)", - !UnoRuntime.areSame(test2Bc, test1Aa)); - success &= test( - "!test2Bc.equals(test1Ab)", - !test2Bc.equals(test1Ab)); - success &= test( - "!UnoRuntime.areSame(test2Bc, test1Ab)", - !UnoRuntime.areSame(test2Bc, test1Ab)); - success &= test( - "!test2Bc.equals(test1Ac)", - !test2Bc.equals(test1Ac)); - success &= test( - "!UnoRuntime.areSame(test2Bc, test1Ac)", - !UnoRuntime.areSame(test2Bc, test1Ac)); - success &= test( - "!test2Bc.equals(test1Ba)", - !test2Bc.equals(test1Ba)); - success &= test( - "!UnoRuntime.areSame(test2Bc, test1Ba)", - !UnoRuntime.areSame(test2Bc, test1Ba)); - success &= test( - "!test2Bc.equals(test1Bb)", - !test2Bc.equals(test1Bb)); - success &= test( - "!UnoRuntime.areSame(test2Bc, test1Bb)", - !UnoRuntime.areSame(test2Bc, test1Bb)); - success &= test( - "!test2Bc.equals(test1Bc)", - !test2Bc.equals(test1Bc)); - success &= test( - "!UnoRuntime.areSame(test2Bc, test1Bc)", - !UnoRuntime.areSame(test2Bc, test1Bc)); - success &= test( - "test2Bc.equals(test2Aa)", - test2Bc.equals(test2Aa)); - success &= test( - "UnoRuntime.areSame(test2Bc, test2Aa)", - UnoRuntime.areSame(test2Bc, test2Aa)); - success &= test( - "test2Bc.equals(test2Ab)", - test2Bc.equals(test2Ab)); - success &= test( - "UnoRuntime.areSame(test2Bc, test2Ab)", - UnoRuntime.areSame(test2Bc, test2Ab)); - success &= test( - "test2Bc.equals(test2Ac)", - test2Bc.equals(test2Ac)); - success &= test( - "UnoRuntime.areSame(test2Bc, test2Ac)", - UnoRuntime.areSame(test2Bc, test2Ac)); - success &= test( - "test2Bc.equals(test2Ba)", - test2Bc.equals(test2Ba)); - success &= test( - "UnoRuntime.areSame(test2Bc, test2Ba)", - UnoRuntime.areSame(test2Bc, test2Ba)); - success &= test( - "test2Bc.equals(test2Bb)", - test2Bc.equals(test2Bb)); - success &= test( - "UnoRuntime.areSame(test2Bc, test2Bb)", - UnoRuntime.areSame(test2Bc, test2Bb)); - success &= test( - "test2Bc.equals(test2Bc)", - test2Bc.equals(test2Bc)); - success &= test( - "UnoRuntime.areSame(test2Bc, test2Bc)", - UnoRuntime.areSame(test2Bc, test2Bc)); - - success &= test( - "test1Aa.hashCode() == test1Ab.hashCode()", - test1Aa.hashCode() - == test1Ab.hashCode()); - success &= test( - "test1Aa.hashCode()" - + " == test1Ac.hashCode()", - test1Aa.hashCode() - == test1Ac.hashCode()); - success &= test( - "test1Aa.hashCode()" - + " == test1Ba.hashCode()", - test1Aa.hashCode() - == test1Ba.hashCode()); - success &= test( - "test1Aa.hashCode()" - + " == test1Bb.hashCode()", - test1Aa.hashCode() - == test1Bb.hashCode()); - success &= test( - "test1Aa.hashCode()" - + " == test1Bc.hashCode()", - test1Aa.hashCode() - == test1Bc.hashCode()); - success &= test( - "test2Aa.hashCode()" - + " == test2Ab.hashCode()", - test2Aa.hashCode() - == test2Ab.hashCode()); - success &= test( - "test2Aa.hashCode()" - + " == test2Ac.hashCode()", - test2Aa.hashCode() - == test2Ac.hashCode()); - success &= test( - "test2Aa.hashCode()" - + " == test2Ba.hashCode()", - test2Aa.hashCode() - == test2Ba.hashCode()); - success &= test( - "test2Aa.hashCode()" - + " == test2Bb.hashCode()", - test2Aa.hashCode() - == test2Bb.hashCode()); - success &= test( - "test2Aa.hashCode()" - + " == test2Bc.hashCode()", - test2Aa.hashCode() - == test2Bc.hashCode()); - - done.notifyDone(); - testBed.serverDone(success); - } catch (Exception e) { - e.printStackTrace(System.err); - } - } - - private /*static*/ boolean test( - String message, boolean condition) - { - if (!condition) { - System.err.println("Failed: " + message); - } - return condition; - } - }.start(); - } - }; - } - - private final TestBed testBed; - private final String unoTypes; - private final String unoServices; - } - - public interface XDone extends XInterface { - void notifyDone(); - - TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("notifyDone", 0, 0) }; - } - - public interface XTestFrame extends XInterface { - void notifyAccepting(XDone done, Object object1, Object object2); - - TypeInfo[] UNOTYPEINFO = { - new MethodTypeInfo("notifyAccepting", 0, TypeInfo.ONEWAY) }; - } - - // Use "127.0.0.1" instead of "localhost", see #i32281#: - private static final String CONNECTION_DESCRIPTION - = "socket,host=127.0.0.1,port=12346"; - private static final String PROTOCOL_DESCRIPTION = "urp"; - - private static final String INSTANCE1 = "instance1"; - private static final String INSTANCE2 = "instance2"; -} diff --git a/bridges/test/java_uno/equals/makefile.mk b/bridges/test/java_uno/equals/makefile.mk deleted file mode 100644 index e6affc874683..000000000000 --- a/bridges/test/java_uno/equals/makefile.mk +++ /dev/null @@ -1,87 +0,0 @@ -# -# 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 . -# - -PRJ = ..$/..$/.. -PRJNAME = bridges - -TARGET = test_javauno_equals -PACKAGE = test$/java_uno$/equals - -ENABLE_EXCEPTIONS = TRUE - -.INCLUDE: settings.mk - -# Make sure TestBed.class is found under $(CLASSDIR)$/test: -.IF "$(XCLASSPATH)" == "" -XCLASSPATH := $(CLASSDIR)$/test -.ELSE -XCLASSPATH !:= $(XCLASSPATH)$(LIBO_PATH_SEPARATOR)$(CLASSDIR)$/test -.ENDIF - -DLLPRE = # no leading "lib" on .so files -INCPRE += $(MISC)$/$(TARGET)$/inc - -SLOFILES = $(SLO)$/testequals.obj - -SHL1TARGET = $(ENFORCEDSHLPREFIX)testequals.uno -SHL1OBJS = $(SLOFILES) -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL1VERSIONMAP = $(SOLARENV)/src/component.map -SHL1IMPLIB = itestequals - -JAVAFILES = TestEquals.java -JARFILES = juh.jar jurt.jar ridl.jar - -.INCLUDE: target.mk - -ALLTAR: $(BIN)$/testequals - -.IF "$(OS)" == "WNT" -GIVE_EXEC_RIGHTS = @echo -.ELSE # GUI, WNT -GIVE_EXEC_RIGHTS = chmod +x -.ENDIF # GUI, WNT - -EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i) -EXEC_CLASSPATH = \ - $(strip $(subst,!,$(LIBO_PATH_SEPARATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) - -$(MISC)$/$(TARGET).rdb: types.idl - - rm $@ - - $(MKDIR) $(MISC)$/$(TARGET) - - $(MKDIR) $(MISC)$/$(TARGET)$/inc - $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $< - $(REGMERGE) $(MISC)$/$(TARGET).rdb /UCR $(MISC)$/$(TARGET)$/types.urd - $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb - $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb - -$(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET).rdb - -$(BIN)$/testequals: $(BIN)$/testequals_services.rdb - echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \ - ..$/class$/test$(LIBO_PATH_SEPARATOR)..$/class$(LIBO_PATH_SEPARATOR)\ -..$/class$/java_uno.jar$(LIBO_PATH_SEPARATOR)$(EXEC_CLASSPATH) \ - test.java_uno.equals.TestEquals $(SOLARBINDIR)$/types.rdb \ - testequals_services.rdb > $@ - $(GIVE_EXEC_RIGHTS) $@ - -$(BIN)$/testequals_services.rdb: - - rm $@ - $(REGCOMP) -register -r $@ -c bridgefac.uno - $(REGCOMP) -register -r $@ -c connector.uno - $(REGCOMP) -register -r $@ -c remotebridge.uno diff --git a/bridges/test/java_uno/equals/testequals.cxx b/bridges/test/java_uno/equals/testequals.cxx deleted file mode 100644 index 651b80d1ffdd..000000000000 --- a/bridges/test/java_uno/equals/testequals.cxx +++ /dev/null @@ -1,202 +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/bridge/XBridge.hpp" -#include "com/sun/star/bridge/XBridgeFactory.hpp" -#include "com/sun/star/connection/Connector.hpp" -#include "com/sun/star/connection/XConnection.hpp" -#include "com/sun/star/connection/XConnector.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" -#include "com/sun/star/registry/InvalidRegistryException.hpp" -#include "com/sun/star/registry/XRegistryKey.hpp" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase.hxx" -#include -#include "cppuhelper/weak.hxx" -#include "rtl/string.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "test/java_uno/equals/XBase.hpp" -#include "test/java_uno/equals/XDerived.hpp" -#include "test/java_uno/equals/XTestInterface.hpp" -#include "uno/environment.h" - -namespace { - -class Service: public cppu::WeakImplHelper< - css::lang::XServiceInfo, test::java_uno::equals::XTestInterface > -{ -public: - virtual inline OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException) - { return OUString::createFromAscii(getImplementationName_static()); } - - virtual sal_Bool SAL_CALL supportsService( - OUString const & rServiceName) throw (css::uno::RuntimeException); - - virtual inline css::uno::Sequence< OUString > SAL_CALL - getSupportedServiceNames() throw (css::uno::RuntimeException) - { return getSupportedServiceNames_static(); } - - virtual void SAL_CALL connect(OUString const & rConnection, - OUString const & rProtocol) - throw (css::uno::Exception); - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL get( - OUString const & rName) throw (css::uno::RuntimeException); - - static inline sal_Char const * getImplementationName_static() - { return "com.sun.star.test.bridges.testequals.impl"; } - - static css::uno::Sequence< OUString > - getSupportedServiceNames_static(); - - static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( - css::uno::Reference< css::uno::XComponentContext > const & rContext) - throw (css::uno::Exception); - -private: - explicit inline Service( - css::uno::Reference< css::uno::XComponentContext > const & rContext): - m_xContext(rContext) {} - - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::bridge::XBridge > m_xBridge; -}; - -} - -sal_Bool Service::supportsService(OUString const & rServiceName) - throw (css::uno::RuntimeException) -{ - return cppu::supportsService(this, rServiceName); -} - -void Service::connect(OUString const & rConnection, - OUString const & rProtocol) - throw (css::uno::Exception) -{ - css::uno::Reference< css::connection::XConnection > xConnection( - css::connection::Connector::create(m_xContext)->connect(rConnection)); - css::uno::Reference< css::bridge::XBridgeFactory > xBridgeFactory( - m_xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", - m_xContext), - css::uno::UNO_QUERY); - m_xBridge = xBridgeFactory->createBridge(OUString(), rProtocol, - xConnection, 0); -} - -css::uno::Reference< css::uno::XInterface > -Service::get(OUString const & rName) throw (css::uno::RuntimeException) -{ - return m_xBridge->getInstance(rName); -} - -css::uno::Sequence< OUString > Service::getSupportedServiceNames_static() -{ - css::uno::Sequence< OUString > aNames { "com.sun.star.test.bridges.testequals" }; - return aNames; -} - -css::uno::Reference< css::uno::XInterface > Service::createInstance( - css::uno::Reference< css::uno::XComponentContext > const & rContext) - throw (css::uno::Exception) -{ - // Make types known: - cppu::UnoType::get(); - cppu::UnoType::get(); - cppu::UnoType::get(); - - return static_cast< cppu::OWeakObject * >(new Service(rContext)); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(sal_Char const * pImplName, - void * pServiceManager, void *) -{ - void * pFactory = 0; - if (pServiceManager) - if (rtl_str_compare(pImplName, Service::getImplementationName_static()) - == 0) - { - css::uno::Reference< css::lang::XSingleComponentFactory > - xFactory(cppu::createSingleComponentFactory( - &Service::createInstance, - OUString::createFromAscii( - Service::getImplementationName_static()), - Service::getSupportedServiceNames_static())); - if (xFactory.is()) - { - xFactory->acquire(); - pFactory = xFactory.get(); - } - } - return pFactory; -} - -namespace { - -bool writeInfo(void * pRegistryKey, sal_Char const * pImplementationName, - css::uno::Sequence< OUString > const & rServiceNames) -{ - OUString aKeyName( "/" ); - aKeyName += OUString::createFromAscii(pImplementationName); - aKeyName += "/UNO/SERVICES"; - css::uno::Reference< css::registry::XRegistryKey > xKey; - try - { - xKey = static_cast< css::registry::XRegistryKey * >(pRegistryKey)-> - createKey(aKeyName); - } - catch (css::registry::InvalidRegistryException &) {} - if (!xKey.is()) - return false; - bool bSuccess = true; - for (sal_Int32 i = 0; i < rServiceNames.getLength(); ++i) - try - { - xKey->createKey(rServiceNames[i]); - } - catch (css::registry::InvalidRegistryException &) - { - bSuccess = false; - break; - } - return bSuccess; -} - -} - -extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey) -{ - return pRegistryKey - && writeInfo(pRegistryKey, Service::getImplementationName_static(), - Service::getSupportedServiceNames_static()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/equals/types.idl b/bridges/test/java_uno/equals/types.idl deleted file mode 100644 index bd69980b6091..000000000000 --- a/bridges/test/java_uno/equals/types.idl +++ /dev/null @@ -1,41 +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 -#include - -// UNO interfaces used between Java and native (C++) environments. - -module test { module java_uno { module equals { - -interface XBase: com::sun::star::uno::XInterface {}; - -interface XDerived: XBase {}; - -interface XTestInterface: com::sun::star::uno::XInterface -{ - void connect([in] string connection, [in] string protocol) - raises (com::sun::star::uno::Exception); - - com::sun::star::uno::XInterface get([in] string name); -}; - -}; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/nativethreadpool/Relay.java b/bridges/test/java_uno/nativethreadpool/Relay.java deleted file mode 100644 index 7b523f3210ab..000000000000 --- a/bridges/test/java_uno/nativethreadpool/Relay.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 test.java_uno.nativethreadpool; - -import com.sun.star.bridge.BridgeExistsException; -import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.comp.helper.Bootstrap; -import com.sun.star.comp.loader.FactoryHelper; -import com.sun.star.connection.AlreadyAcceptingException; -import com.sun.star.connection.ConnectionSetupException; -import com.sun.star.connection.Acceptor; -import com.sun.star.connection.XAcceptor; -import com.sun.star.lang.WrappedTargetRuntimeException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.registry.XRegistryKey; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; - -public final class Relay implements XRelay, XSource { - public void start(XSource source) { - this.source = source; - XComponentContext context; - try { - context = Bootstrap.createInitialComponentContext(null); - } catch (RuntimeException e) { - throw e; - } catch (com.sun.star.uno.Exception e) { - throw new WrappedTargetRuntimeException(e, e.getMessage(), this, e); - } catch (Exception e) { - throw new com.sun.star.uno.RuntimeException(e, "", this); - } - final XAcceptor acceptor = Acceptor.create(context); - final XBridgeFactory factory; - try { - factory = UnoRuntime.queryInterface( - XBridgeFactory.class, - context.getServiceManager().createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", context)); - } catch (com.sun.star.uno.Exception e) { - throw new WrappedTargetRuntimeException(e, e.getMessage(), this, e); - } - new Thread() { - @Override - public void run() { - try { - // Use "127.0.0.1" instead of "localhost", see #i32281#: - factory.createBridge( - "", "urp", - acceptor.accept("socket,host=127.0.0.1,port=3831"), - new XInstanceProvider() { - public Object getInstance(String instanceName) { - return Relay.this; - } - }); - } catch (AlreadyAcceptingException e) { - e.printStackTrace(System.err); - } catch (ConnectionSetupException e) { - e.printStackTrace(System.err); - } catch (BridgeExistsException e) { - e.printStackTrace(System.err); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(System.err); - } - } - }.start(); - try { - Thread.sleep(3000); // wait for new thread to accept connection - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new com.sun.star.uno.RuntimeException(e, "", this); - } - } - - public int get() { - return source.get(); - } - - public static XSingleServiceFactory __getServiceFactory( - String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) - { - return implName.equals(implementationName) - ? FactoryHelper.getServiceFactory( - Relay.class, serviceName, multiFactory, regKey) - : null; - } - - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - implementationName, serviceName, regKey); - } - - private static final String implementationName - = "test.javauno.nativethreadpool.comp.Relay"; - private static final String serviceName - = "test.javauno.nativethreadpool.Relay"; - - private XSource source; -} diff --git a/bridges/test/java_uno/nativethreadpool/makefile.mk b/bridges/test/java_uno/nativethreadpool/makefile.mk deleted file mode 100644 index 504bcb1ac2cc..000000000000 --- a/bridges/test/java_uno/nativethreadpool/makefile.mk +++ /dev/null @@ -1,112 +0,0 @@ -# -# 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 . -# - -PRJ := ..$/..$/.. -PRJNAME := bridges - -TARGET := test_javauno_nativethreadpool -PACKAGE := test$/java_uno$/nativethreadpool - -ENABLE_EXCEPTIONS := TRUE - -#TODO: -.IF "$(OS)" == "LINUX" -JVM_LIB_URL := file:///net/grande.germany/develop6/update/dev/Linux_JDK_1.4.1_03/jre/lib/i386/client/libjvm.so -.ELSE -ERROR -- missing platform -.ENDIF - -.INCLUDE: settings.mk - -DLLPRE = # no leading "lib" on .so files -INCPRE += $(MISC)$/$(TARGET)$/inc - -SHL1TARGET = $(ENFORCEDSHLPREFIX)$(TARGET)_client.uno -SHL1OBJS = $(SLO)$/testnativethreadpoolclient.obj -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL1VERSIONMAP = version.map -SHL1IMPLIB = i$(TARGET)_client - -SHL2TARGET = $(ENFORCEDSHLPREFIX)$(TARGET)_server.uno -SHL2OBJS = $(SLO)$/testnativethreadpoolserver.obj -SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL2VERSIONMAP = version.map -SHL2IMPLIB = i$(TARGET)_server - -SLOFILES = $(SHL1OBJS) $(SHL2OBJS) - -JAVAFILES = Relay.java -JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar - -.INCLUDE: target.mk - -ALLTAR: test - -EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i) -EXEC_CLASSPATH = \ - $(strip $(subst,!,$(LIBO_PATH_SEPARATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) - -$(MISC)$/$(TARGET)$/types.rdb: types.idl - - rm $@ - - $(MKDIR) $(MISC)$/$(TARGET) - - $(MKDIR) $(MISC)$/$(TARGET)$/inc - $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $< - $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/types.urd - $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb - $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb - -$(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET)$/types.rdb - -$(BIN)$/$(TARGET).uno.jar: $(JAVACLASSFILES) relay.manifest - jar cfm $@ relay.manifest -C $(CLASSDIR) test/javauno/nativethreadpool - -$(BIN)$/$(TARGET).rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.rdb \ - $(BIN)$/$(TARGET).uno.jar - cp $(MISC)$/$(TARGET)$/types.rdb $@ - $(REGMERGE) $@ / $(SOLARBINDIR)$/types.rdb - $(REGCOMP) -register -r $@ -c acceptor.uno$(DLLPOST) \ - -c bridgefac.uno$(DLLPOST) -c connector.uno$(DLLPOST) \ - -c remotebridge.uno$(DLLPOST) -c uuresolver.uno$(DLLPOST) \ - -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \ - -c stocservices.uno$(DLLPOST) - cp $(SOLARBINDIR)$/types.rdb $(MISC)$/$(TARGET)$/bootstrap.rdb - $(REGCOMP) -register -r $(MISC)$/$(TARGET)$/bootstrap.rdb \ - -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \ - -c stocservices.uno$(DLLPOST) -.IF "$(OS)" == "WNT" - ERROR -- missing platform -.ELSE # GUI, WNT - + export OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' && \ - $(REGCOMP) -register -r $@ -c file://$(PWD)/$(BIN)$/$(TARGET).uno.jar \ - -br $(MISC)$/$(TARGET)$/bootstrap.rdb -classpath $(EXEC_CLASSPATH) \ - -env:URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR) -.ENDIF # GUI, WNT - -test .PHONY: $(SHL1TARGETN) $(BIN)$/$(TARGET).uno.jar $(BIN)$/$(TARGET).rdb -.IF "$(OS)" == "WNT" - ERROR -- missing platform -.ELSE # GUI, WNT - $(AUGMENT_LIBRARY_PATH) uno -c test.javauno.nativethreadpool.server \ - -l $(SHL2TARGETN) -ro $(BIN)$/$(TARGET).rdb \ - -u 'uno:socket,host=localhost,port=3830;urp;test' --singleaccept & - + $(AUGMENT_LIBRARY_PATH) OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' \ - CLASSPATH=$(EXEC_CLASSPATH)$(LIBO_PATH_SEPARATOR)$(BIN)$/$(TARGET).uno.jar \ - uno -c test.javauno.nativethreadpool.client -l $(SHL1TARGETN) \ - -ro $(BIN)$/$(TARGET).rdb \ - -env:URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR) -.ENDIF # GUI, WNT diff --git a/bridges/test/java_uno/nativethreadpool/readme b/bridges/test/java_uno/nativethreadpool/readme deleted file mode 100644 index f0be4e87fe83..000000000000 --- a/bridges/test/java_uno/nativethreadpool/readme +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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 . -# - -Test that a Java URP bridge started in a native process uses the same thread -pool as a C++ URP bridge. This test currently only works on Linux Intel. - -There are two processes involved. The client starts as a native process. It -first loads a Java component (Relay) via the in-process JNI bridge, which in -turn starts to accept incoming URP connections. The native part of the client -then connects to the server, retrieves a thread-local token from it, and checks -the token for correctness. The server simply waits for a connection from the -native part of the client, creates a connection to the Java part of the client, -and routes all requests from the native part of the client to the Java part of -the client. The Java part of the client in turn uses the in-process JNI bridge -to obtain the thread-local token. diff --git a/bridges/test/java_uno/nativethreadpool/relay.manifest b/bridges/test/java_uno/nativethreadpool/relay.manifest deleted file mode 100644 index 6cd1d9dbd611..000000000000 --- a/bridges/test/java_uno/nativethreadpool/relay.manifest +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -RegistrationClassName: test.javauno.nativethreadpool.Relay diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx deleted file mode 100644 index 32835e024078..000000000000 --- a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx +++ /dev/null @@ -1,157 +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 "test/javauno/nativethreadpool/XRelay.hpp" -#include "test/javauno/nativethreadpool/XSource.hpp" - -#include "com/sun/star/bridge/UnoUrlResolver.hpp" -#include "com/sun/star/bridge/XUnoUrlResolver.hpp" -#include "com/sun/star/connection/ConnectionSetupException.hpp" -#include "com/sun/star/connection/NoConnectException.hpp" -#include "com/sun/star/lang/IllegalArgumentException.hpp" -#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" -#include "com/sun/star/lang/XMain.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "cppuhelper/weak.hxx" -#include "osl/thread.hxx" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -#include - -namespace { - -class Client: public cppu::WeakImplHelper< - css::lang::XMain, test::javauno::nativethreadpool::XSource > -{ -public: - explicit Client( - css::uno::Reference< css::uno::XComponentContext > const & theContext): - context(theContext) {} - -private: - virtual ~Client() {} - - virtual sal_Int32 SAL_CALL run(css::uno::Sequence< OUString > const &) - throw (css::uno::RuntimeException); - - virtual sal_Int32 SAL_CALL get() throw (css::uno::RuntimeException); - - css::uno::Reference< css::uno::XComponentContext > context; - osl::ThreadData data; -}; - -sal_Int32 Client::run(css::uno::Sequence< OUString > const &) - throw (css::uno::RuntimeException) -{ - css::uno::Reference< css::lang::XMultiComponentFactory > factory( - context->getServiceManager()); - if (!factory.is()) { - throw css::uno::RuntimeException( - OUString( "no component context service manager" ), - static_cast< cppu::OWeakObject * >(this)); - } - css::uno::Reference< test::javauno::nativethreadpool::XRelay > relay; - try { - relay.set( - factory->createInstanceWithContext( - "test.javauno.nativethreadpool.Relay", - context), - css::uno::UNO_QUERY_THROW); - } catch (css::uno::RuntimeException &) { - throw; - } catch (css::uno::Exception & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "creating test.javauno.nativethreadpool.Relay service" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } - relay->start(this); - if (!data.setData(reinterpret_cast< void * >(12345))) { - throw css::uno::RuntimeException( - OUString( "osl::ThreadData::setData failed" ), - static_cast< cppu::OWeakObject * >(this)); - } - css::uno::Reference< test::javauno::nativethreadpool::XSource > source; - try { - source.set( - css::bridge::UnoUrlResolver::create(context)->resolve( - OUString( "uno:socket,host=localhost,port=3830;urp;test" )), - css::uno::UNO_QUERY_THROW); - } catch (css::connection::NoConnectException & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "com.sun.star.uno.UnoUrlResolver.resolve" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } catch (css::connection::ConnectionSetupException & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "com.sun.star.uno.UnoUrlResolver.resolve" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } catch (css::lang::IllegalArgumentException & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "com.sun.star.uno.UnoUrlResolver.resolve" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } - bool success = source->get() == 12345; - std::cout << "success? " << (success ? "yes" : "no") << '\n'; - return success ? 0 : 1; -} - -sal_Int32 Client::get() throw (css::uno::RuntimeException) { - return reinterpret_cast< sal_Int32 >(data.getData()); -} - -css::uno::Reference< css::uno::XInterface > SAL_CALL create( - css::uno::Reference< css::uno::XComponentContext > const & context) -{ - return static_cast< cppu::OWeakObject * >(new Client(context)); -} - -OUString SAL_CALL getImplementationName() { - return OUString( "test.javauno.nativethreadpool.client" ); -} - -css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() { - return css::uno::Sequence< OUString >(); -} - -cppu::ImplementationEntry entries[] = { - { &create, &getImplementationName, &getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx deleted file mode 100644 index 3ac084fb794e..000000000000 --- a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx +++ /dev/null @@ -1,121 +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 "test/javauno/nativethreadpool/XSource.hpp" - -#include "com/sun/star/bridge/UnoUrlResolver.hpp" -#include "com/sun/star/bridge/XUnoUrlResolver.hpp" -#include "com/sun/star/connection/ConnectionSetupException.hpp" -#include "com/sun/star/connection/NoConnectException.hpp" -#include "com/sun/star/lang/IllegalArgumentException.hpp" -#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "cppuhelper/weak.hxx" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -namespace { - -class Server: - public cppu::WeakImplHelper< test::javauno::nativethreadpool::XSource > -{ -public: - explicit Server( - css::uno::Reference< css::uno::XComponentContext > const & theContext): - context(theContext) {} - -private: - virtual ~Server() {} - - virtual sal_Int32 SAL_CALL get() throw (css::uno::RuntimeException); - - css::uno::Reference< css::uno::XComponentContext > context; -}; - -sal_Int32 Server::get() throw (css::uno::RuntimeException) { - css::uno::Reference< css::lang::XMultiComponentFactory > factory( - context->getServiceManager()); - if (!factory.is()) { - throw css::uno::RuntimeException( - OUString( "no component context service manager" ), - static_cast< cppu::OWeakObject * >(this)); - } - css::uno::Reference< test::javauno::nativethreadpool::XSource > source; - try { - // Use "127.0.0.1" instead of "localhost", see #i32281#: - source.set( - css::bridge::UnoUrlResolver::create(context)->resolve( - OUString( "uno:socket,host=127.0.0.1,port=3831;urp;test" )), - css::uno::UNO_QUERY_THROW); - } catch (css::connection::NoConnectException & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "com.sun.star.uno.UnoUrlResolver.resolve" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } catch (css::connection::ConnectionSetupException & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "com.sun.star.uno.UnoUrlResolver.resolve" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } catch (css::lang::IllegalArgumentException & e) { - throw css::lang::WrappedTargetRuntimeException( - OUString( "com.sun.star.uno.UnoUrlResolver.resolve" ), - static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); - } - return source->get(); -} - -css::uno::Reference< css::uno::XInterface > SAL_CALL create( - css::uno::Reference< css::uno::XComponentContext > const & context) -{ - return static_cast< cppu::OWeakObject * >(new Server(context)); -} - -OUString SAL_CALL getImplementationName() { - return OUString( "test.javauno.nativethreadpool.server" ); -} - -css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() { - return css::uno::Sequence< OUString >(); -} - -cppu::ImplementationEntry entries[] = { - { &create, &getImplementationName, &getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/nativethreadpool/types.idl b/bridges/test/java_uno/nativethreadpool/types.idl deleted file mode 100644 index de8256310cd4..000000000000 --- a/bridges/test/java_uno/nativethreadpool/types.idl +++ /dev/null @@ -1,34 +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 - -module test { module java_uno { module nativethreadpool { - -interface XSource: com::sun::star::uno::XInterface { - long get(); -}; - -interface XRelay: com::sun::star::uno::XInterface { - void start([in] XSource source); -}; - -}; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/java_uno/nativethreadpool/version.map b/bridges/test/java_uno/nativethreadpool/version.map deleted file mode 100644 index 35b0683eba6d..000000000000 --- a/bridges/test/java_uno/nativethreadpool/version.map +++ /dev/null @@ -1,24 +0,0 @@ -# -# 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 . -# - -UDK_3_0_0 { - global: - component_getFactory; - local: - *; -}; diff --git a/bridges/test/lib/TestBed.java b/bridges/test/lib/TestBed.java deleted file mode 100644 index cff5698e2a5c..000000000000 --- a/bridges/test/lib/TestBed.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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 test.lib; - -import com.sun.star.bridge.XBridge; -import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.bridge.XInstanceProvider; -import com.sun.star.comp.helper.Bootstrap; -import com.sun.star.connection.Acceptor; -import com.sun.star.connection.Connector; -import com.sun.star.connection.XAcceptor; -import com.sun.star.connection.XConnection; -import com.sun.star.connection.XConnector; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintStream; - -public final class TestBed { - public boolean execute(XInstanceProvider provider, boolean waitForServer, - Class client, long wait) throws Exception { - synchronized (lock) { - server = new Server(provider); - server.start(); - server.waitAccepting(); - } - Process p = Runtime.getRuntime().exec(new String[] { - "java", "-classpath", System.getProperty("java.class.path"), - client.getName() }); - pipe(p.getInputStream(), System.out, "CO> "); - pipe(p.getErrorStream(), System.err, "CE> "); - boolean clientDone = false; - if (wait <= 0) { - clientDone = p.waitFor() == CLIENT_DONE; - } else { - try { - Thread.sleep(wait); - } catch (InterruptedException e) { - p.destroy(); - throw e; - } - try { - clientDone = p.exitValue() == CLIENT_DONE; - } catch (IllegalThreadStateException e) { - p.destroy(); - } - } - boolean success = clientDone; - if (waitForServer) { - success &= server.waitDone(); - } - return success; - } - - public void serverDone(boolean success) { - synchronized (lock) { - server.done(success); - } - } - - private void pipe(final InputStream in, final PrintStream out, - final String prefix) { - new Thread("Pipe: " + prefix) { - @Override - public void run() { - BufferedReader r - = new BufferedReader(new InputStreamReader(in)); - try { - for (;;) { - String s = r.readLine(); - if (s == null) { - break; - } - out.println(prefix + s); - } - } catch (java.io.IOException e) { - e.printStackTrace(System.err); - } - } - }.start(); - } - - public static abstract class Client { - protected abstract boolean run(XComponentContext context) - throws Throwable; - - protected final String getConnectionDescription() { - return connectionDescription; - } - - protected final String getProtocolDescription() { - return protocolDescription; - } - - protected final XBridge getBridge(XComponentContext context) - throws com.sun.star.uno.Exception - { - XConnector connector = Connector.create(context); - XBridgeFactory factory = UnoRuntime.queryInterface( - XBridgeFactory.class, - context.getServiceManager().createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", context)); - System.out.println("Client: Connecting..."); - XConnection connection = connector.connect(connectionDescription); - System.out.println("Client: ...connected..."); - XBridge bridge = factory.createBridge( - "", protocolDescription, connection, null); - System.out.println("Client: ...bridged."); - return bridge; - } - - protected final void execute() { - int status = CLIENT_FAILED; - try { - if (run(Bootstrap.createInitialComponentContext(null))) { - status = CLIENT_DONE; - } - } catch (Throwable e) { - e.printStackTrace(System.err); - } - System.exit(status); - } - } - - private static final class Server extends Thread { - public Server(XInstanceProvider provider) { - super("Server"); - // assert provider != null; - this.provider = provider; - } - - @Override - public void run() { - try { - XComponentContext context - = Bootstrap.createInitialComponentContext(null); - XAcceptor acceptor = Acceptor.create(context); - XBridgeFactory factory - = UnoRuntime.queryInterface( - XBridgeFactory.class, - context.getServiceManager().createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", context)); - System.out.println("Server: Accepting..."); - synchronized (this) { - state = ACCEPTING; - notifyAll(); - } - for (;;) { - XConnection connection = acceptor.accept( - connectionDescription); - System.out.println("Server: ...connected..."); - factory.createBridge( - "", protocolDescription, connection, provider); - System.out.println("Server: ...bridged."); - } - } catch (Throwable e) { - e.printStackTrace(System.err); - } - } - - public synchronized void waitAccepting() throws InterruptedException { - while (state < ACCEPTING) { - wait(); - } - } - - public synchronized boolean waitDone() throws InterruptedException { - while (state <= ACCEPTING) { - wait(); - } - return state == SUCCEEDED; - } - - public synchronized void done(boolean success) { - state = success ? SUCCEEDED : FAILED; - notifyAll(); - } - - private static final int INITIAL = 0; - private static final int ACCEPTING = 1; - private static final int FAILED = 2; - private static final int SUCCEEDED = 3; - - private final XInstanceProvider provider; - - private int state = INITIAL; - } - - private static final int CLIENT_FAILED = 0; - private static final int CLIENT_DONE = 123; - - private static final String connectionDescription - = "socket,host=localhost,port=12345"; - private static final String protocolDescription = "urp"; - - private final Object lock = new Object(); - private Server server = null; -} diff --git a/bridges/test/lib/makefile.mk b/bridges/test/lib/makefile.mk deleted file mode 100644 index 629af7d3e02a..000000000000 --- a/bridges/test/lib/makefile.mk +++ /dev/null @@ -1,27 +0,0 @@ -# -# 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 . -# - -PRJ := ..$/..$/..$/..$/.. -PRJNAME := bridges -TARGET := test_com_sun_star_lib - -PACKAGE := test$/lib -JAVAFILES := TestBed.java -JARFILES := juh.jar jurt.jar ridl.jar - -.INCLUDE: javaunittest.mk diff --git a/bridges/test/makefile.mk b/bridges/test/makefile.mk deleted file mode 100644 index d3bff979f4e4..000000000000 --- a/bridges/test/makefile.mk +++ /dev/null @@ -1,166 +0,0 @@ -# -# 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 . -# - -PRJ=.. - -PRJNAME=bridges -TARGET=test -LIBTARGET=NO -TARGETTYPE=CUI -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -ALLIDLFILES = test_bridge.idl -CPPUMAKERFLAGS += -C - - -UNOUCRDEP=$(SOLARBINDIR)$/udkapi.rdb $(BIN)$/test.rdb -UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb $(BIN)$/test.rdb - -# output directory (one dir for each project) -UNOUCROUT=$(OUT)$/inc - -# adding to includepath -INCPRE+=$(UNOUCROUT) -CFLAGS += -I..$/source$/remote$/urp - -UNOTYPES = \ - com.sun.star.uno.XWeak\ - com.sun.star.uno.XNamingService\ - com.sun.star.uno.XAggregation \ - com.sun.star.uno.TypeClass\ - com.sun.star.io.XInputStream\ - com.sun.star.io.XOutputStream\ - com.sun.star.lang.XInitialization \ - com.sun.star.lang.XSingleServiceFactory \ - com.sun.star.lang.XMultiServiceFactory \ - com.sun.star.lang.XTypeProvider \ - com.sun.star.registry.XSimpleRegistry \ - com.sun.star.loader.XImplementationLoader \ - com.sun.star.registry.XImplementationRegistration \ - com.sun.star.corba.giop.TargetAddress \ - com.sun.star.corba.giop.TargetAddressGroup \ - com.sun.star.lang.XComponent \ - com.sun.star.bridge.XBridgeFactory\ - com.sun.star.connection.XAcceptor\ - com.sun.star.connection.XConnector\ - com.sun.star.beans.Property\ - com.sun.star.corba.giop.RequestHeader_1_2\ - com.sun.star.container.XSet\ - com.sun.star.lang.XServiceInfo\ - test.XTestFactory \ - com.sun.star.test.performance.XPerformanceTest \ - com.sun.star.lang.XMain \ - com.sun.star.lang.XMultiComponentFactory \ - com.sun.star.lang.XSingleComponentFactory - -JARFILES = jurt.jar unoil.jar - -OBJFILES= \ - $(OBJ)$/testserver.obj \ - $(OBJ)$/testclient.obj \ - $(OBJ)$/testcomp.obj \ - $(OBJ)$/testsameprocess.obj - - -APP2TARGET= testserver -APP2OBJS= $(OBJ)$/testserver.obj \ - $(OBJ)$/testcomp.obj - -.IF "$(OS)" == "LINUX" -APP2STDLIBS+= -lstdc++ -.ENDIF - -APP2STDLIBS+= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) - -APP3TARGET= testclient -APP3OBJS= $(OBJ)$/testclient.obj \ - $(OBJ)$/testcomp.obj - -.IF "$(OS)" == "LINUX" -APP3STDLIBS+= -lstdc++ -.ENDIF - -APP3STDLIBS+= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) - -#---------------------------------- - -APP4TARGET= testsameprocess -APP4OBJS= $(OBJ)$/testsameprocess.obj \ - $(OBJ)$/testcomp.obj - -.IF "$(OS)" == "LINUX" -APP4STDLIBS+= -lstdc++ -.ENDIF - -APP4STDLIBS+= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) - -APP4DEF= $(MISC)$/$(APP4TARGET).def - -#---------------------------------- - -# APP5TARGET= testoffice -# APP5OBJS= $(OBJ)$/testoffice.obj \ -# $(OBJ)$/testcomp.obj - -# .IF "$(OS)" == "LINUX" -# APP5STDLIBS+= -lstdc++ -# .ENDIF - -# APP5STDLIBS+= \ -# $(CPPULIB) \ -# $(CPPUHELPERLIB)\ -# $(SALLIB) - -# APP5DEF= $(MISC)$/$(APP5TARGET).def - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(BIN)$/test.rdb \ - $(BIN)$/server.rdb \ - $(BIN)$/client.rdb - -$(BIN)$/test.rdb: $(ALLIDLFILES) - $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $? - $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} - touch $@ - -$(BIN)$/client.rdb: $(BIN)$/test.rdb - rm -f $(BIN)$/client.rdb - $(REGMERGE) $@ / $(BIN)$/test.rdb $(SOLARBINDIR)$/udkapi.rdb - -$(BIN)$/server.rdb: $(BIN)$/test.rdb - rm -f $(BIN)$/client.rdb - $(REGMERGE) $@ / $(BIN)$/test.rdb $(SOLARBINDIR)$/udkapi.rdb - diff --git a/bridges/test/performance/makefile.mk b/bridges/test/performance/makefile.mk deleted file mode 100644 index 450f54bd1e0d..000000000000 --- a/bridges/test/performance/makefile.mk +++ /dev/null @@ -1,52 +0,0 @@ -# -# 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 . -# - -PRJ=..$/.. - -PRJNAME=bridges -TARGET=test -LIBTARGET=NO -TARGETTYPE=CUI -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -OBJFILES= $(OBJ)$/testperformance.obj - -#---------------------------------- - -APP1TARGET= testperformance -APP1OBJS= $(OBJ)$/testperformance.obj - -.IF "$(OS)" == "LINUX" -APP1STDLIBS+= -lstdc++ -.ENDIF - -APP1STDLIBS+= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) - -APP1DEF= $(MISC)$/$(APP1TARGET).def - -.INCLUDE : target.mk - diff --git a/bridges/test/performance/testperformance.cxx b/bridges/test/performance/testperformance.cxx deleted file mode 100644 index aa48e85ab216..000000000000 --- a/bridges/test/performance/testperformance.cxx +++ /dev/null @@ -1,179 +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 -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef SAL_W32 -#include -#else -#include -#endif -#ifndef ULONG_MAX -#define ULONG_MAX 0xffffffff -#endif - -using namespace ::osl; -using namespace ::com::sun::star::uno; - -static inline sal_uInt32 getSystemTicks() -{ -#ifdef SAL_W32 - return (sal_uInt32)GetTickCount(); -#else - static sal_uInt32 nImplTicksPerSecond = 0; - static double dImplTicksPerSecond; - static double dImplTicksULONGMAX; - - struct tms aTms; - sal_uInt32 nTicks = (sal_uInt32)times( &aTms ); - - if ( !nImplTicksPerSecond ) - { - nImplTicksPerSecond = CLK_TCK; - dImplTicksPerSecond = nImplTicksPerSecond; - dImplTicksULONGMAX = (double)(sal_uInt32)ULONG_MAX; - } - - double fTicks = nTicks; - fTicks *= 1000; - fTicks /= dImplTicksPerSecond; - fTicks = fmod (fTicks, dImplTicksULONGMAX); - - return (sal_uInt32)fTicks; -#endif -} - -class MyTimer -{ -public: - explicit MyTimer(const OString &descString) - : nStart(getSystemTicks()) - , m_descString(descString) - { - } - ~MyTimer( ) - { - printf( "%f s : %s\n", (getSystemTicks() -nStart) / 1000., m_descString.getStr() ); - } -private: - sal_uInt32 nStart; - OString m_descString; -}; - -void main() -{ - // interlocked count - { - MyTimer timer( "performance - 1000*10000 interlocked count" ); - oslInterlockedCount count; - for( int i = 0 ; i < 1000*10000 ; i ++ ) - { - osl_atomic_increment( &count ); - } - } - { - OString myDummyString( "blubber" ); - MyTimer timer( "performance - 1000*10000 acquiring/releasing a refcounted string(without destruction)" ); - for( int i = 0 ; i < 1000*10000 ; i ++ ) - { - OString myNextDummyString = myDummyString ; - } - } - - printf( "--------------------\n" ); - { - Mutex mutex; - MyTimer timer( "performance - 1000*10000 acquiring/releasing an osl::Mutex" ); - for( int i = 0 ; i < 1000*10000 ; i ++ ) - { - MutexGuard guard( mutex ); - } - } - - { - oslSemaphore sema = osl_createSemaphore(1); - MyTimer timer( "performance - 1000*10000 acquiring/releasing an osl::Semaphore" ); - for( int i = 0 ; i < 1000*10000 ; i ++ ) - { - osl_acquireSemaphore( sema ); - osl_releaseSemaphore( sema ); - } - } - - printf( "--------------------\n" ); - { - MyTimer timer( "performance - 1000*10000 rtl::ByteSequence(500)" ); - for( int i = 0 ; i < 1000*1000 ; i ++ ) - { - ByteSequence seq(500); - } - } - - { - MyTimer timer( "performance - 1000*1000 rtl::ByteSequence(500,BYTESEQ_NODEFAULT)" ); - for( int i = 0 ; i < 1000*1000 ; i ++ ) - { - ByteSequence seq(500, BYTESEQ_NODEFAULT); - } - } - { - MyTimer timer( "performance - 1000*1000 com::sun::star::uno::Sequence< sal_Int8 > (500)" ); - for( int i = 0 ; i < 1000*1000 ; i ++ ) - { - Sequence< sal_Int8> seq(500); - } - } - { - MyTimer timer( "performance - 1000*1000 rtl_freeMemory( rtl_allocateMemory( 512 ) )" ); - for( int i = 0 ; i < 1000*1000 ; i ++ ) - { - rtl_freeMemory( rtl_allocateMemory( 512 ) ); - } - } - - printf( "--------------------\n" ); - { - MyTimer timer( "performance - 1000*1000 byte string construction/destruction" ); - for( int i = 0 ; i < 1000*1000 ; i ++ ) - { - OString textEnc( "this is a test string" ); - } - } - - { - MyTimer timer( "performance - 1000*1000 unicode string construction/destruction" ); - for( int i = 0 ; i < 1000*1000 ; i ++ ) - { - OUString textEnc( "this is a test string" ); - } - } - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/test_bridge.idl b/bridges/test/test_bridge.idl deleted file mode 100644 index af87237256d7..000000000000 --- a/bridges/test/test_bridge.idl +++ /dev/null @@ -1,76 +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 -#include - -module test -{ - -struct TestTypes -{ - boolean Bool; - char Char; - byte Byte; - short Short; - unsigned short UShort; - long Long; - unsigned long ULong; - hyper Hyper; - unsigned hyper UHyper; - float Float; - double Double; -// test::TestEnum Enum; - string String; - com::sun::star::uno::XInterface Interface; - any Any; -}; - -exception TestBridgeException : com::sun::star::uno::Exception -{ - -}; - -interface XCallMe : com::sun::star::uno::XInterface -{ - void call( [in] string s , [in] long nToDo ) raises( TestBridgeException ); - void callOneway( [in] string s , [in] long nToDo ); - [attribute] string sAttribute; - void callAgain( [in] XCallMe callAgain, [in] long nToCall ); - TestTypes transport( [in] TestTypes types ); - void drawLine( [in] long x1 , [in] long y1, [in] long x2, [in] long y2 ); -}; - -interface XInterfaceTest : com::sun::star::uno::XInterface -{ - void setIn( [in] XCallMe callback ); - void setInOut( [inout] XCallMe callback ); - void getOut( [out] XCallMe callback ); - XCallMe get(); -}; - -interface XTestFactory : com::sun::star::uno::XInterface -{ - XCallMe createCallMe(); - XInterfaceTest createInterfaceTest(); -}; - - -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/testclient.cxx b/bridges/test/testclient.cxx deleted file mode 100644 index b8a2a06bb7d2..000000000000 --- a/bridges/test/testclient.cxx +++ /dev/null @@ -1,237 +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 - -#include - -#include -#include -#include -#include -#include - -#include - -#include - -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -#include - - -using namespace ::test; -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::connection; -using namespace ::com::sun::star::test::performance; - -#include "testcomp.h" - - -void doPerformanceTest( const Reference < XPerformanceTest > & /* xBench */) -{ - printf( "not implemented\n" ); -// sal_Int32 i,nLoop = 2000; -// sal_Int32 tStart, tEnd , tEnd2; -// -// // oneway calls -// i = nLoop; -// tStart = GetTickCount(); -// while (i--) -// xBench->async(); -// tEnd = GetTickCount(); -// xBench->sync(); -// tEnd2 = GetTickCount(); -// printf( "%d %d %d\n" , nLoop, tEnd - tStart , tEnd2 -tStart ); -// // synchron calls -// i = nLoop; -// tStart = GetTickCount(); -// while (i--) -// xBench->sync(); -// tEnd = GetTickCount(); -// printf( "%d %d \n" , nLoop, tEnd - tStart ); - -} - -void testLatency( const Reference < XConnection > &r , sal_Bool /* bReply */) -{ - sal_Int32 nLoop = 10000; - TimeValue aStartTime, aEndTime; - osl_getSystemTime( &aStartTime ); - - sal_Int32 i; - for( i = 0 ; i < nLoop ; i++ ) - { - Sequence< sal_Int8 > s1( 200 ); - r->write( s1 ); - r->read( s1 , 12 ); - r->read( s1 , 48 ); - } - osl_getSystemTime( &aEndTime ); - - double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0); - double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0); - - printf( "System latency per call : %g\n" , (( fEnd-fStart )/2.) / ((double)(nLoop)) ); -} - -int main( int argc, char *argv[] ) -{ - if( argc < 2 ) - { - printf( - "usage : testclient [-r] connectionstring\n" - " -r reverse call me test (server calls client)" - ); - return 0; - } - - OUString sConnectionString; - OUString sProtocol; - sal_Bool bLatency = sal_False; - sal_Bool bReverse = sal_False; - - parseCommandLine( argv , &sConnectionString , &sProtocol , &bLatency , &bReverse ); - - { - Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory( - OUString("client.rdb") ); - - - Reference < XConnector > rConnector( - createComponent( OUString("com.sun.star.connection.Connector"), - OUString( "connector.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - - try - { - Reference < XConnection > rConnection = - rConnector->connect( sConnectionString ); - - printf( "%s\n" , OUStringToOString( rConnection->getDescription(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - - - if( bLatency ) - { - testLatency( rConnection , sal_False ); - testLatency( rConnection , sal_True ); - } - else - { - // just ensure that it is registered - createComponent( OUString("com.sun.star.bridge.Bridge.iiop"), - OUString( "remotebridge.uno" SAL_DLLEXTENSION), - rSMgr ); - - Reference < XBridgeFactory > rFactory( - createComponent( OUString("com.sun.star.bridge.BridgeFactory"), - OUString( "bridgefac.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - if( rFactory.is() ) - { - - Reference < XBridge > rBridge = rFactory->createBridge( - OUString("bla blub"), - sProtocol, - rConnection, - new OInstanceProvider ); - { - // test the factory - Reference < XBridge > rBridge2 = rFactory->getBridge( OUString("bla blub") ); - OSL_ASSERT( rBridge2.is() ); - OSL_ASSERT( rBridge2->getDescription() == rBridge->getDescription( ) ); - OSL_ASSERT( rBridge2->getName() == rBridge->getName() ); - OSL_ASSERT( rBridge2 == rBridge ); - } - - - Reference < XInterface > rInitialObject = rBridge->getInstance( - OUString("bridges-testobject") ); - - if( rInitialObject.is() ) - { - printf( "got the remote object\n" ); - if( ! bReverse ) - { - // Reference < XComponent > rPerfTest( rInitialObject , UNO_QUERY ); -// if( rPerfTest.is() ) -// { -// // doPerformanceTest( rPerfTest ); -// } -// else -// { - testRemote( rInitialObject ); -// } - } - } -// Reference < XComponent > rComp( rBridge , UNO_QUERY ); -// rComp->dispose(); - - rInitialObject.clear(); - printf( "Waiting...\n" ); - TimeValue value={bReverse ?1000 :2,0}; - osl_waitThread( &value ); - printf( "Closing...\n" ); - } - - Reference < XBridge > rBridge = rFactory->getBridge( OUString("bla blub") ); -// OSL_ASSERT( ! rBridge.is() ); - } - - } - catch( DisposedException & e ) - { - OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ); - printf( "A remote object reference became invalid\n%s\n" , o.pData->buffer ); - } - catch( Exception &e ) - { - OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ); - printf( "Login failed, got an Exception !\n%s\n" , o.pData->buffer ); - } - - - Reference < XComponent > rComp( rSMgr , UNO_QUERY ); - rComp->dispose(); - } - printf( "Closed\n" ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/testclient.java b/bridges/test/testclient.java deleted file mode 100644 index 06e5efb49f58..000000000000 --- a/bridges/test/testclient.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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 test; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.connection.XConnector; -import com.sun.star.connection.XConnection; -import com.sun.star.bridge.XInstanceProvider; - -class MyInstanceProvider implements XInstanceProvider -{ - public Object getInstance( String sName ) - { - System.out.println( "getInstance called" ); - return new MyTestFactory(); - } - -} - - -class MyTestFactory implements XTestFactory -{ - public XCallMe createCallMe( ) throws com.sun.star.uno.RuntimeException - { - return new MyCallMe(); - } - - public test.XInterfaceTest createInterfaceTest( ) throws com.sun.star.uno.RuntimeException - { - return null; - } - -} -class MyCallMe implements XCallMe -{ - public String getsAttribute() throws com.sun.star.uno.RuntimeException - { - return ""; - } - - // Methods - public void call( /*IN*/String s, /*IN*/int nToDo ) throws com.sun.star.uno.RuntimeException - { - - } - public void callOneway( /*IN*/String s, /*IN*/int nToDo ) throws com.sun.star.uno.RuntimeException - { - System.out.println( "entering callOneway" ); - try { - Thread.sleep( 4000 ); - } - catch ( java.lang.Exception e ) - { - System.out.println( e ); - } - System.out.println( "leaving callOneway" ); - } - public void callAgain( /*IN*/XCallMe callAgain, /*IN*/int nToCall ) throws com.sun.star.uno.RuntimeException - { - - } - public test.TestTypes transport( /*IN*/test.TestTypes types ) throws com.sun.star.uno.RuntimeException - { - return new test.TestTypes(); - } - -} - -public class testclient -{ - static void main( String[] args ) - { - try { - - com.sun.star.comp.servicemanager.ServiceManager smgr = - new com.sun.star.comp.servicemanager.ServiceManager(); - smgr.insert( "com.sun.star.comp.connections.Connector" ); - - Object x = smgr.createInstance("com.sun.star.connection.Connector"); - if( x == null ) - { - System.out.println( "couldn't create connector\n" ); - return; - } - - - XConnector xConnector = - UnoRuntime.queryInterface( XConnector.class , x ); - - XConnection xConnection = xConnector.connect(args[0]); - - if( null != xConnection ) - { - System.out.println( "after connect" ); - UnoRuntime.getBridgeByName( - "java", - null, - "remote", - null, - new Object[]{"iiop", xConnection, new MyInstanceProvider()}); - - System.out.println( "after building bridge" ); - - Thread.sleep( 100000 ); - } - } - catch( com.sun.star.uno.Exception e) - { - System.out.println( "Exception thrown" ); - } - catch( java.lang.Exception e) - { - System.out.println( "java.lang.Exception thrown" ); - } - - System.out.println( "exiting" ); - } -} diff --git a/bridges/test/testcomp.cxx b/bridges/test/testcomp.cxx deleted file mode 100644 index fb33907b7614..000000000000 --- a/bridges/test/testcomp.cxx +++ /dev/null @@ -1,738 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::test; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::test::performance; - -#include "testcomp.h" - - -void parseCommandLine( char *argv[] , - OUString *pConnection , OUString *pProtocol , - sal_Bool *pbLatency , sal_Bool *pbReverse) -{ - sal_Int32 nArgIndex = 1; - if( ! strcmp( argv[1] , "-r" ) ) - { - nArgIndex = 2; - *pbReverse = sal_True; - } - else if( ! strcmp( argv[1] , "-latency" ) ) - { - *pbLatency = sal_True; - nArgIndex = 2; - } - - OUString sTemp = OUString::createFromAscii( argv[nArgIndex] ); - sal_Int32 nIndex = sTemp.indexOf( ';' ); - if( -1 == nIndex ) - { - *pConnection = sTemp; - *pProtocol = "iiop"; - } - else - { - *pConnection = sTemp.copy( 0 , nIndex ); - *pProtocol = sTemp.copy( nIndex+1, sTemp.getLength() - (nIndex+1) ); - } -} - -Any OInstanceProvider::queryInterface( const Type & aType ) throw ( RuntimeException ) -{ - Any a = ::cppu::queryInterface( aType , - (static_cast< XInstanceProvider * >(this)) ); - if( a.hasValue() ) - { - return a; - } - return OWeakObject::queryInterface( aType ); -} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - OInstanceProvider::getInstance( const OUString& sObjectName ) - throw(::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - // Tries to get the PerformanceTestObject - if( sObjectName == "TestRemoteObject" ) - { - return m_rSMgr->createInstance("com.sun.star.test.performance.PerformanceTestObject"); - } - return Reference < XInterface > ( (::cppu::OWeakObject * ) new OTestFactory() ); -} - -class ServiceImpl - : public XServiceInfo - , public XPerformanceTest -{ - OUString _aDummyString; - Any _aDummyAny; - Sequence< Reference< XInterface > > _aDummySequence; - ComplexTypes _aDummyStruct; - RuntimeException _aDummyRE; - - sal_Int32 _nRef; - -public: - ServiceImpl() - : _nRef( 0 ) - {} - explicit ServiceImpl( const Reference< XMultiServiceFactory > & /* xMgr */) - : _nRef( 0 ) - {} - - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException) - { - // execution time remains appr. constant any time - Any aRet; - if (aType == cppu::UnoType::get()) - { - void * p = (XInterface *)(XPerformanceTest *)this; - aRet.setValue( &p, cppu::UnoType::get() ); - } - if (aType == cppu::UnoType::get()) - { - void * p = (XPerformanceTest *)this; - aRet.setValue( &p, cppu::UnoType::get() ); - } - if (! aRet.hasValue()) - { - void * p = (XPerformanceTest *)this; - Any aDummy( &p, cppu::UnoType::get() ); - } - return aRet; - } - virtual void SAL_CALL acquire() throw() - { osl_atomic_increment( &_nRef ); } - virtual void SAL_CALL release() throw() - { if (! osl_atomic_decrement( &_nRef )) delete this; } - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); - - // Attributes - virtual sal_Int32 SAL_CALL getLong_attr() throw(::com::sun::star::uno::RuntimeException) - { return 0; } - virtual void SAL_CALL setLong_attr( sal_Int32 /* _attributelong */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual sal_Int64 SAL_CALL getHyper_attr() throw(::com::sun::star::uno::RuntimeException) - { return 0; } - virtual void SAL_CALL setHyper_attr( sal_Int64 /* _attributehyper */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual float SAL_CALL getFloat_attr() throw(::com::sun::star::uno::RuntimeException) - { return 0.0; } - virtual void SAL_CALL setFloat_attr( float /* _attributefloat */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual double SAL_CALL getDouble_attr() throw(::com::sun::star::uno::RuntimeException) - { return 0.0; } - virtual void SAL_CALL setDouble_attr( double /* _attributedouble */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual OUString SAL_CALL getString_attr() throw(::com::sun::star::uno::RuntimeException) - { return _aDummyString; } - virtual void SAL_CALL setString_attr( const OUString& /* _attributestring */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Reference< XInterface > SAL_CALL getInterface_attr() throw(::com::sun::star::uno::RuntimeException) - { return Reference< XInterface >(); } - virtual void SAL_CALL setInterface_attr( const Reference< XInterface >& /* _attributeinterface */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Any SAL_CALL getAny_attr() throw(::com::sun::star::uno::RuntimeException) - { return _aDummyAny; } - virtual void SAL_CALL setAny_attr( const Any& /* _attributeany */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Sequence< Reference< XInterface > > SAL_CALL getSequence_attr() throw(::com::sun::star::uno::RuntimeException) - { return _aDummySequence; } - virtual void SAL_CALL setSequence_attr( const Sequence< Reference< XInterface > >& /* _attributesequence */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual ComplexTypes SAL_CALL getStruct_attr() throw(::com::sun::star::uno::RuntimeException) - { return _aDummyStruct; } - virtual void SAL_CALL setStruct_attr( const ::com::sun::star::test::performance::ComplexTypes& /* _attributestruct */) throw(::com::sun::star::uno::RuntimeException) - {} - - // Methods - virtual sal_Int32 SAL_CALL getLong() throw(::com::sun::star::uno::RuntimeException) - { return 0; } - virtual void SAL_CALL setLong( sal_Int32 /* _long */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual sal_Int64 SAL_CALL getHyper() throw(::com::sun::star::uno::RuntimeException) - { return 0; } - virtual void SAL_CALL setHyper( sal_Int64 /* _hyper */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual float SAL_CALL getFloat() throw(::com::sun::star::uno::RuntimeException) - { return 0; } - virtual void SAL_CALL setFloat( float /* _float */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual double SAL_CALL getDouble() throw(::com::sun::star::uno::RuntimeException) - { return 0; } - virtual void SAL_CALL setDouble( double /* _double */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException) - { return _aDummyString; } - virtual void SAL_CALL setString( const OUString& /* _string */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Reference< XInterface > SAL_CALL getInterface() throw(::com::sun::star::uno::RuntimeException) - { return Reference< XInterface >(); } - virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /* _interface */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Any SAL_CALL getAny() throw(::com::sun::star::uno::RuntimeException) - { return _aDummyAny; } - virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& /* _any */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Sequence< Reference< XInterface > > SAL_CALL getSequence() throw(::com::sun::star::uno::RuntimeException) - { return _aDummySequence; } - virtual void SAL_CALL setSequence( const Sequence< Reference< XInterface > >& /*_sequence */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual ComplexTypes SAL_CALL getStruct() throw(::com::sun::star::uno::RuntimeException) - { return _aDummyStruct; } - virtual void SAL_CALL setStruct( const ::com::sun::star::test::performance::ComplexTypes& /* c */) throw(::com::sun::star::uno::RuntimeException) - {} - - virtual void SAL_CALL async() throw(::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL sync() throw(::com::sun::star::uno::RuntimeException) - {} - virtual ComplexTypes SAL_CALL complex_in( const ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException) - { return aVal; } - virtual ComplexTypes SAL_CALL complex_inout( ::com::sun::star::test::performance::ComplexTypes& aVal ) throw(::com::sun::star::uno::RuntimeException) - { return aVal; } - virtual void SAL_CALL complex_oneway( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual void SAL_CALL complex_noreturn( const ::com::sun::star::test::performance::ComplexTypes& /* aVal */) throw(::com::sun::star::uno::RuntimeException) - {} - virtual Reference< XPerformanceTest > SAL_CALL createObject() throw(::com::sun::star::uno::RuntimeException) - { return new ServiceImpl(); } - virtual void SAL_CALL raiseRuntimeException( ) throw(::com::sun::star::uno::RuntimeException) - { throw _aDummyRE; } -}; - -void ServiceImpl::async() throw(::com::sun::star::uno::RuntimeException) -{} - -// XServiceInfo -OUString ServiceImpl::getImplementationName() - throw (RuntimeException) -{ - return OUString( ); -} - -sal_Bool ServiceImpl::supportsService( const OUString & rServiceName ) - throw (RuntimeException) -{ - return cppu::supportsService(this, rServiceName); -} - -Sequence< OUString > ServiceImpl::getSupportedServiceNames() - throw (RuntimeException) -{ - return Sequence< OUString > (); -} - -Any OCallMe::queryInterface( const Type & aType ) throw ( RuntimeException ) -{ - Any a = ::cppu::queryInterface( aType, - (static_cast< XCallMe * >(this)) ); - - if( a.hasValue() ) - { - return a; - } - - return OWeakObject::queryInterface( aType ); -} - -void OCallMe::call( const OUString& s, sal_Int32 nToDo ) - throw( RuntimeException, ::test::TestBridgeException) -{ - if( nToDo < 0 ) - { - throw TestBridgeException(); - } - - OUString sDummy; - if( ! nToDo ) { - OString o = OUStringToOString( s,RTL_TEXTENCODING_ASCII_US); - printf( "%s\n" , o.pData->buffer ); - } - for( sal_Int32 i = 0 ; i < nToDo ; i ++ ) - { - sDummy += s; - } -} - -void SAL_CALL OCallMe::drawLine( sal_Int32 /* x1 */, sal_Int32 /* y1 */, sal_Int32 /* x2 */, sal_Int32 /* y2 */) - throw(::com::sun::star::uno::RuntimeException) -{ - // do nothings -} - -void OCallMe::callOneway( const OUString& /* s */, sal_Int32 nToDo ) - throw(RuntimeException) -{ - OUString sDummy; - m_nLastToDos = nToDo; - - - if( nToDo ) - { - printf( "+" ); - fflush( stdout ); - - TimeValue val = { nToDo , 0 }; - osl_waitThread( &val ); - printf( "-\n" ); - } - -} - -::test::TestTypes SAL_CALL OCallMe::transport( const ::test::TestTypes& types ) - throw(::com::sun::star::uno::RuntimeException) -{ - return types; -} - -OUString OCallMe::getsAttribute() throw(RuntimeException) -{ - return m_sAttribute; -} -void OCallMe::setsAttribute( const OUString& _sattribute ) - throw(RuntimeException) -{ - m_sAttribute = _sattribute; -} -void OCallMe::callAgain( const Reference< ::test::XCallMe >& callAgainArg, - sal_Int32 nToCall ) throw(RuntimeException) -{ - ::osl::MutexGuard guard( m_mutex ); - if( nToCall %2 ) - { - printf( "Deadlocktest pong %" SAL_PRIdINT32 "\n", nToCall ); - } - else - { - printf( "Deadlocktest ping %" SAL_PRIdINT32 "\n", nToCall ); - } - if( nToCall ) - { - callAgainArg->callAgain( Reference< XCallMe > ( (XCallMe *) this ) , nToCall -1 ); - } -} - -Any OInterfaceTest::queryInterface( const Type & aType ) throw ( RuntimeException ) -{ - Any a = ::cppu::queryInterface( aType, - (static_cast< XInterfaceTest * >(this)) ); - if( a.hasValue() ) - { - return a; - } - return OWeakObject::queryInterface( aType ); -} - -void OInterfaceTest::setIn( - const Reference< ::test::XCallMe >& callback ) - throw(RuntimeException) -{ - m_rCallMe = callback; - call(); -} - -void OInterfaceTest::setInOut( Reference< ::test::XCallMe >& callback ) - throw(RuntimeException) -{ - Reference< XCallMe > r = m_rCallMe; - m_rCallMe = callback; - callback = r; - call(); -} - -void OInterfaceTest::getOut( Reference< ::test::XCallMe >& callback ) - throw(RuntimeException) -{ - callback = m_rCallMe; -} - -Reference< ::test::XCallMe > OInterfaceTest::get( ) - throw(RuntimeException) -{ - call(); - return m_rCallMe; -} - -void OInterfaceTest::call() -{ - if( m_rCallMe.is() ) - { - m_rCallMe->call( OUString("This is my String during a callback!") , 5); - } -} - -Any OTestFactory::queryInterface( const Type & aType ) throw ( RuntimeException ) -{ - Any a = ::cppu::queryInterface( aType, - (static_cast< XTestFactory * >(this)) ); - - if( a.hasValue() ) - { - return a; - } - - return OWeakObject::queryInterface( aType ); -} - -Reference< ::test::XCallMe > OTestFactory::createCallMe( ) - throw(RuntimeException) -{ - return Reference< XCallMe > ( (XCallMe * ) new OCallMe() ); -} - -Reference< ::test::XInterfaceTest > SAL_CALL OTestFactory::createInterfaceTest( ) - throw(RuntimeException) -{ - return Reference < XInterfaceTest > ( (XInterfaceTest * ) new OInterfaceTest() ); -} - -// class OInstanceProvider : -// public ::cppu::OWeakObject, -// public XInstanceProvider -// { -// public: -// OInstanceProvider( ){} -// ~OInstanceProvider(){ printf( "instance provider dies\n" );} -// public: -// // XInterface -// Any SAL_CALL queryInterface( const Type & aType); -// void SAL_CALL acquire() { OWeakObject::acquire(); } -// void SAL_CALL release() { OWeakObject::release(); } - -// public: -// virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL -// getInstance( const OUString& sObjectName ) -// throw( ::com::sun::star::container::NoSuchElementException, -// ::com::sun::star::uno::RuntimeException); -// }; - -double getCallsPerSec( const Reference < XCallMe > &rCall , int nLoops, int nToDo ) -{ - TimeValue aStartTime, aEndTime; - osl_getSystemTime( &aStartTime ); - for( sal_Int32 i = 0; i < nLoops; i ++ ) - { - rCall->call( OUString("Performance test string") , nToDo ); - } - osl_getSystemTime( &aEndTime ); - - double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0); - double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0); - return fEnd-fStart; -} - -double getCallsPerSecOneway( const Reference < XCallMe > &rCall , - int nLoops, - int nToDo, - double *pdAfterExecution - ) -{ - TimeValue aStartTime, aEndTime, aAfterExecution; - osl_getSystemTime( &aStartTime ); - for( sal_Int32 i = 0; i < nLoops; i ++ ) - { -// rCall->callOneway( OUString("Performance test string" ), 0 ); - rCall->drawLine( 0 , 0 , 500 , 123 ); - } - osl_getSystemTime( &aEndTime ); - - rCall->call( OUString("Performance test string") , nToDo ); - osl_getSystemTime( &aAfterExecution ); - - double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0); - double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0); - *pdAfterExecution = (double)aAfterExecution.Seconds + - ((double)aAfterExecution.Nanosec / 1000000000.0) - fStart; - return fEnd-fStart; -} - -void testOnewayPerformanceOnTwoInterfaces( - const Reference < XCallMe > &rRemote1, const Reference < XCallMe > &rRemote2 ) -{ - printf( "Doing oneway performance test on two interfaces ...\n" ); - const sal_Int32 nLoops = 10000; - TimeValue aStartTime, aEndTime; - osl_getSystemTime( &aStartTime ); - for( sal_Int32 i = 0; i < nLoops ; i ++ ) - { - rRemote1->drawLine( 0 , 0 , 500 , 123 ); - rRemote2->drawLine( 0 , 0 , 500 , 123 ); - } - osl_getSystemTime( &aEndTime ); - double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0); - double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0); - - printf( "Overhead per Call [ms] %g\n" , ((fEnd-fStart)/((double)nLoops/1000 ))/2. ); -} - -void testPerformance( const Reference < XCallMe > &rRemote, - const Reference < XCallMe > &rLocal ) -{ - sal_Int32 nDoSomething = 1; - sal_Int32 nCalls = 80000; - double dRemote, dLocal,dAfterExecution; - - printf( "performance test oneway...\n" ); - dLocal = getCallsPerSecOneway( rLocal , nCalls , nDoSomething , &dAfterExecution); - dRemote = getCallsPerSecOneway( rRemote , nCalls , nDoSomething , &dAfterExecution); - printf( "Local=%g s," - "Remote : %g s\n" , dLocal, dRemote ); - if( dLocal > 0. ) - { - printf( "Remote/Local : %g\n", dRemote/dLocal ); - } - - printf( "Overhead per Call [ms] %g\n" , (dRemote - dLocal)/((double)nCalls/1000 ) ); - printf( "Overhead per Call after completion [ms] %g\n" , (dAfterExecution - dLocal)/((double)nCalls/1000 ) ); - - nCalls = 2000; - - printf( "Doing performance test ...\n" ); - dRemote = getCallsPerSec( rRemote , nCalls , nDoSomething ); - dLocal = getCallsPerSec( rLocal , nCalls , nDoSomething ); - printf( "Local=%g s,\n" - "Remote=%g s\n" , dLocal, dRemote ); - if( dLocal > 0. ) - { - printf( "Remote/Local : %g\n", dRemote/dLocal ); - } - printf( "Overhead per synchron Call [ms] %g\n" , ((dRemote - dLocal)/((double)nCalls/1000 )) ); -} - -void testException( const Reference < XCallMe > &r ) -{ - try { - r->call( OUString("dummy") , -1 ); - OSL_ASSERT( ! "no exception flown !" ); - } - catch( TestBridgeException & e ) - { - // Exception flew successfully ! - } - catch( Exception & e ) - { - OSL_ASSERT( ! "only base class of exception could be catched!" ); - } - catch(...) - { - OSL_ASSERT(! "wrong unknown exception !" ); - } -} - -void testSequenceOfCalls( const Reference< XCallMe > & rRCallMe ) -{ - printf( "Testing sequence of calls\n" ); - for( sal_Int32 i = 0 ; i < 800 ; i ++ ) - { - rRCallMe->callOneway( OUString("hifuj" ), 0 ); - } -} - -void testAllTypes( const Reference < XCallMe > & rRCallMe ) -{ - printf( "Testing all types\n" ); - - for( sal_Int32 i = 0; i < 32 ; i ++ ) - { - - TestTypes types; - types.Bool = sal_True; - types.Char = L'i'; - types.Byte = -12; - types.Short = -32000; - types.UShort = (sal_uInt16 ) (1 << i); - types.Long = -123; - types.ULong = 1 << i; - types.Hyper = 50; - types.UHyper = 1 << i*2; - types.Float = (float)123.239; - types.Double = 1279.12490012; - types.String = OUString("abcdefghijklmnopqrstuvwxyz"); - types.Interface.set( rRCallMe , UNO_QUERY); - types.Any <<= types.Double; - - TestTypes retTypes = rRCallMe->transport( types ); - - OSL_ASSERT( ( types.Bool && retTypes.Bool ) || ( ! types.Bool && ! retTypes.Bool ) ); - OSL_ASSERT( types.Char == retTypes.Char ); - OSL_ASSERT( types.Byte == retTypes.Byte ); - OSL_ASSERT( types.Short == retTypes.Short ); - OSL_ASSERT( types.UShort == retTypes.UShort ); - OSL_ASSERT( types.Long == retTypes.Long ); - OSL_ASSERT( types.ULong == retTypes.ULong ); - OSL_ASSERT( types.Hyper == retTypes.Hyper ); - OSL_ASSERT( types.UHyper == retTypes.UHyper ); - OSL_ASSERT( types.Float == retTypes.Float ); - OSL_ASSERT( types.Double == retTypes.Double ); - OSL_ASSERT( types.String == retTypes.String ); - OSL_ASSERT( types.Interface == retTypes.Interface ); - OSL_ASSERT( types.Any == retTypes.Any ); - } -} - -void testRemote( const Reference< XInterface > &rRemote ) -{ - cppu::UnoType::get(); - - Reference< XTestFactory > rRFact( rRemote , UNO_QUERY ); - if( ! rRFact.is() ) - { - printf( "remote object doesn't support XTestFactory\n" ); - return; - } - OSL_ASSERT( rRFact.is() ); - Reference< XCallMe > rLCallMe = (XCallMe * ) new OCallMe(); - Reference< XCallMe > rRCallMe = rRFact->createCallMe(); - - testAllTypes( rLCallMe ); - testAllTypes( rRCallMe ); - - printf( "Testing exception local ...\n" ); - testException( rLCallMe ); - printf( "Testing exception remote ...\n" ); - testException( rRCallMe ); - - // Test attributes - OUString ow( "dum didel dum dideldei" ); - rLCallMe->setsAttribute( ow ); - OSL_ASSERT( rLCallMe->getsAttribute() == ow ); - - rRCallMe->setsAttribute( ow ); - OSL_ASSERT( rRCallMe->getsAttribute() == ow ); - - // Performance test - testPerformance( rRCallMe , rLCallMe ); - testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe ); - - // Test sequence - testSequenceOfCalls( rRCallMe ); - - - // test triple to check if transporting the same interface multiple - // times causes any problems - Reference< XInterfaceTest > rRTest = rRFact->createInterfaceTest(); - Reference< XInterfaceTest > rRTest2 = rRFact->createInterfaceTest(); - Reference< XInterfaceTest > rRTest3 = rRFact->createInterfaceTest(); - - rRTest->setIn( rRCallMe ); - rRTest2->setIn( rRCallMe ); - rRTest3->setIn( rRCallMe ); - - OSL_ASSERT( rRTest->get() == rRCallMe ); - OSL_ASSERT( rRTest2->get() == rRCallMe ); - OSL_ASSERT( rRTest3->get() == rRCallMe ); - - rRTest->setIn( rLCallMe ); - rRTest2->setIn( rLCallMe ); - rRTest3->setIn( rLCallMe ); - - { - Reference< XCallMe > rLCallMe1 = (XCallMe * ) new OCallMe(); - Reference< XCallMe > rLCallMe2 = (XCallMe * ) new OCallMe(); - Reference< XCallMe > rLCallMe3 = (XCallMe * ) new OCallMe(); - rRTest->setIn( rLCallMe1 ); - rRTest2->setIn( rLCallMe2 ); - rRTest3->setIn( rLCallMe3 ); - OSL_ASSERT( rRTest->get() == rLCallMe1 ); - OSL_ASSERT( rRTest2->get() == rLCallMe2 ); - OSL_ASSERT( rRTest3->get() == rLCallMe3 ); - - rRTest->setIn( rLCallMe ); - rRTest2->setIn( rLCallMe ); - rRTest3->setIn( rLCallMe ); - - OSL_ASSERT( rRTest->get() == rLCallMe ); - OSL_ASSERT( rRTest2->get() == rLCallMe ); - OSL_ASSERT( rRTest3->get() == rLCallMe ); - } - - Reference < XCallMe > r = rRCallMe; - rRTest->setInOut( r ); - OSL_ASSERT( r == rLCallMe ); - OSL_ASSERT( ! ( r == rRCallMe ) ); - - // test empty references - rRTest->setIn( Reference < XCallMe > () ); - - // test thread deadlocking - rLCallMe->callAgain( rRCallMe, 20 ); - -} - -Reference createComponent( const OUString &sService , - const OUString &sDllName, - const Reference < XMultiServiceFactory > &rSMgr ) -{ - Reference< XInterface > rInterface; - rInterface = rSMgr->createInstance( sService ); - - if( ! rInterface.is() ) - { - // erst registrieren - Reference < XImplementationRegistration > rReg ( - rSMgr->createInstance("com.sun.star.registry.ImplementationRegistration"), - UNO_QUERY ); - - OSL_ASSERT( rReg.is() ); - OUString aDllName = sDllName; - - try - { - rReg->registerImplementation( - OUString( "com.sun.star.loader.SharedLibrary" ), - aDllName, - Reference< XSimpleRegistry > () ); - rInterface = rSMgr->createInstance( sService ); - } - catch( Exception & ) - { - printf( "couldn't register dll %s\n" , - OUStringToOString( aDllName, RTL_TEXTENCODING_ASCII_US ).getStr() ); - } - } - return rInterface; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/testcomp.h b/bridges/test/testcomp.h deleted file mode 100644 index 5f6fdd062a97..000000000000 --- a/bridges/test/testcomp.h +++ /dev/null @@ -1,148 +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 - -#include -#include - - -void parseCommandLine( char *argv[] , - OUString *pProtocol , OUString *pConnection , - sal_Bool *pbLatency , sal_Bool *pbReverse); - - -Reference< XInterface > createComponent( - const OUString &sServiceName, - const OUString &sDllName, - const Reference < XMultiServiceFactory > & rSMgr ); - -class OInterfaceTest : - public ::cppu::OWeakObject, - public XInterfaceTest -{ -public: - OInterfaceTest() {} - ~OInterfaceTest() {} - -public: - // XInterface - Any SAL_CALL queryInterface( const com::sun::star::uno::Type & aType) throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - -public: - virtual void SAL_CALL setIn( const ::com::sun::star::uno::Reference< ::test::XCallMe >& callback ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInOut( ::com::sun::star::uno::Reference< ::test::XCallMe >& callback ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL getOut( ::com::sun::star::uno::Reference< ::test::XCallMe >& callback ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::test::XCallMe > SAL_CALL get( ) throw(::com::sun::star::uno::RuntimeException); -private: - void call(); - -private: - Reference < XCallMe > m_rCallMe; -}; - - -class OCallMe : - public ::cppu::OWeakObject, - public XCallMe -{ -public: - OCallMe() : m_nLastToDos(-1) {} - ~OCallMe() {} - -public: - // XInterface - Any SAL_CALL queryInterface( const com::sun::star::uno::Type & aType) throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL acquire()throw() { OWeakObject::acquire(); } - void SAL_CALL release()throw() { OWeakObject::release(); } -public: - // XCallMe - virtual void SAL_CALL call( const OUString& s, sal_Int32 nToDo ) - throw(::com::sun::star::uno::RuntimeException, - ::test::TestBridgeException); - virtual void SAL_CALL callOneway( const OUString& s, sal_Int32 nToDo ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL drawLine( sal_Int32 x1, sal_Int32 y1 , sal_Int32 x2 , sal_Int32 y2 ) - throw(::com::sun::star::uno::RuntimeException); - - virtual OUString SAL_CALL getsAttribute() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setsAttribute( const OUString& _sattribute ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL callAgain( const ::com::sun::star::uno::Reference< ::test::XCallMe >& callAgain, - sal_Int32 nToCall ) throw(::com::sun::star::uno::RuntimeException); - - virtual ::test::TestTypes SAL_CALL transport( const ::test::TestTypes& types ) - throw(::com::sun::star::uno::RuntimeException); - - ::osl::Mutex m_mutex; - OUString m_sAttribute; - sal_Int32 m_nLastToDos; -}; - -class OTestFactory : - public ::cppu::OWeakObject, - public XTestFactory -{ -public: - OTestFactory() {} - ~OTestFactory() {} - -public: - // XInterface - Any SAL_CALL queryInterface( const com::sun::star::uno::Type & aType ) throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } -public: - virtual ::com::sun::star::uno::Reference< ::test::XCallMe > SAL_CALL createCallMe( ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::test::XInterfaceTest > SAL_CALL createInterfaceTest( ) - throw(::com::sun::star::uno::RuntimeException); - -}; - - -class OInstanceProvider : - public ::cppu::OWeakObject, - public XInstanceProvider -{ -public: - OInstanceProvider( ){} - explicit OInstanceProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & r ) : - m_rSMgr( r ) - {} - ~OInstanceProvider(){ printf( "instance provider dies\n" );} -public: - // XInterface - Any SAL_CALL queryInterface( const Type & aType)throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL acquire()throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - -public: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - getInstance( const OUString& sObjectName ) - throw( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_rSMgr; -}; - -void testRemote( const Reference< XInterface > &rRemote ); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/testoffice.cxx b/bridges/test/testoffice.cxx deleted file mode 100644 index 9e346022ad16..000000000000 --- a/bridges/test/testoffice.cxx +++ /dev/null @@ -1,261 +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 - -#include -#include - -#include - -#include - -#include - -#include -#include - -#include - -#include - -#include - -#include -#include - -#include - -#include - -using namespace ::test; -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::connection; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::text; - -#include "testcomp.h" - -#ifdef SAL_W32 -#include -#endif - - -void mygetchar() -{ -#ifdef SAL_W32 - _getch(); -#else - getchar(); -#endif -} - - -void testPipe( const Reference < XMultiServiceFactory > & rSmgr ) -{ - Reference < XPipe > rPipe( Pipe::create(comphelper::getComponentContext(rSmgr)), UNO_QUERY_THROW ); - - { - Sequence < sal_Int8 > seq( 10 ); - seq.getArray()[0] = 42; - rPipe->writeBytes( seq ); - } - - - { - Sequence < sal_Int8 > seq; - if( ! ( rPipe->available() == 10) ) - printf( "wrong bytes available\n" ); - if( ! ( rPipe->readBytes( seq , 10 ) == 10 ) ) - printf( "wrong bytes read\n" ); - if( ! ( 42 == seq.getArray()[0] ) ) - printf( "wrong element in sequence\n" ); - -// OSL_ASSERT( 0 ); - } -} -#include -#include - -void testWriter( const Reference < XComponent > & rCmp ) -{ - - Reference< XTextDocument > rTextDoc( rCmp , UNO_QUERY ); - - Reference< XText > rText = rTextDoc->getText(); - Reference< XTextCursor > rCursor = rText->createTextCursor(); - Reference< XTextRange > rRange ( rCursor , UNO_QUERY ); - - char pcText[1024]; - pcText[0] = 0; - printf( "pleast type any text\n" ); - while( true ) - { - scanf( "%1023s" , pcText ); - - if( !strcmp( pcText , "end" ) ) - { - break; - } - - if ( strlen( pcText ) < sizeof(pcText)-1 ) - strcat( pcText , " " ); // #100211# - checked - - rText->insertString( rRange , OUString::createFromAscii( pcText ) , sal_False ); - } -} - -void testDocument( const Reference < XMultiServiceFactory > & rSmgr ) -{ - Reference < XDesktop2 > rLoader = Desktop::create( comphelper::getComponentContext(rSmgr) ); - - sal_Char *urls[] = { - "private:factory/swriter", - "private:factory/scalc", - "private:factory/sdraw", - "http://www.heise.de", - "file://h|/remote_interfaces.sdw" - }; - - sal_Char *docu[]= { - "a new writer document ...\n", - "a new calc document ...\n", - "a new draw document ...\n", - "www.heise.de\n", - "the remote_interfaces.sdw doc\n" - }; - - sal_Int32 i; - for( i = 0 ; i < 1 ; i ++ ) - { - printf( "press any key to open %s\n" , docu[i] ); - mygetchar(); - - Reference< XComponent > rComponent = - rLoader->loadComponentFromURL( - OUString::createFromAscii( urls[i] ) , - OUString("_blank"), - 0 , - Sequence < ::com::sun::star::beans::PropertyValue >() ); - - testWriter( rComponent ); - printf( "press any key to close the document\n" ); - mygetchar(); - rComponent->dispose(); - } - -} - -void doSomething( const Reference < XInterface > &r ) -{ - Reference < XNamingService > rName( r, UNO_QUERY ); - if( rName.is() ) - { - printf( "got the remote naming service !\n" ); - Reference < XInterface > rXsmgr = rName->getRegisteredObject( - OUString( "StarOffice.ServiceManager" ) ); - - Reference < XMultiServiceFactory > rSmgr( rXsmgr , UNO_QUERY ); - if( rSmgr.is() ) - { - printf( "got the remote service manager !\n" ); - testPipe( rSmgr ); - testDocument( rSmgr ); - } - } -} - - -int main( int argc, char *argv[] ) -{ - if( argc < 2 ) - { - printf( "usage : testclient host:port" ); - return 0; - } - - OUString sConnectionString; - OUString sProtocol; - sal_Bool bLatency = sal_False; - sal_Bool bReverse = sal_False; - parseCommandLine( argv , &sConnectionString , &sProtocol , &bLatency , &bReverse ); - { - Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory( - OUString( "client.rdb" ) ); - - // just ensure that it is registered - - Reference < XConnector > rConnector( - createComponent( OUString("com.sun.star.connection.Connector"), - OUString( "connector.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - createComponent( OUString("com.sun.star.bridge.Bridge.iiop"), - OUString( "remotebridge.uno" SAL_DLLEXTENSION), - rSMgr ); - - Reference < XBridgeFactory > rFactory( - createComponent( OUString("com.sun.star.bridge.BridgeFactory"), - OUString( "bridgefac.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - try - { - if( rFactory.is() && rConnector.is() ) - { - Reference < XConnection > rConnection = - rConnector->connect( sConnectionString ); - - Reference < XBridge > rBridge = rFactory->createBridge( - OUString("bla blub"), - sProtocol, - rConnection, - Reference < XInstanceProvider > () ); - - Reference < XInterface > rInitialObject - = rBridge->getInstance( OUString("NamingService") ); - - if( rInitialObject.is() ) - { - printf( "got the remote object\n" ); - doSomething( rInitialObject ); - } - TimeValue value={2,0}; - osl_waitThread( &value ); - } - } - catch (... ) { - printf( "Exception thrown\n" ); - } - - Reference < XComponent > rComp( rSMgr , UNO_QUERY ); - rComp->dispose(); - } - //_getch(); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/testsameprocess.cxx b/bridges/test/testsameprocess.cxx deleted file mode 100644 index 93f8472c4ea9..000000000000 --- a/bridges/test/testsameprocess.cxx +++ /dev/null @@ -1,206 +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 - -#include -#include - -#include - -#include -#include -#include - -#include - -#include - -#include - - -using namespace ::test; -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::connection; - -#ifdef SAL_W32 -#include -#endif - -#include "testcomp.h" -#include "osl/mutex.h" - -/********* - * - ********/ - -class MyThread : - public Thread -{ -public: - MyThread( const Reference< XAcceptor > &r , - const Reference< XBridgeFactory > &rFactory, - const OUString &sConnectionDescription) : - m_rAcceptor( r ), - m_rBridgeFactory ( rFactory ), - m_sConnectionDescription( sConnectionDescription ) - {} - virtual void SAL_CALL run(); - -private: - Reference < XAcceptor > m_rAcceptor; - Reference < XBridgeFactory > m_rBridgeFactory; - OUString m_sConnectionDescription; -}; - - - -void MyThread::run() -{ - - while ( true ) - { - try - { - Reference < XConnection > rConnection = - m_rAcceptor->accept( m_sConnectionDescription ); - - if( ! rConnection.is() ) - { - break; - } - - Reference < XBridge > rBridge = - m_rBridgeFactory->createBridge( - OUString() , - OUString("iiop") , - rConnection , - (XInstanceProvider * ) new OInstanceProvider ); - - - } - catch ( ... ) - { - printf( "Exception was thrown by acceptor thread\n" ); - break; - } - } -} - - -int main( int argc, char *argv[] ) -{ - if( argc < 2 ) - { - printf( "usage : testsameprocess host:port\n" ); - return 0; - } - - { - Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory( - OUString( "client.rdb" ) ); - - Reference < XConnector > rConnector( - createComponent( OUString("com.sun.star.connection.Connector"), - OUString( "connector.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - Reference < XAcceptor > rAcceptor( - createComponent( OUString("com.sun.star.connection.Acceptor"), - OUString( "acceptor.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - // just ensure that it is registered -// createComponent( OUString("com.sun.star.bridge.Bridge.iiop"), -// OUString( "iiopbrdg" SAL_DLLEXTENSION), -// rSMgr ); - - Reference < XBridgeFactory > rFactory( - createComponent( OUString("com.sun.star.bridge.BridgeFactory"), - OUString( "bridgefac.uno" SAL_DLLEXTENSION), - rSMgr ), - UNO_QUERY ); - - - MyThread threadAcceptor( rAcceptor , rFactory , OUString::createFromAscii( argv[1] ) ); - - threadAcceptor.create(); - TimeValue value={2,0}; - osl_waitThread( &value ); - - try - { - Reference < XConnection > rConnection = - rConnector->connect( OUString::createFromAscii( argv[1] ) ); - - printf( "%s\n" , OUStringToOString( rConnection->getDescription(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - - if( rFactory.is() ) - { - - Reference < XBridge > rBridge = rFactory->createBridge( - OUString("bla blub"), - OUString("iiop"), - rConnection, - Reference < XInstanceProvider > () ); - - Reference < XInterface > rInitialObject - = rBridge->getInstance( OUString("bla") ); - - if( rInitialObject.is() ) - { - printf( "got the remote object\n" ); - testRemote( rInitialObject ); - } - printf( "Closing...\n" ); - TimeValue timeValue={2,0}; - osl_waitThread( &timeValue ); - } - - Reference < XBridge > rBridge = rFactory->getBridge( - OUString("bla blub") ); - OSL_ASSERT( ! rBridge.is() ); - - } - catch( Exception & ) - { - printf( "Login failed, got an Exception !\n" ); - } - - rAcceptor->stopAccepting(); - threadAcceptor.join(); - - Reference < XComponent > rComp( rFactory , UNO_QUERY ); - rComp->dispose(); - - - rComp.set( rSMgr , UNO_QUERY ); - rComp->dispose(); - } - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/test/testserver.cxx b/bridges/test/testserver.cxx deleted file mode 100644 index df2c22d9ef43..000000000000 --- a/bridges/test/testserver.cxx +++ /dev/null @@ -1,243 +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 -#include - -#include -#include - -#include - -#include - -#include -#include - -#include -#include - -#include -#include - - -#include - -#include - -using namespace ::test; -using namespace ::osl; -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::connection; -#include "testcomp.h" -#ifdef SAL_W32 -#include -#endif - -/********* - * - ********/ - - - -class MyThread : - public Thread -{ -public: - MyThread( const Reference< XAcceptor > &r , - const Reference< XBridgeFactory > &rFactory, - const Reference< XMultiServiceFactory > &rSMgr, - const OUString &sConnectionDescription, - const OUString &sProtocol, - sal_Bool bReverse, - sal_Bool bLatency ) : - m_rAcceptor( r ), - m_rBridgeFactory ( rFactory ), - m_rSMgr( rSMgr ), - m_sConnectionDescription( sConnectionDescription ), - m_sProtocol( sProtocol ), - m_bReverse( bReverse ), - m_bLatency( bLatency ) - {} - virtual void SAL_CALL run(); - - void latencyTest( const Reference< XConnection > &r ); - -private: - Reference < XAcceptor > m_rAcceptor; - Reference < XBridgeFactory > m_rBridgeFactory; - Reference < XMultiServiceFactory > m_rSMgr; - OUString m_sConnectionDescription; - OUString m_sProtocol; - sal_Bool m_bReverse; - sal_Bool m_bLatency; -}; - - -void MyThread::latencyTest( const Reference< XConnection > &r ) -{ - Sequence < sal_Int8 > s; - while( 12 == r->read( s , 12 ) ) - { - r->read( s , 188 ); - s = Sequence < sal_Int8 >(60); - r->write( s ); - } -} - -void MyThread::run() -{ - - while ( true ) - { - try - { - Reference < XConnection > rConnection = - m_rAcceptor->accept( m_sConnectionDescription ); - - if( ! rConnection.is() ) - { - break; - } - if( m_bLatency ) - { - latencyTest( rConnection ); - } - else - { - - Reference < XBridge > rBridge = - m_rBridgeFactory->createBridge( - OUString() , - m_sProtocol, - rConnection , - (XInstanceProvider * ) new OInstanceProvider(m_rSMgr) ); - - - if( m_bReverse ) - { - printf( "doing reverse callme test (test is ok, when on each line a +- appears\n" ); - Reference < XInterface > r = rBridge->getInstance( - OUString("blubber" )); - Reference < XTestFactory > rFactory( r , UNO_QUERY ); - Reference < XCallMe > rCallMe = rFactory->createCallMe(); - - for( sal_Int32 i = 0 ; i < 1 ; i ++ ) - { - rCallMe->callOneway( - OUString("my test string") , 2 ); - } - printf( "all oneway are send\n" ); - rCallMe->call( OUString( "reverse call me test finished" ) , 0 ); - printf( "revers callme test finished\n" ); - } - } - } - catch ( Exception & e ) - { - printf( "Exception was thrown by acceptor \n" ); - OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ); - printf( "%s\n" , o.getStr() ); - break; - } - catch ( ... ) - { - printf( "Exception was thrown by acceptor thread\n" ); - break; - } - } -} - - -int main( int argc, char *argv[] ) -{ -// testserver(); - - if( argc < 2 ) - { - printf( "usage : testserver [-r] connectionstring\n" - " -r does a reverse test (server calls client)\n" ); - return 0; - } - - OUString sConnectionString; - OUString sProtocol; - sal_Bool bReverse = sal_False; - sal_Bool bLatency = sal_False; - - parseCommandLine( argv , &sConnectionString , &sProtocol , &bLatency , &bReverse ); - - { - Reference< XMultiServiceFactory > rSMgr = createRegistryServiceFactory( - OUString( "server.rdb" ) ); - - Reference < XBridgeFactory > rBridgeFactory ( createComponent( - OUString("com.sun.star.bridge.BridgeFactory"), - OUString( "bridgefac.uno" SAL_DLLEXTENSION ), - rSMgr ), - UNO_QUERY ); - - - createComponent( OUString("com.sun.star.bridge.Bridge.iiop"), - OUString( "remotebridge.uno" SAL_DLLEXTENSION), - rSMgr ); - - - Reference < XAcceptor > rAcceptor( - createComponent( OUString("com.sun.star.connection.Acceptor"), - OUString( "acceptor.uno" SAL_DLLEXTENSION), - rSMgr ) , - UNO_QUERY ); - - MyThread thread( rAcceptor , - rBridgeFactory, - rSMgr, - sConnectionString, - sProtocol, - bReverse, - bLatency); - thread.create(); - -#ifdef SAL_W32 - _getch(); -#elif SOLARIS - getchar(); -#elif LINUX - TimeValue value={360,0}; - osl_waitThread( &value ); -#endif - printf( "Closing...\n" ); - - rAcceptor->stopAccepting(); - thread.join(); - - printf( "Closed\n" ); - - Reference < XComponent > rComp2( rBridgeFactory , UNO_QUERY ); - rComp2->dispose(); - Reference < XComponent > rComp( rSMgr, UNO_QUERY ); - rComp->dispose(); - } - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit