diff options
Diffstat (limited to 'bridges/test/java_uno')
24 files changed, 6117 insertions, 0 deletions
diff --git a/bridges/test/java_uno/acquire/TestAcquire.java b/bridges/test/java_uno/acquire/TestAcquire.java new file mode 100644 index 000000000000..0314e6bfcf9d --- /dev/null +++ b/bridges/test/java_uno/acquire/TestAcquire.java @@ -0,0 +1,304 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package test.javauno.acquire; + +import com.sun.star.bridge.UnoUrlResolver; +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.bridge.XInstanceProvider; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.connection.Acceptor; +import com.sun.star.connection.XAcceptor; +import com.sun.star.connection.XConnection; +import com.sun.star.lib.uno.helper.UnoUrl; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.XInterface; +import util.WaitUnreachable; + +public final class TestAcquire { + public static void main(String[] arguments) throws Exception { + // - arguments[0] must be "client" or "server" + // - arguments[1] must be the UNO URL to connect to (client) or accept + // on (server) + XComponentContext context + = Bootstrap.createInitialComponentContext(null); + if (arguments[0].equals("client")) { + execClient(context, arguments[1]); + } else { + execServer(context, arguments[1]); + } + } + + private static void assertNotNull(Object obj) { + if (obj == null) { + throw new RuntimeException("assertNotNull failed"); + } + } + + private static void receive(Object obj) { + assertNotNull(obj); + WaitUnreachable.ensureFinalization(obj); + } + + private static void execClient(XComponentContext context, String url) + throws Exception + { + XTest test = UnoRuntime.queryInterface( + XTest.class, UnoUrlResolver.create(context).resolve(url)); + + WaitUnreachable u; + + u = new WaitUnreachable(new XInterface() {}); + test.setInterfaceToInterface((XInterface) u.get()); + receive(test.getInterfaceFromInterface()); + test.clearInterface(); + u.waitUnreachable(); + u = new WaitUnreachable(new XBase() {}); + test.setInterfaceToInterface((XBase) u.get()); + receive(test.getInterfaceFromInterface()); + test.clearInterface(); + u.waitUnreachable(); + u = new WaitUnreachable(new XDerived() {}); + test.setInterfaceToInterface((XDerived) u.get()); + receive(test.getInterfaceFromInterface()); + test.clearInterface(); + u.waitUnreachable(); + + u = new WaitUnreachable(new XBase() {}); + test.setBaseToInterface((XBase) u.get()); + receive(test.getInterfaceFromInterface()); + test.clearInterface(); + u.waitUnreachable(); + u = new WaitUnreachable(new XDerived() {}); + test.setBaseToInterface((XDerived) u.get()); + receive(test.getInterfaceFromInterface()); + test.clearInterface(); + u.waitUnreachable(); + + u = new WaitUnreachable(new XDerived() {}); + test.setDerivedToInterface((XDerived) u.get()); + receive(test.getInterfaceFromInterface()); + test.clearInterface(); + u.waitUnreachable(); + + u = new WaitUnreachable(new XBase() {}); + test.setBaseToBase((XBase) u.get()); + receive(test.getInterfaceFromBase()); + receive(test.getBaseFromBase()); + test.clearBase(); + u.waitUnreachable(); + u = new WaitUnreachable(new XDerived() {}); + test.setBaseToBase((XDerived) u.get()); + receive(test.getInterfaceFromBase()); + receive(test.getBaseFromBase()); + test.clearBase(); + u.waitUnreachable(); + + u = new WaitUnreachable(new XDerived() {}); + test.setDerivedToBase((XDerived) u.get()); + receive(test.getInterfaceFromBase()); + receive(test.getBaseFromBase()); + test.clearBase(); + u.waitUnreachable(); + + u = new WaitUnreachable(new XDerived() {}); + test.setDerivedToDerived((XDerived) u.get()); + receive(test.getInterfaceFromDerived()); + receive(test.getBaseFromDerived()); + receive(test.getDerivedFromDerived()); + test.clearDerived(); + u.waitUnreachable(); + + u = new WaitUnreachable(new XInterface() {}); + receive(test.roundTripInterfaceToInterface((XInterface) u.get())); + u.waitUnreachable(); + u = new WaitUnreachable(new XBase() {}); + receive(test.roundTripInterfaceToInterface((XBase) u.get())); + u.waitUnreachable(); + u = new WaitUnreachable(new XDerived() {}); + receive(test.roundTripInterfaceToInterface((XDerived) u.get())); + u.waitUnreachable(); + + u = new WaitUnreachable(new XBase() {}); + receive(test.roundTripBaseToInterface((XBase) u.get())); + u.waitUnreachable(); + u = new WaitUnreachable(new XDerived() {}); + receive(test.roundTripBaseToInterface((XDerived) u.get())); + u.waitUnreachable(); + + u = new WaitUnreachable(new XDerived() {}); + receive(test.roundTripDerivedToInterface((XDerived) u.get())); + u.waitUnreachable(); + + u = new WaitUnreachable(new XBase() {}); + receive(test.roundTripBaseToBase((XBase) u.get())); + u.waitUnreachable(); + u = new WaitUnreachable(new XDerived() {}); + receive(test.roundTripBaseToBase((XDerived) u.get())); + u.waitUnreachable(); + + u = new WaitUnreachable(new XDerived() {}); + receive(test.roundTripDerivedToBase((XDerived) u.get())); + u.waitUnreachable(); + + u = new WaitUnreachable(new XDerived() {}); + receive(test.roundTripDerivedToDerived((XDerived) u.get())); + u.waitUnreachable(); + + u = new WaitUnreachable(test); + test = null; + u.waitUnreachable(); + System.out.println( + "Client and server both cleanly terminate now: Success"); + } + + private static void execServer(XComponentContext context, String url) + throws Exception + { + XAcceptor acceptor = Acceptor.create(context); + XBridgeFactory factory = UnoRuntime.queryInterface( + XBridgeFactory.class, + context.getServiceManager().createInstanceWithContext( + "com.sun.star.bridge.BridgeFactory", context)); + UnoUrl unoUrl = UnoUrl.parseUnoUrl(url); + System.out.println("Server: Accepting..."); + XConnection connection = acceptor.accept( + unoUrl.getConnectionAndParametersAsString()); + System.out.println("Server: ...connected..."); + factory.createBridge( + "", unoUrl.getProtocolAndParametersAsString(), connection, + new Provider()); + System.out.println("Server: ...bridged."); + } + + private static final class Provider implements XInstanceProvider { + public Object getInstance(String instanceName) { + return new XTest() { + public void setInterfaceToInterface(Object obj) { + iface = obj; + } + + public void setBaseToInterface(XBase obj) { + iface = obj; + } + + public void setDerivedToInterface(XDerived obj) { + iface = obj; + } + + public Object getInterfaceFromInterface() { + return iface; + } + + public void clearInterface() { + WaitUnreachable u = new WaitUnreachable(iface); + iface = null; + u.waitUnreachable(); + } + + public void setBaseToBase(XBase obj) { + base = obj; + } + + public void setDerivedToBase(XDerived obj) { + base = obj; + } + + public Object getInterfaceFromBase() { + return base; + } + + public XBase getBaseFromBase() { + return base; + } + + public void clearBase() { + WaitUnreachable u = new WaitUnreachable(base); + base = null; + u.waitUnreachable(); + } + + public void setDerivedToDerived(XDerived obj) { + derived = obj; + } + + public Object getInterfaceFromDerived() { + return derived; + } + + public XBase getBaseFromDerived() { + return derived; + } + + public XDerived getDerivedFromDerived() { + return derived; + } + + public void clearDerived() { + WaitUnreachable u = new WaitUnreachable(derived); + derived = null; + u.waitUnreachable(); + } + + public Object roundTripInterfaceToInterface(Object obj) { + WaitUnreachable.ensureFinalization(obj); + return obj; + } + + public Object roundTripBaseToInterface(XBase obj) { + WaitUnreachable.ensureFinalization(obj); + return obj; + } + + public Object roundTripDerivedToInterface(XDerived obj) { + WaitUnreachable.ensureFinalization(obj); + return obj; + } + + public XBase roundTripBaseToBase(XBase obj) { + WaitUnreachable.ensureFinalization(obj); + return obj; + } + + public XBase roundTripDerivedToBase(XDerived obj) { + WaitUnreachable.ensureFinalization(obj); + return obj; + } + + public XDerived roundTripDerivedToDerived(XDerived obj) { + WaitUnreachable.ensureFinalization(obj); + return obj; + } + + private Object iface; + private XBase base; + private XDerived derived; + }; + } + } +} diff --git a/bridges/test/java_uno/acquire/makefile.mk b/bridges/test/java_uno/acquire/makefile.mk new file mode 100644 index 000000000000..def12dd53c49 --- /dev/null +++ b/bridges/test/java_uno/acquire/makefile.mk @@ -0,0 +1,117 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ := ..$/..$/.. +PRJNAME := bridges + +TARGET := test_javauno_acquire +PACKAGE := test$/javauno$/acquire + +ENABLE_EXCEPTIONS := TRUE + +.INCLUDE: settings.mk + +DLLPRE = # no leading "lib" on .so files +INCPRE += $(MISC)$/$(TARGET)$/inc + +SLOFILES = $(SLO)$/testacquire.obj + +SHL1TARGET = testacquire.uno +SHL1OBJS = $(SLOFILES) +SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map +SHL1IMPLIB = itestacquire + +JAVAFILES = TestAcquire.java +JARFILES = OOoRunner.jar juh.jar jurt.jar ridl.jar + +.INCLUDE: target.mk + +ALLTAR: \ + $(BIN)$/testacquire-java-client \ + $(BIN)$/testacquire-java-server \ + $(BIN)$/testacquire-native-client \ + $(BIN)$/testacquire-native-server + +.IF "$(GUI)" == "WNT" +GIVE_EXEC_RIGHTS = @echo +.ELSE # GUI, WNT +GIVE_EXEC_RIGHTS = chmod +x +.ENDIF # GUI, WNT + +EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i) +EXEC_CLASSPATH = \ + $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) + +$(BIN)$/$(TARGET).rdb: types.idl + - rm $@ + - $(MKDIR) $(MISC)$/$(TARGET) + - $(MKDIR) $(MISC)$/$(TARGET)$/inc + $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $< + $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/types.urd + $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb + $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb + $(REGMERGE) $@ / $(SOLARBINDIR)$/types.rdb + $(REGCOMP) -register -r $@ -c acceptor.uno$(DLLPOST) \ + -c bridgefac.uno$(DLLPOST) -c connector.uno$(DLLPOST) \ + -c remotebridge.uno$(DLLPOST) -c uuresolver.uno$(DLLPOST) + +$(SLOFILES) $(JAVACLASSFILES): $(BIN)$/$(TARGET).rdb + +# Use "127.0.0.1" instead of "localhost", see #i32281#: +TEST_JAVAUNO_ACQUIRE_UNO_URL := \ + \"'uno:socket,host=127.0.0.1,port=2002;urp;test'\" + +$(BIN)$/testacquire-java-client: + echo java -classpath \ + ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\ +..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ + test.javauno.acquire.TestAcquire client \ + $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ + $(GIVE_EXEC_RIGHTS) $@ + +$(BIN)$/testacquire-java-server: + echo java -classpath \ + ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\ +..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ + test.javauno.acquire.TestAcquire server \ + $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ + $(GIVE_EXEC_RIGHTS) $@ + +$(BIN)$/testacquire-native-client: + echo '$(AUGMENT_LIBRARY_PATH)' uno \ + -c com.sun.star.test.bridges.testacquire.impl \ + -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb -- \ + $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ + $(GIVE_EXEC_RIGHTS) $@ + +$(BIN)$/testacquire-native-server: + echo '$(AUGMENT_LIBRARY_PATH)' uno \ + -c com.sun.star.test.bridges.testacquire.impl \ + -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb \ + -u $(TEST_JAVAUNO_ACQUIRE_UNO_URL) --singleaccept > $@ + $(GIVE_EXEC_RIGHTS) $@ diff --git a/bridges/test/java_uno/acquire/readme.txt b/bridges/test/java_uno/acquire/readme.txt new file mode 100644 index 000000000000..40bdf645c295 --- /dev/null +++ b/bridges/test/java_uno/acquire/readme.txt @@ -0,0 +1,21 @@ +Test scenarios: + +> cd .../bridges/<outdir>/bin +> ./testacquire-java-server & +> sleep 3 # wait for server to accept connection +> ./testacquire-java-client + +> cd .../bridges/<outdir>/bin +> ./testacquire-java-server & +> sleep 3 # wait for server to accept connection +> ./testacquire-native-client + +> cd .../bridges/<outdir>/bin +> ./testacquire-native-server & +> sleep 3 # wait for server to accept connection +> ./testacquire-java-client + +> cd .../bridges/<outdir>/bin +> ./testacquire-native-server & +> sleep 3 # wait for server to accept connection +> ./testacquire-native-client diff --git a/bridges/test/java_uno/acquire/testacquire.cxx b/bridges/test/java_uno/acquire/testacquire.cxx new file mode 100644 index 000000000000..897986c91aa5 --- /dev/null +++ b/bridges/test/java_uno/acquire/testacquire.cxx @@ -0,0 +1,574 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include "com/sun/star/bridge/UnoUrlResolver.hpp" +#include "com/sun/star/bridge/XUnoUrlResolver.hpp" +#include "com/sun/star/lang/XMain.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XSingleComponentFactory.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase3.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/conditn.hxx" +#include "osl/interlck.h" +#include "rtl/string.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "test/javauno/acquire/XBase.hpp" +#include "test/javauno/acquire/XDerived.hpp" +#include "test/javauno/acquire/XTest.hpp" +#include "uno/environment.h" +#include "uno/lbnames.h" + +#include <iostream> +#include <cstdlib> + +namespace css = com::sun::star; + +namespace { + +class WaitCondition { +public: + WaitCondition() {} + + ~WaitCondition(); + + osl::Condition & get() { return m_condition; } + +private: + WaitCondition(WaitCondition &); // not implemented + void operator =(WaitCondition); // not implemented + + osl::Condition m_condition; +}; + +} + +WaitCondition::~WaitCondition() { + std::cout << "waiting for condition\n"; + if (m_condition.wait() != osl::Condition::result_ok) { + throw "osl::Condition::wait failed"; + } +} + +namespace { + +class Interface: public css::uno::XInterface { +public: + explicit Interface(osl::Condition & condition): + m_condition(condition), m_refCount(0) {} + + virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw () + { osl_incrementInterlockedCount(&m_refCount); } + + virtual void SAL_CALL release() throw (); + +protected: + virtual ~Interface() { m_condition.set(); } + +private: + Interface(Interface &); // not implemented + void operator =(Interface); // not implemented + + osl::Condition & m_condition; + oslInterlockedCount m_refCount; +}; + +} + +css::uno::Any Interface::queryInterface(css::uno::Type const & type) + throw (css::uno::RuntimeException) +{ + return type.getTypeName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( + "com.sun.star.uno.XInterface")) + ? css::uno::makeAny(css::uno::Reference< css::uno::XInterface >(this)) + : css::uno::Any(); +} + +void Interface::release() throw () { + if (osl_decrementInterlockedCount(&m_refCount) == 0) { + delete this; + } +} + +namespace { + +class Base: public Interface, public test::javauno::acquire::XBase { +public: + explicit Base(osl::Condition & condition): Interface(condition) {} + + virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw () { Interface::acquire(); } + + virtual void SAL_CALL release() throw () { Interface::release(); } + +protected: + virtual ~Base() {} +}; + +} + +css::uno::Any Base::queryInterface(css::uno::Type const & type) + throw (css::uno::RuntimeException) +{ + return type.getTypeName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( + "test.javauno.acquire.XBase")) + ? css::uno::makeAny( + css::uno::Reference< test::javauno::acquire::XBase >(this)) + : Interface::queryInterface(type); +} + +namespace { + +class Derived: public Base, public test::javauno::acquire::XDerived { +public: + explicit Derived(osl::Condition & condition): Base(condition) {} + + virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw () { Base::acquire(); } + + virtual void SAL_CALL release() throw () { Base::release(); } + +private: + virtual ~Derived() {} +}; + +} + +css::uno::Any Derived::queryInterface(css::uno::Type const & type) + throw (css::uno::RuntimeException) +{ + return (type.getTypeName().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("test.javauno.acquire.XDerived"))) + ? css::uno::makeAny( + css::uno::Reference< test::javauno::acquire::XDerived >(this)) + : Interface::queryInterface(type); +} + +namespace { + +class Service: public cppu::WeakImplHelper3< + css::lang::XServiceInfo, css::lang::XMain, test::javauno::acquire::XTest > +{ +public: + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return getImplementationName_static(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return getSupportedServiceNames_static(); } + + virtual sal_Int32 SAL_CALL + run(css::uno::Sequence< rtl::OUString > const & arguments) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL setInterfaceToInterface( + css::uno::Reference< css::uno::XInterface > const & obj) + throw (css::uno::RuntimeException) + { m_interface = obj; } + + virtual void SAL_CALL setBaseToInterface( + css::uno::Reference< test::javauno::acquire::XBase > const & obj) + throw (css::uno::RuntimeException) + { m_interface = obj; } + + virtual void SAL_CALL setDerivedToInterface( + css::uno::Reference< test::javauno::acquire::XDerived > const & obj) + throw (css::uno::RuntimeException) + { m_interface = obj; } + + virtual css::uno::Reference< css::uno::XInterface > + SAL_CALL getInterfaceFromInterface() throw (css::uno::RuntimeException) + { return m_interface; } + + virtual void SAL_CALL clearInterface() throw (css::uno::RuntimeException) + { m_interface.clear(); } + + virtual void SAL_CALL setBaseToBase( + css::uno::Reference< test::javauno::acquire::XBase > const & obj) + throw (css::uno::RuntimeException) + { m_base = obj; } + + virtual void SAL_CALL setDerivedToBase( + css::uno::Reference< test::javauno::acquire::XDerived > const & obj) + throw (css::uno::RuntimeException) + { m_base = obj.get(); } + + virtual css::uno::Reference< css::uno::XInterface > + SAL_CALL getInterfaceFromBase() throw (css::uno::RuntimeException) + { return m_base; } + + virtual css::uno::Reference< test::javauno::acquire::XBase > + SAL_CALL getBaseFromBase() throw (css::uno::RuntimeException) + { return m_base; } + + virtual void SAL_CALL clearBase() throw (css::uno::RuntimeException) + { m_base.clear(); } + + virtual void SAL_CALL setDerivedToDerived( + css::uno::Reference< test::javauno::acquire::XDerived > const & obj) + throw (css::uno::RuntimeException) + { m_derived = obj; } + + virtual css::uno::Reference< css::uno::XInterface > + SAL_CALL getInterfaceFromDerived() throw (css::uno::RuntimeException) + { return m_derived; } + + virtual css::uno::Reference< test::javauno::acquire::XBase > + SAL_CALL getBaseFromDerived() throw (css::uno::RuntimeException) + { return m_derived.get(); } + + virtual css::uno::Reference< test::javauno::acquire::XDerived > + SAL_CALL getDerivedFromDerived() throw (css::uno::RuntimeException) + { return m_derived; } + + virtual void SAL_CALL clearDerived() throw (css::uno::RuntimeException) + { m_derived.clear(); } + + virtual css::uno::Reference< css::uno::XInterface > + SAL_CALL roundTripInterfaceToInterface( + css::uno::Reference< css::uno::XInterface > const & obj) + throw (css::uno::RuntimeException) + { return obj; } + + virtual css::uno::Reference< css::uno::XInterface > + SAL_CALL roundTripBaseToInterface( + css::uno::Reference< test::javauno::acquire::XBase > const & obj) + throw (css::uno::RuntimeException) + { return obj; } + + virtual css::uno::Reference< css::uno::XInterface > + SAL_CALL roundTripDerivedToInterface( + css::uno::Reference< test::javauno::acquire::XDerived > const & obj) + throw (css::uno::RuntimeException) + { return obj; } + + virtual css::uno::Reference< test::javauno::acquire::XBase > + SAL_CALL roundTripBaseToBase( + css::uno::Reference< test::javauno::acquire::XBase > const & obj) + throw (css::uno::RuntimeException) + { return obj; } + + virtual css::uno::Reference< test::javauno::acquire::XBase > + SAL_CALL roundTripDerivedToBase( + css::uno::Reference< test::javauno::acquire::XDerived > const & obj) + throw (css::uno::RuntimeException) + { return obj.get(); } + + virtual css::uno::Reference< test::javauno::acquire::XDerived > + SAL_CALL roundTripDerivedToDerived( + css::uno::Reference< test::javauno::acquire::XDerived > const & obj) + throw (css::uno::RuntimeException) + { return obj; } + + static rtl::OUString getImplementationName_static(); + + static css::uno::Sequence< rtl::OUString > + getSupportedServiceNames_static(); + + static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( + css::uno::Reference< css::uno::XComponentContext > const & context) + throw (css::uno::Exception); + +private: + explicit Service( + css::uno::Reference< css::uno::XComponentContext > const & context): + m_context(context) {} + + css::uno::Reference< css::uno::XComponentContext > m_context; + css::uno::Reference< css::uno::XInterface > m_interface; + css::uno::Reference< test::javauno::acquire::XBase > m_base; + css::uno::Reference< test::javauno::acquire::XDerived > m_derived; +}; + +} + +sal_Bool Service::supportsService(rtl::OUString const & serviceName) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > names( + getSupportedServiceNames_static()); + for (sal_Int32 i = 0; i< names.getLength(); ++i) { + if (names[i] == serviceName) { + return true; + } + } + return false; +} + +namespace { + +template< typename T > void assertNotNull(css::uno::Reference< T > const & ref) +{ + if (!ref.is()) { + std::cerr << "assertNotNull failed\n"; + std::abort(); + } +} + +} + +sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const & arguments) + throw (css::uno::RuntimeException) +{ + // - arguments[0] must be the UNO URL to connect to: + css::uno::Reference< XTest > test( + css::bridge::UnoUrlResolver::create(m_context)->resolve(arguments[0]), + css::uno::UNO_QUERY_THROW); + + { + WaitCondition c; + test->setInterfaceToInterface(new Interface(c.get())); + assertNotNull(test->getInterfaceFromInterface()); + test->clearInterface(); + } + { + WaitCondition c; + test->setInterfaceToInterface( + static_cast< Interface * >(new Base(c.get()))); + assertNotNull(test->getInterfaceFromInterface()); + test->clearInterface(); + } + { + WaitCondition c; + test->setInterfaceToInterface( + static_cast< Interface * >(new Derived(c.get()))); + assertNotNull(test->getInterfaceFromInterface()); + test->clearInterface(); + } + + { + WaitCondition c; + test->setBaseToInterface(new Base(c.get())); + assertNotNull(test->getInterfaceFromInterface()); + test->clearInterface(); + } + { + WaitCondition c; + test->setBaseToInterface(static_cast< Base * >(new Derived(c.get()))); + assertNotNull(test->getInterfaceFromInterface()); + test->clearInterface(); + } + + { + WaitCondition c; + test->setDerivedToInterface(new Derived(c.get())); + assertNotNull(test->getInterfaceFromInterface()); + test->clearInterface(); + } + + { + WaitCondition c; + test->setBaseToBase(new Base(c.get())); + assertNotNull(test->getInterfaceFromBase()); + assertNotNull(test->getBaseFromBase()); + test->clearBase(); + } + { + WaitCondition c; + test->setBaseToBase(static_cast< Base * >(new Derived(c.get()))); + assertNotNull(test->getInterfaceFromBase()); + assertNotNull(test->getBaseFromBase()); + test->clearBase(); + } + + { + WaitCondition c; + test->setDerivedToBase(new Derived(c.get())); + assertNotNull(test->getInterfaceFromBase()); + assertNotNull(test->getBaseFromBase()); + test->clearBase(); + } + + { + WaitCondition c; + test->setDerivedToDerived(new Derived(c.get())); + assertNotNull(test->getInterfaceFromDerived()); + assertNotNull(test->getBaseFromDerived()); + assertNotNull(test->getDerivedFromDerived()); + test->clearDerived(); + } + + { + WaitCondition c; + assertNotNull( + test->roundTripInterfaceToInterface(new Interface(c.get()))); + } + { + WaitCondition c; + assertNotNull(test->roundTripInterfaceToInterface( + static_cast< Interface * >(new Base(c.get())))); + } + { + WaitCondition c; + assertNotNull(test->roundTripInterfaceToInterface( + static_cast< Interface * >(new Derived(c.get())))); + } + + { + WaitCondition c; + assertNotNull(test->roundTripBaseToInterface(new Base(c.get()))); + } + { + WaitCondition c; + assertNotNull(test->roundTripBaseToInterface( + static_cast< Base * >(new Derived(c.get())))); + } + + { + WaitCondition c; + assertNotNull(test->roundTripDerivedToInterface(new Derived(c.get()))); + } + + { + WaitCondition c; + assertNotNull(test->roundTripBaseToBase(new Base(c.get()))); + } + { + WaitCondition c; + assertNotNull(test->roundTripBaseToBase( + static_cast< Base * >(new Derived(c.get())))); + } + + { + WaitCondition c; + assertNotNull(test->roundTripDerivedToBase(new Derived(c.get()))); + } + + { + WaitCondition c; + assertNotNull(test->roundTripDerivedToDerived(new Derived(c.get()))); + } + + std::cout << "Client and server both cleanly terminate now: Success\n"; + return 0; +} + +rtl::OUString Service::getImplementationName_static() { + return rtl::OUString::createFromAscii( + "com.sun.star.test.bridges.testacquire.impl"); +} + +css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames_static() { + css::uno::Sequence< rtl::OUString > names(1); + names[0] = rtl::OUString::createFromAscii( + "com.sun.star.test.bridges.testacquire"); + return names; +} + +css::uno::Reference< css::uno::XInterface > Service::createInstance( + css::uno::Reference< css::uno::XComponentContext > const & context) + throw (css::uno::Exception) +{ + return static_cast< cppu::OWeakObject * >(new Service(context)); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** envTypeName, uno_Environment **) +{ + if (envTypeName != 0) { + *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } +} + +extern "C" void * SAL_CALL component_getFactory(char const * implName, + void * serviceManager, void *) { + void * p = 0; + if (serviceManager != 0) { + css::uno::Reference< css::lang::XSingleComponentFactory > f; + if (Service::getImplementationName_static().equalsAscii(implName)) { + f = cppu::createSingleComponentFactory( + &Service::createInstance, + Service::getImplementationName_static(), + Service::getSupportedServiceNames_static()); + } + if (f.is()) { + f->acquire(); + p = f.get(); + } + } + return p; +} + +namespace { + +bool writeInfo(void * registryKey, rtl::OUString const & implementationName, + css::uno::Sequence< rtl::OUString > const & serviceNames) { + rtl::OUString keyName(rtl::OUString::createFromAscii("/")); + keyName += implementationName; + keyName += rtl::OUString::createFromAscii("/UNO/SERVICES"); + css::uno::Reference< css::registry::XRegistryKey > key; + try { + key = static_cast< css::registry::XRegistryKey * >(registryKey)-> + createKey(keyName); + } catch (css::registry::InvalidRegistryException &) {} + if (!key.is()) { + return false; + } + bool success = true; + for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) { + try { + key->createKey(serviceNames[i]); + } catch (css::registry::InvalidRegistryException &) { + success = false; + break; + } + } + return success; +} + +} + +extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) { + return registryKey + && writeInfo(registryKey, Service::getImplementationName_static(), + Service::getSupportedServiceNames_static()); +} diff --git a/bridges/test/java_uno/acquire/types.idl b/bridges/test/java_uno/acquire/types.idl new file mode 100644 index 000000000000..6dd2964777bd --- /dev/null +++ b/bridges/test/java_uno/acquire/types.idl @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "com/sun/star/uno/XInterface.idl" + +module test { module javauno { module acquire { + +interface XBase: com::sun::star::uno::XInterface {}; + +interface XDerived: XBase {}; + +interface XTest: com::sun::star::uno::XInterface +{ + void setInterfaceToInterface([in] com::sun::star::uno::XInterface obj); + void setBaseToInterface([in] XBase obj); + void setDerivedToInterface([in] XDerived obj); + com::sun::star::uno::XInterface getInterfaceFromInterface(); + void clearInterface(); + + void setBaseToBase([in] XBase obj); + void setDerivedToBase([in] XDerived obj); + com::sun::star::uno::XInterface getInterfaceFromBase(); + XBase getBaseFromBase(); + void clearBase(); + + void setDerivedToDerived([in] XDerived obj); + com::sun::star::uno::XInterface getInterfaceFromDerived(); + XBase getBaseFromDerived(); + XDerived getDerivedFromDerived(); + void clearDerived(); + + com::sun::star::uno::XInterface roundTripInterfaceToInterface( + [in] com::sun::star::uno::XInterface obj); + com::sun::star::uno::XInterface roundTripBaseToInterface([in] XBase obj); + com::sun::star::uno::XInterface roundTripDerivedToInterface( + [in] XDerived obj); + + XBase roundTripBaseToBase([in] XBase obj); + XBase roundTripDerivedToBase([in] XDerived obj); + + XDerived roundTripDerivedToDerived([in] XDerived obj); +}; + +}; }; }; diff --git a/bridges/test/java_uno/any/TestAny.java b/bridges/test/java_uno/any/TestAny.java new file mode 100644 index 000000000000..43e8bf542479 --- /dev/null +++ b/bridges/test/java_uno/any/TestAny.java @@ -0,0 +1,2267 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package test.java_uno.anytest; + +import com.sun.star.uno.Any; +import com.sun.star.uno.Enum; +import com.sun.star.uno.Type; +import com.sun.star.uno.TypeClass; +import com.sun.star.uno.XInterface; +import java.lang.reflect.Array; + +final class TestAny { + public static boolean test(XTransport transport, boolean createTypes) { + boolean success = true; + + // Sanity check for com.sun.star.uno.Type: + success &= testType(void.class, TypeClass.VOID, "void"); + success &= testType(boolean.class, TypeClass.BOOLEAN, "boolean"); + success &= testType(byte.class, TypeClass.BYTE, "byte"); + success &= testType(short.class, TypeClass.SHORT, "short"); + success &= testType(int.class, TypeClass.LONG, "long"); + success &= testType(long.class, TypeClass.HYPER, "hyper"); + success &= testType(float.class, TypeClass.FLOAT, "float"); + success &= testType(double.class, TypeClass.DOUBLE, "double"); + success &= testType(char.class, TypeClass.CHAR, "char"); + success &= testType(String.class, TypeClass.STRING, "string"); + success &= testType(Type.class, TypeClass.TYPE, "type"); + success &= testType(Any.class, TypeClass.ANY, "any"); + success &= testType(boolean[].class, TypeClass.SEQUENCE, "[]boolean"); + success &= testType(byte[].class, TypeClass.SEQUENCE, "[]byte"); + success &= testType(short[].class, TypeClass.SEQUENCE, "[]short"); + success &= testType(int[].class, TypeClass.SEQUENCE, "[]long"); + success &= testType(long[].class, TypeClass.SEQUENCE, "[]hyper"); + success &= testType(float[].class, TypeClass.SEQUENCE, "[]float"); + success &= testType(double[].class, TypeClass.SEQUENCE, "[]double"); + success &= testType(char[].class, TypeClass.SEQUENCE, "[]char"); + success &= testType(String[].class, TypeClass.SEQUENCE, "[]string"); + success &= testType(Type[].class, TypeClass.SEQUENCE, "[]type"); + success &= testType(Any[].class, TypeClass.SEQUENCE, "[]any"); + success &= testType(Enum1[].class, TypeClass.SEQUENCE, + "[]" + Enum1.class.getName()); + success &= testType(BaseStruct[].class, TypeClass.SEQUENCE, + "[]" + BaseStruct.class.getName()); + success &= testType(DerivedStruct[].class, TypeClass.SEQUENCE, + "[]" + DerivedStruct.class.getName()); + success &= testType(XInterface[].class, TypeClass.SEQUENCE, + "[]" + XInterface.class.getName()); + success &= testType(BaseInterface[].class, TypeClass.SEQUENCE, + "[]" + BaseInterface.class.getName()); + success &= testType(DerivedInterface[].class, TypeClass.SEQUENCE, + "[]" + DerivedInterface.class.getName()); + success &= testType(boolean[][].class, TypeClass.SEQUENCE, + "[][]boolean"); + success &= testType(byte[][].class, TypeClass.SEQUENCE, "[][]byte"); + success &= testType(short[][].class, TypeClass.SEQUENCE, "[][]short"); + success &= testType(int[][].class, TypeClass.SEQUENCE, "[][]long"); + success &= testType(long[][].class, TypeClass.SEQUENCE, "[][]hyper"); + success &= testType(float[][].class, TypeClass.SEQUENCE, "[][]float"); + success &= testType(double[][].class, TypeClass.SEQUENCE, "[][]double"); + success &= testType(char[][].class, TypeClass.SEQUENCE, "[][]char"); + success &= testType(String[][].class, TypeClass.SEQUENCE, "[][]string"); + success &= testType(Type[][].class, TypeClass.SEQUENCE, "[][]type"); + success &= testType(Any[][].class, TypeClass.SEQUENCE, "[][]any"); + success &= testType(Enum1[][].class, TypeClass.SEQUENCE, + "[][]" + Enum1.class.getName()); + success &= testType(BaseStruct[][].class, TypeClass.SEQUENCE, + "[][]" + BaseStruct.class.getName()); + success &= testType(DerivedStruct[][].class, TypeClass.SEQUENCE, + "[][]" + DerivedStruct.class.getName()); + success &= testType(XInterface[][].class, TypeClass.SEQUENCE, + "[][]" + XInterface.class.getName()); + success &= testType(BaseInterface[][].class, TypeClass.SEQUENCE, + "[][]" + BaseInterface.class.getName()); + success &= testType(DerivedInterface[][].class, TypeClass.SEQUENCE, + "[][]" + DerivedInterface.class.getName()); + success &= testType(Enum1.class, TypeClass.ENUM, Enum1.class.getName()); + success &= testType(BaseStruct.class, TypeClass.STRUCT, + BaseStruct.class.getName()); + success &= testType(DerivedStruct.class, TypeClass.STRUCT, + DerivedStruct.class.getName()); + success &= testType(com.sun.star.uno.Exception.class, + TypeClass.EXCEPTION, + com.sun.star.uno.Exception.class.getName()); + success &= testType(com.sun.star.uno.RuntimeException.class, + TypeClass.EXCEPTION, + com.sun.star.uno.RuntimeException.class.getName()); + success &= testType(XInterface.class, TypeClass.INTERFACE, + XInterface.class.getName()); + success &= testType(BaseInterface.class, TypeClass.INTERFACE, + BaseInterface.class.getName()); + success &= testType(DerivedInterface.class, TypeClass.INTERFACE, + DerivedInterface.class.getName()); + + // VOID: + success &= testMapAny(transport, Any.VOID, new CompareBoxed()); + + // BOOLEAN: + success &= testMapAny(transport, Boolean.FALSE, new CompareBoxed()); + success &= testMapAny(transport, Boolean.TRUE, new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.BOOLEAN, Boolean.FALSE), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.BOOLEAN, Boolean.TRUE), + new CompareUnboxed()); + + // BYTE: + success &= testMapAny(transport, new Byte((byte) -128), + new CompareBoxed()); + success &= testMapAny(transport, new Byte((byte) 0), + new CompareBoxed()); + success &= testMapAny(transport, new Byte((byte) 127), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.BYTE, new Byte((byte) -128)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.BYTE, new Byte((byte) 0)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.BYTE, new Byte((byte) 127)), + new CompareUnboxed()); + + // SHORT: + success &= testMapAny(transport, new Short((short) -32768), + new CompareBoxed()); + success &= testMapAny(transport, new Short((short) 0), + new CompareBoxed()); + success &= testMapAny(transport, new Short((short) 32767), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.SHORT, + new Short((short) -32768)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.SHORT, new Short((short) 0)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.SHORT, new Short((short) 32767)), + new CompareUnboxed()); + + // UNSIGNED SHORT: + success &= testMapAny(transport, + new Any(Type.UNSIGNED_SHORT, + new Short((short) 0)), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.UNSIGNED_SHORT, + new Short((short) -32768)), + new CompareBoxed()); + + // LONG: + success &= testMapAny(transport, new Integer(-2147483648), + new CompareBoxed()); + success &= testMapAny(transport, new Integer(0), + new CompareBoxed()); + success &= testMapAny(transport, new Integer(2147483647), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.LONG, new Integer(-2147483648)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.LONG, new Integer(0)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.LONG, new Integer(2147483647)), + new CompareUnboxed()); + + // UNSIGNED LONG: + success &= testMapAny(transport, + new Any(Type.UNSIGNED_LONG, new Integer(0)), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.UNSIGNED_LONG, + new Integer(-2147483648)), + new CompareBoxed()); + + // HYPER: + success &= testMapAny(transport, new Long(-9223372036854775808L), + new CompareBoxed()); + success &= testMapAny(transport, new Long(0L), new CompareBoxed()); + success &= testMapAny(transport, new Long(9223372036854775807L), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.HYPER, + new Long(-9223372036854775808L)), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.HYPER, new Long(0L)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.HYPER, + new Long(9223372036854775807L)), + new CompareUnboxed()); + + // UNSIGNED HYPER: + success &= testMapAny(transport, + new Any(Type.UNSIGNED_HYPER, new Long(0L)), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.UNSIGNED_HYPER, + new Long(-9223372036854775808L)), + new CompareBoxed()); + + // FLOAT: + success &= testMapAny(transport, new Float(Float.NEGATIVE_INFINITY), + new CompareBoxed()); + success &= testMapAny(transport, new Float(Float.MIN_VALUE), + new CompareBoxed()); + success &= testMapAny(transport, new Float(-0.0f), + new CompareBoxed()); + success &= testMapAny(transport, new Float(0.0f), + new CompareBoxed()); + success &= testMapAny(transport, new Float(Float.MAX_VALUE), + new CompareBoxed()); + success &= testMapAny(transport, new Float(Float.POSITIVE_INFINITY), + new CompareBoxed()); + success &= testMapAny(transport, new Float(Float.NaN), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, + new Float(Float.NEGATIVE_INFINITY)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, + new Float(Float.MIN_VALUE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, new Float(-0.0f)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, new Float(0.0f)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, + new Float(Float.MAX_VALUE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, + new Float(Float.POSITIVE_INFINITY)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.FLOAT, new Float(Float.NaN)), + new CompareUnboxed()); + + // DOUBLE: + success &= testMapAny(transport, + new Double(Double.NEGATIVE_INFINITY), + new CompareBoxed()); + success &= testMapAny(transport, new Double(Double.MIN_VALUE), + new CompareBoxed()); + success &= testMapAny(transport, new Double(-0.0f), + new CompareBoxed()); + success &= testMapAny(transport, new Double(0.0f), + new CompareBoxed()); + success &= testMapAny(transport, new Double(Double.MAX_VALUE), + new CompareBoxed()); + success &= testMapAny(transport, + new Double(Double.POSITIVE_INFINITY), + new CompareBoxed()); + success &= testMapAny(transport, new Double(Double.NaN), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, + new Double(Double.NEGATIVE_INFINITY)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, + new Double(Double.MIN_VALUE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, new Double(-0.0)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, new Double(0.0)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, + new Double(Double.MAX_VALUE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, + new Double(Double.POSITIVE_INFINITY)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.DOUBLE, new Double(Double.NaN)), + new CompareUnboxed()); + + // CHAR: + success &= testMapAny(transport, new Character('\u0000'), + new CompareBoxed()); + success &= testMapAny(transport, new Character('\uDBFF'), + new CompareBoxed()); + success &= testMapAny(transport, new Character('\uFFFD'), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(Type.CHAR, new Character('\u0000')), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.CHAR, new Character('\uDBFF')), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.CHAR, new Character('\uFFFD')), + new CompareUnboxed()); + + // STRING: + success &= testMapAny(transport, "", new CompareBoxed()); + success &= testMapAny(transport, "\uD800\uDC00", + new CompareBoxed()); + success &= testMapAny(transport, "Test", new CompareBoxed()); + success &= testMapAny(transport, new Any(Type.STRING, ""), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.STRING, "\uD800\uDC00"), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.STRING, "Test"), + new CompareUnboxed()); + + // TYPE: + success &= testMapAny(transport, Type.VOID, new CompareBoxed()); + success &= testMapAny(transport, Type.BOOLEAN, new CompareBoxed()); + success &= testMapAny(transport, Type.BYTE, new CompareBoxed()); + success &= testMapAny(transport, Type.SHORT, new CompareBoxed()); + success &= testMapAny(transport, Type.UNSIGNED_SHORT, + new CompareBoxed()); + success &= testMapAny(transport, Type.LONG, new CompareBoxed()); + success &= testMapAny(transport, Type.UNSIGNED_LONG, + new CompareBoxed()); + success &= testMapAny(transport, Type.HYPER, new CompareBoxed()); + success &= testMapAny(transport, Type.UNSIGNED_HYPER, + new CompareBoxed()); + success &= testMapAny(transport, Type.FLOAT, new CompareBoxed()); + success &= testMapAny(transport, Type.DOUBLE, new CompareBoxed()); + success &= testMapAny(transport, Type.CHAR, new CompareBoxed()); + success &= testMapAny(transport, Type.STRING, new CompareBoxed()); + success &= testMapAny(transport, Type.TYPE, new CompareBoxed()); + success &= testMapAny(transport, Type.ANY, new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]boolean", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]byte", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]short", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]unsigned short", + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]long", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]unsigned long", + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]hyper", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]unsigned hyper", + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]float", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]double", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]char", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]string", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]type", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]any", TypeClass.SEQUENCE), + new CompareBoxed()); + if (createTypes) { + success &= testMapAny(transport, + new Type("[]" + Enum1.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]" + BaseStruct.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]" + DerivedStruct.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + } + success &= testMapAny(transport, + new Type("[]" + XInterface.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]" + BaseInterface.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[]" + + DerivedInterface.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]boolean", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]byte", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]short", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]unsigned short", + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]long", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]unsigned long", + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]hyper", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]unsigned hyper", + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]float", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]double", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]char", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]string", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]type", TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]any", TypeClass.SEQUENCE), + new CompareBoxed()); + if (createTypes) { + success &= testMapAny(transport, + new Type("[][]" + Enum1.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]" + BaseStruct.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]" + + DerivedStruct.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + } + success &= testMapAny(transport, + new Type("[][]" + XInterface.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]" + + BaseInterface.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type("[][]" + + DerivedInterface.class.getName(), + TypeClass.SEQUENCE), + new CompareBoxed()); + if (createTypes) { + success &= testMapAny(transport, new Type(Enum1.class.getName(), + TypeClass.ENUM), + new CompareBoxed()); + success &= testMapAny(transport, + new Type(BaseStruct.class.getName(), + TypeClass.STRUCT), + new CompareBoxed()); + success &= testMapAny(transport, + new Type(DerivedStruct.class.getName(), + TypeClass.STRUCT), + new CompareBoxed()); + } + success &= testMapAny(transport, + new Type( + com.sun.star.uno.Exception.class. + getName(), + TypeClass.EXCEPTION), + new CompareBoxed()); + if (createTypes) { + success &= testMapAny(transport, + new Type(BaseException.class.getName(), + TypeClass.EXCEPTION), + new CompareBoxed()); + success &= testMapAny(transport, + new Type(DerivedException.class.getName(), + TypeClass.EXCEPTION), + new CompareBoxed()); + } + success &= testMapAny(transport, + new Type( + com.sun.star.uno.RuntimeException.class. + getName(), + TypeClass.EXCEPTION), + new CompareBoxed()); + if (createTypes) { + success &= testMapAny(transport, + new Type( + BaseRuntimeException.class.getName(), + TypeClass.EXCEPTION), + new CompareBoxed()); + success &= testMapAny(transport, + new Type( + DerivedRuntimeException.class. + getName(), + TypeClass.EXCEPTION), + new CompareBoxed()); + } + success &= testMapAny(transport, + new Type(XInterface.class.getName(), + TypeClass.INTERFACE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type(BaseInterface.class.getName(), + TypeClass.INTERFACE), + new CompareBoxed()); + success &= testMapAny(transport, + new Type(DerivedInterface.class.getName(), + TypeClass.INTERFACE), + new CompareBoxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.VOID), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.BOOLEAN), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.BYTE), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.SHORT), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, Type.UNSIGNED_SHORT), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.LONG), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, Type.UNSIGNED_LONG), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.HYPER), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, Type.UNSIGNED_HYPER), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.FLOAT), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.DOUBLE), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.CHAR), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.STRING), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.TYPE), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(Type.TYPE, Type.ANY), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]boolean", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]byte", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]short", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]unsigned short", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]long", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]unsigned long", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]hyper", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]unsigned hyper", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]float", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]double", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]char", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]string", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]type", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]any", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + if (createTypes) { + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]" + Enum1.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]" + + BaseStruct.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + "[]" + + DerivedStruct.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[]" + + XInterface.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + "[]" + + BaseInterface.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + "[]" + + DerivedInterface.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]boolean", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]byte", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]short", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]unsigned short", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]long", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]unsigned long", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]hyper", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]unsigned hyper", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]float", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]double", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]char", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]string", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]type", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]any", + TypeClass.SEQUENCE)), + new CompareUnboxed()); + if (createTypes) { + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]" + + Enum1.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]" + + BaseStruct.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + "[][]" + + DerivedStruct.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type("[][]" + + XInterface.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + "[][]" + + BaseInterface.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + "[][]" + + DerivedInterface.class.getName(), + TypeClass.SEQUENCE)), + new CompareUnboxed()); + if (createTypes) { + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type(Enum1.class.getName(), + TypeClass.ENUM)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type(BaseStruct.class.getName(), + TypeClass.STRUCT)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + DerivedStruct.class.getName(), + TypeClass.STRUCT)), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + com.sun.star.uno.Exception.class. + getName(), + TypeClass.EXCEPTION)), + new CompareUnboxed()); + if (createTypes) { + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + BaseException.class.getName(), + TypeClass.EXCEPTION)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + DerivedException.class.getName(), + TypeClass.EXCEPTION)), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + com.sun.star.uno.RuntimeException. + class.getName(), + TypeClass.EXCEPTION)), + new CompareUnboxed()); + if (createTypes) { + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + BaseRuntimeException.class. + getName(), + TypeClass.EXCEPTION)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + Type.TYPE, + new Type( + DerivedRuntimeException.class. + getName(), + TypeClass.EXCEPTION)), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type(XInterface.class.getName(), + TypeClass.INTERFACE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + BaseInterface.class.getName(), + TypeClass.INTERFACE)), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(Type.TYPE, + new Type( + DerivedInterface.class.getName(), + TypeClass.INTERFACE)), + new CompareUnboxed()); + + // Sequence Types: + success &= testMapAny(transport, new boolean[] {}, + new CompareBoxed()); + success &= testMapAny(transport, new boolean[] { false, true }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(boolean[].class), + new boolean[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(boolean[].class), + new boolean[] { false, true }), + new CompareUnboxed()); + success &= testMapAny(transport, new byte[] {}, + new CompareBoxed()); + success &= testMapAny(transport, new byte[] { -128, 0, 127 }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(byte[].class), + new byte[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(byte[].class), + new byte[] { -128, 0, 127 }), + new CompareUnboxed()); + success &= testMapAny(transport, new short[] {}, + new CompareBoxed()); + success &= testMapAny(transport, new short[] { -32768, 0, 32767 }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(short[].class), + new short[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(short[].class), + new short[] { -32768, 0, 32767 }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type("[]unsigned short", + TypeClass.SEQUENCE), + new short[] {}), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type("[]unsigned short", + TypeClass.SEQUENCE), + new short[] { 0, -32768 }), + new CompareBoxed()); + success &= testMapAny(transport, new int[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new int[] { -2147483648, 0, 2147483647 }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(int[].class), + new int[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(int[].class), + new int[] { -2147483648, 0, + 2147483647 }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type("[]unsigned long", + TypeClass.SEQUENCE), + new int[] {}), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type("[]unsigned long", + TypeClass.SEQUENCE), + new int[] { 0, -2147483648 }), + new CompareBoxed()); + success &= testMapAny(transport, new long[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new long[] { -9223372036854775808L, 0L, + 9223372036854775807L }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(long[].class), + new long[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(long[].class), + new long[] { -9223372036854775808L, + 0L, + 9223372036854775807L }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type("[]unsigned hyper", + TypeClass.SEQUENCE), + new long[] {}), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type("[]unsigned hyper", + TypeClass.SEQUENCE), + new long[] { 0L, + -9223372036854775808L }), + new CompareBoxed()); + success &= testMapAny(transport, new float[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new float[] { Float.NEGATIVE_INFINITY, + Float.MIN_VALUE, -0.0f, 0.0f, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY, + Float.NaN }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(float[].class), + new float[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(float[].class), + new float[] { Float.NEGATIVE_INFINITY, + Float.MIN_VALUE, -0.0f, + 0.0f, Float.MAX_VALUE, + Float.POSITIVE_INFINITY, + Float.NaN }), + new CompareUnboxed()); + success &= testMapAny(transport, new double[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new double[] { Double.NEGATIVE_INFINITY, + Double.MIN_VALUE, -0.0, 0.0, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY, + Double.NaN }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(double[].class), + new double[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(double[].class), + new double[] { + Double.NEGATIVE_INFINITY, + Double.MIN_VALUE, -0.0, 0.0, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY, + Double.NaN }), + new CompareUnboxed()); + success &= testMapAny(transport, new char[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new char[] { '\u0000', '\uDBFF', '\uFFFD' }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(char[].class), + new char[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(char[].class), + new char[] { '\u0000', '\uDBFF', + '\uFFFD' }), + new CompareUnboxed()); + success &= testMapAny(transport, new String[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new String[] { "", "\uD800\uDC00", "Test" }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(String[].class), + new String[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(String[].class), + new String[] { "", "\uD800\uDC00", + "Test" }), + new CompareUnboxed()); + success &= testMapAny(transport, new Type[] {}, new CompareBoxed()); + success &= testMapAny(transport, + new Type[] { + Type.VOID, + new Type(DerivedInterface.class.getName(), + TypeClass.INTERFACE) }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(Type[].class), + new Type[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(Type[].class), + new Type[] { + Type.VOID, + new Type( + DerivedInterface.class.getName(), + TypeClass.INTERFACE) }), + new CompareUnboxed()); + success &= testMapAny(transport, new Object[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new Object[] { Any.VOID, Boolean.FALSE }, + new CompareBoxed()); + success &= testMapAny(transport, + new Object[] { + Boolean.FALSE, + new Any(Type.BOOLEAN, Boolean.TRUE) }, + new CompareBoxed(true)); + success &= testMapAny(transport, + new Any(new Type(Any[].class), + new Object[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(Any[].class), + new Object[] { Any.VOID, + Boolean.FALSE }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(Any[].class), + new Object[] { + Boolean.FALSE, + new Any(Type.BOOLEAN, + Boolean.TRUE) }), + new CompareUnboxed(true)); + success &= testMapAny(transport, new Any[] {}, + new CompareSpecific(new Object[] {})); + success &= testMapAny(transport, + new Any[] { Any.VOID, + new Any(Type.BOOLEAN, + Boolean.TRUE) }, + new CompareSpecific( + new Object[] { Any.VOID, Boolean.TRUE })); + success &= testMapAny(transport, + new Any(new Type(Any[].class), new Any[] {}), + new CompareSpecific(new Object[] {})); + success &= testMapAny(transport, + new Any(new Type(Any[].class), + new Any[] { Any.VOID, + new Any(Type.BOOLEAN, + Boolean.TRUE) }), + new CompareSpecific( + new Object[] { Any.VOID, Boolean.TRUE })); + success &= testMapAny(transport, + new Any(new Type(Any[].class), + new Boolean[] {}), + new CompareSpecific(new Object[] {})); + success &= testMapAny(transport, + new Any(new Type(Any[].class), + new Boolean[] { Boolean.FALSE }), + new CompareSpecific( + new Object[] { Boolean.FALSE })); + if (createTypes) { + success &= testMapAny(transport, new Enum1[] {}, + new CompareBoxed()); + success &= testMapAny(transport, new Enum1[] { new Enum1(), + new Enum2() }, + new CompareSpecific( + new Enum1[] { new Enum1(), + new Enum1() })); + success &= testMapAny(transport, + new Any(new Type(Enum1[].class), + new Enum1[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(Enum1[].class), + new Enum1[] { new Enum1(), + new Enum2() }), + new CompareSpecific( + new Enum1[] { new Enum1(), + new Enum1() })); + success &= testMapAny(transport, + new Any(new Type(Enum1[].class), + new Enum2[] {}), + new CompareSpecific(new Enum1[] {})); + success &= testMapAny(transport, + new Any(new Type(Enum1[].class), + new Enum2[] { new Enum2() }), + new CompareSpecific( + new Enum1[] { new Enum1() })); + success &= testMapAny(transport, new BaseStruct[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new BaseStruct[] { new BaseStruct(), + new DerivedStruct() }, + new CompareSpecific( + new BaseStruct[] { new BaseStruct(), + new BaseStruct() })); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[].class), + new BaseStruct[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[].class), + new BaseStruct[] { + new BaseStruct(), + new DerivedStruct() }), + new CompareSpecific( + new BaseStruct[] { new BaseStruct(), + new BaseStruct() })); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[].class), + new DerivedStruct[] {}), + new CompareSpecific(new BaseStruct[] {})); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[].class), + new DerivedStruct[] { + new DerivedStruct() }), + new CompareSpecific( + new BaseStruct[] { new BaseStruct() })); + success &= testMapAny(transport, new DerivedStruct[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new DerivedStruct[] { new DerivedStruct() }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedStruct[].class), + new DerivedStruct[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedStruct[].class), + new DerivedStruct[] { + new DerivedStruct() }), + new CompareUnboxed()); + } + success &= testMapAny(transport, new XInterface[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new XInterface[] { + null, new XInterface() {}, + new BaseInterface() {}, + new DerivedInterface() {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new XInterface[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new XInterface[] { + null, new XInterface() {}, + new BaseInterface() {}, + new DerivedInterface() {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new Object[] {}), + new CompareSpecific(new XInterface[] {})); + { + XInterface if1 = new XInterface() {}; + XInterface if2 = new BaseInterface() {}; + XInterface if3 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new Object[] { null, if1, if2, + if3 }), + new CompareSpecific( + new XInterface[] { null, if1, if2, + if3 })); + } + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new BaseInterface[] {}), + new CompareSpecific(new XInterface[] {})); + { + BaseInterface if1 = new BaseInterface() {}; + BaseInterface if2 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new BaseInterface[] { null, if1, + if2 }), + new CompareSpecific( + new XInterface[] { null, if1, if2 })); + } + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new DerivedInterface[] {}), + new CompareSpecific(new XInterface[] {})); + { + DerivedInterface if1 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(XInterface[].class), + new DerivedInterface[] { null, + if1 }), + new CompareSpecific( + new XInterface[] { null, if1 })); + } + success &= testMapAny(transport, new BaseInterface[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new BaseInterface[] { + null, new BaseInterface() {}, + new DerivedInterface() {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface[].class), + new BaseInterface[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface[].class), + new BaseInterface[] { + null, new BaseInterface() {}, + new DerivedInterface() {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface[].class), + new DerivedInterface[] {}), + new CompareSpecific(new BaseInterface[] {})); + { + DerivedInterface if1 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(BaseInterface[].class), + new DerivedInterface[] { null, + if1 }), + new CompareSpecific( + new BaseInterface[] { null, if1 })); + } + success &= testMapAny(transport, new DerivedInterface[] {}, + new CompareBoxed()); + success &= testMapAny(transport, + new DerivedInterface[] { + null, new DerivedInterface() {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedInterface[].class), + new DerivedInterface[] {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedInterface[].class), + new DerivedInterface[] { + null, + new DerivedInterface() {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new boolean[][] { new boolean[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new boolean[][] { + new boolean[] { false, true } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(boolean[][].class), + new boolean[][] { new boolean[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(boolean[][].class), + new boolean[][] { + new boolean[] { false, true } }), + new CompareUnboxed()); + success &= testMapAny(transport, new byte[][] { new byte[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new byte[][] { new byte[] { -128, 0, 127 } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(byte[][].class), + new byte[][] { new byte[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(byte[][].class), + new byte[][] { + new byte[] { -128, 0, 127 } }), + new CompareUnboxed()); + success &= testMapAny(transport, new short[][] { new short[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new short[][] { + new short[] { -32768, 0, 32767 } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(short[][].class), + new short[][] { new short[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(short[][].class), + new short[][] { + new short[] { -32768, 0, + 32767 } }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type("[][]unsigned short", + TypeClass.SEQUENCE), + new short[][] { new short[] {} }), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type("[][]unsigned short", + TypeClass.SEQUENCE), + new short[][] { + new short[] { 0, -32768 } }), + new CompareBoxed()); + success &= testMapAny(transport, new int[][] { new int[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new int[][] { new int[] { -2147483648, 0, + 2147483647 } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(int[][].class), + new int[][] { new int[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(int[][].class), + new int[][] { + new int[] { -2147483648, 0, + 2147483647 } }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type("[][]unsigned long", + TypeClass.SEQUENCE), + new int[][] { new int[] {} }), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type("[][]unsigned long", + TypeClass.SEQUENCE), + new int[][] { + new int[] { 0, -2147483648 } }), + new CompareBoxed()); + success &= testMapAny(transport, new long[][] { new long[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new long[][] { + new long[] { -9223372036854775808L, 0L, + 9223372036854775807L } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(long[][].class), + new long[][] { new long[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(long[][].class), + new long[][] { + new long[] { + -9223372036854775808L, 0L, + 9223372036854775807L } }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type("[][]unsigned hyper", + TypeClass.SEQUENCE), + new long[][] { new long[] {} }), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type("[][]unsigned hyper", + TypeClass.SEQUENCE), + new long[][] { + new long[] { + 0L, + -9223372036854775808L } }), + new CompareBoxed()); + success &= testMapAny(transport, new float[][] { new float[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new float[][] { + new float[] { Float.NEGATIVE_INFINITY, + Float.MIN_VALUE, -0.0f, + 0.0f, Float.MAX_VALUE, + Float.POSITIVE_INFINITY, + Float.NaN } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(float[][].class), + new float[][] { new float[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(float[][].class), + new float[][] { + new float[] { + Float.NEGATIVE_INFINITY, + Float.MIN_VALUE, -0.0f, 0.0f, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY, + Float.NaN } }), + new CompareUnboxed()); + success &= testMapAny(transport, new double[][] { new double[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new double[][] { + new double[] { Double.NEGATIVE_INFINITY, + Double.MIN_VALUE, -0.0, + 0.0, Double.MAX_VALUE, + Double.POSITIVE_INFINITY, + Double.NaN } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(double[][].class), + new double[][] { new double[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(double[][].class), + new double[][] { + new double[] { + Double.NEGATIVE_INFINITY, + Double.MIN_VALUE, -0.0, 0.0, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY, + Double.NaN } }), + new CompareUnboxed()); + success &= testMapAny(transport, new char[][] { new char[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new char[][] { + new char[] { '\u0000', '\uDBFF', + '\uFFFD' } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(char[][].class), + new char[][] { new char[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(char[][].class), + new char[][] { + new char[] { '\u0000', '\uDBFF', + '\uFFFD' } }), + new CompareUnboxed()); + success &= testMapAny(transport, new String[][] { new String[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new String[][] { + new String[] { "", "\uD800\uDC00", + "Test" } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(String[][].class), + new String[][] { new String[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(String[][].class), + new String[][] { + new String[] { "", "\uD800\uDC00", + "Test" } }), + new CompareUnboxed()); + success &= testMapAny(transport, new Type[][] { new Type[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new Type[][] { + new Type[] { + Type.VOID, + new Type( + DerivedInterface.class.getName(), + TypeClass.INTERFACE) } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(Type[][].class), + new Type[][] { new Type[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(Type[][].class), + new Type[][] { + new Type[] { + Type.VOID, + new Type( + DerivedInterface.class. + getName(), + TypeClass.INTERFACE) } }), + new CompareUnboxed()); + success &= testMapAny(transport, new Object[][] { new Object[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new Object[][] { + new Object[] { Any.VOID, + Boolean.FALSE } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Object[][] { + new Object[] { + Boolean.FALSE, + new Any(Type.BOOLEAN, + Boolean.TRUE) } }, + new CompareBoxed(true)); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Object[][] { new Object[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Object[][] { + new Object[] { Any.VOID, + Boolean.FALSE } }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Object[][] { + new Object[] { + Boolean.FALSE, + new Any(Type.BOOLEAN, + Boolean.TRUE) } }), + new CompareUnboxed(true)); + success &= testMapAny(transport, new Any[][] { new Any[] {} }, + new CompareSpecific( + new Object[][] { new Object[] {} })); + success &= testMapAny(transport, + new Any[][] { + new Any[] { Any.VOID, + new Any(Type.BOOLEAN, + Boolean.TRUE) } }, + new CompareSpecific( + new Object[][] { + new Object[] { Any.VOID, + Boolean.TRUE } })); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Any[][] { new Any[] {} }), + new CompareSpecific( + new Object[][] { new Object[] {} })); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Any[][] { + new Any[] { + Any.VOID, + new Any(Type.BOOLEAN, + Boolean.TRUE) } }), + new CompareSpecific( + new Object[][] { + new Object[] { Any.VOID, + Boolean.TRUE } })); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Boolean[][] { new Boolean[] {} }), + new CompareSpecific( + new Object[][] { new Object[] {} })); + success &= testMapAny(transport, + new Any(new Type(Any[][].class), + new Boolean[][] { + new Boolean[] { + Boolean.FALSE } }), + new CompareSpecific( + new Object[][] { + new Object[] { Boolean.FALSE } })); + if (createTypes) { + success &= testMapAny(transport, new Enum1[][] { new Enum1[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new Enum1[][] { + new Enum1[] { new Enum1(), + new Enum2() } }, + new CompareSpecific( + new Enum1[][] { + new Enum1[] { new Enum1(), + new Enum1() } })); + success &= testMapAny(transport, + new Any(new Type(Enum1[][].class), + new Enum1[][] { new Enum1[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(Enum1[][].class), + new Enum1[][] { + new Enum1[] { new Enum1(), + new Enum2() } }), + new CompareSpecific( + new Enum1[][] { + new Enum1[] { new Enum1(), + new Enum1() } })); + success &= testMapAny(transport, + new Any(new Type(Enum1[][].class), + new Enum2[][] { new Enum2[] {} }), + new CompareSpecific( + new Enum1[][] { new Enum1[] {} })); + success &= testMapAny(transport, + new Any(new Type(Enum1[][].class), + new Enum2[][] { + new Enum2[] { new Enum2() } }), + new CompareSpecific( + new Enum1[][] { + new Enum1[] { new Enum1() } })); + success &= testMapAny(transport, + new BaseStruct[][] { new BaseStruct[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new BaseStruct[][] { + new BaseStruct[] { + new BaseStruct(), + new DerivedStruct() } }, + new CompareSpecific( + new BaseStruct[][] { + new BaseStruct[] { + new BaseStruct(), + new BaseStruct() } })); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[][].class), + new BaseStruct[][] { + new BaseStruct[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[][].class), + new BaseStruct[][] { + new BaseStruct[] { + new BaseStruct(), + new DerivedStruct() } }), + new CompareSpecific( + new BaseStruct[][] { + new BaseStruct[] { + new BaseStruct(), + new BaseStruct() } })); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[][].class), + new DerivedStruct[][] { + new DerivedStruct[] {} }), + new CompareSpecific( + new BaseStruct[][] { + new BaseStruct[] {} })); + success &= testMapAny(transport, + new Any(new Type(BaseStruct[][].class), + new DerivedStruct[][] { + new DerivedStruct[] { + new DerivedStruct() } }), + new CompareSpecific( + new BaseStruct[][] { + new BaseStruct[] { + new BaseStruct() } })); + success &= testMapAny(transport, + new DerivedStruct[][] { + new DerivedStruct[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new DerivedStruct[][] { + new DerivedStruct[] { + new DerivedStruct() } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedStruct[][].class), + new DerivedStruct[][] { + new DerivedStruct[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedStruct[][].class), + new DerivedStruct[][] { + new DerivedStruct[] { + new DerivedStruct() } }), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new XInterface[][] { new XInterface[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new XInterface[][] { + new XInterface[] { + null, new XInterface() {}, + new BaseInterface() {}, + new DerivedInterface() {} } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new XInterface[][] { + new XInterface[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(XInterface[][].class), + new XInterface[][] { + new XInterface[] { + null, new XInterface() {}, + new BaseInterface() {}, + new DerivedInterface() {} } }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new Object[][] { new Object[] {} }), + new CompareSpecific( + new XInterface[][] { + new XInterface[] {} })); + { + XInterface if1 = new XInterface() {}; + XInterface if2 = new BaseInterface() {}; + XInterface if3 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new Object[][] { + new Object[] { null, if1, if2, + if3 } }), + new CompareSpecific( + new XInterface[][] { + new XInterface[] { null, if1, if2, + if3 } })); + } + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new BaseInterface[][] { + new BaseInterface[] {} }), + new CompareSpecific( + new XInterface[][] { + new XInterface[] {} })); + { + BaseInterface if1 = new BaseInterface() {}; + BaseInterface if2 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new BaseInterface[][] { + new BaseInterface[] { + null, if1, if2 } }), + new CompareSpecific( + new XInterface[][] { + new XInterface[] { + null, if1, if2 } })); + } + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new DerivedInterface[][] { + new DerivedInterface[] {} }), + new CompareSpecific( + new XInterface[][] { + new XInterface[] {} })); + { + DerivedInterface if1 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(XInterface[][].class), + new DerivedInterface[][] { + new DerivedInterface[] { + null, if1 } }), + new CompareSpecific( + new XInterface[][] { + new XInterface[] { + null, if1 } })); + } + success &= testMapAny(transport, + new BaseInterface[][] { + new BaseInterface[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new BaseInterface[][] { + new BaseInterface[] { + null, new BaseInterface() {}, + new DerivedInterface() {} } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface[][].class), + new BaseInterface[][] { + new BaseInterface[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(BaseInterface[][].class), + new BaseInterface[][] { + new BaseInterface[] { + null, new BaseInterface() {}, + new DerivedInterface() {} } }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface[][].class), + new DerivedInterface[][] { + new DerivedInterface[] {} }), + new CompareSpecific( + new BaseInterface[][] { + new BaseInterface[] {} })); + { + DerivedInterface if1 = new DerivedInterface() {}; + success &= testMapAny(transport, + new Any(new Type(BaseInterface[][].class), + new DerivedInterface[][] { + new DerivedInterface[] { + null, if1 } }), + new CompareSpecific( + new BaseInterface[][] { + new BaseInterface[] { + null, if1 } })); + } + success &= testMapAny(transport, + new DerivedInterface[][] { + new DerivedInterface[] {} }, + new CompareBoxed()); + success &= testMapAny(transport, + new DerivedInterface[][] { + new DerivedInterface[] { + null, new DerivedInterface() {} } }, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedInterface[][].class), + new DerivedInterface[][] { + new DerivedInterface[] {} }), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any( + new Type(DerivedInterface[][].class), + new DerivedInterface[][] { + new DerivedInterface[] { + null, + new DerivedInterface() {} } }), + new CompareUnboxed()); + + // Enum Types: + if (createTypes) { + success &= testMapAny(transport, new Enum1(), new CompareBoxed()); + success &= testMapAny(transport, new Any(new Type(Enum1.class), + new Enum1()), + new CompareUnboxed()); + success &= testMapAny(transport, new Any(new Type(Enum1.class), + new Enum2()), + new CompareSpecific(new Enum1())); + } + + // Struct Types: + if (createTypes) { + success &= testMapAny(transport, new BaseStruct(), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(BaseStruct.class), + new BaseStruct()), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseStruct.class), + new DerivedStruct()), + new CompareSpecific(new BaseStruct())); + success &= testMapAny(transport, new DerivedStruct(), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedStruct.class), + new DerivedStruct()), + new CompareUnboxed()); + } + + // Exception Types: + success &= testMapAny(transport, new com.sun.star.uno.Exception(), + new CompareClass( + com.sun.star.uno.Exception.class)); + success &= testMapAny(transport, + new Any(new Type( + com.sun.star.uno.Exception.class), + new com.sun.star.uno.Exception()), + new CompareClass( + com.sun.star.uno.Exception.class)); + success &= testMapAny(transport, + new Any(new Type( + com.sun.star.uno.Exception.class), + new BaseException()), + new CompareClass( + com.sun.star.uno.Exception.class)); + success &= testMapAny(transport, + new Any(new Type( + com.sun.star.uno.Exception.class), + new DerivedException()), + new CompareClass( + com.sun.star.uno.Exception.class)); + if (createTypes) { + success &= testMapAny(transport, new BaseException(), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(BaseException.class), + new BaseException()), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseException.class), + new DerivedException()), + new CompareSpecific(new BaseException())); + success &= testMapAny(transport, new DerivedException(), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedException.class), + new DerivedException()), + new CompareUnboxed()); + } + success &= testMapAny(transport, + new com.sun.star.uno.RuntimeException(), + new CompareClass( + com.sun.star.uno.RuntimeException.class)); + success &= testMapAny(transport, + new Any( + new Type( + com.sun.star.uno.RuntimeException. + class), + new com.sun.star.uno.RuntimeException()), + new CompareClass( + com.sun.star.uno.RuntimeException.class)); + success &= testMapAny(transport, + new Any( + new Type( + com.sun.star.uno.RuntimeException. + class), + new BaseRuntimeException()), + new CompareClass( + com.sun.star.uno.RuntimeException.class)); + success &= testMapAny(transport, + new Any( + new Type( + com.sun.star.uno.RuntimeException. + class), + new DerivedRuntimeException()), + new CompareClass( + com.sun.star.uno.RuntimeException.class)); + if (createTypes) { + success &= testMapAny(transport, new BaseRuntimeException(), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type( + BaseRuntimeException.class), + new BaseRuntimeException()), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type( + BaseRuntimeException.class), + new DerivedRuntimeException()), + new CompareSpecific( + new BaseRuntimeException())); + success &= testMapAny(transport, new DerivedRuntimeException(), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type( + DerivedRuntimeException.class), + new DerivedRuntimeException()), + new CompareUnboxed()); + } + + // Interface Types: + success &= testMapAny(transport, null, new CompareBoxed()); + success &= testMapAny(transport, new XInterface() {}, + new CompareBoxed()); + success &= testMapAny(transport, new BaseInterface() {}, + new CompareBoxed()); + success &= testMapAny(transport, new DerivedInterface() {}, + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface.class), null), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface.class), + new XInterface() {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface.class), + new BaseInterface() {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(XInterface.class), + new DerivedInterface() {}), + new CompareUnboxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface.class), null), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface.class), + new BaseInterface() {}), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(BaseInterface.class), + new DerivedInterface() {}), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedInterface.class), + null), + new CompareBoxed()); + success &= testMapAny(transport, + new Any(new Type(DerivedInterface.class), + new DerivedInterface() {}), + new CompareBoxed()); + + // Misc: + try { + transport.mapAny(new Object()); + System.out.println("BAD mapAny(Object), no exception"); + success = false; + } catch (StackOverflowError e) { + System.out.println("BAD mapAny(Object): " + e); + success = false; + } catch (RuntimeException e) {} + + return success; + } + + private TestAny() {} // do not instantiate + + private static boolean testType(Class zclass, TypeClass tclass, + String tname) { + Type t1 = new Type(zclass); + Type t2 = new Type(tname, tclass); + boolean ok = true; + if (t1.getTypeClass() != tclass) { + ok = false; + System.out.println("BAD Type(" + zclass + ").getTypeClass() = " + + t1.getTypeClass() + " != " + tclass); + } + if (!t1.getTypeName().equals(tname)) { + ok = false; + System.out.println("BAD Type(" + zclass + ").getTypeName() = " + + t1.getTypeName() + " != " + tname); + } + if (!t1.equals(t2)) { + ok = false; + System.out.println("BAD Type(" + zclass + ") != Type(" + tname + + ", " + tclass + ")"); + } + return ok; + } + + private static boolean testMapAny(XTransport transport, Object any, + Compare compare) { + Object any2 = transport.mapAny(any); + boolean eq = compare.equal(any, any2); + if (!eq) { + System.out.println("BAD mapAny(" + any + ") -> " + any2); + } + return eq; + } + + private static abstract class Compare { + public abstract boolean equal(Object o1, Object o2); + } + + private static final class CompareBoxed extends Compare { + public CompareBoxed() { + this(false); + } + + public CompareBoxed(boolean unboxInner) { + this.unboxInner = unboxInner; + } + + public boolean equal(Object o1, Object o2) { + if (o1 instanceof Any) { + return o2 instanceof Any + && ((Any) o1).getType().equals(((Any) o2).getType()) + && equalValues(((Any) o1).getObject(), + ((Any) o2).getObject()); + } else { + return equalValues(o1, o2); + } + } + + private boolean equalValues(Object o1, Object o2) { + if (o1 == null) { + return o2 == null; + } else if (o1.getClass().isArray()) { + if (!(o2 != null && o1.getClass() == o2.getClass() + && Array.getLength(o1) == Array.getLength(o2))) { + return false; + } + for (int i = 0; i < Array.getLength(o1); ++i) { + Object oo1 = Array.get(o1, i); + if (unboxInner && oo1 instanceof Any) { + oo1 = ((Any) oo1).getObject(); + } + if (!equal(oo1, Array.get(o2, i))) { + return false; + } + } + return true; + } else { + return o1.equals(o2); + } + } + + private final boolean unboxInner; + } + + private static final class CompareUnboxed extends Compare { + public CompareUnboxed() { + this(false); + } + + public CompareUnboxed(boolean unboxInner) { + this.unboxInner = unboxInner; + } + + public boolean equal(Object o1, Object o2) { + return new CompareBoxed(unboxInner).equal(((Any) o1).getObject(), + o2); + } + + private final boolean unboxInner; + } + + private static final class CompareSpecific extends Compare { + public CompareSpecific(Object specific) { + this.specific = specific; + } + + public boolean equal(Object o1, Object o2) { + return new CompareBoxed().equal(specific, o2); + } + + private final Object specific; + } + + private static final class CompareClass extends Compare { + public CompareClass(Class clazz) { + this.clazz = clazz; + } + + public boolean equal(Object o1, Object o2) { + return o2 != null && o2.getClass() == clazz; + } + + private final Class clazz; + } + + public static class Enum1 extends Enum { + public Enum1() { + super(0); + } + + public static Enum1 fromInt(int value) { + return new Enum1(); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == Enum1.class; + } + } + + public static class Enum2 extends Enum1 { + public boolean equals(Object obj) { + return obj != null && obj.getClass() == Enum2.class; + } + } + + public static class BaseStruct { + public boolean equals(Object obj) { + return obj != null && obj.getClass() == BaseStruct.class; + } + } + + public static class DerivedStruct extends BaseStruct { + public boolean equals(Object obj) { + return obj != null && obj.getClass() == DerivedStruct.class; + } + } + + public static class BaseException extends com.sun.star.uno.Exception { + public BaseException() {} + + public BaseException(String message) { + super(message); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == BaseException.class; + } + } + + public static class DerivedException extends BaseException { + public DerivedException() {} + + public DerivedException(String message) { + super(message); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == DerivedException.class; + } + } + + public static class BaseRuntimeException + extends com.sun.star.uno.RuntimeException + { + public BaseRuntimeException() {} + + public BaseRuntimeException(String message) { + super(message); + } + + public boolean equals(Object obj) { + return obj != null + && obj.getClass() == BaseRuntimeException.class; + } + } + + public static class DerivedRuntimeException extends BaseRuntimeException + { + public DerivedRuntimeException() {} + + public DerivedRuntimeException(String message) { + super(message); + } + + public boolean equals(Object obj) { + return obj != null + && obj.getClass() == DerivedRuntimeException.class; + } + } +} diff --git a/bridges/test/java_uno/any/TestJni.java b/bridges/test/java_uno/any/TestJni.java new file mode 100644 index 000000000000..1242c38e86b0 --- /dev/null +++ b/bridges/test/java_uno/any/TestJni.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package test.java_uno.anytest; + +public class TestJni +{ + static { System.loadLibrary( "test_javauno_any" ); } + private static native XTransport create_jni_transport(ClassLoader loader); + + public static void main( String args [] ) + { + if (TestAny.test( + create_jni_transport(TestJni.class.getClassLoader()), false )) + { + System.out.println( "jni any test succeeded." ); + } + else + { + System.err.println( "jni any test failed!" ); + System.exit( 1 ); + } + } +} diff --git a/bridges/test/java_uno/any/TestRemote.java b/bridges/test/java_uno/any/TestRemote.java new file mode 100644 index 000000000000..4d038559660f --- /dev/null +++ b/bridges/test/java_uno/any/TestRemote.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package test.java_uno.anytest; + +import com.sun.star.bridge.XInstanceProvider; +import com.sun.star.lib.TestBed; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +public final class TestRemote { + public static void main(String[] args) throws Exception { + boolean success = new TestBed().execute( + new Provider(), false, Client.class, 0); + System.out.println("success? " + success); + System.exit(success ? 0 : 1); + } + + public static final class Client extends TestBed.Client { + public static void main(String[] args) { + new Client().execute(); + } + + protected boolean run(XComponentContext context) throws Throwable { + XTransport transport = UnoRuntime.queryInterface( + XTransport.class, getBridge(context).getInstance("Transport")); + return TestAny.test(transport, true); + } + } + + private static final class Provider implements XInstanceProvider { + public Object getInstance(String instanceName) { + return new XTransport() { + public Object mapAny(Object any) { + return any; + } + }; + } + } +} diff --git a/bridges/test/java_uno/any/makefile.mk b/bridges/test/java_uno/any/makefile.mk new file mode 100644 index 000000000000..888fae21d3d2 --- /dev/null +++ b/bridges/test/java_uno/any/makefile.mk @@ -0,0 +1,127 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/.. +PRJNAME = bridges +TARGET = test_javauno_any + +PACKAGE = test$/java_uno$/anytest + +ENABLE_EXCEPTIONS = TRUE + +.INCLUDE: settings.mk + +.IF "$(GUI)" == "WNT" +GIVE_EXEC_RIGHTS = @echo +.ELSE +GIVE_EXEC_RIGHTS = chmod +x +.ENDIF + +JAVAFILES = \ + $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) + +# Make sure TestBed.class is found under $(CLASSDIR)$/test: +.IF "$(XCLASSPATH)" == "" +XCLASSPATH := $(CLASSDIR)$/test +.ELSE +XCLASSPATH !:= $(XCLASSPATH)$(PATH_SEPERATOR)$(CLASSDIR)$/test +.ENDIF + +EXEC_CLASSPATH_TMP = \ + $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i)$(PATH_SEPERATOR)$(XCLASSPATH) +EXEC_CLASSPATH = \ + $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) + +JARFILES = juh.jar jurt.jar ridl.jar +JAVACLASSFILES = \ + $(CLASSDIR)$/$(PACKAGE)$/TestAny.class \ + $(CLASSDIR)$/$(PACKAGE)$/TestRemote.class \ + $(CLASSDIR)$/$(PACKAGE)$/TestJni.class + +#-------------------------------------------------- + +USE_DEFFILE = TRUE +ENABLE_EXCEPTIONS = TRUE +INCPRE += $(OUT)$/inc$/test + +.IF "$(debug)" != "" +.IF "$(COM)" == "MSC" +CFLAGS += -Ob0 +.ENDIF +.ENDIF + +SLOFILES= \ + $(SLO)$/transport.obj + +SHL1TARGET=$(TARGET) + +SHL1STDLIBS= \ + $(CPPUHELPERLIB) \ + $(SALHELPERLIB) \ + $(JVMACCESSLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1VERSIONMAP=$(TARGET).map +SHL1IMPLIB=i$(TARGET) +SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1DEF=$(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) + +.INCLUDE: target.mk + +#-------------------------------------------------- + +$(SLOFILES) : $(MISC)$/gen_files.flag +$(JAVACLASSFILES) : $(MISC)$/gen_files.flag + +ALLTAR : \ + $(OUT)$/bin$/TestRemote \ + $(OUT)$/bin$/TestJni + +$(OUT)$/bin$/TestRemote : $(JAVACLASSFILES) + -rm -f $@ + echo java -classpath ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ + test.java_uno.anytest.TestRemote > $@ + $(GIVE_EXEC_RIGHTS) $@ + +$(OUT)$/bin$/TestJni : $(JAVACLASSFILES) + -rm -f $@ + echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \ + .$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ + -Djava.library.path=..$/lib test.java_uno.anytest.TestJni >> $@ + $(GIVE_EXEC_RIGHTS) $@ + +$(BIN)$/test_java_uno_anytest.rdb : types.idl + $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $? + $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} + +$(MISC)$/gen_files.flag : $(BIN)$/test_java_uno_anytest.rdb + $(CPPUMAKER) -C -BUCR -O $(OUT)$/inc$/test -X $(SOLARBINDIR)$/udkapi.rdb $? + $(CPPUMAKER) -C -BUCR -O $(OUT)$/inc$/test -T com.sun.star.uno.XInterface $(SOLARBINDIR)$/udkapi.rdb + $(JAVAMAKER) -nD -BUCR -O $(CLASSDIR) -X $(SOLARBINDIR)$/udkapi.rdb $? + $(TOUCH) $@ diff --git a/bridges/test/java_uno/any/test_javauno_any.map b/bridges/test/java_uno/any/test_javauno_any.map new file mode 100644 index 000000000000..c50f7b162db7 --- /dev/null +++ b/bridges/test/java_uno/any/test_javauno_any.map @@ -0,0 +1,6 @@ +UDK_3_0_0 { + global: + Java_test_java_1uno_anytest_TestJni_create_1jni_1transport; + local: + *; +}; diff --git a/bridges/test/java_uno/any/transport.cxx b/bridges/test/java_uno/any/transport.cxx new file mode 100644 index 000000000000..9ea4d59dcfe9 --- /dev/null +++ b/bridges/test/java_uno/any/transport.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include "jni.h" + +#include "uno/mapping.hxx" +#include "uno/environment.hxx" +#include "jvmaccess/virtualmachine.hxx" +#include "jvmaccess/unovirtualmachine.hxx" +#include "cppuhelper/implbase1.hxx" + +#include "test/java_uno/anytest/XTransport.hpp" +#include "test/java_uno/anytest/DerivedInterface.hpp" + + +using namespace ::com::sun::star::uno; +using ::test::java_uno::anytest::XTransport; +using ::rtl::OUString; + +namespace +{ +//================================================================================================== +class Transport : public ::cppu::WeakImplHelper1< XTransport > +{ +public: + virtual Any SAL_CALL mapAny( Any const & any ) + throw (RuntimeException); +}; +//__________________________________________________________________________________________________ +Any Transport::mapAny( Any const & any ) + throw (RuntimeException) +{ + return any; +} +} + +//################################################################################################## +extern "C" JNIEXPORT jobject JNICALL Java_test_java_1uno_anytest_TestJni_create_1jni_1transport( + JNIEnv * jni_env, jclass, jobject loader ) + SAL_THROW_EXTERN_C() +{ + // publish some idl types + ::getCppuType( (Reference< XTransport > const *)0 ); + ::getCppuType( (Reference< ::test::java_uno::anytest::DerivedInterface > const *)0 ); + + Reference< XTransport > xRet( new Transport() ); + + // get java vm + JavaVM * java_vm; + OSL_VERIFY( 0 == jni_env->GetJavaVM( &java_vm ) ); + // create jvmaccess vm + ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > vm; + try { + vm = new ::jvmaccess::UnoVirtualMachine( + new ::jvmaccess::VirtualMachine( + java_vm, JNI_VERSION_1_2, false, jni_env ), + loader ); + } catch ( ::jvmaccess::UnoVirtualMachine::CreationException & ) { + OSL_ASSERT( false ); + throw; + } + // create uno envs + OUString java_name( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_JAVA) ); + OUString cpp_name( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); + Environment java_env, cpp_env; + uno_getEnvironment( (uno_Environment **)&java_env, java_name.pData, vm.get() ); + OSL_ASSERT( java_env.is() ); + uno_getEnvironment( (uno_Environment **)&cpp_env, cpp_name.pData, 0 ); + OSL_ASSERT( cpp_env.is() ); + + // map interface + Mapping mapping( cpp_env.get(), java_env.get() ); + OSL_ASSERT( mapping.is() ); + jobject jo_global = (jobject)mapping.mapInterface( xRet.get(), ::getCppuType( &xRet ) ); + OSL_ASSERT( 0 != jo_global ); + + // return + jobject jo_ret = jni_env->NewLocalRef( jo_global ); + jni_env->DeleteGlobalRef( jo_global ); + return jo_ret; +} diff --git a/bridges/test/java_uno/any/types.idl b/bridges/test/java_uno/any/types.idl new file mode 100644 index 000000000000..a7d7df5487e6 --- /dev/null +++ b/bridges/test/java_uno/any/types.idl @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/uno/XInterface.idl> + + +module test { module java_uno { module anytest { + +interface XTransport : com::sun::star::uno::XInterface +{ + any mapAny([in] any a); +}; + +interface BaseInterface : com::sun::star::uno::XInterface {}; + +interface DerivedInterface : BaseInterface {}; + +}; }; }; diff --git a/bridges/test/java_uno/equals/TestEquals.java b/bridges/test/java_uno/equals/TestEquals.java new file mode 100644 index 000000000000..5f3ee34a1c1d --- /dev/null +++ b/bridges/test/java_uno/equals/TestEquals.java @@ -0,0 +1,1304 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package test.java_uno.equals; + +import com.sun.star.bridge.XBridge; +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.bridge.XInstanceProvider; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.connection.Acceptor; +import com.sun.star.connection.XAcceptor; +import com.sun.star.connection.XConnection; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.TestBed; +import com.sun.star.lib.uno.typeinfo.MethodTypeInfo; +import com.sun.star.lib.uno.typeinfo.TypeInfo; +import com.sun.star.loader.XImplementationLoader; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.XInterface; +import java.io.File; +import java.net.MalformedURLException; +import java.util.HashMap; +import java.util.Hashtable; + +// In this test scenario, the Java server (see implementation of method +// notifyAccepting) has a remote bridge to the Java client and a local JNI +// bridge to a C++ com.sun.star.test.bridges.testequals.impl service. The C++ +// service and the Java client are also connected via a remote bridge. +// +// The Java server gets two objects (INSTANCE1, INSTANCE2), once directly from +// the Java client via the remote bridge (proxies test1A, test2A), and once +// through the C++ service via the JNI bridge (proxies test1B, test2B). +// Exhaustive tests on the proxies' equals and hashCode methods are done. + +public final class TestEquals { + // args[0] must be a file system path to a types.rdb, + // args[1] must be a file system path to a services.rdb + public static void main(String[] args) throws Exception { + TestBed t = new TestBed(); + boolean success = t.execute( + new Provider(t, toFileUrl(args[0]), toFileUrl(args[1])), true, + Client.class, 0); + System.out.println("success? " + success); + System.exit(success ? 0 : 1); + } + + private static String toFileUrl(String path) throws MalformedURLException { + String url = new File(path).toURL().toString(); + String prefix = "file:/"; + if (url.startsWith(prefix) + && (url.length() == prefix.length() + || url.charAt(prefix.length()) != '/')) { + url = url.substring(0, prefix.length()) + "//" + + url.substring(prefix.length()); + } + return url; + } + + public static final class Client extends TestBed.Client { + public static void main(String[] args) { + new Client().execute(); + } + + protected boolean run(XComponentContext context) throws Throwable { + XTestFrame f = UnoRuntime.queryInterface( + XTestFrame.class, getBridge(context).getInstance("TestFrame")); + XAcceptor acceptor = Acceptor.create(context); + XBridgeFactory factory = UnoRuntime.queryInterface( + XBridgeFactory.class, + context.getServiceManager().createInstanceWithContext( + "com.sun.star.bridge.BridgeFactory", context)); + System.out.println("Client, 2nd connection: Accepting..."); + XInstanceProvider prov = new Provider(); + f.notifyAccepting(new Done(), prov.getInstance(INSTANCE1), + prov.getInstance(INSTANCE2)); + XConnection connection = acceptor.accept(CONNECTION_DESCRIPTION); + System.out.println("Client, 2nd connection: ...connected..."); + XBridge bridge2 = factory.createBridge( + "", PROTOCOL_DESCRIPTION, connection, prov); + System.out.println("Client, 2nd connection: ...bridged."); + synchronized (lock) { + while (!done) { + lock.wait(); + } + } + return true; + } + + private static final class Provider implements XInstanceProvider { + public Object getInstance(String instanceName) { + synchronized (map) { + Object o = map.get(instanceName); + if (o == null) { + o = new XDerived() {}; + map.put(instanceName, o); + } + return o; + } + } + + private final HashMap map = new HashMap(); + } + + private final class Done implements XDone { + public void notifyDone() { + synchronized (lock) { + done = true; + lock.notifyAll(); + } + } + } + + private final Object lock = new Object(); + private boolean done = false; + } + + private static final class Provider implements XInstanceProvider { + public Provider(TestBed testBed, String unoTypes, String unoServices) { + this.testBed = testBed; + this.unoTypes = unoTypes; + this.unoServices = unoServices; + } + + public Object getInstance(String instanceName) { + return new XTestFrame() { + public void notifyAccepting( + final XDone done, final Object object1, + final Object object2) + { + new Thread() { + public void run() { + try { + Object test1Aa = object1; + XBase test1Ab = UnoRuntime.queryInterface( + XBase.class, test1Aa); + XDerived test1Ac = + UnoRuntime.queryInterface( + XDerived.class, test1Aa); + Object test2Aa = object2; + XBase test2Ab = UnoRuntime.queryInterface( + XBase.class, test2Aa); + XDerived test2Ac = + UnoRuntime.queryInterface( + XDerived.class, test2Aa); + + Hashtable params = new Hashtable(); + params.put("UNO_TYPES", unoTypes); + params.put("UNO_SERVICES", unoServices); + XComponentContext context = Bootstrap. + defaultBootstrap_InitialComponentContext( + null, params); + XMultiComponentFactory factory + = context.getServiceManager(); + XImplementationLoader loader = + UnoRuntime.queryInterface( + XImplementationLoader.class, + factory.createInstanceWithContext( + "com.sun.star.loader." + + "SharedLibrary", + context)); + XSingleComponentFactory factory2 = + UnoRuntime.queryInterface( + XSingleComponentFactory.class, + loader.activate( + "com.sun.star.test.bridges." + + "testequals.impl", + "", "../lib/testequals.uno", + null)); + XTestInterface test = + UnoRuntime.queryInterface( + XTestInterface.class, + factory2.createInstanceWithContext( + context)); + // allow client to start accepting: + Thread.sleep(3000); + test.connect( + CONNECTION_DESCRIPTION, + PROTOCOL_DESCRIPTION); + + Object test1Ba = test.get(INSTANCE1); + XBase test1Bb = UnoRuntime.queryInterface( + XBase.class, test1Ba); + XDerived test1Bc = + UnoRuntime.queryInterface( + XDerived.class, test1Ba); + Object test2Ba = test.get(INSTANCE2); + XBase test2Bb = UnoRuntime.queryInterface( + XBase.class, test2Ba); + XDerived test2Bc = + UnoRuntime.queryInterface( + XDerived.class, test2Ba); + + boolean success = true; + + success &= test( + "UnoRumtime.areSame(null, null)", + UnoRuntime.areSame(null, null)); + success &= test( + "!UnoRumtime.areSame(null, test1Aa)", + !UnoRuntime.areSame(null, test1Aa)); + success &= test( + "!UnoRumtime.areSame(null, test1Ab)", + !UnoRuntime.areSame(null, test1Ab)); + success &= test( + "!UnoRumtime.areSame(null, test1Ac)", + !UnoRuntime.areSame(null, test1Ac)); + success &= test( + "!UnoRumtime.areSame(null, test1Ba)", + !UnoRuntime.areSame(null, test1Ba)); + success &= test( + "!UnoRumtime.areSame(null, test1Bb)", + !UnoRuntime.areSame(null, test1Bb)); + success &= test( + "!UnoRumtime.areSame(null, test1Bc)", + !UnoRuntime.areSame(null, test1Bc)); + success &= test( + "!UnoRumtime.areSame(null, test2Aa)", + !UnoRuntime.areSame(null, test2Aa)); + success &= test( + "!UnoRumtime.areSame(null, test2Ab)", + !UnoRuntime.areSame(null, test2Ab)); + success &= test( + "!UnoRumtime.areSame(null, test2Ac)", + !UnoRuntime.areSame(null, test2Ac)); + success &= test( + "!UnoRumtime.areSame(null, test2Ba)", + !UnoRuntime.areSame(null, test2Ba)); + success &= test( + "!UnoRumtime.areSame(null, test2Bb)", + !UnoRuntime.areSame(null, test2Bb)); + success &= test( + "!UnoRumtime.areSame(null, test2Bc)", + !UnoRuntime.areSame(null, test2Bc)); + + success &= test( + "!test1Aa.equals(null)", + !test1Aa.equals(null)); + success &= test( + "!UnoRuntime.areSame(test1Aa, null)", + !UnoRuntime.areSame(test1Aa, null)); + success &= test( + "test1Aa.equals(test1Aa)", + test1Aa.equals(test1Aa)); + success &= test( + "UnoRuntime.areSame(test1Aa, test1Aa)", + UnoRuntime.areSame(test1Aa, test1Aa)); + success &= test( + "test1Aa.equals(test1Ab)", + test1Aa.equals(test1Ab)); + success &= test( + "UnoRuntime.areSame(test1Aa, test1Ab)", + UnoRuntime.areSame(test1Aa, test1Ab)); + success &= test( + "test1Aa.equals(test1Ac)", + test1Aa.equals(test1Ac)); + success &= test( + "UnoRuntime.areSame(test1Aa, test1Ac)", + UnoRuntime.areSame(test1Aa, test1Ac)); + success &= test( + "test1Aa.equals(test1Ba)", + test1Aa.equals(test1Ba)); + success &= test( + "UnoRuntime.areSame(test1Aa, test1Ba)", + UnoRuntime.areSame(test1Aa, test1Ba)); + success &= test( + "test1Aa.equals(test1Bb)", + test1Aa.equals(test1Bb)); + success &= test( + "UnoRuntime.areSame(test1Aa, test1Bb)", + UnoRuntime.areSame(test1Aa, test1Bb)); + success &= test( + "test1Aa.equals(test1Bc)", + test1Aa.equals(test1Bc)); + success &= test( + "UnoRuntime.areSame(test1Aa, test1Bc)", + UnoRuntime.areSame(test1Aa, test1Bc)); + success &= test( + "!test1Aa.equals(test2Aa)", + !test1Aa.equals(test2Aa)); + success &= test( + "!UnoRuntime.areSame(test1Aa, test2Aa)", + !UnoRuntime.areSame(test1Aa, test2Aa)); + success &= test( + "!test1Aa.equals(test2Ab)", + !test1Aa.equals(test2Ab)); + success &= test( + "!UnoRuntime.areSame(test1Aa, test2Ab)", + !UnoRuntime.areSame(test1Aa, test2Ab)); + success &= test( + "!test1Aa.equals(test2Ac)", + !test1Aa.equals(test2Ac)); + success &= test( + "!UnoRuntime.areSame(test1Aa, test2Ac)", + !UnoRuntime.areSame(test1Aa, test2Ac)); + success &= test( + "!test1Aa.equals(test2Ba)", + !test1Aa.equals(test2Ba)); + success &= test( + "!UnoRuntime.areSame(test1Aa, test2Ba)", + !UnoRuntime.areSame(test1Aa, test2Ba)); + success &= test( + "!test1Aa.equals(test2Bb)", + !test1Aa.equals(test2Bb)); + success &= test( + "!UnoRuntime.areSame(test1Aa, test2Bb)", + !UnoRuntime.areSame(test1Aa, test2Bb)); + success &= test( + "!test1Aa.equals(test2Bc)", + !test1Aa.equals(test2Bc)); + success &= test( + "!UnoRuntime.areSame(test1Aa, test2Bc)", + !UnoRuntime.areSame(test1Aa, test2Bc)); + + success &= test( + "!test1Ab.equals(null)", + !test1Ab.equals(null)); + success &= test( + "!UnoRuntime.areSame(test1Ab, null)", + !UnoRuntime.areSame(test1Ab, null)); + success &= test( + "test1Ab.equals(test1Aa)", + test1Ab.equals(test1Aa)); + success &= test( + "UnoRuntime.areSame(test1Ab, test1Aa)", + UnoRuntime.areSame(test1Ab, test1Aa)); + success &= test( + "test1Ab.equals(test1Ab)", + test1Ab.equals(test1Ab)); + success &= test( + "UnoRuntime.areSame(test1Ab, test1Ab)", + UnoRuntime.areSame(test1Ab, test1Ab)); + success &= test( + "test1Ab.equals(test1Ac)", + test1Ab.equals(test1Ac)); + success &= test( + "UnoRuntime.areSame(test1Ab, test1Ac)", + UnoRuntime.areSame(test1Ab, test1Ac)); + success &= test( + "test1Ab.equals(test1Ba)", + test1Ab.equals(test1Ba)); + success &= test( + "UnoRuntime.areSame(test1Ab, test1Ba)", + UnoRuntime.areSame(test1Ab, test1Ba)); + success &= test( + "test1Ab.equals(test1Bb)", + test1Ab.equals(test1Bb)); + success &= test( + "UnoRuntime.areSame(test1Ab, test1Bb)", + UnoRuntime.areSame(test1Ab, test1Bb)); + success &= test( + "test1Ab.equals(test1Bc)", + test1Ab.equals(test1Bc)); + success &= test( + "UnoRuntime.areSame(test1Ab, test1Bc)", + UnoRuntime.areSame(test1Ab, test1Bc)); + success &= test( + "!test1Ab.equals(test2Aa)", + !test1Ab.equals(test2Aa)); + success &= test( + "!UnoRuntime.areSame(test1Ab, test2Aa)", + !UnoRuntime.areSame(test1Ab, test2Aa)); + success &= test( + "!test1Ab.equals(test2Ab)", + !test1Ab.equals(test2Ab)); + success &= test( + "!UnoRuntime.areSame(test1Ab, test2Ab)", + !UnoRuntime.areSame(test1Ab, test2Ab)); + success &= test( + "!test1Ab.equals(test2Ac)", + !test1Ab.equals(test2Ac)); + success &= test( + "!UnoRuntime.areSame(test1Ab, test2Ac)", + !UnoRuntime.areSame(test1Ab, test2Ac)); + success &= test( + "!test1Ab.equals(test2Ba)", + !test1Ab.equals(test2Ba)); + success &= test( + "!UnoRuntime.areSame(test1Ab, test2Ba)", + !UnoRuntime.areSame(test1Ab, test2Ba)); + success &= test( + "!test1Ab.equals(test2Bb)", + !test1Ab.equals(test2Bb)); + success &= test( + "!UnoRuntime.areSame(test1Ab, test2Bb)", + !UnoRuntime.areSame(test1Ab, test2Bb)); + success &= test( + "!test1Ab.equals(test2Bc)", + !test1Ab.equals(test2Bc)); + success &= test( + "!UnoRuntime.areSame(test1Ab, test2Bc)", + !UnoRuntime.areSame(test1Ab, test2Bc)); + + success &= test( + "!test1Ac.equals(null)", + !test1Ac.equals(null)); + success &= test( + "!UnoRuntime.areSame(test1Ac, null)", + !UnoRuntime.areSame(test1Ac, null)); + success &= test( + "test1Ac.equals(test1Aa)", + test1Ac.equals(test1Aa)); + success &= test( + "UnoRuntime.areSame(test1Ac, test1Aa)", + UnoRuntime.areSame(test1Ac, test1Aa)); + success &= test( + "test1Ac.equals(test1Ab)", + test1Ac.equals(test1Ab)); + success &= test( + "UnoRuntime.areSame(test1Ac, test1Ab)", + UnoRuntime.areSame(test1Ac, test1Ab)); + success &= test( + "test1Ac.equals(test1Ac)", + test1Ac.equals(test1Ac)); + success &= test( + "UnoRuntime.areSame(test1Ac, test1Ac)", + UnoRuntime.areSame(test1Ac, test1Ac)); + success &= test( + "test1Ac.equals(test1Ba)", + test1Ac.equals(test1Ba)); + success &= test( + "UnoRuntime.areSame(test1Ac, test1Ba)", + UnoRuntime.areSame(test1Ac, test1Ba)); + success &= test( + "test1Ac.equals(test1Bb)", + test1Ac.equals(test1Bb)); + success &= test( + "UnoRuntime.areSame(test1Ac, test1Bb)", + UnoRuntime.areSame(test1Ac, test1Bb)); + success &= test( + "test1Ac.equals(test1Bc)", + test1Ac.equals(test1Bc)); + success &= test( + "UnoRuntime.areSame(test1Ac, test1Bc)", + UnoRuntime.areSame(test1Ac, test1Bc)); + success &= test( + "!test1Ac.equals(test2Aa)", + !test1Ac.equals(test2Aa)); + success &= test( + "!UnoRuntime.areSame(test1Ac, test2Aa)", + !UnoRuntime.areSame(test1Ac, test2Aa)); + success &= test( + "!test1Ac.equals(test2Ab)", + !test1Ac.equals(test2Ab)); + success &= test( + "!UnoRuntime.areSame(test1Ac, test2Ab)", + !UnoRuntime.areSame(test1Ac, test2Ab)); + success &= test( + "!test1Ac.equals(test2Ac)", + !test1Ac.equals(test2Ac)); + success &= test( + "!UnoRuntime.areSame(test1Ac, test2Ac)", + !UnoRuntime.areSame(test1Ac, test2Ac)); + success &= test( + "!test1Ac.equals(test2Ba)", + !test1Ac.equals(test2Ba)); + success &= test( + "!UnoRuntime.areSame(test1Ac, test2Ba)", + !UnoRuntime.areSame(test1Ac, test2Ba)); + success &= test( + "!test1Ac.equals(test2Bb)", + !test1Ac.equals(test2Bb)); + success &= test( + "!UnoRuntime.areSame(test1Ac, test2Bb)", + !UnoRuntime.areSame(test1Ac, test2Bb)); + success &= test( + "!test1Ac.equals(test2Bc)", + !test1Ac.equals(test2Bc)); + success &= test( + "!UnoRuntime.areSame(test1Ac, test2Bc)", + !UnoRuntime.areSame(test1Ac, test2Bc)); + + success &= test( + "!test1Ba.equals(null)", + !test1Ba.equals(null)); + success &= test( + "!UnoRuntime.areSame(test1Ba, null)", + !UnoRuntime.areSame(test1Ba, null)); + success &= test( + "test1Ba.equals(test1Aa)", + test1Ba.equals(test1Aa)); + success &= test( + "UnoRuntime.areSame(test1Ba, test1Aa)", + UnoRuntime.areSame(test1Ba, test1Aa)); + success &= test( + "test1Ba.equals(test1Ab)", + test1Ba.equals(test1Ab)); + success &= test( + "UnoRuntime.areSame(test1Ba, test1Ab)", + UnoRuntime.areSame(test1Ba, test1Ab)); + success &= test( + "test1Ba.equals(test1Ac)", + test1Ba.equals(test1Ac)); + success &= test( + "UnoRuntime.areSame(test1Ba, test1Ac)", + UnoRuntime.areSame(test1Ba, test1Ac)); + success &= test( + "test1Ba.equals(test1Ba)", + test1Ba.equals(test1Ba)); + success &= test( + "UnoRuntime.areSame(test1Ba, test1Ba)", + UnoRuntime.areSame(test1Ba, test1Ba)); + success &= test( + "test1Ba.equals(test1Bb)", + test1Ba.equals(test1Bb)); + success &= test( + "UnoRuntime.areSame(test1Ba, test1Bb)", + UnoRuntime.areSame(test1Ba, test1Bb)); + success &= test( + "test1Ba.equals(test1Bc)", + test1Ba.equals(test1Bc)); + success &= test( + "UnoRuntime.areSame(test1Ba, test1Bc)", + UnoRuntime.areSame(test1Ba, test1Bc)); + success &= test( + "!test1Ba.equals(test2Aa)", + !test1Ba.equals(test2Aa)); + success &= test( + "!UnoRuntime.areSame(test1Ba, test2Aa)", + !UnoRuntime.areSame(test1Ba, test2Aa)); + success &= test( + "!test1Ba.equals(test2Ab)", + !test1Ba.equals(test2Ab)); + success &= test( + "!UnoRuntime.areSame(test1Ba, test2Ab)", + !UnoRuntime.areSame(test1Ba, test2Ab)); + success &= test( + "!test1Ba.equals(test2Ac)", + !test1Ba.equals(test2Ac)); + success &= test( + "!UnoRuntime.areSame(test1Ba, test2Ac)", + !UnoRuntime.areSame(test1Ba, test2Ac)); + success &= test( + "!test1Ba.equals(test2Ba)", + !test1Ba.equals(test2Ba)); + success &= test( + "!UnoRuntime.areSame(test1Ba, test2Ba)", + !UnoRuntime.areSame(test1Ba, test2Ba)); + success &= test( + "!test1Ba.equals(test2Bb)", + !test1Ba.equals(test2Bb)); + success &= test( + "!UnoRuntime.areSame(test1Ba, test2Bb)", + !UnoRuntime.areSame(test1Ba, test2Bb)); + success &= test( + "!test1Ba.equals(test2Bc)", + !test1Ba.equals(test2Bc)); + success &= test( + "!UnoRuntime.areSame(test1Ba, test2Bc)", + !UnoRuntime.areSame(test1Ba, test2Bc)); + + success &= test( + "!test1Bb.equals(null)", + !test1Bb.equals(null)); + success &= test( + "!UnoRuntime.areSame(test1Bb, null)", + !UnoRuntime.areSame(test1Bb, null)); + success &= test( + "test1Bb.equals(test1Aa)", + test1Bb.equals(test1Aa)); + success &= test( + "UnoRuntime.areSame(test1Bb, test1Aa)", + UnoRuntime.areSame(test1Bb, test1Aa)); + success &= test( + "test1Bb.equals(test1Ab)", + test1Bb.equals(test1Ab)); + success &= test( + "UnoRuntime.areSame(test1Bb, test1Ab)", + UnoRuntime.areSame(test1Bb, test1Ab)); + success &= test( + "test1Bb.equals(test1Ac)", + test1Bb.equals(test1Ac)); + success &= test( + "UnoRuntime.areSame(test1Bb, test1Ac)", + UnoRuntime.areSame(test1Bb, test1Ac)); + success &= test( + "test1Bb.equals(test1Ba)", + test1Bb.equals(test1Ba)); + success &= test( + "UnoRuntime.areSame(test1Bb, test1Ba)", + UnoRuntime.areSame(test1Bb, test1Ba)); + success &= test( + "test1Bb.equals(test1Bb)", + test1Bb.equals(test1Bb)); + success &= test( + "UnoRuntime.areSame(test1Bb, test1Bb)", + UnoRuntime.areSame(test1Bb, test1Bb)); + success &= test( + "test1Bb.equals(test1Bc)", + test1Bb.equals(test1Bc)); + success &= test( + "UnoRuntime.areSame(test1Bb, test1Bc)", + UnoRuntime.areSame(test1Bb, test1Bc)); + success &= test( + "!test1Bb.equals(test2Aa)", + !test1Bb.equals(test2Aa)); + success &= test( + "!UnoRuntime.areSame(test1Bb, test2Aa)", + !UnoRuntime.areSame(test1Bb, test2Aa)); + success &= test( + "!test1Bb.equals(test2Ab)", + !test1Bb.equals(test2Ab)); + success &= test( + "!UnoRuntime.areSame(test1Bb, test2Ab)", + !UnoRuntime.areSame(test1Bb, test2Ab)); + success &= test( + "!test1Bb.equals(test2Ac)", + !test1Bb.equals(test2Ac)); + success &= test( + "!UnoRuntime.areSame(test1Bb, test2Ac)", + !UnoRuntime.areSame(test1Bb, test2Ac)); + success &= test( + "!test1Bb.equals(test2Ba)", + !test1Bb.equals(test2Ba)); + success &= test( + "!UnoRuntime.areSame(test1Bb, test2Ba)", + !UnoRuntime.areSame(test1Bb, test2Ba)); + success &= test( + "!test1Bb.equals(test2Bb)", + !test1Bb.equals(test2Bb)); + success &= test( + "!UnoRuntime.areSame(test1Bb, test2Bb)", + !UnoRuntime.areSame(test1Bb, test2Bb)); + success &= test( + "!test1Bb.equals(test2Bc)", + !test1Bb.equals(test2Bc)); + success &= test( + "!UnoRuntime.areSame(test1Bb, test2Bc)", + !UnoRuntime.areSame(test1Bb, test2Bc)); + + success &= test( + "!test1Bc.equals(null)", + !test1Bc.equals(null)); + success &= test( + "!UnoRuntime.areSame(test1Bc, null)", + !UnoRuntime.areSame(test1Bc, null)); + success &= test( + "test1Bc.equals(test1Aa)", + test1Bc.equals(test1Aa)); + success &= test( + "UnoRuntime.areSame(test1Bc, test1Aa)", + UnoRuntime.areSame(test1Bc, test1Aa)); + success &= test( + "test1Bc.equals(test1Ab)", + test1Bc.equals(test1Ab)); + success &= test( + "UnoRuntime.areSame(test1Bc, test1Ab)", + UnoRuntime.areSame(test1Bc, test1Ab)); + success &= test( + "test1Bc.equals(test1Ac)", + test1Bc.equals(test1Ac)); + success &= test( + "UnoRuntime.areSame(test1Bc, test1Ac)", + UnoRuntime.areSame(test1Bc, test1Ac)); + success &= test( + "test1Bc.equals(test1Ba)", + test1Bc.equals(test1Ba)); + success &= test( + "UnoRuntime.areSame(test1Bc, test1Ba)", + UnoRuntime.areSame(test1Bc, test1Ba)); + success &= test( + "test1Bc.equals(test1Bb)", + test1Bc.equals(test1Bb)); + success &= test( + "UnoRuntime.areSame(test1Bc, test1Bb)", + UnoRuntime.areSame(test1Bc, test1Bb)); + success &= test( + "test1Bc.equals(test1Bc)", + test1Bc.equals(test1Bc)); + success &= test( + "UnoRuntime.areSame(test1Bc, test1Bc)", + UnoRuntime.areSame(test1Bc, test1Bc)); + success &= test( + "!test1Bc.equals(test2Aa)", + !test1Bc.equals(test2Aa)); + success &= test( + "!UnoRuntime.areSame(test1Bc, test2Aa)", + !UnoRuntime.areSame(test1Bc, test2Aa)); + success &= test( + "!test1Bc.equals(test2Ab)", + !test1Bc.equals(test2Ab)); + success &= test( + "!UnoRuntime.areSame(test1Bc, test2Ab)", + !UnoRuntime.areSame(test1Bc, test2Ab)); + success &= test( + "!test1Bc.equals(test2Ac)", + !test1Bc.equals(test2Ac)); + success &= test( + "!UnoRuntime.areSame(test1Bc, test2Ac)", + !UnoRuntime.areSame(test1Bc, test2Ac)); + success &= test( + "!test1Bc.equals(test2Ba)", + !test1Bc.equals(test2Ba)); + success &= test( + "!UnoRuntime.areSame(test1Bc, test2Ba)", + !UnoRuntime.areSame(test1Bc, test2Ba)); + success &= test( + "!test1Bc.equals(test2Bb)", + !test1Bc.equals(test2Bb)); + success &= test( + "!UnoRuntime.areSame(test1Bc, test2Bb)", + !UnoRuntime.areSame(test1Bc, test2Bb)); + success &= test( + "!test1Bc.equals(test2Bc)", + !test1Bc.equals(test2Bc)); + success &= test( + "!UnoRuntime.areSame(test1Bc, test2Bc)", + !UnoRuntime.areSame(test1Bc, test2Bc)); + + success &= test( + "!test2Aa.equals(null)", + !test2Aa.equals(null)); + success &= test( + "!UnoRuntime.areSame(test2Aa, null)", + !UnoRuntime.areSame(test2Aa, null)); + success &= test( + "!test2Aa.equals(test1Aa)", + !test2Aa.equals(test1Aa)); + success &= test( + "!UnoRuntime.areSame(test2Aa, test1Aa)", + !UnoRuntime.areSame(test2Aa, test1Aa)); + success &= test( + "!test2Aa.equals(test1Ab)", + !test2Aa.equals(test1Ab)); + success &= test( + "!UnoRuntime.areSame(test2Aa, test1Ab)", + !UnoRuntime.areSame(test2Aa, test1Ab)); + success &= test( + "!test2Aa.equals(test1Ac)", + !test2Aa.equals(test1Ac)); + success &= test( + "!UnoRuntime.areSame(test2Aa, test1Ac)", + !UnoRuntime.areSame(test2Aa, test1Ac)); + success &= test( + "!test2Aa.equals(test1Ba)", + !test2Aa.equals(test1Ba)); + success &= test( + "!UnoRuntime.areSame(test2Aa, test1Ba)", + !UnoRuntime.areSame(test2Aa, test1Ba)); + success &= test( + "!test2Aa.equals(test1Bb)", + !test2Aa.equals(test1Bb)); + success &= test( + "!UnoRuntime.areSame(test2Aa, test1Bb)", + !UnoRuntime.areSame(test2Aa, test1Bb)); + success &= test( + "!test2Aa.equals(test1Bc)", + !test2Aa.equals(test1Bc)); + success &= test( + "!UnoRuntime.areSame(test2Aa, test1Bc)", + !UnoRuntime.areSame(test2Aa, test1Bc)); + success &= test( + "test2Aa.equals(test2Aa)", + test2Aa.equals(test2Aa)); + success &= test( + "UnoRuntime.areSame(test2Aa, test2Aa)", + UnoRuntime.areSame(test2Aa, test2Aa)); + success &= test( + "test2Aa.equals(test2Ab)", + test2Aa.equals(test2Ab)); + success &= test( + "UnoRuntime.areSame(test2Aa, test2Ab)", + UnoRuntime.areSame(test2Aa, test2Ab)); + success &= test( + "test2Aa.equals(test2Ac)", + test2Aa.equals(test2Ac)); + success &= test( + "UnoRuntime.areSame(test2Aa, test2Ac)", + UnoRuntime.areSame(test2Aa, test2Ac)); + success &= test( + "test2Aa.equals(test2Ba)", + test2Aa.equals(test2Ba)); + success &= test( + "UnoRuntime.areSame(test2Aa, test2Ba)", + UnoRuntime.areSame(test2Aa, test2Ba)); + success &= test( + "test2Aa.equals(test2Bb)", + test2Aa.equals(test2Bb)); + success &= test( + "UnoRuntime.areSame(test2Aa, test2Bb)", + UnoRuntime.areSame(test2Aa, test2Bb)); + success &= test( + "test2Aa.equals(test2Bc)", + test2Aa.equals(test2Bc)); + success &= test( + "UnoRuntime.areSame(test2Aa, test2Bc)", + UnoRuntime.areSame(test2Aa, test2Bc)); + + success &= test( + "!test2Ab.equals(null)", + !test2Ab.equals(null)); + success &= test( + "!UnoRuntime.areSame(test2Ab, null)", + !UnoRuntime.areSame(test2Ab, null)); + success &= test( + "!test2Ab.equals(test1Aa)", + !test2Ab.equals(test1Aa)); + success &= test( + "!UnoRuntime.areSame(test2Ab, test1Aa)", + !UnoRuntime.areSame(test2Ab, test1Aa)); + success &= test( + "!test2Ab.equals(test1Ab)", + !test2Ab.equals(test1Ab)); + success &= test( + "!UnoRuntime.areSame(test2Ab, test1Ab)", + !UnoRuntime.areSame(test2Ab, test1Ab)); + success &= test( + "!test2Ab.equals(test1Ac)", + !test2Ab.equals(test1Ac)); + success &= test( + "!UnoRuntime.areSame(test2Ab, test1Ac)", + !UnoRuntime.areSame(test2Ab, test1Ac)); + success &= test( + "!test2Ab.equals(test1Ba)", + !test2Ab.equals(test1Ba)); + success &= test( + "!UnoRuntime.areSame(test2Ab, test1Ba)", + !UnoRuntime.areSame(test2Ab, test1Ba)); + success &= test( + "!test2Ab.equals(test1Bb)", + !test2Ab.equals(test1Bb)); + success &= test( + "!UnoRuntime.areSame(test2Ab, test1Bb)", + !UnoRuntime.areSame(test2Ab, test1Bb)); + success &= test( + "!test2Ab.equals(test1Bc)", + !test2Ab.equals(test1Bc)); + success &= test( + "!UnoRuntime.areSame(test2Ab, test1Bc)", + !UnoRuntime.areSame(test2Ab, test1Bc)); + success &= test( + "test2Ab.equals(test2Aa)", + test2Ab.equals(test2Aa)); + success &= test( + "UnoRuntime.areSame(test2Ab, test2Aa)", + UnoRuntime.areSame(test2Ab, test2Aa)); + success &= test( + "test2Ab.equals(test2Ab)", + test2Ab.equals(test2Ab)); + success &= test( + "UnoRuntime.areSame(test2Ab, test2Ab)", + UnoRuntime.areSame(test2Ab, test2Ab)); + success &= test( + "test2Ab.equals(test2Ac)", + test2Ab.equals(test2Ac)); + success &= test( + "UnoRuntime.areSame(test2Ab, test2Ac)", + UnoRuntime.areSame(test2Ab, test2Ac)); + success &= test( + "test2Ab.equals(test2Ba)", + test2Ab.equals(test2Ba)); + success &= test( + "UnoRuntime.areSame(test2Ab, test2Ba)", + UnoRuntime.areSame(test2Ab, test2Ba)); + success &= test( + "test2Ab.equals(test2Bb)", + test2Ab.equals(test2Bb)); + success &= test( + "UnoRuntime.areSame(test2Ab, test2Bb)", + UnoRuntime.areSame(test2Ab, test2Bb)); + success &= test( + "test2Ab.equals(test2Bc)", + test2Ab.equals(test2Bc)); + success &= test( + "UnoRuntime.areSame(test2Ab, test2Bc)", + UnoRuntime.areSame(test2Ab, test2Bc)); + + success &= test( + "!test2Ac.equals(null)", + !test2Ac.equals(null)); + success &= test( + "!UnoRuntime.areSame(test2Ac, null)", + !UnoRuntime.areSame(test2Ac, null)); + success &= test( + "!test2Ac.equals(test1Aa)", + !test2Ac.equals(test1Aa)); + success &= test( + "!UnoRuntime.areSame(test2Ac, test1Aa)", + !UnoRuntime.areSame(test2Ac, test1Aa)); + success &= test( + "!test2Ac.equals(test1Ab)", + !test2Ac.equals(test1Ab)); + success &= test( + "!UnoRuntime.areSame(test2Ac, test1Ab)", + !UnoRuntime.areSame(test2Ac, test1Ab)); + success &= test( + "!test2Ac.equals(test1Ac)", + !test2Ac.equals(test1Ac)); + success &= test( + "!UnoRuntime.areSame(test2Ac, test1Ac)", + !UnoRuntime.areSame(test2Ac, test1Ac)); + success &= test( + "!test2Ac.equals(test1Ba)", + !test2Ac.equals(test1Ba)); + success &= test( + "!UnoRuntime.areSame(test2Ac, test1Ba)", + !UnoRuntime.areSame(test2Ac, test1Ba)); + success &= test( + "!test2Ac.equals(test1Bb)", + !test2Ac.equals(test1Bb)); + success &= test( + "!UnoRuntime.areSame(test2Ac, test1Bb)", + !UnoRuntime.areSame(test2Ac, test1Bb)); + success &= test( + "!test2Ac.equals(test1Bc)", + !test2Ac.equals(test1Bc)); + success &= test( + "!UnoRuntime.areSame(test2Ac, test1Bc)", + !UnoRuntime.areSame(test2Ac, test1Bc)); + success &= test( + "test2Ac.equals(test2Aa)", + test2Ac.equals(test2Aa)); + success &= test( + "UnoRuntime.areSame(test2Ac, test2Aa)", + UnoRuntime.areSame(test2Ac, test2Aa)); + success &= test( + "test2Ac.equals(test2Ab)", + test2Ac.equals(test2Ab)); + success &= test( + "UnoRuntime.areSame(test2Ac, test2Ab)", + UnoRuntime.areSame(test2Ac, test2Ab)); + success &= test( + "test2Ac.equals(test2Ac)", + test2Ac.equals(test2Ac)); + success &= test( + "UnoRuntime.areSame(test2Ac, test2Ac)", + UnoRuntime.areSame(test2Ac, test2Ac)); + success &= test( + "test2Ac.equals(test2Ba)", + test2Ac.equals(test2Ba)); + success &= test( + "UnoRuntime.areSame(test2Ac, test2Ba)", + UnoRuntime.areSame(test2Ac, test2Ba)); + success &= test( + "test2Ac.equals(test2Bb)", + test2Ac.equals(test2Bb)); + success &= test( + "UnoRuntime.areSame(test2Ac, test2Bb)", + UnoRuntime.areSame(test2Ac, test2Bb)); + success &= test( + "test2Ac.equals(test2Bc)", + test2Ac.equals(test2Bc)); + success &= test( + "UnoRuntime.areSame(test2Ac, test2Bc)", + UnoRuntime.areSame(test2Ac, test2Bc)); + + success &= test( + "!test2Ba.equals(null)", + !test2Ba.equals(null)); + success &= test( + "!UnoRuntime.areSame(test2Ba, null)", + !UnoRuntime.areSame(test2Ba, null)); + success &= test( + "!test2Ba.equals(test1Aa)", + !test2Ba.equals(test1Aa)); + success &= test( + "!UnoRuntime.areSame(test2Ba, test1Aa)", + !UnoRuntime.areSame(test2Ba, test1Aa)); + success &= test( + "!test2Ba.equals(test1Ab)", + !test2Ba.equals(test1Ab)); + success &= test( + "!UnoRuntime.areSame(test2Ba, test1Ab)", + !UnoRuntime.areSame(test2Ba, test1Ab)); + success &= test( + "!test2Ba.equals(test1Ac)", + !test2Ba.equals(test1Ac)); + success &= test( + "!UnoRuntime.areSame(test2Ba, test1Ac)", + !UnoRuntime.areSame(test2Ba, test1Ac)); + success &= test( + "!test2Ba.equals(test1Ba)", + !test2Ba.equals(test1Ba)); + success &= test( + "!UnoRuntime.areSame(test2Ba, test1Ba)", + !UnoRuntime.areSame(test2Ba, test1Ba)); + success &= test( + "!test2Ba.equals(test1Bb)", + !test2Ba.equals(test1Bb)); + success &= test( + "!UnoRuntime.areSame(test2Ba, test1Bb)", + !UnoRuntime.areSame(test2Ba, test1Bb)); + success &= test( + "!test2Ba.equals(test1Bc)", + !test2Ba.equals(test1Bc)); + success &= test( + "!UnoRuntime.areSame(test2Ba, test1Bc)", + !UnoRuntime.areSame(test2Ba, test1Bc)); + success &= test( + "test2Ba.equals(test2Aa)", + test2Ba.equals(test2Aa)); + success &= test( + "UnoRuntime.areSame(test2Ba, test2Aa)", + UnoRuntime.areSame(test2Ba, test2Aa)); + success &= test( + "test2Ba.equals(test2Ab)", + test2Ba.equals(test2Ab)); + success &= test( + "UnoRuntime.areSame(test2Ba, test2Ab)", + UnoRuntime.areSame(test2Ba, test2Ab)); + success &= test( + "test2Ba.equals(test2Ac)", + test2Ba.equals(test2Ac)); + success &= test( + "UnoRuntime.areSame(test2Ba, test2Ac)", + UnoRuntime.areSame(test2Ba, test2Ac)); + success &= test( + "test2Ba.equals(test2Ba)", + test2Ba.equals(test2Ba)); + success &= test( + "UnoRuntime.areSame(test2Ba, test2Ba)", + UnoRuntime.areSame(test2Ba, test2Ba)); + success &= test( + "test2Ba.equals(test2Bb)", + test2Ba.equals(test2Bb)); + success &= test( + "UnoRuntime.areSame(test2Ba, test2Bb)", + UnoRuntime.areSame(test2Ba, test2Bb)); + success &= test( + "test2Ba.equals(test2Bc)", + test2Ba.equals(test2Bc)); + success &= test( + "UnoRuntime.areSame(test2Ba, test2Bc)", + UnoRuntime.areSame(test2Ba, test2Bc)); + + success &= test( + "!test2Bb.equals(null)", + !test2Bb.equals(null)); + success &= test( + "!UnoRuntime.areSame(test2Bb, null)", + !UnoRuntime.areSame(test2Bb, null)); + success &= test( + "!test2Bb.equals(test1Aa)", + !test2Bb.equals(test1Aa)); + success &= test( + "!UnoRuntime.areSame(test2Bb, test1Aa)", + !UnoRuntime.areSame(test2Bb, test1Aa)); + success &= test( + "!test2Bb.equals(test1Ab)", + !test2Bb.equals(test1Ab)); + success &= test( + "!UnoRuntime.areSame(test2Bb, test1Ab)", + !UnoRuntime.areSame(test2Bb, test1Ab)); + success &= test( + "!test2Bb.equals(test1Ac)", + !test2Bb.equals(test1Ac)); + success &= test( + "!UnoRuntime.areSame(test2Bb, test1Ac)", + !UnoRuntime.areSame(test2Bb, test1Ac)); + success &= test( + "!test2Bb.equals(test1Ba)", + !test2Bb.equals(test1Ba)); + success &= test( + "!UnoRuntime.areSame(test2Bb, test1Ba)", + !UnoRuntime.areSame(test2Bb, test1Ba)); + success &= test( + "!test2Bb.equals(test1Bb)", + !test2Bb.equals(test1Bb)); + success &= test( + "!UnoRuntime.areSame(test2Bb, test1Bb)", + !UnoRuntime.areSame(test2Bb, test1Bb)); + success &= test( + "!test2Bb.equals(test1Bc)", + !test2Bb.equals(test1Bc)); + success &= test( + "!UnoRuntime.areSame(test2Bb, test1Bc)", + !UnoRuntime.areSame(test2Bb, test1Bc)); + success &= test( + "test2Bb.equals(test2Aa)", + test2Bb.equals(test2Aa)); + success &= test( + "UnoRuntime.areSame(test2Bb, test2Aa)", + UnoRuntime.areSame(test2Bb, test2Aa)); + success &= test( + "test2Bb.equals(test2Ab)", + test2Bb.equals(test2Ab)); + success &= test( + "UnoRuntime.areSame(test2Bb, test2Ab)", + UnoRuntime.areSame(test2Bb, test2Ab)); + success &= test( + "test2Bb.equals(test2Ac)", + test2Bb.equals(test2Ac)); + success &= test( + "UnoRuntime.areSame(test2Bb, test2Ac)", + UnoRuntime.areSame(test2Bb, test2Ac)); + success &= test( + "test2Bb.equals(test2Ba)", + test2Bb.equals(test2Ba)); + success &= test( + "UnoRuntime.areSame(test2Bb, test2Ba)", + UnoRuntime.areSame(test2Bb, test2Ba)); + success &= test( + "test2Bb.equals(test2Bb)", + test2Bb.equals(test2Bb)); + success &= test( + "UnoRuntime.areSame(test2Bb, test2Bb)", + UnoRuntime.areSame(test2Bb, test2Bb)); + success &= test( + "test2Bb.equals(test2Bc)", + test2Bb.equals(test2Bc)); + success &= test( + "UnoRuntime.areSame(test2Bb, test2Bc)", + UnoRuntime.areSame(test2Bb, test2Bc)); + + success &= test( + "!test2Bc.equals(null)", + !test2Bc.equals(null)); + success &= test( + "!UnoRuntime.areSame(test2Bc, null)", + !UnoRuntime.areSame(test2Bc, null)); + success &= test( + "!test2Bc.equals(test1Aa)", + !test2Bc.equals(test1Aa)); + success &= test( + "!UnoRuntime.areSame(test2Bc, test1Aa)", + !UnoRuntime.areSame(test2Bc, test1Aa)); + success &= test( + "!test2Bc.equals(test1Ab)", + !test2Bc.equals(test1Ab)); + success &= test( + "!UnoRuntime.areSame(test2Bc, test1Ab)", + !UnoRuntime.areSame(test2Bc, test1Ab)); + success &= test( + "!test2Bc.equals(test1Ac)", + !test2Bc.equals(test1Ac)); + success &= test( + "!UnoRuntime.areSame(test2Bc, test1Ac)", + !UnoRuntime.areSame(test2Bc, test1Ac)); + success &= test( + "!test2Bc.equals(test1Ba)", + !test2Bc.equals(test1Ba)); + success &= test( + "!UnoRuntime.areSame(test2Bc, test1Ba)", + !UnoRuntime.areSame(test2Bc, test1Ba)); + success &= test( + "!test2Bc.equals(test1Bb)", + !test2Bc.equals(test1Bb)); + success &= test( + "!UnoRuntime.areSame(test2Bc, test1Bb)", + !UnoRuntime.areSame(test2Bc, test1Bb)); + success &= test( + "!test2Bc.equals(test1Bc)", + !test2Bc.equals(test1Bc)); + success &= test( + "!UnoRuntime.areSame(test2Bc, test1Bc)", + !UnoRuntime.areSame(test2Bc, test1Bc)); + success &= test( + "test2Bc.equals(test2Aa)", + test2Bc.equals(test2Aa)); + success &= test( + "UnoRuntime.areSame(test2Bc, test2Aa)", + UnoRuntime.areSame(test2Bc, test2Aa)); + success &= test( + "test2Bc.equals(test2Ab)", + test2Bc.equals(test2Ab)); + success &= test( + "UnoRuntime.areSame(test2Bc, test2Ab)", + UnoRuntime.areSame(test2Bc, test2Ab)); + success &= test( + "test2Bc.equals(test2Ac)", + test2Bc.equals(test2Ac)); + success &= test( + "UnoRuntime.areSame(test2Bc, test2Ac)", + UnoRuntime.areSame(test2Bc, test2Ac)); + success &= test( + "test2Bc.equals(test2Ba)", + test2Bc.equals(test2Ba)); + success &= test( + "UnoRuntime.areSame(test2Bc, test2Ba)", + UnoRuntime.areSame(test2Bc, test2Ba)); + success &= test( + "test2Bc.equals(test2Bb)", + test2Bc.equals(test2Bb)); + success &= test( + "UnoRuntime.areSame(test2Bc, test2Bb)", + UnoRuntime.areSame(test2Bc, test2Bb)); + success &= test( + "test2Bc.equals(test2Bc)", + test2Bc.equals(test2Bc)); + success &= test( + "UnoRuntime.areSame(test2Bc, test2Bc)", + UnoRuntime.areSame(test2Bc, test2Bc)); + + success &= test( + "test1Aa.hashCode() == test1Ab.hashCode()", + test1Aa.hashCode() + == test1Ab.hashCode()); + success &= test( + "test1Aa.hashCode()" + + " == test1Ac.hashCode()", + test1Aa.hashCode() + == test1Ac.hashCode()); + success &= test( + "test1Aa.hashCode()" + + " == test1Ba.hashCode()", + test1Aa.hashCode() + == test1Ba.hashCode()); + success &= test( + "test1Aa.hashCode()" + + " == test1Bb.hashCode()", + test1Aa.hashCode() + == test1Bb.hashCode()); + success &= test( + "test1Aa.hashCode()" + + " == test1Bc.hashCode()", + test1Aa.hashCode() + == test1Bc.hashCode()); + success &= test( + "test2Aa.hashCode()" + + " == test2Ab.hashCode()", + test2Aa.hashCode() + == test2Ab.hashCode()); + success &= test( + "test2Aa.hashCode()" + + " == test2Ac.hashCode()", + test2Aa.hashCode() + == test2Ac.hashCode()); + success &= test( + "test2Aa.hashCode()" + + " == test2Ba.hashCode()", + test2Aa.hashCode() + == test2Ba.hashCode()); + success &= test( + "test2Aa.hashCode()" + + " == test2Bb.hashCode()", + test2Aa.hashCode() + == test2Bb.hashCode()); + success &= test( + "test2Aa.hashCode()" + + " == test2Bc.hashCode()", + test2Aa.hashCode() + == test2Bc.hashCode()); + + done.notifyDone(); + testBed.serverDone(success); + } catch (Exception e) { + e.printStackTrace(System.err); + } + }; + + private /*static*/ boolean test( + String message, boolean condition) + { + if (!condition) { + System.err.println("Failed: " + message); + } + return condition; + } + }.start(); + } + }; + } + + private final TestBed testBed; + private final String unoTypes; + private final String unoServices; + } + + public interface XDone extends XInterface { + void notifyDone(); + + TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("notifyDone", 0, 0) }; + } + + public interface XTestFrame extends XInterface { + void notifyAccepting(XDone done, Object object1, Object object2); + + TypeInfo[] UNOTYPEINFO = { + new MethodTypeInfo("notifyAccepting", 0, TypeInfo.ONEWAY) }; + } + + // Use "127.0.0.1" instead of "localhost", see #i32281#: + private static final String CONNECTION_DESCRIPTION + = "socket,host=127.0.0.1,port=12346"; + private static final String PROTOCOL_DESCRIPTION = "urp"; + + private static final String INSTANCE1 = "instance1"; + private static final String INSTANCE2 = "instance2"; +} diff --git a/bridges/test/java_uno/equals/makefile.mk b/bridges/test/java_uno/equals/makefile.mk new file mode 100644 index 000000000000..9ac266f80ff5 --- /dev/null +++ b/bridges/test/java_uno/equals/makefile.mk @@ -0,0 +1,96 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/.. +PRJNAME = bridges + +TARGET = test_javauno_equals +PACKAGE = test$/java_uno$/equals + +ENABLE_EXCEPTIONS = TRUE + +.INCLUDE: settings.mk + +# Make sure TestBed.class is found under $(CLASSDIR)$/test: +.IF "$(XCLASSPATH)" == "" +XCLASSPATH := $(CLASSDIR)$/test +.ELSE +XCLASSPATH !:= $(XCLASSPATH)$(PATH_SEPERATOR)$(CLASSDIR)$/test +.ENDIF + +DLLPRE = # no leading "lib" on .so files +INCPRE += $(MISC)$/$(TARGET)$/inc + +SLOFILES = $(SLO)$/testequals.obj + +SHL1TARGET = testequals.uno +SHL1OBJS = $(SLOFILES) +SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map +SHL1IMPLIB = itestequals + +JAVAFILES = TestEquals.java +JARFILES = juh.jar jurt.jar ridl.jar + +.INCLUDE: target.mk + +ALLTAR: $(BIN)$/testequals + +.IF "$(GUI)" == "WNT" +GIVE_EXEC_RIGHTS = @echo +.ELSE # GUI, WNT +GIVE_EXEC_RIGHTS = chmod +x +.ENDIF # GUI, WNT + +EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i) +EXEC_CLASSPATH = \ + $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) + +$(MISC)$/$(TARGET).rdb: types.idl + - rm $@ + - $(MKDIR) $(MISC)$/$(TARGET) + - $(MKDIR) $(MISC)$/$(TARGET)$/inc + $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $< + $(REGMERGE) $(MISC)$/$(TARGET).rdb /UCR $(MISC)$/$(TARGET)$/types.urd + $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb + $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb + +$(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET).rdb + +$(BIN)$/testequals: $(BIN)$/testequals_services.rdb + echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \ + ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\ +..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ + test.java_uno.equals.TestEquals $(SOLARBINDIR)$/types.rdb \ + testequals_services.rdb > $@ + $(GIVE_EXEC_RIGHTS) $@ + +$(BIN)$/testequals_services.rdb: + - rm $@ + $(REGCOMP) -register -r $@ -c bridgefac.uno + $(REGCOMP) -register -r $@ -c connector.uno + $(REGCOMP) -register -r $@ -c remotebridge.uno diff --git a/bridges/test/java_uno/equals/testequals.cxx b/bridges/test/java_uno/equals/testequals.cxx new file mode 100644 index 000000000000..81357e12899b --- /dev/null +++ b/bridges/test/java_uno/equals/testequals.cxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include "com/sun/star/bridge/XBridge.hpp" +#include "com/sun/star/bridge/XBridgeFactory.hpp" +#include "com/sun/star/connection/Connector.hpp" +#include "com/sun/star/connection/XConnection.hpp" +#include "com/sun/star/connection/XConnector.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XSingleComponentFactory.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/string.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "test/java_uno/equals/XBase.hpp" +#include "test/java_uno/equals/XDerived.hpp" +#include "test/java_uno/equals/XTestInterface.hpp" +#include "uno/environment.h" +#include "uno/lbnames.h" + +namespace css = com::sun::star; + +namespace { + +class Service: public cppu::WeakImplHelper2< + css::lang::XServiceInfo, test::java_uno::equals::XTestInterface > +{ +public: + virtual inline rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return rtl::OUString::createFromAscii(getImplementationName_static()); } + + virtual sal_Bool SAL_CALL supportsService( + rtl::OUString const & rServiceName) throw (css::uno::RuntimeException); + + virtual inline css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return getSupportedServiceNames_static(); } + + virtual void SAL_CALL connect(rtl::OUString const & rConnection, + rtl::OUString const & rProtocol) + throw (css::uno::Exception); + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL get( + rtl::OUString const & rName) throw (css::uno::RuntimeException); + + static inline sal_Char const * getImplementationName_static() + { return "com.sun.star.test.bridges.testequals.impl"; } + + static css::uno::Sequence< rtl::OUString > + getSupportedServiceNames_static(); + + static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( + css::uno::Reference< css::uno::XComponentContext > const & rContext) + throw (css::uno::Exception); + +private: + explicit inline Service( + css::uno::Reference< css::uno::XComponentContext > const & rContext): + m_xContext(rContext) {} + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::bridge::XBridge > m_xBridge; +}; + +} + +sal_Bool Service::supportsService(rtl::OUString const & rServiceName) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > aNames( + getSupportedServiceNames_static()); + for (sal_Int32 i = 0; i< aNames.getLength(); ++i) + if (aNames[i] == rServiceName) + return true; + return false; +} + +void Service::connect(rtl::OUString const & rConnection, + rtl::OUString const & rProtocol) + throw (css::uno::Exception) +{ + css::uno::Reference< css::connection::XConnection > xConnection( + css::connection::Connector::create(m_xContext)->connect(rConnection)); + css::uno::Reference< css::bridge::XBridgeFactory > xBridgeFactory( + m_xContext->getServiceManager()->createInstanceWithContext( + rtl::OUString::createFromAscii("com.sun.star.bridge.BridgeFactory"), + m_xContext), + css::uno::UNO_QUERY); + m_xBridge = xBridgeFactory->createBridge(rtl::OUString(), rProtocol, + xConnection, 0); +} + +css::uno::Reference< css::uno::XInterface > +Service::get(rtl::OUString const & rName) throw (css::uno::RuntimeException) +{ + return m_xBridge->getInstance(rName); +} + +css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames_static() +{ + css::uno::Sequence< rtl::OUString > aNames(1); + aNames[0] = rtl::OUString::createFromAscii( + "com.sun.star.test.bridges.testequals"); + return aNames; +} + +css::uno::Reference< css::uno::XInterface > Service::createInstance( + css::uno::Reference< css::uno::XComponentContext > const & rContext) + throw (css::uno::Exception) +{ + // Make types known: + getCppuType( + static_cast< + css::uno::Reference< test::java_uno::equals::XBase > const * >(0)); + getCppuType( + static_cast< + css::uno::Reference< test::java_uno::equals::XDerived > const * >(0)); + getCppuType( + static_cast< + css::uno::Reference< test::java_uno::equals::XTestInterface > const * >( + 0)); + + return static_cast< cppu::OWeakObject * >(new Service(rContext)); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + sal_Char const ** pEnvTypeName, uno_Environment **) +{ + *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName, + void * pServiceManager, void *) +{ + void * pFactory = 0; + if (pServiceManager) + if (rtl_str_compare(pImplName, Service::getImplementationName_static()) + == 0) + { + css::uno::Reference< css::lang::XSingleComponentFactory > + xFactory(cppu::createSingleComponentFactory( + &Service::createInstance, + rtl::OUString::createFromAscii( + Service::getImplementationName_static()), + Service::getSupportedServiceNames_static())); + if (xFactory.is()) + { + xFactory->acquire(); + pFactory = xFactory.get(); + } + } + return pFactory; +} + +namespace { + +bool writeInfo(void * pRegistryKey, sal_Char const * pImplementationName, + css::uno::Sequence< rtl::OUString > const & rServiceNames) +{ + rtl::OUString aKeyName(rtl::OUString::createFromAscii("/")); + aKeyName += rtl::OUString::createFromAscii(pImplementationName); + aKeyName += rtl::OUString::createFromAscii("/UNO/SERVICES"); + css::uno::Reference< css::registry::XRegistryKey > xKey; + try + { + xKey = static_cast< css::registry::XRegistryKey * >(pRegistryKey)-> + createKey(aKeyName); + } + catch (css::registry::InvalidRegistryException &) {} + if (!xKey.is()) + return false; + bool bSuccess = true; + for (sal_Int32 i = 0; i < rServiceNames.getLength(); ++i) + try + { + xKey->createKey(rServiceNames[i]); + } + catch (css::registry::InvalidRegistryException &) + { + bSuccess = false; + break; + } + return bSuccess; +} + +} + +extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey) +{ + return pRegistryKey + && writeInfo(pRegistryKey, Service::getImplementationName_static(), + Service::getSupportedServiceNames_static()); +} diff --git a/bridges/test/java_uno/equals/types.idl b/bridges/test/java_uno/equals/types.idl new file mode 100644 index 000000000000..c8ddc2f072fe --- /dev/null +++ b/bridges/test/java_uno/equals/types.idl @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "com/sun/star/uno/Exception.idl" +#include "com/sun/star/uno/XInterface.idl" + +// UNO interfaces used between Java and native (C++) environments. + +module test { module java_uno { module equals { + +interface XBase: com::sun::star::uno::XInterface {}; + +interface XDerived: XBase {}; + +interface XTestInterface: com::sun::star::uno::XInterface +{ + void connect([in] string connection, [in] string protocol) + raises (com::sun::star::uno::Exception); + + com::sun::star::uno::XInterface get([in] string name); +}; + +}; }; }; diff --git a/bridges/test/java_uno/nativethreadpool/Relay.java b/bridges/test/java_uno/nativethreadpool/Relay.java new file mode 100644 index 000000000000..50e198a2d819 --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/Relay.java @@ -0,0 +1,125 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package test.javauno.nativethreadpool; + +import com.sun.star.bridge.BridgeExistsException; +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.bridge.XInstanceProvider; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.comp.loader.FactoryHelper; +import com.sun.star.connection.AlreadyAcceptingException; +import com.sun.star.connection.ConnectionSetupException; +import com.sun.star.connection.Acceptor; +import com.sun.star.connection.XAcceptor; +import com.sun.star.connection.XConnection; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +public final class Relay implements XRelay, XSource { + public void start(XSource source) { + this.source = source; + XComponentContext context; + try { + context = Bootstrap.createInitialComponentContext(null); + } catch (RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException(e.toString(), this, e); + } catch (Exception e) { + throw new com.sun.star.uno.RuntimeException(e.toString(), this); + } + final XAcceptor acceptor = Acceptor.create(context); + final XBridgeFactory factory; + try { + factory = UnoRuntime.queryInterface( + XBridgeFactory.class, + context.getServiceManager().createInstanceWithContext( + "com.sun.star.bridge.BridgeFactory", context)); + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException(e.toString(), this, e); + } + new Thread() { + public void run() { + try { + // Use "127.0.0.1" instead of "localhost", see #i32281#: + factory.createBridge( + "", "urp", + acceptor.accept("socket,host=127.0.0.1,port=3831"), + new XInstanceProvider() { + public Object getInstance(String instanceName) { + return Relay.this; + } + }); + } catch (AlreadyAcceptingException e) { + e.printStackTrace(System.err); + } catch (ConnectionSetupException e) { + e.printStackTrace(System.err); + } catch (BridgeExistsException e) { + e.printStackTrace(System.err); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(System.err); + } + } + }.start(); + try { + Thread.sleep(3000); // wait for new thread to accept connection + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new com.sun.star.uno.RuntimeException(e.toString(), this); + } + } + + public int get() { + return source.get(); + } + + public static XSingleServiceFactory __getServiceFactory( + String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) + { + return implName.equals(implementationName) + ? FactoryHelper.getServiceFactory( + Relay.class, serviceName, multiFactory, regKey) + : null; + } + + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo( + implementationName, serviceName, regKey); + } + + private static final String implementationName + = "test.javauno.nativethreadpool.comp.Relay"; + private static final String serviceName + = "test.javauno.nativethreadpool.Relay"; + + private XSource source; +} diff --git a/bridges/test/java_uno/nativethreadpool/makefile.mk b/bridges/test/java_uno/nativethreadpool/makefile.mk new file mode 100644 index 000000000000..d4926e07307b --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/makefile.mk @@ -0,0 +1,121 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ := ..$/..$/.. +PRJNAME := bridges + +TARGET := test_javauno_nativethreadpool +PACKAGE := test$/javauno$/nativethreadpool + +ENABLE_EXCEPTIONS := TRUE + +#TODO: +.IF "$(OS)" == "LINUX" +JVM_LIB_URL := file:///net/grande.germany/develop6/update/dev/Linux_JDK_1.4.1_03/jre/lib/i386/client/libjvm.so +.ELSE +ERROR -- missing platform +.ENDIF + +.INCLUDE: settings.mk + +DLLPRE = # no leading "lib" on .so files +INCPRE += $(MISC)$/$(TARGET)$/inc + +SHL1TARGET = $(TARGET)_client.uno +SHL1OBJS = $(SLO)$/testnativethreadpoolclient.obj +SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) +SHL1VERSIONMAP = version.map +SHL1IMPLIB = i$(TARGET)_client + +SHL2TARGET = $(TARGET)_server.uno +SHL2OBJS = $(SLO)$/testnativethreadpoolserver.obj +SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) +SHL2VERSIONMAP = version.map +SHL2IMPLIB = i$(TARGET)_server + +SLOFILES = $(SHL1OBJS) $(SHL2OBJS) + +JAVAFILES = Relay.java +JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar + +.INCLUDE: target.mk + +ALLTAR: test + +EXEC_CLASSPATH_TMP = $(foreach,i,$(JARFILES) $(SOLARBINDIR)$/$i) +EXEC_CLASSPATH = \ + $(strip $(subst,!,$(PATH_SEPERATOR) $(EXEC_CLASSPATH_TMP:s/ /!/))) + +$(MISC)$/$(TARGET)$/types.rdb: types.idl + - rm $@ + - $(MKDIR) $(MISC)$/$(TARGET) + - $(MKDIR) $(MISC)$/$(TARGET)$/inc + $(IDLC) -I$(SOLARIDLDIR) -O$(MISC)$/$(TARGET) $< + $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/types.urd + $(CPPUMAKER) -BUCR -C -O$(MISC)$/$(TARGET)$/inc $@ -X$(SOLARBINDIR)$/types.rdb + $(JAVAMAKER) -BUCR -nD -O$(CLASSDIR) $@ -X$(SOLARBINDIR)$/types.rdb + +$(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET)$/types.rdb + +$(BIN)$/$(TARGET).uno.jar: $(JAVACLASSFILES) relay.manifest + jar cfm $@ relay.manifest -C $(CLASSDIR) test/javauno/nativethreadpool + +$(BIN)$/$(TARGET).rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.rdb \ + $(BIN)$/$(TARGET).uno.jar + cp $(MISC)$/$(TARGET)$/types.rdb $@ + $(REGMERGE) $@ / $(SOLARBINDIR)$/types.rdb + $(REGCOMP) -register -r $@ -c acceptor.uno$(DLLPOST) \ + -c bridgefac.uno$(DLLPOST) -c connector.uno$(DLLPOST) \ + -c remotebridge.uno$(DLLPOST) -c uuresolver.uno$(DLLPOST) \ + -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \ + -c stocservices.uno$(DLLPOST) + cp $(SOLARBINDIR)$/types.rdb $(MISC)$/$(TARGET)$/bootstrap.rdb + $(REGCOMP) -register -r $(MISC)$/$(TARGET)$/bootstrap.rdb \ + -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \ + -c stocservices.uno$(DLLPOST) +.IF "$(GUI)" == "WNT" + ERROR -- missing platform +.ELSE # GUI, WNT + + export OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' && \ + $(REGCOMP) -register -r $@ -c file://$(PWD)/$(BIN)$/$(TARGET).uno.jar \ + -br $(MISC)$/$(TARGET)$/bootstrap.rdb -classpath $(EXEC_CLASSPATH) \ + -env:URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR) +.ENDIF # GUI, WNT + +test .PHONY: $(SHL1TARGETN) $(BIN)$/$(TARGET).uno.jar $(BIN)$/$(TARGET).rdb +.IF "$(GUI)" == "WNT" + ERROR -- missing platform +.ELSE # GUI, WNT + $(AUGMENT_LIBRARY_PATH) uno -c test.javauno.nativethreadpool.server \ + -l $(SHL2TARGETN) -ro $(BIN)$/$(TARGET).rdb \ + -u 'uno:socket,host=localhost,port=3830;urp;test' --singleaccept & + + $(AUGMENT_LIBRARY_PATH) OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' \ + CLASSPATH=$(EXEC_CLASSPATH)$(PATH_SEPERATOR)$(BIN)$/$(TARGET).uno.jar \ + uno -c test.javauno.nativethreadpool.client -l $(SHL1TARGETN) \ + -ro $(BIN)$/$(TARGET).rdb \ + -env:URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR) +.ENDIF # GUI, WNT diff --git a/bridges/test/java_uno/nativethreadpool/readme b/bridges/test/java_uno/nativethreadpool/readme new file mode 100644 index 000000000000..c137ed162372 --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/readme @@ -0,0 +1,39 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +Test that a Java URP bridge started in a native process uses the same thread +pool as a C++ URP bridge. This test currently only works on Linux Intel. + +There are two processes involved. The client starts as a native process. It +first loads a Java component (Relay) via the in-process JNI bridge, which in +turn starts to accept incomming URP connections. The native part of the client +then connects to the server, retrieves a thread-local token from it, and checks +the token for correctness. The server simply waits for a connection from the +native part of the client, creates a connection to the Java part of the client, +and routes all requests from the native part of the client to the Java part of +the client. The Java part of the client in turn uses the in-process JNI bridge +to obtain the thread-local token. diff --git a/bridges/test/java_uno/nativethreadpool/relay.manifest b/bridges/test/java_uno/nativethreadpool/relay.manifest new file mode 100644 index 000000000000..6cd1d9dbd611 --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/relay.manifest @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +RegistrationClassName: test.javauno.nativethreadpool.Relay diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx new file mode 100644 index 000000000000..1964a73d1878 --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx @@ -0,0 +1,184 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include "test/javauno/nativethreadpool/XRelay.hpp" +#include "test/javauno/nativethreadpool/XSource.hpp" + +#include "com/sun/star/bridge/UnoUrlResolver.hpp" +#include "com/sun/star/bridge/XUnoUrlResolver.hpp" +#include "com/sun/star/connection/ConnectionSetupException.hpp" +#include "com/sun/star/connection/NoConnectException.hpp" +#include "com/sun/star/lang/IllegalArgumentException.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XMain.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/thread.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +#include <iostream> + +namespace css = com::sun::star; + +namespace { + +class Client: public cppu::WeakImplHelper2< + css::lang::XMain, test::javauno::nativethreadpool::XSource > +{ +public: + explicit Client( + css::uno::Reference< css::uno::XComponentContext > const & theContext): + context(theContext) {} + +private: + virtual ~Client() {} + + virtual sal_Int32 SAL_CALL run(css::uno::Sequence< rtl::OUString > const &) + throw (css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL get() throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context; + osl::ThreadData data; +}; + +sal_Int32 Client::run(css::uno::Sequence< rtl::OUString > const &) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::lang::XMultiComponentFactory > factory( + context->getServiceManager()); + if (!factory.is()) { + throw new css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "no component context service manager"), + static_cast< cppu::OWeakObject * >(this)); + } + css::uno::Reference< test::javauno::nativethreadpool::XRelay > relay; + try { + relay = css::uno::Reference< test::javauno::nativethreadpool::XRelay >( + factory->createInstanceWithContext( + rtl::OUString::createFromAscii( + "test.javauno.nativethreadpool.Relay"), + context), + css::uno::UNO_QUERY_THROW); + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::uno::Exception & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "creating test.javauno.nativethreadpool.Relay service"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } + relay->start(this); + if (!data.setData(reinterpret_cast< void * >(12345))) { + throw new css::uno::RuntimeException( + rtl::OUString::createFromAscii("osl::ThreadData::setData failed"), + static_cast< cppu::OWeakObject * >(this)); + } + css::uno::Reference< test::javauno::nativethreadpool::XSource > source; + try { + source + = css::uno::Reference< test::javauno::nativethreadpool::XSource >( + css::bridge::UnoUrlResolver::create(context)->resolve( + rtl::OUString::createFromAscii( + "uno:socket,host=localhost,port=3830;urp;test")), + css::uno::UNO_QUERY_THROW); + } catch (css::connection::NoConnectException & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "com.sun.star.uno.UnoUrlResolver.resolve"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } catch (css::connection::ConnectionSetupException & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "com.sun.star.uno.UnoUrlResolver.resolve"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } catch (css::lang::IllegalArgumentException & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "com.sun.star.uno.UnoUrlResolver.resolve"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } + bool success = source->get() == 12345; + std::cout << "success? " << (success ? "yes" : "no") << '\n'; + return success ? 0 : 1; +} + +sal_Int32 Client::get() throw (css::uno::RuntimeException) { + return reinterpret_cast< sal_Int32 >(data.getData()); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL create( + css::uno::Reference< css::uno::XComponentContext > const & context) + SAL_THROW((css::uno::Exception)) +{ + return static_cast< cppu::OWeakObject * >(new Client(context)); +} + +rtl::OUString SAL_CALL getImplementationName() { + return rtl::OUString::createFromAscii( + "test.javauno.nativethreadpool.client"); +} + +css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { + return css::uno::Sequence< rtl::OUString >(); +} + +cppu::ImplementationEntry entries[] = { + { &create, &getImplementationName, &getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * implName, void * serviceManager, void * registryKey) +{ + return cppu::component_getFactoryHelper( + implName, serviceManager, registryKey, entries); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** envTypeName, uno_Environment **) +{ + *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx new file mode 100644 index 000000000000..0e3b30effb7e --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include "test/javauno/nativethreadpool/XSource.hpp" + +#include "com/sun/star/bridge/UnoUrlResolver.hpp" +#include "com/sun/star/bridge/XUnoUrlResolver.hpp" +#include "com/sun/star/connection/ConnectionSetupException.hpp" +#include "com/sun/star/connection/NoConnectException.hpp" +#include "com/sun/star/lang/IllegalArgumentException.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +namespace css = com::sun::star; + +namespace { + +class Server: + public cppu::WeakImplHelper1< test::javauno::nativethreadpool::XSource > +{ +public: + explicit Server( + css::uno::Reference< css::uno::XComponentContext > const & theContext): + context(theContext) {} + +private: + virtual ~Server() {} + + virtual sal_Int32 SAL_CALL get() throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context; +}; + +sal_Int32 Server::get() throw (css::uno::RuntimeException) { + css::uno::Reference< css::lang::XMultiComponentFactory > factory( + context->getServiceManager()); + if (!factory.is()) { + throw new css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "no component context service manager"), + static_cast< cppu::OWeakObject * >(this)); + } + css::uno::Reference< test::javauno::nativethreadpool::XSource > source; + try { + // Use "127.0.0.1" instead of "localhost", see #i32281#: + source + = css::uno::Reference< test::javauno::nativethreadpool::XSource >( + css::bridge::UnoUrlResolver::create(context)->resolve( + rtl::OUString::createFromAscii( + "uno:socket,host=127.0.0.1,port=3831;urp;test")), + css::uno::UNO_QUERY_THROW); + } catch (css::connection::NoConnectException & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "com.sun.star.uno.UnoUrlResolver.resolve"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } catch (css::connection::ConnectionSetupException & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "com.sun.star.uno.UnoUrlResolver.resolve"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } catch (css::lang::IllegalArgumentException & e) { + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString::createFromAscii( + "com.sun.star.uno.UnoUrlResolver.resolve"), + static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); + } + return source->get(); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL create( + css::uno::Reference< css::uno::XComponentContext > const & context) + SAL_THROW((css::uno::Exception)) +{ + return static_cast< cppu::OWeakObject * >(new Server(context)); +} + +rtl::OUString SAL_CALL getImplementationName() { + return rtl::OUString::createFromAscii( + "test.javauno.nativethreadpool.server"); +} + +css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { + return css::uno::Sequence< rtl::OUString >(); +} + +cppu::ImplementationEntry entries[] = { + { &create, &getImplementationName, &getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * implName, void * serviceManager, void * registryKey) +{ + return cppu::component_getFactoryHelper( + implName, serviceManager, registryKey, entries); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** envTypeName, uno_Environment **) +{ + *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} diff --git a/bridges/test/java_uno/nativethreadpool/types.idl b/bridges/test/java_uno/nativethreadpool/types.idl new file mode 100644 index 000000000000..36ca44af37e0 --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/types.idl @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "com/sun/star/uno/XInterface.idl" + +module test { module javauno { module nativethreadpool { + +interface XSource: com::sun::star::uno::XInterface { + long get(); +}; + +interface XRelay: com::sun::star::uno::XInterface { + void start([in] XSource source); +}; + +}; }; }; diff --git a/bridges/test/java_uno/nativethreadpool/version.map b/bridges/test/java_uno/nativethreadpool/version.map new file mode 100644 index 000000000000..b560ad15b99f --- /dev/null +++ b/bridges/test/java_uno/nativethreadpool/version.map @@ -0,0 +1,35 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +UDK_3_0_0 { + global: + component_getFactory; + component_getImplementationEnvironment; + + local: + *; +}; |