diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-01-18 20:05:40 -0500 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2017-01-19 01:45:08 +0000 |
commit | bbf40e3b5d06bd1437b097ed2703179026d1e871 (patch) | |
tree | 2abeb474c0edc1dda54740f7085a9056efdc7be2 /package | |
parent | acbcec11940d245aabed93ca756ef9462e06f192 (diff) |
Use the old-fashion way to instantiate a UNO service.
Change-Id: Ibc5c55dbe9c4c5101ebb292696f79e4e8c8a35c5
Reviewed-on: https://gerrit.libreoffice.org/33293
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'package')
-rw-r--r-- | package/qa/cppunit/test_package.cxx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx index 80f02d8e4842..335f490ddaba 100644 --- a/package/qa/cppunit/test_package.cxx +++ b/package/qa/cppunit/test_package.cxx @@ -11,7 +11,8 @@ #include <unotest/filters-test.hxx> #include <unotest/bootstrapfixturebase.hxx> #include <comphelper/threadpool.hxx> -#include "com/sun/star/packages/zip/ZipFileAccess.hpp" +#include <com/sun/star/packages/zip/ZipFileAccess.hpp> +#include <com/sun/star/beans/NamedValue.hpp> #include <iterator> @@ -96,14 +97,22 @@ namespace OUString aURL = m_directories.getURLFromSrc("/package/qa/cppunit/data/a2z.zip"); - uno::Sequence<beans::NamedValue> aArgs(2); - aArgs[0].Name = "URL"; - aArgs[0].Value <<= aURL; - aArgs[1].Name = "UseBufferedStream"; - aArgs[1].Value <<= true; + uno::Sequence<beans::NamedValue> aNVs(2); + aNVs[0].Name = "URL"; + aNVs[0].Value <<= aURL; + aNVs[1].Name = "UseBufferedStream"; + aNVs[1].Value <<= true; + + uno::Sequence<uno::Any> aArgs(1); + aArgs[0] <<= aNVs; + + uno::Reference<uno::XComponentContext> xCxt = comphelper::getProcessComponentContext(); + uno::Reference<lang::XMultiComponentFactory> xSvcMgr = xCxt->getServiceManager(); uno::Reference<packages::zip::XZipFileAccess2> xZip( - packages::zip::ZipFileAccess::createWithArguments(comphelper::getProcessComponentContext(), aArgs)); + xSvcMgr->createInstanceWithArgumentsAndContext( + "com.sun.star.packages.zip.ZipFileAccess", aArgs, xCxt), + uno::UNO_QUERY); CPPUNIT_ASSERT(xZip.is()); |