diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-03-11 11:35:29 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-03-11 11:35:29 +0000 |
commit | 8c59580b88a33d7f0c892c9c53776716ad661fcf (patch) | |
tree | da43a9c8f3ba7cba7afca05894acc8712f6e36ce /testtools | |
parent | e62f74cabe9558e003d3105df7a69e3841dfc9ce (diff) | |
parent | 36979f1c9e43c42e62b0ad5a32b7abb2fc425b5b (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
Conflicts:
smoketestoo_native/data/Global.xml
smoketestoo_native/data/OptionsDlg.xml
smoketestoo_native/data/Test_10er.xml
smoketestoo_native/data/content.xml
smoketestoo_native/smoketest.cxx
test/source/cpp/getargument.cxx
test/source/cpp/officeconnection.cxx
testautomation/framework/optional/includes/basic_vba-compat_security_check.inc
testautomation/framework/optional/includes/filedlg_cjk_folders.inc
testautomation/global/sid/all.sid
testautomation/global/sid/bars.sid
testautomation/global/sid/e_all.sid
testautomation/global/win/bars.win
testautomation/graphics/optional/includes/impress/i_slideshow2.inc
testautomation/graphics/optional/includes/impress/i_slideshow3.inc
testtools/source/bridgetest/bridgetest.cxx
testtools/source/bridgetest/constructors.cxx
testtools/source/bridgetest/makefile.mk
testtools/source/bridgetest/testComponent.component
Diffstat (limited to 'testtools')
-rw-r--r-- | testtools/com/sun/star/comp/bridge/TestComponent.java | 19 | ||||
-rw-r--r-- | testtools/prj/build.lst | 4 | ||||
-rw-r--r-- | testtools/source/bridgetest/bridgetest.component | 34 | ||||
-rw-r--r-- | testtools/source/bridgetest/bridgetest.cxx | 1074 | ||||
-rw-r--r-- | testtools/source/bridgetest/constructors.component | 37 | ||||
-rw-r--r-- | testtools/source/bridgetest/constructors.cxx | 7 | ||||
-rw-r--r-- | testtools/source/bridgetest/cppobj.component | 34 | ||||
-rw-r--r-- | testtools/source/bridgetest/cppobj.cxx | 24 | ||||
-rw-r--r-- | testtools/source/bridgetest/currentcontextchecker.cxx | 12 | ||||
-rw-r--r-- | testtools/source/bridgetest/makefile.mk | 91 | ||||
-rw-r--r-- | testtools/source/bridgetest/pyuno/makefile.mk | 25 | ||||
-rw-r--r-- | testtools/source/bridgetest/testComponent.component | 38 |
12 files changed, 725 insertions, 674 deletions
diff --git a/testtools/com/sun/star/comp/bridge/TestComponent.java b/testtools/com/sun/star/comp/bridge/TestComponent.java index 6953a4da90da..c63ff7fe2293 100644 --- a/testtools/com/sun/star/comp/bridge/TestComponent.java +++ b/testtools/com/sun/star/comp/bridge/TestComponent.java @@ -1325,23 +1325,4 @@ public class TestComponent { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - boolean result = true; - - result = result & FactoryHelper.writeRegistryServiceInfo(_TestObject.class.getName(), _TestObject.__serviceName, regKey); - result = result & FactoryHelper.writeRegistryServiceInfo(_PerformancTestObject.class.getName(), - _PerformancTestObject.__serviceName, regKey); - - return result; - } - } diff --git a/testtools/prj/build.lst b/testtools/prj/build.lst index 24dce4119821..a76ac598f95c 100644 --- a/testtools/prj/build.lst +++ b/testtools/prj/build.lst @@ -1,6 +1,6 @@ -tt testtools : cpputools io remotebridges stoc javaunohelper pyuno cli_ure offapi NULL +tt testtools : cpputools io remotebridges stoc javaunohelper pyuno cli_ure offapi ure LIBXSLT:libxslt NULL tt testtools\inc nmake - all tt_inc NULL -tt testtools\source\bridgetest nmake - all tt_bridgetest tt_bridgetest_idl tt_javaTestObjs tt_inc NULL +tt testtools\source\bridgetest nmake - all tt_bridgetest tt_bridgetest_idl tt_inc NULL tt testtools\source\bridgetest\cli nmake - w,vc7 tt_cli tt_bridgetest tt_bridgetest_idl tt_inc NULL tt testtools\source\bridgetest\idl nmake - all tt_bridgetest_idl tt_inc NULL tt testtools\com\sun\star\comp\bridge nmake - all tt_javaTestObjs tt_bridgetest_idl tt_inc NULL diff --git a/testtools/source/bridgetest/bridgetest.component b/testtools/source/bridgetest/bridgetest.component new file mode 100644 index 000000000000..e2dec0b74c77 --- /dev/null +++ b/testtools/source/bridgetest/bridgetest.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.bridge.BridgeTest"> + <service name="com.sun.star.test.bridge.BridgeTest"/> + </implementation> +</component> diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 3931459fde9b..18b4ac387974 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -48,7 +48,6 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMain.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/bridge/UnoUrlResolver.hpp> #include <com/sun/star/bridge/XUnoUrlResolver.hpp> #include "com/sun/star/uno/RuntimeException.hpp" @@ -351,37 +350,6 @@ static sal_Bool performRecursiveCallTest( const Reference < XBridgeTest > & xLBT return sal_True; } -static sal_Bool performQueryForUnknownType( const Reference< XBridgeTest > & xLBT ) -{ - sal_Bool bRet = sal_True; - // use this when you want to test querying for unknown types - // currently (not supported by the java remote bridge ) - { - // test queryInterface for an unknown type - typelib_TypeDescriptionReference *pTypeRef = 0; - OUString aName( RTL_CONSTASCII_USTRINGPARAM( "foo.MyInterface" ) ); - typelib_typedescriptionreference_new( - &pTypeRef, typelib_TypeClass_INTERFACE, aName.pData); - try - { - Any a = xLBT->queryInterface( Type( pTypeRef ) ); - bRet = check( a == Any( ), "got an foo.MyInterface, but didn't expect to get one" ); - } - catch( com::sun::star::uno::RuntimeException & ) - { - fprintf( - stderr, - "tried to query for an interface reference of an unknown type " - "but got a runtime exception. This should work for native bridges " - "but isn't implemented for Java remote bridge\n" - "Note: All subsequent tests may fail now as the remote bridge is broken\n" - "QueryForUnknownType" ); - } - typelib_typedescriptionreference_release( pTypeRef ); - } - return bRet; -} - class MyClass : public osl::DebugBase<MyClass>, public OWeakObject { public: @@ -416,139 +384,65 @@ static sal_Bool performTest( const Reference<XBridgeTest > & xLBT, bool noCurrentContext ) { - check( xLBT.is(), "### no test interface!" ); + check(xLBT.is(), "### no test interface!"); bool bRet = true; - if (xLBT.is()) - { - // this data is never ever granted access to by calls other than equals(), assign()! + if (xLBT.is()) { + // this data is never ever granted access to by calls other than + // equals(), assign()! TestData aData; // test against this data - - Reference<XInterface > xI( new MyClass ); - - assign( (TestElement &)aData, - sal_True, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - SAL_CONST_INT64(0x123456789abcdef0), - SAL_CONST_UINT64(0xfedcba9876543210), - (float)17.0815, 3.1415926359, TestEnum_LOLA, - OUSTR(STRING_TEST_CONSTANT), xI, - Any( &xI, ::getCppuType( (const Reference<XInterface > *)0 ) ) ); - - bRet = check( aData.Any == xI, "### unexpected any!" ) && bRet; - bRet = check( !(aData.Any != xI), "### unexpected any!" ) && bRet; - - aData.Sequence.realloc( 2 ); - aData.Sequence[ 0 ] = *(const TestElement *)&aData; - // aData.Sequence[ 1 ] is empty - - // aData complete - //================================================================================ - - // this is a manually copy of aData for first setting... + Reference< XInterface > xI(new MyClass); + assign( + (TestElement &) aData, true, '@', 17, 0x1234, 0xFEDC, 0x12345678, + 0xFEDCBA98, SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + TestEnum_LOLA, OUSTR(STRING_TEST_CONSTANT), xI, + Any(&xI, getCppuType((Reference< XInterface > const *) 0))); + bRet &= check(aData.Any == xI, "### unexpected any!"); + bRet &= check(!(aData.Any != xI), "### unexpected any!"); + aData.Sequence.realloc(2); + aData.Sequence[0] = *(TestElement const *) &aData; + // aData.Sequence[1] is empty + // aSetData is a manually copy of aData for first setting: TestData aSetData; - - assign( (TestElement &)aSetData, - aData.Bool, aData.Char, aData.Byte, aData.Short, aData.UShort, - aData.Long, aData.ULong, aData.Hyper, aData.UHyper, aData.Float, aData.Double, - aData.Enum, aData.String, xI, - Any( &xI, ::getCppuType( (const Reference<XInterface > *)0 ) ) ); - - aSetData.Sequence.realloc( 2 ); - aSetData.Sequence[ 0 ] = *(const TestElement *)&aSetData; - // aSetData.Sequence[ 1 ] is empty - + assign( + (TestElement &) aSetData, aData.Bool, aData.Char, aData.Byte, + aData.Short, aData.UShort, aData.Long, aData.ULong, aData.Hyper, + aData.UHyper, aData.Float, aData.Double, aData.Enum, aData.String, + xI, Any(&xI, getCppuType((Reference< XInterface > const *) 0))); + aSetData.Sequence.realloc(2); + aSetData.Sequence[0] = *(TestElement const *) &aSetData; + // aSetData.Sequence[1] is empty xLBT->setValues( - aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, aSetData.UShort, - aSetData.Long, aSetData.ULong, aSetData.Hyper, aSetData.UHyper, aSetData.Float, aSetData.Double, - aSetData.Enum, aSetData.String, aSetData.Interface, aSetData.Any, aSetData.Sequence, aSetData ); - - { - TestData aRet, aRet2; - xLBT->getValues( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); - - bRet = check( equals( aData, aRet ) && equals( aData, aRet2 ) , "getValues test") && bRet; - - // set last retrieved values - TestData aSV2ret = xLBT->setValues2( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); - // check inout sequence order - // => inout sequence parameter was switched by test objects - TestElement temp = aRet.Sequence[ 0 ]; - aRet.Sequence[ 0 ] = aRet.Sequence[ 1 ]; - aRet.Sequence[ 1 ] = temp; - - bRet = check( - equals( aData, aSV2ret ) && equals( aData, aRet2 ), - "getValues2 test") && bRet; - } + aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, + aSetData.UShort, aSetData.Long, aSetData.ULong, aSetData.Hyper, + aSetData.UHyper, aSetData.Float, aSetData.Double, aSetData.Enum, + aSetData.String, aSetData.Interface, aSetData.Any, + aSetData.Sequence, aSetData); { - TestData aRet, aRet2; - TestData aGVret = xLBT->getValues( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); - - bRet = check( equals( aData, aRet ) && equals( aData, aRet2 ) && equals( aData, aGVret ), "getValues test" ) && bRet; - - // set last retrieved values - xLBT->setBool( aRet.Bool ); - xLBT->setChar( aRet.Char ); - xLBT->setByte( aRet.Byte ); - xLBT->setShort( aRet.Short ); - xLBT->setUShort( aRet.UShort ); - xLBT->setLong( aRet.Long ); - xLBT->setULong( aRet.ULong ); - xLBT->setHyper( aRet.Hyper ); - xLBT->setUHyper( aRet.UHyper ); - xLBT->setFloat( aRet.Float ); - xLBT->setDouble( aRet.Double ); - xLBT->setEnum( aRet.Enum ); - xLBT->setString( aRet.String ); - xLBT->setInterface( aRet.Interface ); - xLBT->setAny( aRet.Any ); - xLBT->setSequence( aRet.Sequence ); - xLBT->setStruct( aRet2 ); - } - { - TestData aRet, aRet2; - aRet.Hyper = xLBT->getHyper(); - aRet.UHyper = xLBT->getUHyper(); - aRet.Float = xLBT->getFloat(); - aRet.Double = xLBT->getDouble(); - aRet.Byte = xLBT->getByte(); - aRet.Char = xLBT->getChar(); - aRet.Bool = xLBT->getBool(); - aRet.Short = xLBT->getShort(); - aRet.UShort = xLBT->getUShort(); - aRet.Long = xLBT->getLong(); - aRet.ULong = xLBT->getULong(); - aRet.Enum = xLBT->getEnum(); - aRet.String = xLBT->getString(); - aRet.Interface = xLBT->getInterface(); - aRet.Any = xLBT->getAny(); - aRet.Sequence = xLBT->getSequence(); - aRet2 = xLBT->getStruct(); - - bRet = check( equals( aData, aRet ) && equals( aData, aRet2 ) , "struct comparison test") && bRet; - - { - SmallStruct aIn(1, 2); - SmallStruct aOut = xLBT->echoSmallStruct(aIn); - bRet = check( memcmp(&aIn, &aOut, sizeof(SmallStruct)) == 0, "small struct test" ) && bRet; - } - { - MediumStruct aIn(1, 2, 3, 4); - MediumStruct aOut = xLBT->echoMediumStruct(aIn); - bRet = check( memcmp(&aIn, &aOut, sizeof(MediumStruct)) == 0, "medium struct test" ) && bRet; - } - { - BigStruct aIn(1, 2, 3, 4, 5, 6, 7, 8); - BigStruct aOut = xLBT->echoBigStruct(aIn); - bRet = check( memcmp(&aIn, &aOut, sizeof(BigStruct)) == 0, "big struct test" ) && bRet; + TestData aRet; + TestData aRet2; + xLBT->getValues( + aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, + aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, + aRet.Double, aRet.Enum, aRet.String, aRet.Interface, aRet.Any, + aRet.Sequence, aRet2); + bRet &= check( + equals(aData, aRet) && equals(aData, aRet2), "getValues test"); + // Set last retrieved values: + TestData aSV2ret( + xLBT->setValues2( + aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, + aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, + aRet.Double, aRet.Enum, aRet.String, aRet.Interface, + aRet.Any, aRet.Sequence, aRet2)); + // Check inout sequence order (=> inout sequence parameter was + // switched by test objects): + TestElement temp(aRet.Sequence[0]); + aRet.Sequence[0] = aRet.Sequence[1]; + aRet.Sequence[1] = temp; + bRet &= check( + equals(aData, aSV2ret) && equals(aData, aRet2), + "getValues2 test"); } { TwoFloats aIn(1.1f, 2.2f); @@ -571,409 +465,477 @@ static sal_Bool performTest( bRet = check( memcmp(&aIn, &aOut, sizeof(ThreeByteStruct)) == 0, "three byte struct test" ) && bRet; } { - sal_Int32 i2 = xLBT->testPPCAlignment( 0, 0, 0, 0, 0xbeaf ); - bRet = check( i2 == 0xbeaf, "ppc-style alignment test" ) && bRet; - } - - // Test extended attributes that raise exceptions: - try { - xLBT->getRaiseAttr1(); - bRet &= check(false, "getRaiseAttr1 did not throw"); - } catch (RuntimeException &) { - } catch (...) { - bRet &= check(false, "getRaiseAttr1 threw wrong type"); - } - try { - xLBT->setRaiseAttr1(0); - bRet &= check(false, "setRaiseAttr1 did not throw"); - } catch (IllegalArgumentException &) { - } catch (...) { - bRet &= check(false, "setRaiseAttr1 threw wrong type"); - } - try { - xLBT->getRaiseAttr2(); - bRet &= check(false, "getRaiseAttr2 did not throw"); - } catch (IllegalArgumentException &) { - } catch (...) { - bRet &= check(false, "getRaiseAttr2 threw wrong type"); + TestData aRet; + TestData aRet2; + TestData aGVret( + xLBT->getValues( + aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, + aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, + aRet.Double, aRet.Enum, aRet.String, aRet.Interface, + aRet.Any, aRet.Sequence, aRet2)); + bRet &= check( + (equals(aData, aRet) && equals(aData, aRet2) && + equals(aData, aGVret)), + "getValues test"); + // Set last retrieved values: + xLBT->setBool(aRet.Bool); + xLBT->setChar(aRet.Char); + xLBT->setByte(aRet.Byte); + xLBT->setShort(aRet.Short); + xLBT->setUShort(aRet.UShort); + xLBT->setLong(aRet.Long); + xLBT->setULong(aRet.ULong); + xLBT->setHyper(aRet.Hyper); + xLBT->setUHyper(aRet.UHyper); + xLBT->setFloat(aRet.Float); + xLBT->setDouble(aRet.Double); + xLBT->setEnum(aRet.Enum); + xLBT->setString(aRet.String); + xLBT->setInterface(aRet.Interface); + xLBT->setAny(aRet.Any); + xLBT->setSequence(aRet.Sequence); + xLBT->setStruct(aRet2); } - - // Test instantiated polymorphic struct types: { - bRet &= check( - xLBT->transportPolyBoolean(TestPolyStruct< sal_Bool >(true)).member, - "transportPolyBoolean"); - TestPolyStruct< sal_Int64 > tps1(12345); - xLBT->transportPolyHyper(tps1); - bRet &= check(tps1.member == 12345, "transportPolyHyper"); - Sequence< Any > seq(2); - seq[0] <<= static_cast< sal_uInt32 >(33); - seq[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ABC")); - TestPolyStruct< Sequence< Any > > tps2(seq); - TestPolyStruct< Sequence< Any > > tps3; - xLBT->transportPolySequence(tps2, tps3); - bRet &= check( - tps3.member.getLength() == 2, "transportPolySequence, length"); - sal_uInt32 v0 = sal_uInt32(); - tps3.member[0] >>= v0; - bRet &= check(v0 == 33, "transportPolySequence, element 0"); - rtl::OUString v1; - tps3.member[1] >>= v1; - bRet &= check( - v1.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ABC")), - "transportPolySequence, element 1"); - bRet &= check(xLBT->getNullPolyLong().member == 0, "getNullPolyLong"); - bRet &= check( - xLBT->getNullPolyString().member.getLength() == 0, - "getNullPolyString"); - bRet &= check( - xLBT->getNullPolyType().member == Type(), "getNullPolyType"); - Any nullAny(xLBT->getNullPolyAny().member); - bRet &= check( - (((nullAny.getValueTypeName() - == rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface"))) - && !static_cast< Reference< XInterface > const * >( - nullAny.getValue())->is()) - || nullAny == Any()), - "getNullPolyAny"); - bRet &= check( - xLBT->getNullPolySequence().member.getLength() == 0, - "getNullPolySequence"); - bRet &= check( - xLBT->getNullPolyEnum().member == TestEnum_TEST, "getNullPolyEnum"); - bRet &= check( - xLBT->getNullPolyBadEnum().member == TestBadEnum_M, - "getNullPolyBadEnum"); - bRet &= check( - xLBT->getNullPolyStruct().member.member == 0, "getNullPolyStruct"); - bRet &= check( - !xLBT->getNullPolyInterface().member.is(), "getNullPolyInterface"); - } - - // any test - bRet = check( performAnyTest( xLBT , aData ) , "any test" ) && bRet; - - // sequence of call test - bRet = check( performSequenceOfCallTest( xLBT ) , "sequence of call test" ) && bRet; - - // recursive call test - bRet = check( performRecursiveCallTest( xLBT ) , "recursive test" ) && bRet; - - bRet = (equals( aData, aRet ) && equals( aData, aRet2 )) && bRet ; - - // multiple inheritance test - bRet &= checkEmpty( - testtools::bridgetest::testMulti(xLBT->getMulti()), "remote multi"); - bRet &= checkEmpty( - xLBT->testMulti(new testtools::bridgetest::Multi), "local multi"); + TestData aRet; + aRet.Hyper = xLBT->getHyper(); + aRet.UHyper = xLBT->getUHyper(); + aRet.Float = xLBT->getFloat(); + aRet.Double = xLBT->getDouble(); + aRet.Byte = xLBT->getByte(); + aRet.Char = xLBT->getChar(); + aRet.Bool = xLBT->getBool(); + aRet.Short = xLBT->getShort(); + aRet.UShort = xLBT->getUShort(); + aRet.Long = xLBT->getLong(); + aRet.ULong = xLBT->getULong(); + aRet.Enum = xLBT->getEnum(); + aRet.String = xLBT->getString(); + aRet.Interface = xLBT->getInterface(); + aRet.Any = xLBT->getAny(); + aRet.Sequence = xLBT->getSequence(); + TestData aRet2(xLBT->getStruct()); + bRet &= check( + equals(aData, aRet) && equals(aData, aRet2), + "struct comparison test"); + { + SmallStruct aIn(1, 2); + SmallStruct aOut(xLBT->echoSmallStruct(aIn)); + bRet &= check( + memcmp(&aIn, &aOut, sizeof(SmallStruct)) == 0, + "small struct test"); + } + { + MediumStruct aIn(1, 2, 3, 4); + MediumStruct aOut(xLBT->echoMediumStruct(aIn)); + bRet &= check( + memcmp(&aIn, &aOut, sizeof(MediumStruct)) == 0, + "medium struct test"); + } + { + BigStruct aIn(1, 2, 3, 4, 5, 6, 7, 8); + BigStruct aOut(xLBT->echoBigStruct(aIn)); + bRet &= check( + memcmp(&aIn, &aOut, sizeof(BigStruct)) == 0, + "big struct test"); + } + { + sal_Int32 i2 = xLBT->testPPCAlignment(0, 0, 0, 0, 0xBEAF); + bRet &= check(i2 == 0xBEAF, "ppc-style alignment test"); + } + // Test extended attributes that raise exceptions: + try { + xLBT->getRaiseAttr1(); + bRet &= check(false, "getRaiseAttr1 did not throw"); + } catch (RuntimeException &) { + } catch (...) { + bRet &= check(false, "getRaiseAttr1 threw wrong type"); + } + try { + xLBT->setRaiseAttr1(0); + bRet &= check(false, "setRaiseAttr1 did not throw"); + } catch (IllegalArgumentException &) { + } catch (...) { + bRet &= check(false, "setRaiseAttr1 threw wrong type"); + } + try { + xLBT->getRaiseAttr2(); + bRet &= check(false, "getRaiseAttr2 did not throw"); + } catch (IllegalArgumentException &) { + } catch (...) { + bRet &= check(false, "getRaiseAttr2 threw wrong type"); + } + // Test instantiated polymorphic struct types: + { + bRet &= check( + (xLBT->transportPolyBoolean( + TestPolyStruct< sal_Bool >(true)). + member), + "transportPolyBoolean"); + TestPolyStruct< sal_Int64 > tps1(12345); + xLBT->transportPolyHyper(tps1); + bRet &= check(tps1.member == 12345, "transportPolyHyper"); + Sequence< Any > seq(2); + seq[0] <<= static_cast< sal_uInt32 >(33); + seq[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ABC")); + TestPolyStruct< Sequence< Any > > tps2(seq); + TestPolyStruct< Sequence< Any > > tps3; + xLBT->transportPolySequence(tps2, tps3); + bRet &= check( + tps3.member.getLength() == 2, + "transportPolySequence, length"); + sal_uInt32 v0 = sal_uInt32(); + tps3.member[0] >>= v0; + bRet &= check(v0 == 33, "transportPolySequence, element 0"); + rtl::OUString v1; + tps3.member[1] >>= v1; + bRet &= check( + v1.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ABC")), + "transportPolySequence, element 1"); + bRet &= check( + xLBT->getNullPolyLong().member == 0, "getNullPolyLong"); + bRet &= check( + xLBT->getNullPolyString().member.getLength() == 0, + "getNullPolyString"); + bRet &= check( + xLBT->getNullPolyType().member == Type(), + "getNullPolyType"); + Any nullAny(xLBT->getNullPolyAny().member); + bRet &= check( + (((nullAny.getValueTypeName() == + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.uno.XInterface"))) && + !static_cast< Reference< XInterface > const * >( + nullAny.getValue())->is()) + || nullAny == Any()), + "getNullPolyAny"); + bRet &= check( + xLBT->getNullPolySequence().member.getLength() == 0, + "getNullPolySequence"); + bRet &= check( + xLBT->getNullPolyEnum().member == TestEnum_TEST, + "getNullPolyEnum"); + bRet &= check( + xLBT->getNullPolyBadEnum().member == TestBadEnum_M, + "getNullPolyBadEnum"); + bRet &= check( + xLBT->getNullPolyStruct().member.member == 0, + "getNullPolyStruct"); + bRet &= check( + !xLBT->getNullPolyInterface().member.is(), + "getNullPolyInterface"); + } + // Any test: + bRet &= check(performAnyTest(xLBT , aData), "any test"); + // Sequence of call test: + bRet &= check( + performSequenceOfCallTest(xLBT), "sequence of call test"); + // Recursive call test: + bRet &= check(performRecursiveCallTest(xLBT), "recursive test"); + bRet &= check( + equals(aData, aRet) && equals(aData, aRet2), + "recursive test results"); + // Multiple inheritance test: + bRet &= checkEmpty( + testtools::bridgetest::testMulti(xLBT->getMulti()), + "remote multi"); + bRet &= checkEmpty( + xLBT->testMulti(new testtools::bridgetest::Multi), + "local multi"); } - } { - Reference<XBridgeTest2> xBT2(xLBT, UNO_QUERY); - if ( ! xBT2.is()) - return bRet; - - // perform sequence tests (XBridgeTest2) - // create the sequence which are compared with the results - sal_Bool _arBool[] = {sal_True, sal_False, sal_True}; - sal_Unicode _arChar[] = {0x0065, 0x0066, 0x0067}; - sal_Int8 _arByte[] = { 1, 2, -1 }; - sal_Int16 _arShort[] = { -0x8000, 1, 0x7fff }; - sal_uInt16 _arUShort[] = {0 , 1, 0xffff}; - sal_Int32 _arLong[] = {0x80000000, 1, 0x7fffffff}; - sal_uInt32 _arULong[] = {0, 1, 0xffffffff}; - sal_Int64 _arHyper[] = { - SAL_CONST_INT64(0x8000000000000000), 1, - SAL_CONST_INT64(0x7fffffffffffffff)}; - sal_uInt64 _arUHyper[] = {0, 1, SAL_CONST_UINT64(0xffffffffffffffff)}; - float _arFloat[] = {1.1f, 2.2f, 3.3f}; - double _arDouble[] = {1.11, 2.22, 3.33}; - OUString _arString[] = { - OUString(RTL_CONSTASCII_USTRINGPARAM("String 1")), - OUString(RTL_CONSTASCII_USTRINGPARAM("String 2")), - OUString(RTL_CONSTASCII_USTRINGPARAM("String 3")) - }; - - sal_Bool _aBool = sal_True; - sal_Int32 _aInt = 0xbabebabe; - float _aFloat = 3.14f; - Any _any1(&_aBool, getCppuBooleanType()); - Any _any2(&_aInt, getCppuType((sal_Int32*) 0)); - Any _any3(&_aFloat, getCppuType((float*) 0)); - Any _arAny[] = { _any1, _any2, _any3}; - - Reference<XInterface> _arObj[3]; - _arObj[0] = new OWeakObject(); - _arObj[1] = new OWeakObject(); - _arObj[2] = new OWeakObject(); - - TestEnum _arEnum[] = {TestEnum_ONE, TestEnum_TWO, TestEnum_CHECK}; - - TestElement _arStruct[3]; - assign( _arStruct[0], sal_True, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - SAL_CONST_INT64(0x123456789abcdef0), - SAL_CONST_UINT64(0xfedcba9876543210), - 17.0815f, 3.1415926359, + Reference< XBridgeTest2 > xBT2(xLBT, UNO_QUERY); + if (!xBT2.is()) { + return bRet; + } + // Perform sequence tests (XBridgeTest2); create the sequence which is + // compared with the results: + sal_Bool _arBool[] = { true, false, true }; + sal_Unicode _arChar[] = { 0x0065, 0x0066, 0x0067 }; + sal_Int8 _arByte[] = { 1, 2, -1 }; + sal_Int16 _arShort[] = { -0x8000, 1, 0x7FFF }; + sal_uInt16 _arUShort[] = { 0 , 1, 0xFFFF }; + sal_Int32 _arLong[] = { 0x80000000, 1, 0x7FFFFFFF }; + sal_uInt32 _arULong[] = { 0, 1, 0xFFFFFFFF }; + sal_Int64 _arHyper[] = { + SAL_CONST_INT64(0x8000000000000000), 1, + SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF) }; + sal_uInt64 _arUHyper[] = { 0, 1, SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF) }; + float _arFloat[] = { 1.1f, 2.2f, 3.3f }; + double _arDouble[] = { 1.11, 2.22, 3.33 }; + OUString _arString[] = { + OUString(RTL_CONSTASCII_USTRINGPARAM("String 1")), + OUString(RTL_CONSTASCII_USTRINGPARAM("String 2")), + OUString(RTL_CONSTASCII_USTRINGPARAM("String 3")) }; + sal_Bool _aBool = true; + sal_Int32 _aInt = 0xBABEBABE; + float _aFloat = 3.14f; + Any _any1(&_aBool, getCppuBooleanType()); + Any _any2(&_aInt, getCppuType((sal_Int32 *) 0)); + Any _any3(&_aFloat, getCppuType((float *) 0)); + Any _arAny[] = { _any1, _any2, _any3 }; + Reference< XInterface > _arObj[3]; + _arObj[0] = new OWeakObject(); + _arObj[1] = new OWeakObject(); + _arObj[2] = new OWeakObject(); + TestEnum _arEnum[] = { TestEnum_ONE, TestEnum_TWO, TestEnum_CHECK }; + TestElement _arStruct[3]; + assign( + _arStruct[0], true, '@', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, + SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, TestEnum_LOLA, OUSTR(STRING_TEST_CONSTANT), _arObj[0], - Any( &_arObj[0], ::getCppuType( (const Reference<XInterface > *)0 ) ) ); - assign( _arStruct[1], sal_True, 'A', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - SAL_CONST_INT64(0x123456789abcdef0), - SAL_CONST_UINT64(0xfedcba9876543210), - 17.0815f, 3.1415926359, + Any(&_arObj[0], getCppuType((Reference< XInterface > const *) 0))); + assign( + _arStruct[1], true, 'A', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, + SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, TestEnum_TWO, OUSTR(STRING_TEST_CONSTANT), _arObj[1], - Any( &_arObj[1], ::getCppuType( (const Reference<XInterface > *)0 ) ) ); - assign( _arStruct[2], sal_True, 'B', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - SAL_CONST_INT64(0x123456789abcdef0), - SAL_CONST_UINT64(0xfedcba9876543210), - 17.0815f, 3.1415926359, + Any(&_arObj[1], getCppuType((Reference< XInterface > const *) 0))); + assign( + _arStruct[2], true, 'B', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, + SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, TestEnum_CHECK, OUSTR(STRING_TEST_CONSTANT), _arObj[2], - Any( &_arObj[2], ::getCppuType( (const Reference<XInterface > *)0 ) ) ); - - { - Sequence<sal_Bool> arBool(_arBool, 3); - Sequence<sal_Unicode> arChar( _arChar, 3); - Sequence<sal_Int8> arByte(_arByte, 3); - Sequence<sal_Int16> arShort(_arShort, 3); - Sequence<sal_uInt16> arUShort(_arUShort, 3); - Sequence<sal_Int32> arLong(_arLong, 3); - Sequence<sal_uInt32> arULong(_arULong, 3); - Sequence<sal_Int64> arHyper(_arHyper, 3); - Sequence<sal_uInt64> arUHyper(_arUHyper, 3); - Sequence<float> arFloat(_arFloat, 3); - Sequence<double> arDouble(_arDouble, 3); - Sequence<OUString> arString(_arString, 3); - Sequence<Any> arAny(_arAny, 3); - Sequence<Reference<XInterface> > arObject(_arObj, 3); - Sequence<TestEnum> arEnum(_arEnum, 3); - Sequence<TestElement> arStruct(_arStruct, 3); - Sequence<Sequence<sal_Int32> > _arSeqLong2[3]; - for (int j = 0; j < 3; j++) - { - Sequence<sal_Int32> _arSeqLong[3]; - for (int i = 0; i < 3; i++) + Any(&_arObj[2], getCppuType((Reference< XInterface > const *) 0))); { - _arSeqLong[i] = Sequence<sal_Int32>(_arLong, 3); - } - - _arSeqLong2[j] = Sequence< Sequence<sal_Int32> > (_arSeqLong, 3); - } - - Sequence<Sequence<Sequence<sal_Int32> > > arLong3( _arSeqLong2, 3); - Sequence<Sequence<sal_Int32> > seqSeqRet = xBT2->setDim2(arLong3[0]); - bRet = check( seqSeqRet == arLong3[0], "sequence test") && bRet; - Sequence<Sequence<Sequence<sal_Int32> > > seqSeqRet2 = xBT2->setDim3(arLong3); - bRet = check( seqSeqRet2 == arLong3, "sequence test") && bRet; - Sequence<Any> seqAnyRet = xBT2->setSequenceAny(arAny); - bRet = check( seqAnyRet == arAny, "sequence test") && bRet; - Sequence<sal_Bool> seqBoolRet = xBT2->setSequenceBool(arBool); - bRet = check( seqBoolRet == arBool, "sequence test") && bRet; - Sequence<sal_Int8> seqByteRet = xBT2->setSequenceByte(arByte); - bRet = check( seqByteRet == arByte, "sequence test") && bRet; - Sequence<sal_Unicode> seqCharRet = xBT2->setSequenceChar(arChar); - bRet = check( seqCharRet == arChar, "sequence test") && bRet; - Sequence<sal_Int16> seqShortRet = xBT2->setSequenceShort(arShort); - bRet = check( seqShortRet == arShort, "sequence test") && bRet; - Sequence<sal_Int32> seqLongRet = xBT2->setSequenceLong(arLong); - bRet = check( seqLongRet == arLong, "sequence test") && bRet; - Sequence<sal_Int64> seqHyperRet = xBT2->setSequenceHyper(arHyper); - bRet = check( seqHyperRet == arHyper, "sequence test") && bRet; - Sequence<float> seqFloatRet = xBT2->setSequenceFloat(arFloat); - bRet = check( seqFloatRet == arFloat, "sequence test") && bRet; - Sequence<double> seqDoubleRet = xBT2->setSequenceDouble(arDouble); - bRet = check( seqDoubleRet == arDouble, "sequence test") && bRet; - Sequence<TestEnum> seqEnumRet = xBT2->setSequenceEnum(arEnum); - bRet = check( seqEnumRet == arEnum, "sequence test") && bRet; - Sequence<sal_uInt16> seqUShortRet = xBT2->setSequenceUShort(arUShort); - bRet = check( seqUShortRet == arUShort, "sequence test") && bRet; - Sequence<sal_uInt32> seqULongRet = xBT2->setSequenceULong(arULong); - bRet = check( seqULongRet == arULong, "sequence test") && bRet; - Sequence<sal_uInt64> seqUHyperRet = xBT2->setSequenceUHyper(arUHyper); - bRet = check( seqUHyperRet == arUHyper, "sequence test") && bRet; - Sequence<Reference<XInterface> > seqObjectRet = xBT2->setSequenceXInterface(arObject); - bRet = check( seqObjectRet == arObject, "sequence test") && bRet; - Sequence<OUString> seqStringRet = xBT2->setSequenceString(arString); - bRet = check( seqStringRet == arString, "sequence test") && bRet; - Sequence<TestElement> seqStructRet = xBT2->setSequenceStruct(arStruct); - bRet = check( seqStructRet == arStruct, "sequence test") && bRet; - - Sequence<sal_Bool> arBoolTemp = cloneSequence(arBool); - Sequence<sal_Unicode> arCharTemp = cloneSequence(arChar); - Sequence<sal_Int8> arByteTemp = cloneSequence(arByte); - Sequence<sal_Int16> arShortTemp = cloneSequence(arShort); - Sequence<sal_uInt16> arUShortTemp = cloneSequence(arUShort); - Sequence<sal_Int32> arLongTemp = cloneSequence(arLong); - Sequence<sal_uInt32> arULongTemp = cloneSequence(arULong); - Sequence<sal_Int64> arHyperTemp = cloneSequence(arHyper); - Sequence<sal_uInt64> arUHyperTemp = cloneSequence(arUHyper); - Sequence<float> arFloatTemp = cloneSequence(arFloat); - Sequence<double> arDoubleTemp = cloneSequence(arDouble); - Sequence<TestEnum> arEnumTemp = cloneSequence(arEnum); - Sequence<OUString> arStringTemp = cloneSequence(arString); - Reference<XInterface> _xint; - Sequence<Reference<XInterface> > arObjectTemp = cloneSequence(arObject); - Sequence<Any> arAnyTemp = cloneSequence(arAny); - Sequence<Sequence<sal_Int32> > arLong2Temp(arLong3[0]); - Sequence<Sequence<Sequence<sal_Int32> > > arLong3Temp(arLong3); - - xBT2->setSequencesInOut(arBoolTemp, arCharTemp, arByteTemp, arShortTemp, - arUShortTemp, arLongTemp,arULongTemp, arHyperTemp, - arUHyperTemp, arFloatTemp, arDoubleTemp, - arEnumTemp, arStringTemp, arObjectTemp, arAnyTemp, - arLong2Temp, arLong3Temp); - bRet = check( - arBoolTemp == arBool && - arCharTemp == arChar && - arByteTemp == arByte && - arShortTemp == arShort && - arUShortTemp == arUShort && - arLongTemp == arLong && - arULongTemp == arULong && - arHyperTemp == arHyper && - arUHyperTemp == arUHyper && - arFloatTemp == arFloat && - arDoubleTemp == arDouble && - arEnumTemp == arEnum && - arStringTemp == arString && - arObjectTemp == arObject && - arAnyTemp == arAny && - arLong2Temp == arLong3[0] && - arLong3Temp == arLong3, "sequence test") && bRet; - - Sequence<sal_Bool> arBoolOut; - Sequence<sal_Unicode> arCharOut; - Sequence<sal_Int8> arByteOut; - Sequence<sal_Int16> arShortOut; - Sequence<sal_uInt16> arUShortOut; - Sequence<sal_Int32> arLongOut; - Sequence<sal_uInt32> arULongOut; - Sequence<sal_Int64> arHyperOut; - Sequence<sal_uInt64> arUHyperOut; - Sequence<float> arFloatOut; - Sequence<double> arDoubleOut; - Sequence<TestEnum> arEnumOut; - Sequence<OUString> arStringOut; - Sequence<Reference<XInterface> > arObjectOut; - Sequence<Any> arAnyOut; - Sequence<Sequence<sal_Int32> > arLong2Out; - Sequence<Sequence<Sequence<sal_Int32> > > arLong3Out; - xBT2->setSequencesOut(arBoolOut, arCharOut, arByteOut, arShortOut, - arUShortOut, arLongOut,arULongOut, arHyperOut, - arUHyperOut, arFloatOut, arDoubleOut, - arEnumOut, arStringOut, arObjectOut, arAnyOut, - arLong2Out, arLong3Out); - bRet = check( - arBoolOut == arBool && - arCharOut == arChar && - arByteOut == arByte && - arShortOut == arShort && - arUShortOut == arUShort && - arLongOut == arLong && - arULongOut == arULong && - arHyperOut == arHyper && - arUHyperOut == arUHyper && - arFloatOut == arFloat && - arDoubleOut == arDouble && - arEnumOut == arEnum && - arStringOut == arString && - arObjectOut == arObject && - arAnyOut == arAny && - arLong2Out == arLong3[0] && - arLong3Out == arLong3, "sequence test") && bRet; - } - { - //test with empty sequences - Sequence<Sequence<sal_Int32> > arLong2; - Sequence<Sequence<sal_Int32> > seqSeqRet = xBT2->setDim2(arLong2); - bRet = check( seqSeqRet == arLong2, "sequence test") && bRet; - Sequence<Sequence<Sequence<sal_Int32> > > arLong3; - Sequence<Sequence<Sequence<sal_Int32> > > seqSeqRet2 = xBT2->setDim3( - arLong3); - bRet = check( seqSeqRet2 == arLong3, "sequence test") && bRet; - Sequence<Any> arAny; - Sequence<Any> seqAnyRet = xBT2->setSequenceAny(arAny); - bRet = check( seqAnyRet == arAny, "sequence test") && bRet; - Sequence<sal_Bool> arBool; - Sequence<sal_Bool> seqBoolRet = xBT2->setSequenceBool(arBool); - bRet = check( seqBoolRet == arBool, "sequence test") && bRet; - Sequence<sal_Int8> arByte; - Sequence<sal_Int8> seqByteRet = xBT2->setSequenceByte(arByte); - bRet = check( seqByteRet == arByte, "sequence test") && bRet; - Sequence<sal_Unicode> arChar; - Sequence<sal_Unicode> seqCharRet = xBT2->setSequenceChar(arChar); - bRet = check( seqCharRet == arChar, "sequence test") && bRet; - Sequence<sal_Int16> arShort; - Sequence<sal_Int16> seqShortRet = xBT2->setSequenceShort(arShort); - bRet = check( seqShortRet == arShort, "sequence test") && bRet; - Sequence<sal_Int32> arLong; - Sequence<sal_Int32> seqLongRet = xBT2->setSequenceLong(arLong); - bRet = check( seqLongRet == arLong, "sequence test") && bRet; - Sequence<sal_Int64> arHyper; - Sequence<sal_Int64> seqHyperRet = xBT2->setSequenceHyper(arHyper); - bRet = check( seqHyperRet == arHyper, "sequence test") && bRet; - Sequence<float> arFloat; - Sequence<float> seqFloatRet = xBT2->setSequenceFloat(arFloat); - bRet = check( seqFloatRet == arFloat, "sequence test") && bRet; - Sequence<double> arDouble; - Sequence<double> seqDoubleRet = xBT2->setSequenceDouble(arDouble); - bRet = check( seqDoubleRet == arDouble, "sequence test") && bRet; - Sequence<TestEnum> arEnum; - Sequence<TestEnum> seqEnumRet = xBT2->setSequenceEnum(arEnum); - bRet = check( seqEnumRet == arEnum, "sequence test") && bRet; - Sequence<sal_uInt16> arUShort; - Sequence<sal_uInt16> seqUShortRet = xBT2->setSequenceUShort(arUShort); - bRet = check( seqUShortRet == arUShort, "sequence test") && bRet; - Sequence<sal_uInt32> arULong; - Sequence<sal_uInt32> seqULongRet = xBT2->setSequenceULong(arULong); - bRet = check( seqULongRet == arULong, "sequence test") && bRet; - Sequence<sal_uInt64> arUHyper; - Sequence<sal_uInt64> seqUHyperRet = xBT2->setSequenceUHyper(arUHyper); - bRet = check( seqUHyperRet == arUHyper, "sequence test") && bRet; - Sequence<Reference<XInterface> > arObject; - Sequence<Reference<XInterface> > seqObjectRet = - xBT2->setSequenceXInterface(arObject); - bRet = check( seqObjectRet == arObject, "sequence test") && bRet; - Sequence<OUString> arString; - Sequence<OUString> seqStringRet = xBT2->setSequenceString(arString); - bRet = check( seqStringRet == arString, "sequence test") && bRet; - Sequence<TestElement> arStruct; - Sequence<TestElement> seqStructRet = xBT2->setSequenceStruct(arStruct); - bRet = check( seqStructRet == arStruct, "sequence test") && bRet; - } - // Issue #i60341# shows that the most interesting case is were Java calls - // the constructors; however, since this client is currently not available - // in Java, while the server is, the logic is reversed here: - try { - xBT2->testConstructorsService(xContext); - } catch (BadConstructorArguments &) { - bRet = false; - } - if (!noCurrentContext) { - if (!(new testtools::bridgetest::CurrentContextChecker)->perform( - xBT2->getCurrentContextChecker(), 0, 1)) - { - bRet = false; + Sequence<sal_Bool> arBool(_arBool, 3); + Sequence<sal_Unicode> arChar( _arChar, 3); + Sequence<sal_Int8> arByte(_arByte, 3); + Sequence<sal_Int16> arShort(_arShort, 3); + Sequence<sal_uInt16> arUShort(_arUShort, 3); + Sequence<sal_Int32> arLong(_arLong, 3); + Sequence<sal_uInt32> arULong(_arULong, 3); + Sequence<sal_Int64> arHyper(_arHyper, 3); + Sequence<sal_uInt64> arUHyper(_arUHyper, 3); + Sequence<float> arFloat(_arFloat, 3); + Sequence<double> arDouble(_arDouble, 3); + Sequence<OUString> arString(_arString, 3); + Sequence<Any> arAny(_arAny, 3); + Sequence<Reference<XInterface> > arObject(_arObj, 3); + Sequence<TestEnum> arEnum(_arEnum, 3); + Sequence<TestElement> arStruct(_arStruct, 3); + Sequence<Sequence<sal_Int32> > _arSeqLong2[3]; + for (int j = 0; j != 3; ++j) { + Sequence< sal_Int32 > _arSeqLong[3]; + for (int i = 0; i != 3; ++i) { + _arSeqLong[i] = Sequence< sal_Int32 >(_arLong, 3); + } + _arSeqLong2[j] = Sequence< Sequence< sal_Int32 > >( + _arSeqLong, 3); + } + Sequence< Sequence< Sequence< sal_Int32> > > arLong3( + _arSeqLong2, 3); + Sequence< Sequence< sal_Int32 > > seqSeqRet( + xBT2->setDim2(arLong3[0])); + bRet &= check(seqSeqRet == arLong3[0], "sequence test"); + Sequence< Sequence< Sequence< sal_Int32 > > > seqSeqRet2( + xBT2->setDim3(arLong3)); + bRet &= check(seqSeqRet2 == arLong3, "sequence test"); + Sequence< Any > seqAnyRet(xBT2->setSequenceAny(arAny)); + bRet &= check(seqAnyRet == arAny, "sequence test"); + Sequence< sal_Bool > seqBoolRet(xBT2->setSequenceBool(arBool)); + bRet &= check(seqBoolRet == arBool, "sequence test"); + Sequence< sal_Int8 > seqByteRet(xBT2->setSequenceByte(arByte)); + bRet &= check(seqByteRet == arByte, "sequence test"); + Sequence< sal_Unicode > seqCharRet(xBT2->setSequenceChar(arChar)); + bRet &= check(seqCharRet == arChar, "sequence test"); + Sequence< sal_Int16 > seqShortRet(xBT2->setSequenceShort(arShort)); + bRet &= check(seqShortRet == arShort, "sequence test"); + Sequence< sal_Int32 > seqLongRet(xBT2->setSequenceLong(arLong)); + bRet &= check(seqLongRet == arLong, "sequence test"); + Sequence< sal_Int64 > seqHyperRet(xBT2->setSequenceHyper(arHyper)); + bRet &= check(seqHyperRet == arHyper, "sequence test"); + Sequence< float > seqFloatRet(xBT2->setSequenceFloat(arFloat)); + bRet &= check(seqFloatRet == arFloat, "sequence test"); + Sequence< double > seqDoubleRet(xBT2->setSequenceDouble(arDouble)); + bRet &= check(seqDoubleRet == arDouble, "sequence test"); + Sequence< TestEnum > seqEnumRet(xBT2->setSequenceEnum(arEnum)); + bRet &= check(seqEnumRet == arEnum, "sequence test"); + Sequence< sal_uInt16 > seqUShortRet( + xBT2->setSequenceUShort(arUShort)); + bRet &= check(seqUShortRet == arUShort, "sequence test"); + Sequence< sal_uInt32 > seqULongRet(xBT2->setSequenceULong(arULong)); + bRet &= check(seqULongRet == arULong, "sequence test"); + Sequence< sal_uInt64 > seqUHyperRet( + xBT2->setSequenceUHyper(arUHyper)); + bRet &= check(seqUHyperRet == arUHyper, "sequence test"); + Sequence< Reference< XInterface > > seqObjectRet( + xBT2->setSequenceXInterface(arObject)); + bRet &= check(seqObjectRet == arObject, "sequence test"); + Sequence< OUString > seqStringRet( + xBT2->setSequenceString(arString)); + bRet &= check(seqStringRet == arString, "sequence test"); + Sequence< TestElement > seqStructRet( + xBT2->setSequenceStruct(arStruct)); + bRet &= check(seqStructRet == arStruct, "sequence test"); + Sequence< sal_Bool > arBoolTemp(cloneSequence(arBool)); + Sequence< sal_Unicode > arCharTemp(cloneSequence(arChar)); + Sequence< sal_Int8 > arByteTemp(cloneSequence(arByte)); + Sequence< sal_Int16 > arShortTemp(cloneSequence(arShort)); + Sequence< sal_uInt16 > arUShortTemp(cloneSequence(arUShort)); + Sequence< sal_Int32 > arLongTemp(cloneSequence(arLong)); + Sequence< sal_uInt32 > arULongTemp(cloneSequence(arULong)); + Sequence< sal_Int64 > arHyperTemp(cloneSequence(arHyper)); + Sequence< sal_uInt64 > arUHyperTemp(cloneSequence(arUHyper)); + Sequence< float > arFloatTemp(cloneSequence(arFloat)); + Sequence< double > arDoubleTemp(cloneSequence(arDouble)); + Sequence< TestEnum > arEnumTemp(cloneSequence(arEnum)); + Sequence< OUString > arStringTemp(cloneSequence(arString)); + Sequence< Reference< XInterface > > arObjectTemp( + cloneSequence(arObject)); + Sequence< Any > arAnyTemp(cloneSequence(arAny)); + Sequence< Sequence< sal_Int32 > > arLong2Temp(arLong3[0]); + Sequence< Sequence< Sequence< sal_Int32 > > > arLong3Temp(arLong3); + xBT2->setSequencesInOut( + arBoolTemp, arCharTemp, arByteTemp, arShortTemp, arUShortTemp, + arLongTemp,arULongTemp, arHyperTemp, arUHyperTemp, arFloatTemp, + arDoubleTemp, arEnumTemp, arStringTemp, arObjectTemp, arAnyTemp, + arLong2Temp, arLong3Temp); + bRet &= check( + (arBoolTemp == arBool && arCharTemp == arChar && + arByteTemp == arByte && arShortTemp == arShort && + arUShortTemp == arUShort && arLongTemp == arLong && + arULongTemp == arULong && arHyperTemp == arHyper && + arUHyperTemp == arUHyper && arFloatTemp == arFloat && + arDoubleTemp == arDouble && arEnumTemp == arEnum && + arStringTemp == arString && arObjectTemp == arObject && + arAnyTemp == arAny && arLong2Temp == arLong3[0] && + arLong3Temp == arLong3), + "sequence test"); + Sequence< sal_Bool > arBoolOut; + Sequence< sal_Unicode > arCharOut; + Sequence< sal_Int8 > arByteOut; + Sequence< sal_Int16 > arShortOut; + Sequence< sal_uInt16 > arUShortOut; + Sequence< sal_Int32 > arLongOut; + Sequence< sal_uInt32 > arULongOut; + Sequence< sal_Int64 > arHyperOut; + Sequence< sal_uInt64 > arUHyperOut; + Sequence< float > arFloatOut; + Sequence< double > arDoubleOut; + Sequence< TestEnum > arEnumOut; + Sequence< OUString > arStringOut; + Sequence< Reference< XInterface > > arObjectOut; + Sequence< Any > arAnyOut; + Sequence< Sequence< sal_Int32 > > arLong2Out; + Sequence< Sequence< Sequence< sal_Int32 > > > arLong3Out; + xBT2->setSequencesOut( + arBoolOut, arCharOut, arByteOut, arShortOut, arUShortOut, + arLongOut,arULongOut, arHyperOut, arUHyperOut, arFloatOut, + arDoubleOut, arEnumOut, arStringOut, arObjectOut, arAnyOut, + arLong2Out, arLong3Out); + bRet &= check( + (arBoolOut == arBool && arCharOut == arChar && + arByteOut == arByte && arShortOut == arShort && + arUShortOut == arUShort && arLongOut == arLong && + arULongOut == arULong && arHyperOut == arHyper && + arUHyperOut == arUHyper && arFloatOut == arFloat && + arDoubleOut == arDouble && arEnumOut == arEnum && + arStringOut == arString && arObjectOut == arObject && + arAnyOut == arAny && arLong2Out == arLong3[0] && + arLong3Out == arLong3), + "sequence test"); } - if (!(new testtools::bridgetest::CurrentContextChecker)->perform( - xBT2->getCurrentContextChecker(), 0, 2)) { - bRet = false; + // Test with empty sequences: + Sequence< Sequence< sal_Int32 > > arLong2; + Sequence< Sequence< sal_Int32 > > seqSeqRet(xBT2->setDim2(arLong2)); + bRet &= check(seqSeqRet == arLong2, "sequence test"); + Sequence< Sequence< Sequence< sal_Int32 > > > arLong3; + Sequence< Sequence< Sequence< sal_Int32 > > > seqSeqRet2( + xBT2->setDim3(arLong3)); + bRet &= check(seqSeqRet2 == arLong3, "sequence test"); + Sequence< Any > arAny; + Sequence< Any > seqAnyRet(xBT2->setSequenceAny(arAny)); + bRet &= check(seqAnyRet == arAny, "sequence test"); + Sequence< sal_Bool > arBool; + Sequence< sal_Bool > seqBoolRet(xBT2->setSequenceBool(arBool)); + bRet &= check(seqBoolRet == arBool, "sequence test"); + Sequence< sal_Int8 > arByte; + Sequence< sal_Int8 > seqByteRet(xBT2->setSequenceByte(arByte)); + bRet &= check(seqByteRet == arByte, "sequence test"); + Sequence< sal_Unicode > arChar; + Sequence< sal_Unicode > seqCharRet(xBT2->setSequenceChar(arChar)); + bRet &= check(seqCharRet == arChar, "sequence test"); + Sequence< sal_Int16 > arShort; + Sequence< sal_Int16 > seqShortRet(xBT2->setSequenceShort(arShort)); + bRet &= check(seqShortRet == arShort, "sequence test"); + Sequence< sal_Int32 > arLong; + Sequence< sal_Int32 > seqLongRet(xBT2->setSequenceLong(arLong)); + bRet &= check(seqLongRet == arLong, "sequence test"); + Sequence< sal_Int64 > arHyper; + Sequence< sal_Int64 > seqHyperRet(xBT2->setSequenceHyper(arHyper)); + bRet &= check(seqHyperRet == arHyper, "sequence test"); + Sequence< float > arFloat; + Sequence< float > seqFloatRet(xBT2->setSequenceFloat(arFloat)); + bRet &= check(seqFloatRet == arFloat, "sequence test"); + Sequence< double > arDouble; + Sequence< double > seqDoubleRet(xBT2->setSequenceDouble(arDouble)); + bRet &= check(seqDoubleRet == arDouble, "sequence test"); + Sequence< TestEnum > arEnum; + Sequence< TestEnum > seqEnumRet(xBT2->setSequenceEnum(arEnum)); + bRet &= check(seqEnumRet == arEnum, "sequence test"); + Sequence< sal_uInt16 > arUShort; + Sequence< sal_uInt16 > seqUShortRet( + xBT2->setSequenceUShort(arUShort)); + bRet &= check(seqUShortRet == arUShort, "sequence test"); + Sequence< sal_uInt32 > arULong; + Sequence< sal_uInt32 > seqULongRet(xBT2->setSequenceULong(arULong)); + bRet &= check(seqULongRet == arULong, "sequence test"); + Sequence< sal_uInt64 > arUHyper; + Sequence< sal_uInt64 > seqUHyperRet( + xBT2->setSequenceUHyper(arUHyper)); + bRet &= check(seqUHyperRet == arUHyper, "sequence test"); + Sequence< Reference< XInterface > > arObject; + Sequence< Reference< XInterface > > seqObjectRet( + xBT2->setSequenceXInterface(arObject)); + bRet &= check(seqObjectRet == arObject, "sequence test"); + Sequence< OUString > arString; + Sequence< OUString > seqStringRet( + xBT2->setSequenceString(arString)); + bRet &= check(seqStringRet == arString, "sequence test"); + Sequence< TestElement > arStruct; + Sequence< TestElement > seqStructRet( + xBT2->setSequenceStruct(arStruct)); + bRet &= check(seqStructRet == arStruct, "sequence test"); } - if (!(new testtools::bridgetest::CurrentContextChecker)->perform( - xBT2->getCurrentContextChecker(), 1, 2)) - { + // Issue #i60341# shows that the most interesting case is were Java + // calls the constructors; however, since this client is currently not + // available in Java, while the server is, the logic is reversed here: + try { + xBT2->testConstructorsService(xContext); + } catch (BadConstructorArguments &) { bRet = false; } - if (!(new testtools::bridgetest::CurrentContextChecker)->perform( - xBT2->getCurrentContextChecker(), 1, 3)) - { - bRet = false; + if (!noCurrentContext) { + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 0, 1)) + { + bRet = false; + } + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 0, 2)) + { + bRet = false; + } + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 1, 2)) + { + bRet = false; + } + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 1, 3)) + { + bRet = false; + } } } - } return bRet; } + static sal_Bool raiseOnewayException( const Reference < XBridgeTest > & xLBT ) { sal_Bool bReturn = sal_True; @@ -1267,7 +1229,6 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) bRet = check( raiseException( xLBT ) , "exception test" )&& bRet; bRet = check( raiseOnewayException( xLBT ), "oneway exception test" ) && bRet; - bRet = performQueryForUnknownType( xLBT ) && bRet; if (! bRet) { throw RuntimeException( @@ -1342,27 +1303,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); - xNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ) ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { diff --git a/testtools/source/bridgetest/constructors.component b/testtools/source/bridgetest/constructors.component new file mode 100644 index 000000000000..3f3957c7c859 --- /dev/null +++ b/testtools/source/bridgetest/constructors.component @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="comp.test.testtools.bridgetest.Constructors"> + <service name="test.testtools.bridgetest.Constructors"/> + </implementation> + <implementation name="comp.test.testtools.bridgetest.Constructors2"> + <service name="test.testtools.bridgetest.Constructors2"/> + </implementation> +</component> diff --git a/testtools/source/bridgetest/constructors.cxx b/testtools/source/bridgetest/constructors.cxx index a7d8a96c1bf3..5de51bae5ccf 100644 --- a/testtools/source/bridgetest/constructors.cxx +++ b/testtools/source/bridgetest/constructors.cxx @@ -510,11 +510,4 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" ::sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return ::cppu::component_writeInfoHelper( - serviceManager, registryKey, entries); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/cppobj.component b/testtools/source/bridgetest/cppobj.component new file mode 100644 index 000000000000..239e8e348702 --- /dev/null +++ b/testtools/source/bridgetest/cppobj.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.bridge.CppTestObject"> + <service name="com.sun.star.test.bridge.CppTestObject"/> + </implementation> +</component> diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx index 9e767b6095e7..a49acf4a15b7 100644 --- a/testtools/source/bridgetest/cppobj.cxx +++ b/testtools/source/bridgetest/cppobj.cxx @@ -43,7 +43,6 @@ #include "cppuhelper/compbase_ex.hxx" #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" @@ -163,7 +162,7 @@ public: {} virtual ~Test_Impl() { - OSL_TRACE( "> scalar Test_Impl dtor <\n" ); + OSL_TRACE( "> scalar Test_Impl dtor <" ); } void SAL_CALL acquire() throw () @@ -1191,27 +1190,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); - xNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ) ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { diff --git a/testtools/source/bridgetest/currentcontextchecker.cxx b/testtools/source/bridgetest/currentcontextchecker.cxx index 38933d928b6a..eea4cdb95c5d 100644 --- a/testtools/source/bridgetest/currentcontextchecker.cxx +++ b/testtools/source/bridgetest/currentcontextchecker.cxx @@ -51,8 +51,8 @@ namespace { namespace css = ::com::sun::star; -static char const key[] = "testtools.bridgetest.Key"; -static char const value[] = "good"; +static char const KEY[] = "testtools.bridgetest.Key"; +static char const VALUE[] = "good"; class CurrentContext: public ::osl::DebugBase< CurrentContext >, @@ -78,8 +78,8 @@ CurrentContext::~CurrentContext() {} css::uno::Any CurrentContext::getValueByName(::rtl::OUString const & Name) throw (css::uno::RuntimeException) { - return Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(key)) - ? css::uno::makeAny(::rtl::OUString::createFromAscii(value)) + return Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(KEY)) + ? css::uno::makeAny(::rtl::OUString::createFromAscii(VALUE)) : css::uno::Any(); } @@ -116,13 +116,13 @@ bool testtools::bridgetest::CurrentContextChecker::performCheck( return false; } css::uno::Any a( - context->getValueByName(::rtl::OUString::createFromAscii(key))); + context->getValueByName(::rtl::OUString::createFromAscii(KEY))); if (a.getValueType() != ::cppu::UnoType< ::rtl::OUString >::get()) { return false; } ::rtl::OUString s; OSL_VERIFY(a >>= s); - return s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(value)); + return s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(VALUE)); } else { return other->perform( this, setSteps >= 0 ? setSteps - 1 : -1, checkSteps - 1); diff --git a/testtools/source/bridgetest/makefile.mk b/testtools/source/bridgetest/makefile.mk index e7a2b5fe7675..0abe1ab09767 100644 --- a/testtools/source/bridgetest/makefile.mk +++ b/testtools/source/bridgetest/makefile.mk @@ -41,18 +41,23 @@ DLLPRE = # no leading "lib" on .so files BATCH_SUFFIX=.bat GIVE_EXEC_RIGHTS=@echo MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR)))) -MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)$/$(CLASSDIR)))) +MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/))) .ELIF "$(GUI)"=="OS2" BATCH_SUFFIX=.cmd GIVE_EXEC_RIGHTS=@echo MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR)))) -MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)$/$(CLASSDIR)))) +MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/))) .ELSE GIVE_EXEC_RIGHTS=chmod +x MY_URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR) -MY_LOCAL_CLASSDIR=file://$(PWD)$/$(CLASSDIR) +MY_LOCAL_CLASSDIR=file://$(PWD)/$(CLASSDIR)/ .ENDIF +my_components = bridgetest constructors cppobj +.IF "$(SOLAR_JAVA)" != "" +my_components += testComponent +.END + .IF "$(GUI)"=="WNT" .IF "$(compcheck)" != "" CFLAGSCXX += -DCOMPCHECK @@ -122,6 +127,7 @@ JAVATARGETS=\ .IF "$(L10N_framework)"=="" ALLTAR: \ runtest \ + $(DLLDEST)/services.rdb \ $(DLLDEST)$/uno_types.rdb \ $(DLLDEST)$/uno_services.rdb \ $(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) \ @@ -130,7 +136,8 @@ ALLTAR: \ ################################################################# -runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk +runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \ + $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN) .IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" @echo "Mac OSX PPC GCC fails this test!, likely broken UNO bridge. Fix me." .ELSE @@ -139,14 +146,18 @@ runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk -s com.sun.star.test.bridge.BridgeTest -- \ com.sun.star.test.bridge.CppTestObject .ENDIF - -$(DLLDEST)$/uno_types.rdb : $(SOLARBINDIR)$/udkapi.rdb $(BIN)$/bridgetest.rdb + +$(DLLDEST)/services.rdb : + $(COPY) $(SOLARXMLDIR)/ure/services.rdb $@ + +$(DLLDEST)$/uno_types.rdb : $(SOLARBINDIR)$/udkapi.rdb echo $(DLLDEST) $(GNUCOPY) $(SOLARBINDIR)$/udkapi.rdb $@ $(REGMERGE) $@ / $(BIN)$/bridgetest.rdb $(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk - echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro uno_services.rdb -ro uno_types.rdb \ + echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \ + -ro uno_services.rdb -ro uno_types.rdb \ -s com.sun.star.test.bridge.BridgeTest -- \ -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' > $@ $(GIVE_EXEC_RIGHTS) $@ @@ -175,44 +186,44 @@ $(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) : makefile.mk $(GIVE_EXEC_RIGHTS) $@ $(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk - echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro uno_services.rdb -ro uno_types.rdb \ + echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \ + -ro uno_services.rdb -ro uno_types.rdb \ -s com.sun.star.test.bridge.BridgeTest \ -env:URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) \ + -env:MY_CLASSDIR_URL=$(MY_LOCAL_CLASSDIR) \ -- com.sun.star.test.bridge.JavaTestObject noCurrentContext > $@ $(GIVE_EXEC_RIGHTS) $@ .ENDIF -$(DLLDEST)$/uno_services.rdb .ERRREMOVE: $(DLLDEST)$/uno_types.rdb \ - $(DLLDEST)$/bridgetest.uno$(DLLPOST) $(DLLDEST)$/cppobj.uno$(DLLPOST) \ - $(MISC)$/$(TARGET)$/bootstrap.rdb $(SHL3TARGETN) - - $(MKDIR) $(@:d) - $(REGCOMP) -register -br $(DLLDEST)$/uno_types.rdb \ - -r $(DLLDEST)$/uno_services.rdb -wop \ - -c acceptor.uno$(DLLPOST) \ - -c bridgefac.uno$(DLLPOST) \ - -c connector.uno$(DLLPOST) \ - -c remotebridge.uno$(DLLPOST) \ - -c uuresolver.uno$(DLLPOST) \ - -c stocservices.uno$(DLLPOST) - cd $(DLLDEST) && $(REGCOMP) -register -br uno_types.rdb \ - -r uno_services.rdb -wop=./ \ - -c .$/bridgetest.uno$(DLLPOST) \ - -c .$/cppobj.uno$(DLLPOST) \ - -c .$/$(SHL3TARGETN:f) -.IF "$(SOLAR_JAVA)" != "" - $(REGCOMP) -register -br $(DLLDEST)$/uno_types.rdb -r $@ \ - -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) - $(REGCOMP) -register -br $(MISC)$/$(TARGET)$/bootstrap.rdb -r $@ -c \ - $(MY_LOCAL_CLASSDIR)/testComponent.jar \ - -env:URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) -.ENDIF +$(DLLDEST)$/uno_services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/uno_services.input $(my_components:^"$(MISC)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/uno_services.input -$(MISC)$/$(TARGET)$/bootstrap.rdb .ERRREMOVE: - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)$/types.rdb $@ -.IF "$(SOLAR_JAVA)" != "" - $(REGCOMP) -register -r $@ -c javaloader.uno$(DLLPOST) \ - -c javavm.uno$(DLLPOST) -c stocservices.uno$(DLLPOST) -.ENDIF -.ENDIF # L10N_framework +$(MISC)/uno_services.input : + echo \ + '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \ + > $@ + +$(MISC)/bridgetest.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + bridgetest.component + $(XSLTPROC) --nonet --stringparam uri './$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt bridgetest.component +$(MISC)/constructors.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt constructors.component + $(XSLTPROC) --nonet --stringparam uri './$(SHL3TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt constructors.component + +$(MISC)/cppobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + cppobj.component + $(XSLTPROC) --nonet --stringparam uri './$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt cppobj.component + +$(MISC)/testComponent.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt testComponent.component + $(XSLTPROC) --nonet --stringparam uri \ + 'vnd.sun.star.expand:$${{MY_CLASSDIR_URL}}testComponent.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt testComponent.component + +.ENDIF # L10N_framework diff --git a/testtools/source/bridgetest/pyuno/makefile.mk b/testtools/source/bridgetest/pyuno/makefile.mk index fb7a78f71f4a..ded3cdbc7931 100644 --- a/testtools/source/bridgetest/pyuno/makefile.mk +++ b/testtools/source/bridgetest/pyuno/makefile.mk @@ -33,6 +33,8 @@ LIBTARGET=NO TARGETTYPE=CUI ENABLE_EXCEPTIONS=TRUE +my_components = pythonloader + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -55,12 +57,12 @@ PYTHONPATH:=$(SOLARLIBDIR)$/pyuno:$(PWD):$(SOLARLIBDIR):$(SOLARLIBDIR)$/python:$ .IF "$(GUI)"!="WNT" && "$(GUI)"!="OS2" TEST_ENV=export FOO=file://$(shell @pwd)$/$(DLLDEST) \ - UNO_TYPES=pyuno_regcomp.rdb UNO_SERVICES=pyuno_regcomp.rdb + UNO_TYPES=uno_types.rdb UNO_SERVICES=pyuno_services.rdb .ELSE # "$(GUI)" != "WNT" # aaaaaa, how to get the current working directory on windows ??? CWD_TMP=$(strip $(shell @echo "import os;print os.getcwd()" | $(PYTHON))) TEST_ENV=export FOO=file:///$(strip $(subst,\,/ $(CWD_TMP)$/$(DLLDEST))) && \ - export UNO_TYPES=pyuno_regcomp.rdb && export UNO_SERVICES=pyuno_regcomp.rdb + export UNO_TYPES=uno_types.rdb && export UNO_SERVICES=pyuno_services.rdb .ENDIF # "$(GUI)"!="WNT" PYFILES = \ $(DLLDEST)$/core.py \ @@ -75,7 +77,7 @@ PYCOMPONENTS = \ ALL : \ $(PYFILES) \ - $(DLLDEST)$/pyuno_regcomp.rdb \ + $(DLLDEST)/pyuno_services.rdb \ doc \ ALLTAR .ENDIF # L10N_framework @@ -91,18 +93,21 @@ $(DLLDEST)$/python$(EXECPOST) : $(SOLARBINDIR)$/python$(EXECPOST) $(DLLDEST)$/regcomp$(EXECPOST) : $(SOLARBINDIR)$/regcomp$(EXECPOST) cp $? $@ -$(DLLDEST)$/pyuno_regcomp.rdb: $(DLLDEST)$/uno_types.rdb $(SOLARBINDIR)$/pyuno_services.rdb - -rm -f $@ - $(WRAPCMD) $(REGMERGE) $(DLLDEST)$/pyuno_regcomp.rdb / $(DLLDEST)$/uno_types.rdb $(SOLARBINDIR)$/pyuno_services.rdb +$(DLLDEST)$/pyuno_services.rdb .ERRREMOVE : \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/pyuno_services.input \ + $(my_components:^"$(SOLARXMLDIR)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/pyuno_services.input + +$(MISC)/pyuno_services.input : + echo \ + '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \ + > $@ doc .PHONY: @echo start test with dmake runtest runtest : ALL cd $(DLLDEST) && $(TEST_ENV) && $(PYTHON) main.py - cd $(DLLDEST) && $(TEST_ENV) && $(WRAPCMD) $(REGCOMP) -register -br pyuno_regcomp.rdb -r dummy.rdb \ - -l com.sun.star.loader.Python $(foreach,i,$(PYCOMPONENTS) -c vnd.openoffice.pymodule:$(i)) - cd $(DLLDEST) && $(TEST_ENV) && $(WRAPCMD) $(REGCOMP) -register -br pyuno_regcomp.rdb -r dummy2.rdb \ - -l com.sun.star.loader.Python -c vnd.sun.star.expand:$$FOO/samplecomponent.py .ENDIF # L10N_framework diff --git a/testtools/source/bridgetest/testComponent.component b/testtools/source/bridgetest/testComponent.component new file mode 100644 index 000000000000..eae9b063140d --- /dev/null +++ b/testtools/source/bridgetest/testComponent.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation + name="com.sun.star.comp.bridge.TestComponent$_PerformancTestObject"> + <service name="com.sun.star.comp.benchmark.JavaTestObject"/> + </implementation> + <implementation name="com.sun.star.comp.bridge.TestComponent$_TestObject"> + <service name="com.sun.star.test.bridge.JavaTestObject"/> + </implementation> +</component> |