1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <uno/threadpool.h>
24 #include <osl/mutex.hxx>
25 #include <osl/diagnose.h>
26 #include <test/XTestFactory.hpp>
27 #include <cppuhelper/servicefactory.hxx>
28 #include <com/sun/star/bridge/XInstanceProvider.hpp>
29 #include <com/sun/star/registry/XImplementationRegistration.hpp>
30 #include <com/sun/star/test/performance/XPerformanceTest.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <cppuhelper/weak.hxx>
33 #include <cppuhelper/supportsservice.hxx>
35 using namespace ::test
;
36 using namespace ::com::sun::star::uno
;
37 using namespace ::com::sun::star::bridge
;
38 using namespace ::com::sun::star::lang
;
39 using namespace ::com::sun::star::registry
;
40 using namespace ::com::sun::star::test::performance
;
45 void parseCommandLine( char *argv
[] ,
46 OUString
*pConnection
, OUString
*pProtocol
,
47 sal_Bool
*pbLatency
, sal_Bool
*pbReverse
)
49 sal_Int32 nArgIndex
= 1;
50 if( ! strcmp( argv
[1] , "-r" ) )
53 *pbReverse
= sal_True
;
55 else if( ! strcmp( argv
[1] , "-latency" ) )
57 *pbLatency
= sal_True
;
61 OUString sTemp
= OUString::createFromAscii( argv
[nArgIndex
] );
62 sal_Int32 nIndex
= sTemp
.indexOf( ';' );
70 *pConnection
= sTemp
.copy( 0 , nIndex
);
71 *pProtocol
= sTemp
.copy( nIndex
+1, sTemp
.getLength() - (nIndex
+1) );
75 Any
OInstanceProvider::queryInterface( const Type
& aType
) throw ( RuntimeException
)
77 Any a
= ::cppu::queryInterface( aType
,
78 (static_cast< XInstanceProvider
* >(this)) );
83 return OWeakObject::queryInterface( aType
);
86 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>
87 OInstanceProvider::getInstance( const OUString
& sObjectName
)
88 throw(::com::sun::star::container::NoSuchElementException
,
89 ::com::sun::star::uno::RuntimeException
)
91 // Tries to get the PerformanceTestObject
92 if( sObjectName
== "TestRemoteObject" )
94 return m_rSMgr
->createInstance(
95 OUString("com.sun.star.test.performance.PerformanceTestObject") );
97 return Reference
< XInterface
> ( (::cppu::OWeakObject
* ) new OTestFactory() );
101 : public XServiceInfo
102 , public XPerformanceTest
104 OUString _aDummyString
;
106 Sequence
< Reference
< XInterface
> > _aDummySequence
;
107 ComplexTypes _aDummyStruct
;
108 RuntimeException _aDummyRE
;
116 ServiceImpl( const Reference
< XMultiServiceFactory
> & /* xMgr */)
121 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
) throw(::com::sun::star::uno::RuntimeException
)
123 // execution time remains appr. constant any time
125 if (aType
== cppu::UnoType
<XInterface
>::get())
127 void * p
= (XInterface
*)(XPerformanceTest
*)this;
128 aRet
.setValue( &p
, cppu::UnoType
<XInterface
>::get() );
130 if (aType
== cppu::UnoType
<XPerformanceTest
>::get())
132 void * p
= (XPerformanceTest
*)this;
133 aRet
.setValue( &p
, cppu::UnoType
<XPerformanceTest
>::get() );
135 if (! aRet
.hasValue())
137 void * p
= (XPerformanceTest
*)this;
138 Any
aDummy( &p
, cppu::UnoType
<XPerformanceTest
>::get() );
142 virtual void SAL_CALL
acquire() throw()
143 { osl_atomic_increment( &_nRef
); }
144 virtual void SAL_CALL
release() throw()
145 { if (! osl_atomic_decrement( &_nRef
)) delete this; }
148 virtual OUString SAL_CALL
getImplementationName() throw (RuntimeException
);
149 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) throw (RuntimeException
);
150 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw (RuntimeException
);
153 virtual sal_Int32 SAL_CALL
getLong_attr() throw(::com::sun::star::uno::RuntimeException
)
155 virtual void SAL_CALL
setLong_attr( sal_Int32
/* _attributelong */) throw(::com::sun::star::uno::RuntimeException
)
157 virtual sal_Int64 SAL_CALL
getHyper_attr() throw(::com::sun::star::uno::RuntimeException
)
159 virtual void SAL_CALL
setHyper_attr( sal_Int64
/* _attributehyper */) throw(::com::sun::star::uno::RuntimeException
)
161 virtual float SAL_CALL
getFloat_attr() throw(::com::sun::star::uno::RuntimeException
)
163 virtual void SAL_CALL
setFloat_attr( float /* _attributefloat */) throw(::com::sun::star::uno::RuntimeException
)
165 virtual double SAL_CALL
getDouble_attr() throw(::com::sun::star::uno::RuntimeException
)
167 virtual void SAL_CALL
setDouble_attr( double /* _attributedouble */) throw(::com::sun::star::uno::RuntimeException
)
169 virtual OUString SAL_CALL
getString_attr() throw(::com::sun::star::uno::RuntimeException
)
170 { return _aDummyString
; }
171 virtual void SAL_CALL
setString_attr( const OUString
& /* _attributestring */) throw(::com::sun::star::uno::RuntimeException
)
173 virtual Reference
< XInterface
> SAL_CALL
getInterface_attr() throw(::com::sun::star::uno::RuntimeException
)
174 { return Reference
< XInterface
>(); }
175 virtual void SAL_CALL
setInterface_attr( const Reference
< XInterface
>& /* _attributeinterface */) throw(::com::sun::star::uno::RuntimeException
)
177 virtual Any SAL_CALL
getAny_attr() throw(::com::sun::star::uno::RuntimeException
)
178 { return _aDummyAny
; }
179 virtual void SAL_CALL
setAny_attr( const Any
& /* _attributeany */) throw(::com::sun::star::uno::RuntimeException
)
181 virtual Sequence
< Reference
< XInterface
> > SAL_CALL
getSequence_attr() throw(::com::sun::star::uno::RuntimeException
)
182 { return _aDummySequence
; }
183 virtual void SAL_CALL
setSequence_attr( const Sequence
< Reference
< XInterface
> >& /* _attributesequence */) throw(::com::sun::star::uno::RuntimeException
)
185 virtual ComplexTypes SAL_CALL
getStruct_attr() throw(::com::sun::star::uno::RuntimeException
)
186 { return _aDummyStruct
; }
187 virtual void SAL_CALL
setStruct_attr( const ::com::sun::star::test::performance::ComplexTypes
& /* _attributestruct */) throw(::com::sun::star::uno::RuntimeException
)
191 virtual sal_Int32 SAL_CALL
getLong() throw(::com::sun::star::uno::RuntimeException
)
193 virtual void SAL_CALL
setLong( sal_Int32
/* _long */) throw(::com::sun::star::uno::RuntimeException
)
195 virtual sal_Int64 SAL_CALL
getHyper() throw(::com::sun::star::uno::RuntimeException
)
197 virtual void SAL_CALL
setHyper( sal_Int64
/* _hyper */) throw(::com::sun::star::uno::RuntimeException
)
199 virtual float SAL_CALL
getFloat() throw(::com::sun::star::uno::RuntimeException
)
201 virtual void SAL_CALL
setFloat( float /* _float */) throw(::com::sun::star::uno::RuntimeException
)
203 virtual double SAL_CALL
getDouble() throw(::com::sun::star::uno::RuntimeException
)
205 virtual void SAL_CALL
setDouble( double /* _double */) throw(::com::sun::star::uno::RuntimeException
)
207 virtual OUString SAL_CALL
getString() throw(::com::sun::star::uno::RuntimeException
)
208 { return _aDummyString
; }
209 virtual void SAL_CALL
setString( const OUString
& /* _string */) throw(::com::sun::star::uno::RuntimeException
)
211 virtual Reference
< XInterface
> SAL_CALL
getInterface() throw(::com::sun::star::uno::RuntimeException
)
212 { return Reference
< XInterface
>(); }
213 virtual void SAL_CALL
setInterface( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& /* _interface */) throw(::com::sun::star::uno::RuntimeException
)
215 virtual Any SAL_CALL
getAny() throw(::com::sun::star::uno::RuntimeException
)
216 { return _aDummyAny
; }
217 virtual void SAL_CALL
setAny( const ::com::sun::star::uno::Any
& /* _any */) throw(::com::sun::star::uno::RuntimeException
)
219 virtual Sequence
< Reference
< XInterface
> > SAL_CALL
getSequence() throw(::com::sun::star::uno::RuntimeException
)
220 { return _aDummySequence
; }
221 virtual void SAL_CALL
setSequence( const Sequence
< Reference
< XInterface
> >& /*_sequence */) throw(::com::sun::star::uno::RuntimeException
)
223 virtual ComplexTypes SAL_CALL
getStruct() throw(::com::sun::star::uno::RuntimeException
)
224 { return _aDummyStruct
; }
225 virtual void SAL_CALL
setStruct( const ::com::sun::star::test::performance::ComplexTypes
& /* c */) throw(::com::sun::star::uno::RuntimeException
)
228 virtual void SAL_CALL
async() throw(::com::sun::star::uno::RuntimeException
);
230 virtual void SAL_CALL
sync() throw(::com::sun::star::uno::RuntimeException
)
232 virtual ComplexTypes SAL_CALL
complex_in( const ::com::sun::star::test::performance::ComplexTypes
& aVal
) throw(::com::sun::star::uno::RuntimeException
)
234 virtual ComplexTypes SAL_CALL
complex_inout( ::com::sun::star::test::performance::ComplexTypes
& aVal
) throw(::com::sun::star::uno::RuntimeException
)
236 virtual void SAL_CALL
complex_oneway( const ::com::sun::star::test::performance::ComplexTypes
& /* aVal */) throw(::com::sun::star::uno::RuntimeException
)
238 virtual void SAL_CALL
complex_noreturn( const ::com::sun::star::test::performance::ComplexTypes
& /* aVal */) throw(::com::sun::star::uno::RuntimeException
)
240 virtual Reference
< XPerformanceTest
> SAL_CALL
createObject() throw(::com::sun::star::uno::RuntimeException
)
241 { return new ServiceImpl(); }
242 virtual void SAL_CALL
raiseRuntimeException( ) throw(::com::sun::star::uno::RuntimeException
)
246 void ServiceImpl::async() throw(::com::sun::star::uno::RuntimeException
)
250 OUString
ServiceImpl::getImplementationName()
251 throw (RuntimeException
)
256 sal_Bool
ServiceImpl::supportsService( const OUString
& rServiceName
)
257 throw (RuntimeException
)
259 return cppu::supportsService(this, rServiceName
);
262 Sequence
< OUString
> ServiceImpl::getSupportedServiceNames()
263 throw (RuntimeException
)
265 return Sequence
< OUString
> ();
268 Any
OCallMe::queryInterface( const Type
& aType
) throw ( RuntimeException
)
270 Any a
= ::cppu::queryInterface( aType
,
271 (static_cast< XCallMe
* >(this)) );
278 return OWeakObject::queryInterface( aType
);
281 void OCallMe::call( const OUString
& s
, sal_Int32 nToDo
)
282 throw( RuntimeException
, ::test::TestBridgeException
)
286 throw TestBridgeException();
291 OString o
= OUStringToOString( s
,RTL_TEXTENCODING_ASCII_US
);
292 printf( "%s\n" , o
.pData
->buffer
);
294 for( sal_Int32 i
= 0 ; i
< nToDo
; i
++ )
300 void SAL_CALL
OCallMe::drawLine( sal_Int32
/* x1 */, sal_Int32
/* y1 */, sal_Int32
/* x2 */, sal_Int32
/* y2 */)
301 throw(::com::sun::star::uno::RuntimeException
)
306 void OCallMe::callOneway( const OUString
& /* s */, sal_Int32 nToDo
)
307 throw(RuntimeException
)
310 m_nLastToDos
= nToDo
;
318 TimeValue val
= { nToDo
, 0 };
319 osl_waitThread( &val
);
325 ::test::TestTypes SAL_CALL
OCallMe::transport( const ::test::TestTypes
& types
)
326 throw(::com::sun::star::uno::RuntimeException
)
331 OUString
OCallMe::getsAttribute() throw(RuntimeException
)
335 void OCallMe::setsAttribute( const OUString
& _sattribute
)
336 throw(RuntimeException
)
338 m_sAttribute
= _sattribute
;
340 void OCallMe::callAgain( const Reference
< ::test::XCallMe
>& callAgainArg
,
341 sal_Int32 nToCall
) throw(RuntimeException
)
343 ::osl::MutexGuard
guard( m_mutex
);
346 printf( "Deadlocktest pong %" SAL_PRIdINT32
"\n", nToCall
);
350 printf( "Deadlocktest ping %" SAL_PRIdINT32
"\n", nToCall
);
354 callAgainArg
->callAgain( Reference
< XCallMe
> ( (XCallMe
*) this ) , nToCall
-1 );
358 Any
OInterfaceTest::queryInterface( const Type
& aType
) throw ( RuntimeException
)
360 Any a
= ::cppu::queryInterface( aType
,
361 (static_cast< XInterfaceTest
* >(this)) );
366 return OWeakObject::queryInterface( aType
);
369 void OInterfaceTest::setIn(
370 const Reference
< ::test::XCallMe
>& callback
)
371 throw(RuntimeException
)
373 m_rCallMe
= callback
;
377 void OInterfaceTest::setInOut( Reference
< ::test::XCallMe
>& callback
)
378 throw(RuntimeException
)
380 Reference
< XCallMe
> r
= m_rCallMe
;
381 m_rCallMe
= callback
;
386 void OInterfaceTest::getOut( Reference
< ::test::XCallMe
>& callback
)
387 throw(RuntimeException
)
389 callback
= m_rCallMe
;
392 Reference
< ::test::XCallMe
> OInterfaceTest::get( )
393 throw(RuntimeException
)
399 void OInterfaceTest::call()
403 m_rCallMe
->call( OUString("This is my String during a callback!") , 5);
407 Any
OTestFactory::queryInterface( const Type
& aType
) throw ( RuntimeException
)
409 Any a
= ::cppu::queryInterface( aType
,
410 (static_cast< XTestFactory
* >(this)) );
417 return OWeakObject::queryInterface( aType
);
420 Reference
< ::test::XCallMe
> OTestFactory::createCallMe( )
421 throw(RuntimeException
)
423 return Reference
< XCallMe
> ( (XCallMe
* ) new OCallMe() );
426 Reference
< ::test::XInterfaceTest
> SAL_CALL
OTestFactory::createInterfaceTest( )
427 throw(RuntimeException
)
429 return Reference
< XInterfaceTest
> ( (XInterfaceTest
* ) new OInterfaceTest() );
432 // class OInstanceProvider :
433 // public ::cppu::OWeakObject,
434 // public XInstanceProvider
437 // OInstanceProvider( ){}
438 // ~OInstanceProvider(){ printf( "instance provider dies\n" );}
441 // Any SAL_CALL queryInterface( const Type & aType);
442 // void SAL_CALL acquire() { OWeakObject::acquire(); }
443 // void SAL_CALL release() { OWeakObject::release(); }
446 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
447 // getInstance( const OUString& sObjectName )
448 // throw( ::com::sun::star::container::NoSuchElementException,
449 // ::com::sun::star::uno::RuntimeException);
452 double getCallsPerSec( const Reference
< XCallMe
> &rCall
, int nLoops
, int nToDo
)
454 TimeValue aStartTime
, aEndTime
;
455 osl_getSystemTime( &aStartTime
);
456 for( sal_Int32 i
= 0; i
< nLoops
; i
++ )
458 rCall
->call( OUString("Performance test string") , nToDo
);
460 osl_getSystemTime( &aEndTime
);
462 double fStart
= (double)aStartTime
.Seconds
+ ((double)aStartTime
.Nanosec
/ 1000000000.0);
463 double fEnd
= (double)aEndTime
.Seconds
+ ((double)aEndTime
.Nanosec
/ 1000000000.0);
467 double getCallsPerSecOneway( const Reference
< XCallMe
> &rCall
,
470 double *pdAfterExecution
473 TimeValue aStartTime
, aEndTime
, aAfterExecution
;
474 osl_getSystemTime( &aStartTime
);
475 for( sal_Int32 i
= 0; i
< nLoops
; i
++ )
477 // rCall->callOneway( OUString("Performance test string" ), 0 );
478 rCall
->drawLine( 0 , 0 , 500 , 123 );
480 osl_getSystemTime( &aEndTime
);
482 rCall
->call( OUString("Performance test string") , nToDo
);
483 osl_getSystemTime( &aAfterExecution
);
485 double fStart
= (double)aStartTime
.Seconds
+ ((double)aStartTime
.Nanosec
/ 1000000000.0);
486 double fEnd
= (double)aEndTime
.Seconds
+ ((double)aEndTime
.Nanosec
/ 1000000000.0);
487 *pdAfterExecution
= (double)aAfterExecution
.Seconds
+
488 ((double)aAfterExecution
.Nanosec
/ 1000000000.0) - fStart
;
492 void testOnewayPerformanceOnTwoInterfaces(
493 const Reference
< XCallMe
> &rRemote1
, const Reference
< XCallMe
> &rRemote2
)
495 printf( "Doing oneway performance test on two interfaces ...\n" );
496 const sal_Int32 nLoops
= 10000;
497 TimeValue aStartTime
, aEndTime
;
498 osl_getSystemTime( &aStartTime
);
499 for( sal_Int32 i
= 0; i
< nLoops
; i
++ )
501 rRemote1
->drawLine( 0 , 0 , 500 , 123 );
502 rRemote2
->drawLine( 0 , 0 , 500 , 123 );
504 osl_getSystemTime( &aEndTime
);
505 double fStart
= (double)aStartTime
.Seconds
+ ((double)aStartTime
.Nanosec
/ 1000000000.0);
506 double fEnd
= (double)aEndTime
.Seconds
+ ((double)aEndTime
.Nanosec
/ 1000000000.0);
508 printf( "Overhead per Call [ms] %g\n" , ((fEnd
-fStart
)/((double)nLoops
/1000 ))/2. );
511 void testPerformance( const Reference
< XCallMe
> &rRemote
,
512 const Reference
< XCallMe
> &rLocal
)
514 sal_Int32 nDoSomething
= 1;
515 sal_Int32 nCalls
= 80000;
516 double dRemote
, dLocal
,dAfterExecution
;
518 printf( "performance test oneway...\n" );
519 dLocal
= getCallsPerSecOneway( rLocal
, nCalls
, nDoSomething
, &dAfterExecution
);
520 dRemote
= getCallsPerSecOneway( rRemote
, nCalls
, nDoSomething
, &dAfterExecution
);
521 printf( "Local=%g s,"
522 "Remote : %g s\n" , dLocal
, dRemote
);
525 printf( "Remote/Local : %g\n", dRemote
/dLocal
);
528 printf( "Overhead per Call [ms] %g\n" , (dRemote
- dLocal
)/((double)nCalls
/1000 ) );
529 printf( "Overhead per Call after completion [ms] %g\n" , (dAfterExecution
- dLocal
)/((double)nCalls
/1000 ) );
533 printf( "Doing performance test ...\n" );
534 dRemote
= getCallsPerSec( rRemote
, nCalls
, nDoSomething
);
535 dLocal
= getCallsPerSec( rLocal
, nCalls
, nDoSomething
);
536 printf( "Local=%g s,\n"
537 "Remote=%g s\n" , dLocal
, dRemote
);
540 printf( "Remote/Local : %g\n", dRemote
/dLocal
);
542 printf( "Overhead per synchron Call [ms] %g\n" , ((dRemote
- dLocal
)/((double)nCalls
/1000 )) );
545 void testException( const Reference
< XCallMe
> &r
)
548 r
->call( OUString("dummy") , -1 );
549 OSL_ASSERT( ! "no exception flown !" );
551 catch( TestBridgeException
& e
)
553 // Exception flew successfully !
555 catch( Exception
& e
)
557 OSL_ASSERT( ! "only base class of exception could be catched!" );
561 OSL_ASSERT(! "wrong unknown exception !" );
565 void testSequenceOfCalls( const Reference
< XCallMe
> & rRCallMe
)
567 printf( "Testing sequence of calls\n" );
568 for( sal_Int32 i
= 0 ; i
< 800 ; i
++ )
570 rRCallMe
->callOneway( OUString("hifuj" ), 0 );
574 void testAllTypes( const Reference
< XCallMe
> & rRCallMe
)
576 printf( "Testing all types\n" );
578 for( sal_Int32 i
= 0; i
< 32 ; i
++ )
582 types
.Bool
= sal_True
;
585 types
.Short
= -32000;
586 types
.UShort
= (sal_uInt16
) (1 << i
);
588 types
.ULong
= 1 << i
;
590 types
.UHyper
= 1 << i
*2;
591 types
.Float
= (float)123.239;
592 types
.Double
= 1279.12490012;
593 types
.String
= OUString("abcdefghijklmnopqrstuvwxyz");
594 types
.Interface
= Reference
< XInterface
>( rRCallMe
, UNO_QUERY
);
595 types
.Any
<<= types
.Double
;
597 TestTypes retTypes
= rRCallMe
->transport( types
);
599 OSL_ASSERT( ( types
.Bool
&& retTypes
.Bool
) || ( ! types
.Bool
&& ! retTypes
.Bool
) );
600 OSL_ASSERT( types
.Char
== retTypes
.Char
);
601 OSL_ASSERT( types
.Byte
== retTypes
.Byte
);
602 OSL_ASSERT( types
.Short
== retTypes
.Short
);
603 OSL_ASSERT( types
.UShort
== retTypes
.UShort
);
604 OSL_ASSERT( types
.Long
== retTypes
.Long
);
605 OSL_ASSERT( types
.ULong
== retTypes
.ULong
);
606 OSL_ASSERT( types
.Hyper
== retTypes
.Hyper
);
607 OSL_ASSERT( types
.UHyper
== retTypes
.UHyper
);
608 OSL_ASSERT( types
.Float
== retTypes
.Float
);
609 OSL_ASSERT( types
.Double
== retTypes
.Double
);
610 OSL_ASSERT( types
.String
== retTypes
.String
);
611 OSL_ASSERT( types
.Interface
== retTypes
.Interface
);
612 OSL_ASSERT( types
.Any
== retTypes
.Any
);
616 void testRemote( const Reference
< XInterface
> &rRemote
)
618 cppu::UnoType
<sal_Int8
>::get();
620 Reference
< XTestFactory
> rRFact( rRemote
, UNO_QUERY
);
623 printf( "remote object doesn't support XTestFactory\n" );
626 OSL_ASSERT( rRFact
.is() );
627 Reference
< XCallMe
> rLCallMe
= (XCallMe
* ) new OCallMe();
628 Reference
< XCallMe
> rRCallMe
= rRFact
->createCallMe();
630 testAllTypes( rLCallMe
);
631 testAllTypes( rRCallMe
);
633 printf( "Testing exception local ...\n" );
634 testException( rLCallMe
);
635 printf( "Testing exception remote ...\n" );
636 testException( rRCallMe
);
639 OUString
ow( "dum didel dum dideldei" );
640 rLCallMe
->setsAttribute( ow
);
641 OSL_ASSERT( rLCallMe
->getsAttribute() == ow
);
643 rRCallMe
->setsAttribute( ow
);
644 OSL_ASSERT( rRCallMe
->getsAttribute() == ow
);
647 testPerformance( rRCallMe
, rLCallMe
);
648 testOnewayPerformanceOnTwoInterfaces( rRFact
->createCallMe(), rRCallMe
);
651 testSequenceOfCalls( rRCallMe
);
654 // test triple to check if transporting the same interface multiple
655 // times causes any problems
656 Reference
< XInterfaceTest
> rRTest
= rRFact
->createInterfaceTest();
657 Reference
< XInterfaceTest
> rRTest2
= rRFact
->createInterfaceTest();
658 Reference
< XInterfaceTest
> rRTest3
= rRFact
->createInterfaceTest();
660 rRTest
->setIn( rRCallMe
);
661 rRTest2
->setIn( rRCallMe
);
662 rRTest3
->setIn( rRCallMe
);
664 OSL_ASSERT( rRTest
->get() == rRCallMe
);
665 OSL_ASSERT( rRTest2
->get() == rRCallMe
);
666 OSL_ASSERT( rRTest3
->get() == rRCallMe
);
668 rRTest
->setIn( rLCallMe
);
669 rRTest2
->setIn( rLCallMe
);
670 rRTest3
->setIn( rLCallMe
);
673 Reference
< XCallMe
> rLCallMe1
= (XCallMe
* ) new OCallMe();
674 Reference
< XCallMe
> rLCallMe2
= (XCallMe
* ) new OCallMe();
675 Reference
< XCallMe
> rLCallMe3
= (XCallMe
* ) new OCallMe();
676 rRTest
->setIn( rLCallMe1
);
677 rRTest2
->setIn( rLCallMe2
);
678 rRTest3
->setIn( rLCallMe3
);
679 OSL_ASSERT( rRTest
->get() == rLCallMe1
);
680 OSL_ASSERT( rRTest2
->get() == rLCallMe2
);
681 OSL_ASSERT( rRTest3
->get() == rLCallMe3
);
683 rRTest
->setIn( rLCallMe
);
684 rRTest2
->setIn( rLCallMe
);
685 rRTest3
->setIn( rLCallMe
);
687 OSL_ASSERT( rRTest
->get() == rLCallMe
);
688 OSL_ASSERT( rRTest2
->get() == rLCallMe
);
689 OSL_ASSERT( rRTest3
->get() == rLCallMe
);
692 Reference
< XCallMe
> r
= rRCallMe
;
693 rRTest
->setInOut( r
);
694 OSL_ASSERT( r
== rLCallMe
);
695 OSL_ASSERT( ! ( r
== rRCallMe
) );
697 // test empty references
698 rRTest
->setIn( Reference
< XCallMe
> () );
700 // test thread deadlocking
701 rLCallMe
->callAgain( rRCallMe
, 20 );
705 Reference
<XInterface
> createComponent( const OUString
&sService
,
706 const OUString
&sDllName
,
707 const Reference
< XMultiServiceFactory
> &rSMgr
)
709 Reference
< XInterface
> rInterface
;
710 rInterface
= rSMgr
->createInstance( sService
);
712 if( ! rInterface
.is() )
715 Reference
< XImplementationRegistration
> rReg (
716 rSMgr
->createInstance(
717 OUString( "com.sun.star.registry.ImplementationRegistration" )),
720 OSL_ASSERT( rReg
.is() );
721 OUString aDllName
= sDllName
;
725 rReg
->registerImplementation(
726 OUString( "com.sun.star.loader.SharedLibrary" ),
728 Reference
< XSimpleRegistry
> () );
729 rInterface
= rSMgr
->createInstance( sService
);
733 printf( "couldn't register dll %s\n" ,
734 OUStringToOString( aDllName
, RTL_TEXTENCODING_ASCII_US
).getStr() );
740 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */