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 .
26 #include <osl/module.hxx>
27 #include <osl/diagnose.h>
28 #include <osl/process.h>
29 #include <registry/registry.hxx>
32 #include <com/sun/star/registry/XSimpleRegistry.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <cppuhelper/factory.hxx>
37 #include <cppuhelper/bootstrap.hxx>
38 #include <cppuhelper/servicefactory.hxx>
40 #include <com/sun/star/lang/XComponent.hpp>
44 #define _MAX_PATH PATH_MAX
47 using namespace com::sun::star
;
48 using namespace css::uno
;
49 using namespace css::registry
;
50 using namespace css::lang
;
51 using namespace css::beans
;
57 void SAL_CALL
mergeKeys(
58 Reference
< registry::XRegistryKey
> const & xDest
,
59 Reference
< registry::XRegistryKey
> const & xSource
);
61 static void mergeKeys(
62 Reference
< registry::XSimpleRegistry
> const & xDest
,
63 OUString
const & rBaseNode
,
64 OUString
const & rURL
)
66 Reference
< registry::XRegistryKey
> xDestRoot( xDest
->getRootKey() );
67 Reference
< registry::XRegistryKey
> xDestKey
;
68 if (rBaseNode
.getLength())
70 xDestKey
= xDestRoot
->createKey( rBaseNode
);
71 xDestRoot
->closeKey();
77 Reference
< registry::XSimpleRegistry
> xSimReg( ::cppu::createSimpleRegistry() );
78 xSimReg
->open( rURL
, sal_True
, sal_False
);
79 OSL_ASSERT( xSimReg
->isValid() );
80 Reference
< registry::XRegistryKey
> xSourceKey( xSimReg
->getRootKey() );
81 ::stoc_impreg::mergeKeys( xDestKey
, xSourceKey
);
82 xSourceKey
->closeKey();
88 OString
userRegEnv("STAR_USER_REGISTRY=");
93 OSL_VERIFY( osl_getExecutableFile( &exe
.pData
) == osl_Process_E_None
);
95 exe
= exe
.copy(0, exe
.getLength() - 16);
97 exe
= exe
.copy(0, exe
.getLength() - 12);
102 void setStarUserRegistry()
104 Registry
*myRegistry
= new Registry();
106 RegistryKey rootKey
, rKey
, rKey2
;
108 OUString userReg
= getExePath();
109 userReg
+= "user.rdb";
110 if(myRegistry
->open(userReg
, RegAccessMode::READWRITE
))
112 OSL_VERIFY(!myRegistry
->create(userReg
));
115 OSL_VERIFY(!myRegistry
->close());
118 userRegEnv
+= OUStringToOString(userReg
, RTL_TEXTENCODING_ASCII_US
);
119 putenv((char *)userRegEnv
.getStr());
122 void setLinkInDefaultRegistry(const OUString
& linkName
, const OUString
& linkTarget
)
124 Registry
*myRegistry
= new Registry();
128 OUString appReg
= getExePath();
129 appReg
+= "stoctest.rdb";
131 OSL_VERIFY(!myRegistry
->open(appReg
, RegAccessMode::READWRITE
));
132 OSL_VERIFY(!myRegistry
->openRootKey(rootKey
));
134 OSL_VERIFY(!rootKey
.createLink(linkName
, linkTarget
));
136 OSL_VERIFY(!rootKey
.closeKey());
137 OSL_VERIFY(!myRegistry
->close());
143 void test_SimpleRegistry(
144 OUString
const & testreg
,
145 OUString
const & testreg2
,
146 bool bMergeDifferently
= true )
148 Reference
<XInterface
> xIFace
;
152 "simplereg.uno" SAL_DLLEXTENSION
);
154 if (module
.load(dllName
))
156 // try to get provider from module
157 component_getFactoryFunc pCompFactoryFunc
= (component_getFactoryFunc
)
158 module
.getFunctionSymbol( OUString(COMPONENT_GETFACTORY
) );
160 if (pCompFactoryFunc
)
162 XSingleServiceFactory
* pRet
= (XSingleServiceFactory
*)
164 "com.sun.star.comp.stoc.SimpleRegistry", 0, 0 );
173 OSL_ENSURE( xIFace
.is(), "test_SimpleRegistry error1");
175 Reference
<XSingleServiceFactory
> xFactory( Reference
<XSingleServiceFactory
>::query(xIFace
) );
178 OSL_ENSURE( xFactory
.is(), "testloader error11");
180 Reference
<XInterface
> xIFace2
= xFactory
->createInstance();
183 OSL_ENSURE( xIFace2
.is(), "testloader error12");
185 Reference
<XServiceInfo
> xServInfo( Reference
<XServiceInfo
>::query(xIFace2
) );
187 OSL_ENSURE( xServInfo
.is(), "test_SimpleRegistry error2");
189 OSL_ENSURE( xServInfo
->getImplementationName() == "com.sun.star.comp.stoc.SimpleRegistry", "test_SimpleRegistry error3");
190 OSL_ENSURE( xServInfo
->supportsService("com.sun.star.registry.SimpleRegistry"), "test_SimpleRegistry error4");
191 OSL_ENSURE( xServInfo
->getSupportedServiceNames().getLength() == 1, "test_SimpleRegistry error5");
194 Reference
<XSimpleRegistry
> xReg( Reference
<XSimpleRegistry
>::query(xIFace2
) );
197 OSL_ENSURE( xReg
.is(), "test_SimpleRegistry error6");
201 xReg
->open(testreg
, sal_False
, sal_True
);
203 OSL_ENSURE( xReg
->isValid() != sal_False
, "test_SimpleRegistry error 7" );
204 OSL_ENSURE( xReg
->isReadOnly() == sal_False
, "test_SimpleRegistry error 8" );
206 Reference
<XRegistryKey
> xRootKey(xReg
->getRootKey());
207 OSL_ENSURE( xRootKey
->isValid(), "test_SimpleRegistry error 9" );
209 Reference
<XRegistryKey
> xKey
= xRootKey
->createKey(OUString( "FirstKey" ));
211 Reference
<XRegistryKey
> xSubKey
= xKey
->createKey(OUString( "FirstSubKey" ));
212 xSubKey
->setLongValue(123456789);
214 xSubKey
= xKey
->createKey(OUString( "SecondSubKey" ));
215 xSubKey
->setAsciiValue(OUString( "I'm an ascii value" ));
217 xSubKey
= xKey
->createKey(OUString( "ThirdSubKey" ));
218 xSubKey
->setStringValue(OUString( "I'm a Unicode value" ));
220 xSubKey
= xKey
->createKey(OUString( "FourthSubKey" ));
221 Sequence
<sal_Int8
> aSeq((sal_Int8
*)"I'm a binary value", 25);
222 xSubKey
->setBinaryValue(aSeq
);
224 Sequence
<OUString
> seqNames
= xKey
->getKeyNames();
225 Sequence
< Reference
<XRegistryKey
> > seqKeys
= xKey
->openKeys();
228 for (sal_Int32 i
=0; i
< seqNames
.getLength(); i
++)
230 name
= seqNames
.getArray()[i
];
231 xSubKey
= seqKeys
.getArray()[i
];
233 if (name
== "/FirstKey/FirstSubKey" )
235 OSL_ENSURE( xSubKey
->getLongValue() == 123456789,
236 "test_SimpleRegistry error 10" );
238 if (name
== "/FirstKey/SecondSubKey" )
240 OSL_ENSURE( xSubKey
->getAsciiValue() == "I'm an ascii value",
241 "test_SimpleRegistry error 11" );
243 if (name
== "/FirstKey/ThirdSubKey" )
245 OSL_ENSURE( xSubKey
->getStringValue() == "I'm a Unicode value",
246 "test_SimpleRegistry error 12" );
248 if (name
== "/FirstKey/FourthSubKey" )
250 Sequence
<sal_Int8
> seqByte
= xSubKey
->getBinaryValue();
251 OSL_ENSURE(!strcmp(((const char*)seqByte
.getArray()), "I'm a binary value"),
252 "test_SimpleRegistry error 13" );
255 seqKeys
.getArray()[i
]->closeKey();
260 xRootKey
->deleteKey(OUString( "FirstKey" ));
261 xRootKey
->createKey(OUString( "SecondFirstKey" ));
263 xKey
= xRootKey
->createKey(OUString( "SecondKey" ));
264 sal_Int32 pLongs
[3] = {123, 456, 789};
265 Sequence
<sal_Int32
> seqLongs(pLongs
, 3);
266 xKey
->setLongListValue(seqLongs
);
268 Sequence
<sal_Int32
> seqLongs2
;
269 seqLongs2
= xKey
->getLongListValue();
270 OSL_ENSURE( seqLongs
.getLength() == 3, "test_SimpleRegistry error 14" );
271 OSL_ENSURE( seqLongs
.getArray()[0] == 123, "test_SimpleRegistry error 15" );
272 OSL_ENSURE( seqLongs
.getArray()[1] == 456, "test_SimpleRegistry error 16" );
273 OSL_ENSURE( seqLongs
.getArray()[2] == 789, "test_SimpleRegistry error 17" );
276 xKey
= xRootKey
->createKey(OUString( "ThirdKey" ));
279 pAscii
[1] = "here I";
282 Sequence
<OUString
> seqAscii(pAscii
, 3);
283 xKey
->setAsciiListValue(seqAscii
);
285 Sequence
<OUString
> seqAscii2
;
286 seqAscii2
= xKey
->getAsciiListValue();
287 OSL_ENSURE( seqAscii2
.getLength() == 3, "test_SimpleRegistry error 18" );
288 OSL_ENSURE( seqAscii2
.getArray()[0] == "Hello", "test_SimpleRegistry error 19");
289 OSL_ENSURE( seqAscii2
.getArray()[1] == "here I", "test_SimpleRegistry error 20");
290 OSL_ENSURE( seqAscii2
.getArray()[2] == "come", "test_SimpleRegistry error 21");
292 xKey
= xRootKey
->createKey(OUString( "FourthKey" ));
293 OUString pUnicode
[3];
294 pUnicode
[0] = "Hello";
295 pUnicode
[1] = "here I";
296 pUnicode
[2] = "come as unicode";
298 Sequence
<OUString
> seqUnicode(pUnicode
, 3);
299 xKey
->setStringListValue(seqUnicode
);
301 Sequence
<OUString
> seqUnicode2
;
302 seqUnicode2
= xKey
->getStringListValue();
303 OSL_ENSURE( seqUnicode2
.getLength() == 3, "test_SimpleRegistry error 22" );
304 OSL_ENSURE( seqUnicode2
.getArray()[0] == "Hello", "test_SimpleRegistry error 23");
305 OSL_ENSURE( seqUnicode2
.getArray()[1] == "here I", "test_SimpleRegistry error 24");
306 OSL_ENSURE( seqUnicode2
.getArray()[2] == "come as unicode", "test_SimpleRegistry error 25");
309 xReg
->open(testreg2
, sal_False
, sal_True
);
310 OSL_ENSURE( xReg
->isValid() != sal_False
, "test_SimpleRegistry error 25" );
311 xRootKey
= xReg
->getRootKey();
312 xKey
= xRootKey
->createKey(OUString( "ThirdKey/FirstSubKey/WithSubSubKey" ));
315 xRootKey
->createLink(
316 OUString( "LinkTest" ),
317 OUString( "/ThirdKey/FirstSubKey/WithSubSubKey" )) );
318 xRootKey
->closeKey();
321 xReg
->open(testreg
, sal_False
, sal_False
);
322 OSL_ENSURE( xReg
->isValid() != sal_False
, "test_SimpleRegistry error 26" );
324 if (bMergeDifferently
)
333 xReg
->mergeKey(OUString(), testreg2
);
336 xRootKey
= xReg
->getRootKey();
337 xKey
= xRootKey
->openKey("LinkTest");
338 OSL_ENSURE( xKey
.is() && xKey
->isValid() && xKey
->getKeyName() == "/ThirdKey/FirstSubKey/WithSubSubKey", "test_SimpleRegistry error 1213" );
341 xRootKey
->getKeyType( OUString( "LinkTest" ) ) ==
342 registry::RegistryKeyType_LINK
,
343 "test_SimpleRegistry error 1214" );
345 xKey
= xRootKey
->openKey("FirstKey/SecondSubKey");
346 OSL_ENSURE( !xKey
.is(), "test_SimpleRegistry error 27" );
349 xKey
= xRootKey
->createKey(OUString( "FifthKey" ));
350 xKey
->createLink(OUString( "MyFirstLink" ),
351 OUString( "/ThirdKey/FirstSubKey" ));
353 xKey
= xRootKey
->openKey("/FifthKey/MyFirstLink");
354 OSL_ENSURE( xKey
->isValid(), "test_SimpleRegistry error 27" );
355 OSL_ENSURE( xKey
->getKeyName() == "/ThirdKey/FirstSubKey", "test_SimpleRegistry error 28" );
357 xKey
->createLink(OUString( "/WithSubSubKey/MyFourthLink" ),
358 OUString( "/FourthKey/MySecondLink" ));
360 OSL_ENSURE( xKey
->getLinkTarget(OUString( "/WithSubSubKey/MyFourthLink" ))
361 == "/FourthKey/MySecondLink", "test_SimpleRegistry error 29" );
365 OSL_ENSURE( xKey
->getResolvedName(OUString( "/WithSubSubKey/MyFourthLink/BlaBlaBla" ))
366 == "/FourthKey/MySecondLink/BlaBlaBla", "test_SimpleRegistry error 30" );
368 catch(InvalidRegistryException
&)
372 xRootKey
->createLink(OUString( "/FourthKey/MySecondLink" ),
373 OUString( "/SixthKey/MyThirdLink" ));
374 xKey
= xRootKey
->createKey(OUString( "SixthKey" ));
375 xKey
->createLink(OUString( "MyThirdLink" ),
376 OUString( "/FourthKey/MySecondLink" ));
378 xKey
= xRootKey
->createKey(OUString( "/SixthKey/SixthSubKey" ));
382 xRootKey
->openKey("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink");
384 catch(InvalidRegistryException
&)
388 OSL_ENSURE( xRootKey
->getLinkTarget(OUString( "/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink" ))
389 == "/FourthKey/MySecondLink", "test_SimpleRegistry error 31" );
391 xRootKey
->deleteLink(OUString( "/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink" ));
393 xRootKey
->createLink(OUString( "/FourthKey/MySecondLink" ),
394 OUString( "/ThirdKey/FirstSubKey/WithSubSubKey" ));
396 xKey
= xRootKey
->openKey("SixthKey");
397 seqNames
= xKey
->getKeyNames();
398 seqKeys
= xKey
->openKeys();
400 OSL_ENSURE( seqNames
.getArray()[0] == "/SixthKey/SixthSubKey",
401 "test_SimpleRegistry error 32" );
402 OSL_ENSURE( seqNames
.getArray()[1] == "/SixthKey/MyThirdLink",
403 "test_SimpleRegistry error 33" );
405 OSL_ENSURE( seqKeys
.getArray()[0]->getKeyName() == "/SixthKey/SixthSubKey",
406 "test_SimpleRegistry error 34" );
407 OSL_ENSURE( seqKeys
.getArray()[1]->getKeyName() == "/ThirdKey/FirstSubKey/WithSubSubKey",
408 "test_SimpleRegistry error 35" );
410 xRootKey
->deleteLink(OUString( "/FourthKey/MySecondLink" ));
411 xRootKey
->closeKey();
413 catch(InvalidRegistryException
&)
415 OSL_ENSURE(0, "exception InvalidRegistryExcption raised while doing test_SimpleRegistry");
417 catch(InvalidValueException
&)
419 OSL_ENSURE(0, "exception InvalidValueExcption raised while doing test_SimpleRegistry()");
424 printf("Test SimpleRegistry, OK!\n");
428 void test_DefaultRegistry(
429 OUString
const & testreg
,
430 OUString
const & testreg2
,
431 bool bMergeDifferently
= false )
433 // Test NestedRegistry
434 OUString
exePath( getExePath() );
435 OUString
userRdb(exePath
);
436 OUString
applicatRdb(exePath
);
438 userRdb
+= "user.rdb";
439 applicatRdb
+= "stoctest.rdb";
441 Reference
< XMultiServiceFactory
> rSMgr
= ::cppu::createRegistryServiceFactory( userRdb
, applicatRdb
, sal_False
, OUString());
442 //OUString("//./e:/src596/stoc/wntmsci3/bin") );
444 Reference
< XPropertySet
> xPropSet( rSMgr
, UNO_QUERY
);
445 OSL_ENSURE( xPropSet
.is(), "test_DefaultRegistry error0");
447 Any
aPropertyAny( xPropSet
->getPropertyValue("Registry") );
448 OSL_ENSURE( aPropertyAny
.hasValue(), "test_DefaultRegistry error1");
450 Reference
<XSimpleRegistry
> xReg
;
451 aPropertyAny
>>= xReg
;
452 OSL_ENSURE( xReg
.is(), "test_DefaultRegistry error1a");
454 Reference
<XServiceInfo
> xServInfo( Reference
<XServiceInfo
>::query(xReg
) );
456 OSL_ENSURE( xServInfo
.is(), "test_DefaultRegistry error2");
458 OSL_ENSURE( xServInfo
->getImplementationName() == "com.sun.star.comp.stoc.NestedRegistry", "test_DefaultRegistry error3");
459 OSL_ENSURE( xServInfo
->supportsService("com.sun.star.registry.NestedRegistry"), "test_DefaultRegistry error4");
460 OSL_ENSURE( xServInfo
->getSupportedServiceNames().getLength() == 1, "test_DefaultRegistry error5");
463 OSL_ENSURE( xReg
.is(), "test_DefaultRegistry error6");
467 Reference
<XRegistryKey
> xRootKey(xReg
->getRootKey());
469 Reference
<XRegistryKey
> xKey
= xRootKey
->openKey("/UCR/com/sun/star/registry/XSimpleRegistry");
471 OSL_ENSURE( xKey
->getKeyName() == "/UCR/com/sun/star/registry/XSimpleRegistry",
472 "test_DefaultRegistry error 7" );
474 if (bMergeDifferently
)
483 xReg
->mergeKey(OUString( "Test" ), testreg
);
486 xKey
= xRootKey
->openKey("Test/ThirdKey/FirstSubKey/WithSubSubKey");
488 xKey
->setLongValue(123456789);
490 xKey
= xRootKey
->openKey("Test/ThirdKey/FirstSubKey");
493 xKey
->createKey(OUString( "SecondSubSubKey" ));
495 Sequence
<OUString
> seqNames
= xKey
->getKeyNames();
497 OSL_ENSURE( seqNames
.getLength() == 2, "test_DefaultRegistry error 8" );
500 xKey
= xRootKey
->openKey("/Test/ThirdKey");
503 RegistryValueType valueType
= xKey
->getValueType();
504 OSL_ENSURE( valueType
== RegistryValueType_ASCIILIST
, "test_DefaultRegistry error 9" );
506 Sequence
<OUString
> seqValue
= xKey
->getAsciiListValue();
508 OSL_ENSURE( seqValue
.getLength() == 3, "test_DefaultRegistry error 10" );
509 OSL_ENSURE( seqValue
.getArray()[0] == "Hello",
510 "test_DefaultRegistry error 11" );
511 OSL_ENSURE( seqValue
.getArray()[1] == "here I",
512 "test_DefaultRegistry error 12" );
513 OSL_ENSURE( seqValue
.getArray()[2] == "come",
514 "test_DefaultRegistry error 13" );
516 xKey
->setLongListValue({ 1234, 4567, 7890 });
518 Sequence
<sal_Int32
> seqLongValue
= xKey
->getLongListValue();
520 OSL_ENSURE( seqLongValue
.getLength() == 3, "test_DefaultRegistry error 14" );
521 OSL_ENSURE( seqLongValue
.getArray()[0] == 1234, "test_DefaultRegistry error 15" );
522 OSL_ENSURE( seqLongValue
.getArray()[1] == 4567, "test_DefaultRegistry error 16" );
523 OSL_ENSURE( seqLongValue
.getArray()[2] == 7890, "test_DefaultRegistry error 17" );
527 xKey
= xRootKey
->createKey(OUString( "/Test/FifthKey" ));
528 xKey
->createLink(OUString( "MyFirstLink" ),
529 OUString( "/Test/ThirdKey/FirstSubKey" ));
531 xKey
= xRootKey
->openKey("/Test/FifthKey/MyFirstLink");
532 OSL_ENSURE( xKey
->isValid(), "test_DefaultRegistry error 18" );
533 OSL_ENSURE( xKey
->getKeyName() == "/Test/ThirdKey/FirstSubKey",
534 "test_DefaultRegistry error 19" );
536 xKey
->createLink(OUString( "/WithSubSubKey/MyFourthLink" ),
537 OUString( "/Test/FourthKey/MySecondLink" ));
539 OSL_ENSURE( xKey
->getLinkTarget(OUString( "/WithSubSubKey/MyFourthLink" ))
540 == "/Test/FourthKey/MySecondLink",
541 "test_DefaultRegistry error 20" );
545 OSL_ENSURE( xKey
->getResolvedName(OUString( "/WithSubSubKey/MyFourthLink/BlaBlaBla" ))
546 == "/Test/FourthKey/MySecondLink/BlaBlaBla",
547 "test_DefaultRegistry error 21" );
549 catch(InvalidRegistryException
&)
553 xRootKey
->createLink(OUString( "/Test/FourthKey/MySecondLink" ),
554 OUString( "/Test/SixthKey/MyThirdLink" ));
555 xKey
= xRootKey
->createKey(OUString( "/Test/SixthKey" ));
556 xKey
->createLink(OUString( "MyThirdLink" ),
557 OUString( "/Test/FourthKey/MySecondLink" ));
561 xRootKey
->openKey("/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink");
563 catch(InvalidRegistryException
&)
565 printf("test InvalidRegistryExcption OK!\n");
568 OSL_ENSURE( xRootKey
->getLinkTarget(OUString( "/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink" ))
569 == "/Test/FourthKey/MySecondLink",
570 "test_DefaultRegistry error 22" );
572 xRootKey
->deleteLink(OUString( "/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink" ));
574 xKey
= xRootKey
->openKey("/Test/DefaultLink/SecondSubSubKey");
577 OSL_ENSURE( xKey
->getKeyName() == "/Test/ThirdKey/FirstSubKey/SecondSubSubKey", "test_DefaultRegistry error 23" );
579 xKey
= xRootKey
->createKey(OUString( "/Test/DefaultLink/ThirdSubSubKey" ));
582 OSL_ENSURE( xKey
->getKeyName() == "/Test/ThirdKey/FirstSubKey/ThirdSubSubKey",
583 "test_DefaultRegistry error 24" );
586 xKey
= xRootKey
->openKey("Test");
587 OSL_ENSURE( xKey
->isValid(), "test_DefaultRegistry error 25" );
589 xRootKey
->deleteKey(OUString( "Test" ));
591 if (bMergeDifferently
)
595 OUString( "AllFromTestreg2" ),
600 xReg
->mergeKey(OUString( "AllFromTestreg2" ),
604 xKey
= xRootKey
->openKey("/AllFromTestreg2/ThirdKey/FirstSubKey");
607 xRootKey
->deleteKey(OUString( "/AllFromTestreg2" ));
611 catch(InvalidRegistryException
&)
613 OSL_ENSURE(0, "exception InvalidRegistryExcption raised while doing test_DefaultRegistry");
615 catch(InvalidValueException
&)
617 OSL_ENSURE(0, "exception InvalidValueExcption raised while doing test_DefaultRegistry()");
623 catch(const InvalidRegistryException
& e
)
626 OSL_ENSURE(0, OUStringToOString(e
.Message
,RTL_TEXTENCODING_ASCII_US
).getStr());
633 Reference
< css::lang::XComponent
> xComp( rSMgr
, UNO_QUERY
);
634 OSL_ENSURE( xComp
.is(), "### service manager has to implement XComponent!" );
637 printf("Test DefaultRegistry, OK!\n");
643 // setStarUserRegistry();
644 setLinkInDefaultRegistry(OUString("/Test/DefaultLink"),
645 OUString("/Test/FifthKey/MyFirstLink"));
647 OUString
reg1( "testreg1.rdb" );
648 OUString
reg2( "testreg2.rdb" );
649 OUString
areg1( "atestreg1.rdb" );
650 OUString
areg2( "atestreg2.rdb" );
652 test_SimpleRegistry( reg1
, reg2
);
653 test_DefaultRegistry( reg1
, reg2
);
654 test_SimpleRegistry( areg1
, areg2
, true ); // use different merge
655 test_DefaultRegistry( areg1
, areg2
, true );
657 Reference
< XSimpleRegistry
> xSimReg( ::cppu::createSimpleRegistry() );
658 xSimReg
->open( reg1
, sal_False
, sal_True
);
660 xSimReg
->open( reg2
, sal_False
, sal_True
);
662 xSimReg
->open( areg1
, sal_False
, sal_True
);
664 xSimReg
->open( areg2
, sal_False
, sal_True
);
670 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */