diff options
author | sb <sb@openoffice.org> | 2010-05-14 13:50:22 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-05-14 13:50:22 +0200 |
commit | 88d1e25d5c61d1d4ef12f0ac397db3c8b399564c (patch) | |
tree | 2d2b3c400eff3ba6eef398db04f5fcdba4ee33b0 /test/source | |
parent | c170fae47342a76bc8b86dcfef750a707fac617b (diff) |
sb123: #i111598# OfficeConnection getFactory -> getComponentContext
Diffstat (limited to 'test/source')
-rw-r--r-- | test/source/cpp/officeconnection.cxx | 23 | ||||
-rw-r--r-- | test/source/java/OfficeConnection.java | 23 |
2 files changed, 24 insertions, 22 deletions
diff --git a/test/source/cpp/officeconnection.cxx b/test/source/cpp/officeconnection.cxx index ccfd2cd0a069..c8c42873c4a8 100644 --- a/test/source/cpp/officeconnection.cxx +++ b/test/source/cpp/officeconnection.cxx @@ -30,8 +30,8 @@ #include "com/sun/star/connection/NoConnectException.hpp" #include "com/sun/star/frame/XDesktop.hpp" #include "com/sun/star/lang/DisposedException.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" #include "cppuhelper/bootstrap.hxx" #include "cppunit/TestAssert.h" #include "osl/process.h" @@ -118,14 +118,14 @@ void OfficeConnection::setUp() { cppu::defaultBootstrap_InitialComponentContext())); for (;;) { try { - factory_ = - css::uno::Reference< css::lang::XMultiServiceFactory >( + context_ = + css::uno::Reference< css::uno::XComponentContext >( resolver->resolve( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:")) + desc + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - ";urp;StarOffice.ServiceManager"))), + ";urp;StarOffice.ComponentContext"))), css::uno::UNO_QUERY_THROW); break; } catch (css::connection::NoConnectException &) {} @@ -139,13 +139,14 @@ void OfficeConnection::setUp() { } void OfficeConnection::tearDown() { - if (factory_.is()) { + if (context_.is()) { css::uno::Reference< css::frame::XDesktop > desktop( - factory_->createInstance( + context_->getServiceManager()->createInstanceWithContext( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), + context_), css::uno::UNO_QUERY_THROW); - factory_.clear(); + context_.clear(); try { CPPUNIT_ASSERT(desktop->terminate()); desktop.clear(); @@ -165,9 +166,9 @@ void OfficeConnection::tearDown() { } } -css::uno::Reference< css::lang::XMultiServiceFactory > -OfficeConnection::getFactory() const { - return factory_; +css::uno::Reference< css::uno::XComponentContext > +OfficeConnection::getComponentContext() const { + return context_; } } diff --git a/test/source/java/OfficeConnection.java b/test/source/java/OfficeConnection.java index 6887c3bfa3cd..b0b08c1643fd 100644 --- a/test/source/java/OfficeConnection.java +++ b/test/source/java/OfficeConnection.java @@ -31,8 +31,8 @@ import com.sun.star.comp.helper.Bootstrap; import com.sun.star.connection.NoConnectException; import com.sun.star.frame.XDesktop; import com.sun.star.lang.DisposedException; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; @@ -85,11 +85,11 @@ public final class OfficeConnection { Bootstrap.createInitialComponentContext(null)); for (;;) { try { - factory = UnoRuntime.queryInterface( - XMultiServiceFactory.class, + context = UnoRuntime.queryInterface( + XComponentContext.class, resolver.resolve( "uno:" + description + - ";urp;StarOffice.ServiceManager")); + ";urp;StarOffice.ComponentContext")); break; } catch (NoConnectException e) {} if (process != null) { @@ -104,11 +104,12 @@ public final class OfficeConnection { throws InterruptedException, com.sun.star.uno.Exception { boolean desktopTerminated = true; - if (factory != null) { + if (context != null) { XDesktop desktop = UnoRuntime.queryInterface( XDesktop.class, - factory.createInstance("com.sun.star.frame.Desktop")); - factory = null; + context.getServiceManager().createInstanceWithContext( + "com.sun.star.frame.Desktop", context)); + context = null; try { desktopTerminated = desktop.terminate(); } catch (DisposedException e) {} @@ -130,10 +131,10 @@ public final class OfficeConnection { assertTrue(errTerminated); } - /** Obtain the service factory of the running OOo instance. + /** Obtain the component context of the running OOo instance. */ - public XMultiServiceFactory getFactory() { - return factory; + public XComponentContext getComponentContext() { + return context; } //TODO: get rid of this hack for legacy qa/unoapi tests @@ -217,5 +218,5 @@ public final class OfficeConnection { private Process process = null; private Forward outForward = null; private Forward errForward = null; - private XMultiServiceFactory factory = null; + private XComponentContext context = null; } |