From 7ff06e3c0b9c474064ba5448d2104a2059466269 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Thu, 20 Mar 2003 11:27:09 +0000 Subject: INTEGRATION: CWS uno1 (1.9.6.1.6); FILE MERGED 2003/03/11 16:03:58 dbo 1.9.6.1.6.1: #107762# loading core uno component with full path; code cleanup --- cppuhelper/test/testhelper.cxx | 66 ++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'cppuhelper/test/testhelper.cxx') diff --git a/cppuhelper/test/testhelper.cxx b/cppuhelper/test/testhelper.cxx index 68e223a64086..2ce322d1ca4d 100644 --- a/cppuhelper/test/testhelper.cxx +++ b/cppuhelper/test/testhelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: testhelper.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: hr $ $Date: 2003-03-19 17:23:42 $ + * last change: $Author: vg $ $Date: 2003-03-20 12:27:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,51 +86,47 @@ int main( int argc, char * argv[] ) int __cdecl main( int argc, char * argv[] ) #endif { - Reference< XMultiComponentFactory > xMgr( createRegistryServiceFactory( - OUString( RTL_CONSTASCII_USTRINGPARAM("cpputest.rdb") ) ), UNO_QUERY ); - Reference< XComponentContext > xInitialContext; - OSL_VERIFY( Reference< beans::XPropertySet >( xMgr, UNO_QUERY )->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xInitialContext ); - - ContextEntry_Init aEntry; - aEntry.bLateInitService = false; - aEntry.name = OUString( RTL_CONSTASCII_USTRINGPARAM("bla, bla") ); - aEntry.value = makeAny( (sal_Int32)5 ); - Reference< XComponentContext > xContext( createComponentContext( &aEntry, 1, xInitialContext ) ); - OSL_ASSERT( xContext->getServiceManager() != xMgr ); // must be wrapped one - OSL_ASSERT( - Reference< beans::XPropertySet >( - xContext->getServiceManager(), UNO_QUERY )->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) != xInitialContext ); - - sal_Bool bSucc = sal_False; try { + Reference< XMultiComponentFactory > xMgr( createRegistryServiceFactory( + OUString( RTL_CONSTASCII_USTRINGPARAM("cpputest.rdb") ) ), UNO_QUERY ); + Reference< XComponentContext > xInitialContext; + OSL_VERIFY( Reference< beans::XPropertySet >( xMgr, UNO_QUERY )->getPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xInitialContext ); + + ContextEntry_Init aEntry; + aEntry.bLateInitService = false; + aEntry.name = OUString( RTL_CONSTASCII_USTRINGPARAM("bla, bla") ); + aEntry.value = makeAny( (sal_Int32)5 ); + Reference< XComponentContext > xContext( createComponentContext( &aEntry, 1, xInitialContext ) ); + OSL_ASSERT( xContext->getServiceManager() != xMgr ); // must be wrapped one + OSL_ASSERT( + Reference< beans::XPropertySet >( + xContext->getServiceManager(), UNO_QUERY )->getPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) != xInitialContext ); + Reference< XMultiServiceFactory > x( xMgr, UNO_QUERY ); test_ImplHelper( x ); testPropertyTypeHelper(); testidlclass( x ); test_PropertySetHelper(); test_interfacecontainer(); + + OSL_VERIFY( xContext->getValueByName( + OUString( RTL_CONSTASCII_USTRINGPARAM("bla, bla") ) ) == (sal_Int32)5 ); + OSL_VERIFY( ! xInitialContext->getValueByName( + OUString( RTL_CONSTASCII_USTRINGPARAM("bla, bla") ) ).hasValue() ); + Reference< XComponent >( xInitialContext, UNO_QUERY )->dispose(); + xMgr.clear(); + xContext.clear(); + xInitialContext.clear(); } - catch (Exception & rExc) + catch (Exception & exc) { - OSL_ENSURE( sal_False, "### exception occured!" ); - OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### exception occured: " ); - OSL_TRACE( aMsg.getStr() ); - OSL_TRACE( "\n" ); + OString cstr_msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); + OSL_ENSURE( ! "exception occured: ", cstr_msg.getStr() ); } - OSL_VERIFY( xContext->getValueByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("bla, bla") ) ) == (sal_Int32)5 ); - OSL_VERIFY( ! xInitialContext->getValueByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("bla, bla") ) ).hasValue() ); - Reference< XComponent >( xInitialContext, UNO_QUERY )->dispose(); - xMgr.clear(); - xContext.clear(); - xInitialContext.clear(); - printf( "Test finished\n" ); return 0; } -- cgit