1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #include "precompiled_configmgr.hxx" 25 #include "sal/config.h" 26 27 #include <cstddef> 28 #include <cstdlib> 29 30 #include "com/sun/star/beans/NamedValue.hpp" 31 #include "com/sun/star/beans/PropertyChangeEvent.hpp" 32 #include "com/sun/star/beans/XPropertyChangeListener.hpp" 33 #include "com/sun/star/beans/XPropertySet.hpp" 34 #include "com/sun/star/beans/XPropertyState.hpp" 35 #include "com/sun/star/container/XHierarchicalNameAccess.hpp" 36 #include "com/sun/star/container/XNameReplace.hpp" 37 #include "com/sun/star/container/XNamed.hpp" 38 #include "com/sun/star/lang/EventObject.hpp" 39 #include "com/sun/star/lang/XComponent.hpp" 40 #include "com/sun/star/lang/XMultiServiceFactory.hpp" 41 #include "com/sun/star/uno/Any.hxx" 42 #include "com/sun/star/uno/Reference.hxx" 43 #include "com/sun/star/uno/RuntimeException.hpp" 44 #include "com/sun/star/uno/Sequence.hxx" 45 #include "com/sun/star/uno/XComponentContext.hpp" 46 #include "com/sun/star/uno/XInterface.hpp" 47 #include "com/sun/star/util/XChangesBatch.hpp" 48 #include "cppuhelper/implbase1.hxx" 49 #include "cppuhelper/servicefactory.hxx" 50 #include "osl/conditn.hxx" 51 #include "osl/process.h" 52 #include "osl/thread.h" 53 #include "osl/thread.hxx" 54 #include "osl/time.h" 55 #include "rtl/ref.hxx" 56 #include "rtl/string.h" 57 #include "rtl/textcvt.h" 58 #include "rtl/ustrbuf.hxx" 59 #include "rtl/ustring.h" 60 #include "rtl/ustring.hxx" 61 #include "sal/types.h" 62 #include "gtest/gtest.h" 63 64 namespace { 65 66 namespace css = com::sun::star; 67 68 void normalize( 69 rtl::OUString const & path, rtl::OUString const & relative, 70 rtl::OUString * normalizedPath, rtl::OUString * name) 71 { 72 sal_Int32 i = relative.lastIndexOf('/'); 73 if (i == -1) { 74 *normalizedPath = path; 75 *name = relative; 76 } else { 77 rtl::OUStringBuffer buf(path); 78 buf.append(sal_Unicode('/')); 79 buf.append(relative.copy(0, i)); 80 *normalizedPath = buf.makeStringAndClear(); 81 *name = relative.copy(i + 1); 82 } 83 } 84 85 class Test: public ::testing::Test { 86 public: 87 virtual void SetUp(); 88 89 virtual void TearDown(); 90 91 css::uno::Any getKey( 92 rtl::OUString const & path, rtl::OUString const & relative) const; 93 94 void setKey( 95 rtl::OUString const & path, rtl::OUString const & name, 96 css::uno::Any const & value) const; 97 98 bool resetKey(rtl::OUString const & path, rtl::OUString const & name) const; 99 100 css::uno::Reference< css::uno::XInterface > createViewAccess( 101 rtl::OUString const & path) const; 102 103 css::uno::Reference< css::uno::XInterface > createUpdateAccess( 104 rtl::OUString const & path) const; 105 106 private: 107 css::uno::Reference< css::uno::XComponentContext > context_; 108 css::uno::Reference< css::lang::XMultiServiceFactory > provider_; 109 }; 110 111 class TestThread: public osl::Thread { 112 public: 113 TestThread(osl::Condition & stop); 114 115 bool getSuccess() const; 116 117 protected: 118 virtual bool iteration() = 0; 119 120 private: 121 virtual void SAL_CALL run(); 122 123 osl::Condition & stop_; 124 bool success_; 125 }; 126 127 TestThread::TestThread( 128 osl::Condition & stop): 129 stop_(stop), success_(true) 130 {} 131 132 bool TestThread::getSuccess() const { 133 return success_; 134 } 135 136 void TestThread::run() { 137 try { 138 while (!stop_.check()) { 139 if (!iteration()) { 140 success_ = false; 141 } 142 } 143 } catch (...) { 144 success_ = false; 145 } 146 } 147 148 class ReaderThread: public TestThread { 149 public: 150 ReaderThread( 151 osl::Condition & stop, Test const & test, rtl::OUString const & path, 152 rtl::OUString const & relative); 153 154 private: 155 virtual bool iteration(); 156 157 Test const & test_; 158 rtl::OUString path_; 159 rtl::OUString relative_; 160 }; 161 162 ReaderThread::ReaderThread( 163 osl::Condition & stop, Test const & test, rtl::OUString const & path, 164 rtl::OUString const & relative): 165 TestThread(stop), test_(test), path_(path), relative_(relative) 166 { 167 create(); 168 } 169 170 bool ReaderThread::iteration() { 171 return test_.getKey(path_, relative_).hasValue(); 172 } 173 174 class WriterThread: public TestThread { 175 public: 176 WriterThread( 177 osl::Condition & stop, Test const & test, rtl::OUString const & path, 178 rtl::OUString const & relative); 179 180 private: 181 virtual bool iteration(); 182 183 Test const & test_; 184 rtl::OUString path_; 185 rtl::OUString name_; 186 std::size_t index_; 187 }; 188 189 WriterThread::WriterThread( 190 osl::Condition & stop, Test const & test, rtl::OUString const & path, 191 rtl::OUString const & relative): 192 TestThread(stop), test_(test), index_(0) 193 { 194 normalize(path, relative, &path_, &name_); 195 create(); 196 } 197 198 bool WriterThread::iteration() { 199 rtl::OUString options[] = { 200 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fish")), 201 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("chips")), 202 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("kippers")), 203 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bloaters")) }; 204 test_.setKey(path_, name_, css::uno::makeAny(options[index_])); 205 index_ = (index_ + 1) % (sizeof options / sizeof (rtl::OUString)); 206 return true; 207 } 208 209 class RecursiveTest: 210 public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > 211 { 212 public: 213 RecursiveTest(Test const & theTest, int count, bool * destroyed); 214 215 void test(); 216 217 protected: 218 virtual ~RecursiveTest(); 219 220 virtual void step() const = 0; 221 222 Test const & test_; 223 224 private: 225 virtual void SAL_CALL disposing(css::lang::EventObject const &); 226 227 virtual void SAL_CALL propertyChange( 228 css::beans::PropertyChangeEvent const &); 229 230 int count_; 231 bool * destroyed_; 232 css::uno::Reference< css::beans::XPropertySet > properties_; 233 }; 234 235 RecursiveTest::RecursiveTest( 236 Test const & theTest, int count, bool * destroyed): 237 test_(theTest), count_(count), destroyed_(destroyed) 238 {} 239 240 void RecursiveTest::test() { 241 properties_ = css::uno::Reference< css::beans::XPropertySet >( 242 test_.createUpdateAccess( 243 rtl::OUString( 244 RTL_CONSTASCII_USTRINGPARAM( 245 "/org.openoffice.UI.GenericCommands/UserInterface/Commands/" 246 "dotuno:WebHtml"))), 247 css::uno::UNO_QUERY_THROW); 248 properties_->addPropertyChangeListener( 249 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), this); 250 step(); 251 ASSERT_TRUE(count_ == 0); 252 css::uno::Reference< css::lang::XComponent >( 253 properties_, css::uno::UNO_QUERY_THROW)->dispose(); 254 } 255 256 RecursiveTest::~RecursiveTest() { 257 *destroyed_ = true; 258 } 259 260 void RecursiveTest::disposing(css::lang::EventObject const & Source) 261 { 262 ASSERT_TRUE(properties_.is() && Source.Source == properties_); 263 properties_.clear(); 264 } 265 266 void RecursiveTest::propertyChange(css::beans::PropertyChangeEvent const & evt) 267 { 268 ASSERT_TRUE( 269 evt.Source == properties_ && 270 evt.PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Label"))); 271 if (count_ > 0) { 272 --count_; 273 step(); 274 } 275 } 276 277 class SimpleRecursiveTest: public RecursiveTest { 278 public: 279 SimpleRecursiveTest(Test const & theTest, int count, bool * destroyed); 280 281 private: 282 virtual void step() const; 283 }; 284 285 SimpleRecursiveTest::SimpleRecursiveTest( 286 Test const & theTest, int count, bool * destroyed): 287 RecursiveTest(theTest, count, destroyed) 288 {} 289 290 void SimpleRecursiveTest::step() const { 291 test_.setKey( 292 rtl::OUString( 293 RTL_CONSTASCII_USTRINGPARAM( 294 "/org.openoffice.UI.GenericCommands/UserInterface/Commands/" 295 "dotuno:WebHtml")), 296 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), 297 css::uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("step")))); 298 } 299 300 class CrossThreadTest: public RecursiveTest { 301 public: 302 CrossThreadTest(Test const & theTest, int count, bool * destroyed); 303 304 private: 305 virtual void step() const; 306 }; 307 308 CrossThreadTest::CrossThreadTest( 309 Test const & theTest, int count, bool * destroyed): 310 RecursiveTest(theTest, count, destroyed) 311 {} 312 313 void CrossThreadTest::step() const { 314 osl::Condition stop; 315 stop.set(); 316 WriterThread( 317 stop, test_, 318 rtl::OUString( 319 RTL_CONSTASCII_USTRINGPARAM( 320 "/org.openoffice.UI.GenericCommands/UserInterface/Commands/" 321 "dotuno:WebHtml")), 322 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))).join(); 323 test_.resetKey( 324 rtl::OUString( 325 RTL_CONSTASCII_USTRINGPARAM( 326 "/org.openoffice.UI.GenericCommands/UserInterface/Commands/" 327 "dotuno:WebHtml")), 328 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))); 329 } 330 331 void Test::SetUp() { 332 char const * forward = getenv("CONFIGMGR_UNIT_FORWARD_STRING"); 333 rtl_uString * registry = 0; 334 ASSERT_TRUE( 335 rtl_convertStringToUString( 336 ®istry, forward, rtl_str_getLength(forward), 337 osl_getThreadTextEncoding(), 338 (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | 339 RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | 340 RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))); 341 context_ = css::uno::Reference< css::uno::XComponentContext >( 342 css::uno::Reference< css::beans::XPropertySet >( 343 cppu::createRegistryServiceFactory( 344 rtl::OUString(registry, SAL_NO_ACQUIRE)), 345 css::uno::UNO_QUERY_THROW)->getPropertyValue( 346 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))), 347 css::uno::UNO_QUERY_THROW); 348 ASSERT_TRUE( 349 context_->getValueByName( 350 rtl::OUString( 351 RTL_CONSTASCII_USTRINGPARAM( 352 "/singletons/" 353 "com.sun.star.configuration.theDefaultProvider"))) >>= 354 provider_); 355 } 356 357 void Test::TearDown() { 358 css::uno::Reference< css::lang::XComponent >( 359 context_, css::uno::UNO_QUERY_THROW)->dispose(); 360 } 361 362 TEST_F(Test, testKeyFetch) { 363 rtl::OUString s; 364 ASSERT_TRUE( 365 getKey( 366 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), 367 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale"))) >>= 368 s); 369 ASSERT_TRUE( 370 getKey( 371 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), 372 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/AString"))) >>= 373 s); 374 } 375 376 TEST_F(Test, testKeySet) { 377 setKey( 378 rtl::OUString( 379 RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")), 380 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString")), 381 css::uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baa")))); 382 rtl::OUString s; 383 ASSERT_TRUE( 384 getKey( 385 rtl::OUString( 386 RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")), 387 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString"))) >>= 388 s); 389 ASSERT_TRUE(s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("baa"))); 390 } 391 392 TEST_F(Test, testKeyReset) { 393 if (resetKey( 394 rtl::OUString( 395 RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")), 396 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString")))) 397 { 398 rtl::OUString s; 399 ASSERT_TRUE( 400 getKey( 401 rtl::OUString( 402 RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")), 403 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString"))) >>= 404 s); 405 ASSERT_TRUE(s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Foo"))); 406 } 407 } 408 409 TEST_F(Test, testSetSetMemberName) { 410 rtl::OUString s; 411 ASSERT_TRUE( 412 getKey( 413 rtl::OUString( 414 RTL_CONSTASCII_USTRINGPARAM( 415 "/org.openoffice.UI.GenericCommands/UserInterface/Commands/" 416 ".uno:FontworkShapeType")), 417 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))) >>= 418 s); 419 ASSERT_TRUE( 420 s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Fontwork Shape"))); 421 422 css::uno::Reference< css::container::XNameAccess > access( 423 createUpdateAccess( 424 rtl::OUString( 425 RTL_CONSTASCII_USTRINGPARAM( 426 "/org.openoffice.UI.GenericCommands/UserInterface/" 427 "Commands"))), 428 css::uno::UNO_QUERY_THROW); 429 css::uno::Reference< css::container::XNamed > member; 430 access->getByName( 431 rtl::OUString( 432 RTL_CONSTASCII_USTRINGPARAM(".uno:FontworkGalleryFloater"))) >>= 433 member; 434 ASSERT_TRUE(member.is()); 435 member->setName( 436 rtl::OUString( 437 RTL_CONSTASCII_USTRINGPARAM(".uno:FontworkShapeType"))); 438 css::uno::Reference< css::util::XChangesBatch >( 439 access, css::uno::UNO_QUERY_THROW)->commitChanges(); 440 css::uno::Reference< css::lang::XComponent >( 441 access, css::uno::UNO_QUERY_THROW)->dispose(); 442 443 ASSERT_TRUE( 444 getKey( 445 rtl::OUString( 446 RTL_CONSTASCII_USTRINGPARAM( 447 "/org.openoffice.UI.GenericCommands/UserInterface/Commands/" 448 ".uno:FontworkShapeType")), 449 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))) >>= 450 s); 451 ASSERT_TRUE( 452 s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Fontwork Gallery"))); 453 } 454 455 TEST_F(Test, testReadCommands) { 456 css::uno::Reference< css::container::XNameAccess > access( 457 createViewAccess( 458 rtl::OUString( 459 RTL_CONSTASCII_USTRINGPARAM( 460 "/org.openoffice.UI.GenericCommands/UserInterface/" 461 "Commands"))), 462 css::uno::UNO_QUERY_THROW); 463 css::uno::Sequence< rtl::OUString > names(access->getElementNames()); 464 ASSERT_TRUE(names.getLength() == 695); 465 // testSetSetMemberName() already removed ".uno:FontworkGalleryFloater" 466 sal_uInt32 n = osl_getGlobalTimer(); 467 for (int i = 0; i < 8; ++i) { 468 for (sal_Int32 j = 0; j < names.getLength(); ++j) { 469 css::uno::Reference< css::container::XNameAccess > child; 470 if (access->getByName(names[j]) >>= child) { 471 ASSERT_TRUE(child.is()); 472 child->getByName( 473 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))); 474 child->getByName( 475 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContextLabel"))); 476 child->getByName( 477 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Properties"))); 478 } 479 } 480 } 481 n = osl_getGlobalTimer() - n; 482 printf("Reading elements took %" SAL_PRIuUINT32 " ms\n", n); 483 css::uno::Reference< css::lang::XComponent >( 484 access, css::uno::UNO_QUERY_THROW)->dispose(); 485 } 486 487 TEST_F(Test, testThreads) { 488 struct Entry { rtl::OUString path; rtl::OUString relative; }; 489 Entry list[] = { 490 { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), 491 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/AString")) }, 492 { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), 493 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/AString")) }, 494 { rtl::OUString( 495 RTL_CONSTASCII_USTRINGPARAM( 496 "/org.openoffice.UI.GenericCommands")), 497 rtl::OUString( 498 RTL_CONSTASCII_USTRINGPARAM( 499 "UserInterface/Commands/dotuno:WebHtml/Label")) }, 500 { rtl::OUString( 501 RTL_CONSTASCII_USTRINGPARAM( 502 "/org.openoffice.UI.GenericCommands")), 503 rtl::OUString( 504 RTL_CONSTASCII_USTRINGPARAM( 505 "UserInterface/Commands/dotuno:NewPresentation/Label")) }, 506 { rtl::OUString( 507 RTL_CONSTASCII_USTRINGPARAM( 508 "/org.openoffice.UI.GenericCommands")), 509 rtl::OUString( 510 RTL_CONSTASCII_USTRINGPARAM( 511 "UserInterface/Commands/dotuno:RecentFileList/Label")) }, 512 { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), 513 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale")) }, 514 { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), 515 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/ABoolean")) } 516 }; 517 std::size_t const numReaders = sizeof list / sizeof (Entry); 518 std::size_t const numWriters = numReaders - 2; 519 ReaderThread * readers[numReaders]; 520 WriterThread * writers[numWriters]; 521 osl::Condition stop; 522 for (std::size_t i = 0; i < numReaders; ++i) { 523 ASSERT_TRUE(getKey(list[i].path, list[i].relative).hasValue()); 524 readers[i] = new ReaderThread( 525 stop, *this, list[i].path, list[i].relative); 526 } 527 for (std::size_t i = 0; i < numWriters; ++i) { 528 writers[i] = new WriterThread( 529 stop, *this, list[i].path, list[i].relative); 530 } 531 for (int i = 0; i < 5; ++i) { 532 for (std::size_t j = 0; j < numReaders; ++j) { 533 rtl::OUString path; 534 rtl::OUString name; 535 normalize(list[j].path, list[j].relative, &path, &name); 536 resetKey(path, name); 537 osl::Thread::yield(); 538 } 539 } 540 stop.set(); 541 bool success = true; 542 for (std::size_t i = 0; i < numReaders; ++i) { 543 readers[i]->join(); 544 success = success && readers[i]->getSuccess(); 545 delete readers[i]; 546 } 547 for (std::size_t i = 0; i < numWriters; ++i) { 548 writers[i]->join(); 549 success = success && writers[i]->getSuccess(); 550 delete writers[i]; 551 } 552 ASSERT_TRUE(success); 553 } 554 555 TEST_F(Test, testRecursive) { 556 bool destroyed = false; 557 rtl::Reference< RecursiveTest >( 558 new SimpleRecursiveTest(*this, 100, &destroyed))->test(); 559 ASSERT_TRUE(destroyed); 560 } 561 562 TEST_F(Test, testCrossThreads) { 563 bool destroyed = false; 564 rtl::Reference< RecursiveTest >( 565 new SimpleRecursiveTest(*this, 10, &destroyed))->test(); 566 ASSERT_TRUE(destroyed); 567 } 568 569 css::uno::Any Test::getKey( 570 rtl::OUString const & path, rtl::OUString const & relative) const 571 { 572 css::uno::Reference< css::container::XHierarchicalNameAccess > access( 573 createViewAccess(path), css::uno::UNO_QUERY_THROW); 574 css::uno::Any value(access->getByHierarchicalName(relative)); 575 css::uno::Reference< css::lang::XComponent >( 576 access, css::uno::UNO_QUERY_THROW)->dispose(); 577 return value; 578 } 579 580 void Test::setKey( 581 rtl::OUString const & path, rtl::OUString const & name, 582 css::uno::Any const & value) const 583 { 584 css::uno::Reference< css::container::XNameReplace > access( 585 createUpdateAccess(path), css::uno::UNO_QUERY_THROW); 586 access->replaceByName(name, value); 587 css::uno::Reference< css::util::XChangesBatch >( 588 access, css::uno::UNO_QUERY_THROW)->commitChanges(); 589 css::uno::Reference< css::lang::XComponent >( 590 access, css::uno::UNO_QUERY_THROW)->dispose(); 591 } 592 593 bool Test::resetKey(rtl::OUString const & path, rtl::OUString const & name) 594 const 595 { 596 //TODO: support setPropertyToDefault 597 css::uno::Reference< css::util::XChangesBatch > access( 598 createUpdateAccess(path), css::uno::UNO_QUERY_THROW); 599 css::uno::Reference< css::beans::XPropertyState > state( 600 access, css::uno::UNO_QUERY); 601 if (!state.is()) { 602 return false; 603 } 604 state->setPropertyToDefault(name); 605 access->commitChanges(); 606 css::uno::Reference< css::lang::XComponent >( 607 access, css::uno::UNO_QUERY_THROW)->dispose(); 608 return true; 609 } 610 611 css::uno::Reference< css::uno::XInterface > Test::createViewAccess( 612 rtl::OUString const & path) const 613 { 614 css::uno::Any arg( 615 css::uno::makeAny( 616 css::beans::NamedValue( 617 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 618 css::uno::makeAny(path)))); 619 return provider_->createInstanceWithArguments( 620 rtl::OUString( 621 RTL_CONSTASCII_USTRINGPARAM( 622 "com.sun.star.configuration.ConfigurationAccess")), 623 css::uno::Sequence< css::uno::Any >(&arg, 1)); 624 } 625 626 css::uno::Reference< css::uno::XInterface > Test::createUpdateAccess( 627 rtl::OUString const & path) const 628 { 629 css::uno::Any arg( 630 css::uno::makeAny( 631 css::beans::NamedValue( 632 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 633 css::uno::makeAny(path)))); 634 return provider_->createInstanceWithArguments( 635 rtl::OUString( 636 RTL_CONSTASCII_USTRINGPARAM( 637 "com.sun.star.configuration.ConfigurationUpdateAccess")), 638 css::uno::Sequence< css::uno::Any >(&arg, 1)); 639 } 640 641 642 } 643 644 int main(int argc, char **argv) 645 { 646 osl_setCommandArgs(argc, argv); 647 ::testing::InitGoogleTest(&argc, argv); 648 return RUN_ALL_TESTS(); 649 } 650