summaryrefslogtreecommitdiff
path: root/configmgr/qa
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-03-04 23:05:27 +0100
committersb <sb@openoffice.org>2010-03-04 23:05:27 +0100
commitc79b576a3dbbbce2a67c6215a4180ac060131790 (patch)
tree32e1b51bf16b501fd7eea6d23f0610eee339fa5f /configmgr/qa
parentff783db420cdb801613ca46ffec6dc6812d9ad0d (diff)
parent0d0b4e1cdd842808707e570b1dea125f312f2a50 (diff)
merged in re/DEV300_next towards DEV300_m74
Diffstat (limited to 'configmgr/qa')
-rw-r--r--configmgr/qa/unit/common.hxx111
-rw-r--r--configmgr/qa/unit/configmgrrc22
-rw-r--r--configmgr/qa/unit/data.xcd (renamed from configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu)175
-rw-r--r--configmgr/qa/unit/data/org/openoffice/Setup.xcu43
-rw-r--r--configmgr/qa/unit/export.map7
-rw-r--r--configmgr/qa/unit/makefile.mk78
-rw-r--r--configmgr/qa/unit/no_localization0
-rw-r--r--configmgr/qa/unit/performance.cxx268
-rw-r--r--configmgr/qa/unit/schema/org/openoffice/Setup.xcs72
-rw-r--r--configmgr/qa/unit/schema/org/openoffice/UI/Commands.xcs62
-rw-r--r--configmgr/qa/unit/schema/org/openoffice/UI/GenericCommands.xcs49
-rw-r--r--configmgr/qa/unit/test.cxx678
-rw-r--r--configmgr/qa/unit/threading.cxx259
-rw-r--r--configmgr/qa/unit/ubootstrap.cxx120
-rw-r--r--configmgr/qa/unit/urebootstrap.ini30
-rw-r--r--configmgr/qa/unit/version.map34
-rw-r--r--configmgr/qa/unoapi/cfgmgr2.sce34
-rw-r--r--configmgr/qa/unoapi/knownissues.xcl55
-rw-r--r--configmgr/qa/unoapi/makefile.mk2
-rw-r--r--configmgr/qa/unoapi/module.sce29
20 files changed, 976 insertions, 1152 deletions
diff --git a/configmgr/qa/unit/common.hxx b/configmgr/qa/unit/common.hxx
deleted file mode 100644
index 6da6f861ba20..000000000000
--- a/configmgr/qa/unit/common.hxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "sal/config.h"
-#include <cstdlib>
-#include "com/sun/star/beans/NamedValue.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
-#include "com/sun/star/beans/XPropertyState.hpp"
-#include "com/sun/star/lang/XComponent.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
-#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-#include "com/sun/star/container/XNameReplace.hpp"
-#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
-#include "com/sun/star/util/XChangesBatch.hpp"
-#include "com/sun/star/uno/Any.hxx"
-#include "com/sun/star/uno/Reference.hxx"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "cppuhelper/component_context.hxx"
-#include "cppuhelper/servicefactory.hxx"
-#include "testshl/simpleheader.hxx"
-#include "osl/file.hxx"
-#include "osl/thread.h"
-#include "osl/process.h"
-#include "rtl/string.h"
-#include "rtl/bootstrap.h"
-#include "rtl/ustring.h"
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-
-namespace css = com::sun::star;
-
-#define CATCH_FAIL(msg) \
- catch (const css::uno::Exception &e) { \
- t_print ("msg '%s'\n", rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr()); \
- CPPUNIT_FAIL( msg ); \
- throw; \
- }
-
-class Magic
-{
- rtl::OUString maTempDir;
- public:
- Magic();
- ~Magic();
-};
-
-class Test: public CppUnit::TestFixture {
- Magic *mpMagic;
-public:
- // init
- virtual void setUp();
- virtual void tearDown();
-
- // helpers
- void normalizePathKey (rtl::OString &rPath, rtl::OString &rKey);
- css::uno::Reference< css::uno::XInterface > createView(const sal_Char *pNodepath, bool bUpdate);
- css::uno::Any getKey (const sal_Char *pPath, rtl::OUString aName);
- css::uno::Any getKey (const sal_Char *pPath, const sal_Char *pName)
- { return getKey (pPath, rtl::OUString::createFromAscii (pName)); }
- void setKey (const sal_Char *pPath, rtl::OUString aName, css::uno::Any a);
- void resetKey (const sal_Char *pPath, rtl::OUString aName);
-
- // tests
- void keyFetch();
- void keySet();
- void keyReset();
- void readCommands();
- void threadTests();
- void recursiveTests();
- void eventTests();
-
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(keyFetch);
- CPPUNIT_TEST(keySet);
- CPPUNIT_TEST(keyReset);
- CPPUNIT_TEST(readCommands);
- CPPUNIT_TEST(threadTests);
- CPPUNIT_TEST(recursiveTests);
- CPPUNIT_TEST(eventTests);
- CPPUNIT_TEST_SUITE_END();
-
-private:
- css::uno::Reference< css::uno::XComponentContext > mxContext;
- css::uno::Reference< css::lang::XMultiServiceFactory > mxProvider;
-};
-
-void disposeComponent (const css::uno::Reference<css::uno::XInterface> &xComp);
diff --git a/configmgr/qa/unit/configmgrrc b/configmgr/qa/unit/configmgrrc
deleted file mode 100644
index b162e77c2e00..000000000000
--- a/configmgr/qa/unit/configmgrrc
+++ /dev/null
@@ -1,22 +0,0 @@
-[Bootstrap]
-CFG_ServerType=uno
-BootstrapFile=$ORIGIN/bootstraprc
-VersionFile=$ORIGIN/versionrc
-UnoFile=$ORIGIN/unorc
-BaseInstallation=${$BootstrapFile:BaseInstallation}
-UserInstallation=${$BootstrapFile:UserInstallation}
-CFG_SchemaVersion=${$VersionFile:buildid}
-CFG_SchemaDataUrl=$BaseInstallation/schema
-CFG_DefaultLayerUrls=$BaseInstallation
-CFG_CacheDisposeDelay=900
-CFG_CacheDisposeInterval=60
-CFG_CacheWriteInterval=2
-CFG_UserLayerUrl=$UserInstallation
-CFG_CacheUrl=$BaseInstallation/cache
-CFG_DefaultLayerUrl=$BaseInstallation
-CFG_BackendService=com.sun.star.comp.configuration.backend.MultiStratumBackend
-CFG_SchemaSupplier=com.sun.star.comp.configuration.backend.LocalSchemaSupplier
-CFG_LocalDataSvc=com.sun.star.comp.configuration.backend.LocalStratum
-CFG_LocalModuleDataSvc=com.sun.star.comp.configuration.backend.LocalMultiStratum
-# CFG_Strata=${CFG_LocalDataSvc}:$CFG_DefaultLayerUrl;?com.sun.star.comp.configuration.backend.SystemIntegration:;${CFG_LocalDataSvc}:$CFG_UserLayerUrl
-CFG_Strata=${CFG_LocalDataSvc}:$CFG_DefaultLayerUrl;${CFG_LocalDataSvc}:$CFG_UserLayerUrl
diff --git a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu b/configmgr/qa/unit/data.xcd
index 25cc7021d6a7..506a82928eff 100644
--- a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu
+++ b/configmgr/qa/unit/data.xcd
@@ -1,31 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd">
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+<oor:data xmlns:oor="http://openoffice.org/2001/registry">
+
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Setup" oor:package="org.openoffice" xml:lang="en-US">
+ <info>
+ <author>mmeeks</author>
+ <desc >Setup prefs (for configmgr) and unit test schema bits.</desc>
+ </info>
+ <component>
+ <group oor:name="L10N">
+ <info>
+ <author>PB</author>
+ <desc>Specifies the installation locales.</desc>
+ </info>
+ <prop oor:name="ooLocale" oor:type="xs:string">
+ <info>
+ <author>PB</author>
+ <desc>Indicates the Office language selected by the user.</desc>
+ <label>Locale</label>
+ </info>
+ <value/>
+ </prop>
+ </group>
+ <group oor:name="Test">
+ <info>
+ <author>mmeeks</author>
+ <desc>Misc test pieces</desc>
+ </info>
+ <prop oor:name="ABoolean" oor:type="xs:boolean">
+ <info>
+ <author>mmeeks</author>
+ <desc>A boolean</desc>
+ <label>Boolean</label>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="AString" oor:type="xs:string">
+ <info>
+ <author>mmeeks</author>
+ <desc>A string</desc>
+ <label>String</label>
+ </info>
+ <value>Foo</value>
+ </prop>
+ </group>
+ </component>
+</oor:component-schema>
+
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Commands" oor:package="org.openoffice.UI" xml:lang="en-US"> <info>
+ <author>CD</author>
+ <desc >Contains general information about ~ and rules, and about actions based on office commands.</desc>
+ </info>
+ <templates>
+ <group oor:name="LabelType">
+ <info>
+ <desc>Provides a mapping between commands and their textual representation on the user interface.</desc>
+ </info>
+ <prop oor:name="Label" oor:type="xs:string" oor:localized="true">
+ <info>
+ <desc>A localized text that describes the command or identifier. Can be used as a label inside a menu or as short tool tip help.</desc>
+ </info>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string" oor:localized="true">
+ <info>
+ <desc>A localized text that describes the identifier of a command in a structured menu. </desc>
+ </info>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <info>
+ <desc>
+ Additional information about a single command.
+ Bit 0 = Command has an image.
+ Bit 1 = Image must be mirrored (CTL/vertical text).
+ Bit 2 = Image must be rotated (CTL/vertical text).
+ </desc>
+ </info>
+ <value>0</value>
+ </prop>
+ </group>
+ </templates>
+ <component/>
+</oor:component-schema>
+
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="GenericCommands" oor:package="org.openoffice.UI" xml:lang="en-US">
+ <info>
+ <author>CD</author>
+ <desc >Contains general information about ~ and rules, and about actions based on office commands.</desc>
+ </info>
+ <import oor:component="org.openoffice.UI.Commands"/>
+ <uses oor:component="org.openoffice.UI.Commands"/>
+ <templates/>
+ <component>
+ <group oor:name="UserInterface">
+ <info>
+ <desc>Contains user interface data for Office commands and identifiers that are used by the user interface."</desc>
+ </info>
+ <set oor:name="Commands" oor:node-type="LabelType" oor:component="org.openoffice.UI.Commands">
+ <info>
+ <desc>Contains label text for Office commands and identifiers that are used by the user interface."</desc>
+ </info>
+ </set>
+ </group>
+ </component>
+</oor:component-schema>
+
+<oor:component-data oor:name="Setup" oor:package="org.openoffice" xmlns:oor="http://openoffice.org/2001/registry" xmlns:install="http://openoffice.org/2004/installation" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="L10N">
+ <prop oor:name="ooLocale" oor:type="xs:string">
+ <value>en-US</value>
+ </prop>
+ </node>
+ <node oor:name="Test">
+ <prop oor:name="ABoolean" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ <prop oor:name="AString" oor:type="xs:string">
+ <value>Foo</value>
+ </prop>
+ </node>
+</oor:component-data>
+
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="GenericCommands" oor:package="org.openoffice.UI">
<node oor:name="UserInterface">
<node oor:name="Commands">
@@ -5067,3 +5186,5 @@
</node>
</node>
</oor:component-data>
+
+</oor:data>
diff --git a/configmgr/qa/unit/data/org/openoffice/Setup.xcu b/configmgr/qa/unit/data/org/openoffice/Setup.xcu
deleted file mode 100644
index 956aacbf4e1e..000000000000
--- a/configmgr/qa/unit/data/org/openoffice/Setup.xcu
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<!DOCTYPE oor:component-data SYSTEM "../../../component-update.dtd">
-<oor:component-data oor:name="Setup" oor:package="org.openoffice" xmlns:oor="http://openoffice.org/2001/registry" xmlns:install="http://openoffice.org/2004/installation" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <node oor:name="L10N">
- <prop oor:name="ooLocale" oor:type="xs:string">
- <value>en-US</value>
- </prop>
- </node>
- <node oor:name="Test">
- <prop oor:name="ABoolean" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- <prop oor:name="AString" oor:type="xs:string">
- <value>Foo</value>
- </prop>
- </node>
-</oor:component-data>
diff --git a/configmgr/qa/unit/export.map b/configmgr/qa/unit/export.map
deleted file mode 100644
index 879fa8953788..000000000000
--- a/configmgr/qa/unit/export.map
+++ /dev/null
@@ -1,7 +0,0 @@
-UDK_3_0_0 {
- global:
- registerAllTestFunction;
-
- local:
- *;
-};
diff --git a/configmgr/qa/unit/makefile.mk b/configmgr/qa/unit/makefile.mk
index 94b4c58c41c9..25035d7e9dda 100644
--- a/configmgr/qa/unit/makefile.mk
+++ b/configmgr/qa/unit/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -23,39 +23,71 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
+#***********************************************************************/
-PRJ := ..$/..
-PRJNAME := configmgr
-TARGET := qa_unit
+PRJ = ../..
+PRJNAME = configmgr
+TARGET = unit
-ENABLE_EXCEPTIONS := TRUE
+ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
-DLLPRE = # no leading "lib" on .so files
+SLOFILES = $(SLO)/test.obj
-SHL1TARGET = $(TARGET)
-SHL1OBJS = $(SLO)$/performance.obj $(SLO)$/threading.obj $(SLO)$/ubootstrap.obj
-SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(TESTSHL2LIB) $(SALLIB)
-SHL1VERSIONMAP = export.map
-SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1STDLIBS = \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(CPPUNITLIB) \
+ $(SALLIB) \
+ $(TESTSHL2LIB)
+SHL1TARGET = unit
+SHL1VERSIONMAP = version.map
DEF1NAME = $(SHL1TARGET)
-SLOFILES = $(SHL1OBJS)
-
.INCLUDE: target.mk
-ALLTAR: test
+ALLTAR: TEST
+
+.IF "$(OS)" == "OS2" || "$(OS)" == "WNT"
+MY_INI = .ini
+.ELSE
+MY_INI = rc
+.ENDIF
-$(MISC)$/$(TARGET).rdb .ERRREMOVE:
- $(COPY) $(SOLARBINDIR)$/types.rdb $@
- $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(DLLDEST)$/configmgr2.uno$(DLLPOST))
- $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/sax.uno$(DLLPOST))
- $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/stocservices.uno$(DLLPOST))
- $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/streams.uno$(DLLPOST))
+$(MISC)/unit.rdb .ERRREMOVE:
+ cp $(SOLARBINDIR)/types.rdb $@
+ $(REGCOMP) -register -r $@ -c $(DLLDEST)/$(DLLPRE)configmgr$(DLLPOST)
-test .PHONY: $(SHL1TARGETN) $(MISC)$/$(TARGET).rdb
- $(AUGMENT_LIBRARY_PATH) testshl2 $(SHL1TARGETN) -forward "$(MISC)$/$(TARGET).rdb#$(PWD)$/$(MISC)$/$(TARGET).registry"
+TEST .PHONY: $(SHL1TARGETN) $(MISC)/unit.rdb
+ rm -rf $(MISC)/unitdata
+ mkdir $(MISC)/unitdata
+ cp urebootstrap.ini $(MISC)/unitdata
+ mkdir $(MISC)/unitdata/basis
+ mkdir $(MISC)/unitdata/basis/program
+ echo '[Bootstrap]' > $(MISC)/unitdata/basis/program/uno$(MY_INI)
+ echo 'UNO_SHARED_PACKAGES_CACHE = $$OOO_BASE_DIR' \
+ >> $(MISC)/unitdata/basis/program/uno$(MY_INI)
+ echo 'UNO_USER_PACKAGES_CACHE =' \
+ '$${$$BRAND_BASE_DIR/program/bootstrap$(MY_INI):UserInstallation}' \
+ >> $(MISC)/unitdata/basis/program/uno$(MY_INI)
+ mkdir $(MISC)/unitdata/basis/share
+ mkdir $(MISC)/unitdata/basis/share/registry
+ cp data.xcd $(MISC)/unitdata/basis/share/registry
+ mkdir $(MISC)/unitdata/brand
+ mkdir $(MISC)/unitdata/brand/program
+ echo '[Bootstrap]' > $(MISC)/unitdata/brand/program/bootstrap$(MY_INI)
+ echo 'UserInstallation = $$ORIGIN/../../user' \
+ >> $(MISC)/unitdata/brand/program/bootstrap$(MY_INI)
+.IF "$(USE_SHELL)" == "bash"
+ export \
+ URE_BOOTSTRAP=vnd.sun.star.pathname:$(MISC)/unitdata/urebootstrap.ini \
+ && $(TESTSHL2) $(SHL1TARGETN) -forward $(MISC)/unit.rdb
+.ELSE
+ setenv \
+ URE_BOOTSTRAP vnd.sun.star.pathname:$(MISC)/unitdata/urebootstrap.ini \
+ && $(TESTSHL2) $(SHL1TARGETN) -forward $(MISC)/unit.rdb
+.ENDIF
diff --git a/configmgr/qa/unit/no_localization b/configmgr/qa/unit/no_localization
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/configmgr/qa/unit/no_localization
diff --git a/configmgr/qa/unit/performance.cxx b/configmgr/qa/unit/performance.cxx
deleted file mode 100644
index 13c998a3c2ab..000000000000
--- a/configmgr/qa/unit/performance.cxx
+++ /dev/null
@@ -1,268 +0,0 @@
-// To debug me use:
-// $ export ENVCFGFLAGS='-me -ti -tw -tp -td'
-
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "common.hxx"
-
-void Test::setUp()
-{
- mpMagic = new Magic();
-
- char const * f = getForwardString();
- rtl::OUString args(
- f, rtl_str_getLength(f), osl_getThreadTextEncoding());
- //TODO: handle conversion failure
- sal_Int32 i = args.indexOf('#');
- if (i < 0)
- std::abort();
-
- rtl::OUString rdb(args.copy(0, i));
- rtl::OUString regpath(args.copy(i + 1));
- rtl::OUString regurl;
- if (osl::FileBase::getFileURLFromSystemPath(regpath, regurl) !=
- osl::FileBase::E_None)
- std::abort();
-
- css::uno::Reference< css::beans::XPropertySet > factory(
- cppu::createRegistryServiceFactory(rdb), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::uno::XComponentContext > context(
- factory->getPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
- css::uno::UNO_QUERY_THROW);
- cppu::ContextEntry_Init entry(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "/modules/com.sun.star.configuration/bootstrap/Strata")),
- css::uno::makeAny(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.configuration.backend.LocalStratum:"))
- + regurl));
- mxContext = cppu::createComponentContext(&entry, 1, context);
-
- CPPUNIT_ASSERT_MESSAGE ("component context is valid", mxContext.is());
-
- try {
- mxProvider = css::uno::Reference< css::lang::XMultiServiceFactory >(
- (css::uno::Reference< css::lang::XMultiComponentFactory >(
- mxContext->getServiceManager(), css::uno::UNO_QUERY_THROW)->
- createInstanceWithContext(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider")),
- mxContext)),
- css::uno::UNO_QUERY_THROW);
-
- } catch (css::uno::Exception&e) {
- CPPUNIT_FAIL( "exception creating provider" );
- throw;
- }
-}
-
-css::uno::Reference< css::uno::XInterface >
-Test::createView(const sal_Char *pNodepath, bool bUpdate)
-{
- rtl::OUString aNodePath = rtl::OUString::createFromAscii(pNodepath);
- static const rtl::OUString kInfoViewService(
- RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")) ;
- static const rtl::OUString kUpdateViewService(
- RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")) ;
- static const rtl::OUString kNodepath(RTL_CONSTASCII_USTRINGPARAM("nodepath")) ;
- static const rtl::OUString kAsync(RTL_CONSTASCII_USTRINGPARAM("EnableAsync")) ;
-
- const rtl::OUString & kViewService = bUpdate ? kUpdateViewService : kInfoViewService;
- css::uno::Sequence< css::uno::Any > aViewArgs(2);
- aViewArgs[0] <<= css::beans::NamedValue( kNodepath, css::uno::makeAny(aNodePath) );
- aViewArgs[1] <<= css::beans::NamedValue( kAsync, css::uno::makeAny(sal_False) );
-
- css::uno::Reference< css::uno::XInterface > xView(
- mxProvider->createInstanceWithArguments( kViewService, aViewArgs ) );
- return xView;
-}
-
-void disposeComponent (const css::uno::Reference<css::uno::XInterface> &xComp)
-{
- css::uno::Reference< css::lang::XComponent >(
- xComp, css::uno::UNO_QUERY_THROW)->dispose();
-}
-
-void Test::tearDown()
-{
- disposeComponent (mxProvider);
- disposeComponent (mxContext);
-
- delete mpMagic;
-}
-
-void Test::normalizePathKey (rtl::OString &rPath, rtl::OString &rKey)
-{
- sal_Int32 idx = rKey.lastIndexOf("/");
- if (idx > 0) {
- rPath += "/";
- rPath += rKey.copy (0, idx);
- rKey = rKey.copy (idx + 1);
-// t_print ("write to '%s' '%s'\n", (const sal_Char *)rPath,
-// (const sal_Char *)rKey);
- }
-}
-
-css::uno::Any Test::getKey (const sal_Char *pPath, rtl::OUString aName)
-{
- css::uno::Reference< css::container::XHierarchicalNameAccess > xNameAccess(
- createView(pPath, false), css::uno::UNO_QUERY_THROW);
- css::uno::Any aVal;
- aVal = xNameAccess->getByHierarchicalName (aName);
- disposeComponent (xNameAccess);
- return aVal;
-}
-
-void Test::setKey (const sal_Char *pPath, rtl::OUString aName, css::uno::Any a)
-{
- css::uno::Reference< css::util::XChangesBatch > xAppView;
-
- xAppView = css::uno::Reference< css::util::XChangesBatch > (
- createView(pPath, true), css::uno::UNO_QUERY_THROW );
- css::uno::Reference< css::container::XNameReplace > xSettings(xAppView, css::uno::UNO_QUERY_THROW);
- rtl::OUString aStr;
-
- // set key
- xSettings->replaceByName(aName, a);
- xAppView->commitChanges();
-
- disposeComponent(xAppView);
-}
-
-void Test::resetKey (const sal_Char *pPath, rtl::OUString aName)
-{
- css::uno::Reference< css::util::XChangesBatch > xAppView;
-
- // reset to default
- xAppView = css::uno::Reference< css::util::XChangesBatch > ( createView(pPath, true), css::uno::UNO_QUERY_THROW );
- css::uno::Reference< css::container::XNameReplace > xSettings(xAppView, css::uno::UNO_QUERY_THROW);
-
- css::uno::Reference< css::beans::XPropertyState > xSettingsState(xSettings, css::uno::UNO_QUERY);
- xSettingsState->setPropertyToDefault(aName);
- xAppView->commitChanges();
-
- disposeComponent(xAppView);
-}
-
-void Test::keyFetch()
-{
- try {
- rtl::OUString aStr;
- if (!(getKey ("/org.openoffice.Setup", "L10N/ooLocale") >>= aStr))
- CPPUNIT_FAIL("to fetch key");
- if (!(getKey ("/org.openoffice.Setup", "Test/AString") >>= aStr))
- CPPUNIT_FAIL("to fetch key");
- } CATCH_FAIL ("fetching key")
-}
-
-void Test::keySet()
-{
- try {
- setKey ("/org.openoffice.Setup/Test",
- rtl::OUString::createFromAscii("AString"),
- css::uno::makeAny (rtl::OUString::createFromAscii("baa")));
-
- // check value
- rtl::OUString aStr;
- if (!(getKey ("/org.openoffice.Setup/Test", "AString") >>= aStr))
- CPPUNIT_FAIL("to fetch key");
-
- CPPUNIT_ASSERT_MESSAGE ("check set value valid", aStr.equalsAscii("baa"));
- } CATCH_FAIL ("exception setting keys" )
-}
-
-void Test::keyReset()
-{
- try {
- resetKey ("/org.openoffice.Setup/Test",
- rtl::OUString::createFromAscii("AString"));
-
- // check value
- rtl::OUString aStr;
- if (!(getKey ("/org.openoffice.Setup/Test", "AString") >>= aStr))
- CPPUNIT_FAIL("to fetch key");
-
- CPPUNIT_ASSERT_MESSAGE ("check default value valid",
- aStr == rtl::OUString::createFromAscii("Foo"));
- } CATCH_FAIL ("exception setting keys" )
-}
-
-// This simulates the framework UI description code paths
-void Test::readCommands()
-{
- rtl::OUString aPropUILabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ));
- rtl::OUString aPropUIContextLabel( RTL_CONSTASCII_USTRINGPARAM( "ContextLabel" ));
- rtl::OUString aPropProperties( RTL_CONSTASCII_USTRINGPARAM( "Properties" ));
-
- try {
- css::uno::Reference< css::container::XNameAccess > xNameAccess (
- createView("/org.openoffice.UI.GenericCommands/UserInterface/Commands", false),
- css::uno::UNO_QUERY_THROW);
-
- CPPUNIT_ASSERT_MESSAGE ("fetched UI generic commands", xNameAccess.is());
-
- css::uno::Any a;
- css::uno::Sequence< rtl::OUString > aNameSeq = xNameAccess->getElementNames();
-
- CPPUNIT_ASSERT_MESSAGE ("right element / sequence", aNameSeq.getLength() == 696);
- sal_uInt32 end, start = osl_getGlobalTimer();
- for ( sal_Int32 j = 0; j < 8; j++ )
- {
- for ( sal_Int32 i = 0; i < aNameSeq.getLength(); i++ )
- {
- try
- {
- {
- css::uno::Reference< css::container::XNameAccess > xChildNameAccess;
- // This is the slow bit ! ...
- // Creating the @#$@#$ing XNameAccess object [ 650 times ]
- // which we then use to 'getByName' etc.
- a = xNameAccess->getByName( aNameSeq[i] );
- if ( a >>= xChildNameAccess )
- {
- a = xChildNameAccess->getByName( aPropUILabel );
- a = xChildNameAccess->getByName( aPropUIContextLabel );
- a = xChildNameAccess->getByName( aPropProperties );
- }
- }
- } CATCH_FAIL( "fetching keys" );
- }
- }
- end = osl_getGlobalTimer();
- t_print ("Reading elements took %d ms\n", (int)(end-start));
- disposeComponent (xNameAccess);
- } CATCH_FAIL( "accessing commands" );
-}
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
-
-NOADDITIONAL;
diff --git a/configmgr/qa/unit/schema/org/openoffice/Setup.xcs b/configmgr/qa/unit/schema/org/openoffice/Setup.xcs
deleted file mode 100644
index 990e4247075e..000000000000
--- a/configmgr/qa/unit/schema/org/openoffice/Setup.xcs
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<!DOCTYPE oor:component-schema SYSTEM "../../../component-schema.dtd">
-<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Setup" oor:package="org.openoffice" xml:lang="en-US">
- <info>
- <author>mmeeks</author>
- <desc >Setup prefs (for configmgr) and unit test schema bits.</desc>
- </info>
- <component>
- <group oor:name="L10N">
- <info>
- <author>PB</author>
- <desc>Specifies the installation locales.</desc>
- </info>
- <prop oor:name="ooLocale" oor:type="xs:string">
- <info>
- <author>PB</author>
- <desc>Indicates the Office language selected by the user.</desc>
- <label>Locale</label>
- </info>
- <value/>
- </prop>
- </group>
- <group oor:name="Test">
- <info>
- <author>mmeeks</author>
- <desc>Misc test pieces</desc>
- </info>
- <prop oor:name="ABoolean" oor:type="xs:boolean">
- <info>
- <author>mmeeks</author>
- <desc>A boolean</desc>
- <label>Boolean</label>
- </info>
- <value>false</value>
- </prop>
- <prop oor:name="AString" oor:type="xs:string">
- <info>
- <author>mmeeks</author>
- <desc>A string</desc>
- <label>String</label>
- </info>
- <value>Foo</value>
- </prop>
- </group>
- </component>
-</oor:component-schema>
diff --git a/configmgr/qa/unit/schema/org/openoffice/UI/Commands.xcs b/configmgr/qa/unit/schema/org/openoffice/UI/Commands.xcs
deleted file mode 100644
index 35f365aa714c..000000000000
--- a/configmgr/qa/unit/schema/org/openoffice/UI/Commands.xcs
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd">
-<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Commands" oor:package="org.openoffice.UI" xml:lang="en-US"> <info>
- <author>CD</author>
- <desc >Contains general information about ~ and rules, and about actions based on office commands.</desc>
- </info>
- <templates>
- <group oor:name="LabelType">
- <info>
- <desc>Provides a mapping between commands and their textual representation on the user interface.</desc>
- </info>
- <prop oor:name="Label" oor:type="xs:string" oor:localized="true">
- <info>
- <desc>A localized text that describes the command or identifier. Can be used as a label inside a menu or as short tool tip help.</desc>
- </info>
- </prop>
- <prop oor:name="ContextLabel" oor:type="xs:string" oor:localized="true">
- <info>
- <desc>A localized text that describes the identifier of a command in a structured menu. </desc>
- </info>
- </prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <info>
- <desc>
- Additional information about a single command.
- Bit 0 = Command has an image.
- Bit 1 = Image must be mirrored (CTL/vertical text).
- Bit 2 = Image must be rotated (CTL/vertical text).
- </desc>
- </info>
- <value>0</value>
- </prop>
- </group>
- </templates>
- <component/>
-</oor:component-schema>
diff --git a/configmgr/qa/unit/schema/org/openoffice/UI/GenericCommands.xcs b/configmgr/qa/unit/schema/org/openoffice/UI/GenericCommands.xcs
deleted file mode 100644
index dcfbe38abba4..000000000000
--- a/configmgr/qa/unit/schema/org/openoffice/UI/GenericCommands.xcs
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd">
-<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="GenericCommands" oor:package="org.openoffice.UI" xml:lang="en-US">
- <info>
- <author>CD</author>
- <desc >Contains general information about ~ and rules, and about actions based on office commands.</desc>
- </info>
- <import oor:component="org.openoffice.UI.Commands"/>
- <uses oor:component="org.openoffice.UI.Commands"/>
- <templates/>
- <component>
- <group oor:name="UserInterface">
- <info>
- <desc>Contains user interface data for Office commands and identifiers that are used by the user interface."</desc>
- </info>
- <set oor:name="Commands" oor:node-type="LabelType" oor:component="org.openoffice.UI.Commands">
- <info>
- <desc>Contains label text for Office commands and identifiers that are used by the user interface."</desc>
- </info>
- </set>
- </group>
- </component>
-</oor:component-schema>
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
new file mode 100644
index 000000000000..8e5e87310336
--- /dev/null
+++ b/configmgr/qa/unit/test.cxx
@@ -0,0 +1,678 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_configmgr.hxx"
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "com/sun/star/beans/NamedValue.hpp"
+#include "com/sun/star/beans/PropertyChangeEvent.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyState.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/container/XNameReplace.hpp"
+#include "com/sun/star/container/XNamed.hpp"
+#include "com/sun/star/lang/EventObject.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/util/XChangesBatch.hpp"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/servicefactory.hxx"
+#include "osl/conditn.hxx"
+#include "osl/thread.h"
+#include "osl/thread.hxx"
+#include "osl/time.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/textcvt.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "testshl/simpleheader.hxx"
+
+namespace {
+
+namespace css = com::sun::star;
+
+void normalize(
+ rtl::OUString const & path, rtl::OUString const & relative,
+ rtl::OUString * normalizedPath, rtl::OUString * name)
+{
+ sal_Int32 i = relative.lastIndexOf('/');
+ if (i == -1) {
+ *normalizedPath = path;
+ *name = relative;
+ } else {
+ rtl::OUStringBuffer buf(path);
+ buf.append(sal_Unicode('/'));
+ buf.append(relative.copy(0, i));
+ *normalizedPath = buf.makeStringAndClear();
+ *name = relative.copy(i + 1);
+ }
+}
+
+class Test: public CppUnit::TestFixture {
+public:
+ virtual void setUp();
+
+ virtual void tearDown();
+
+ void testKeyFetch();
+
+ void testKeySet();
+
+ void testKeyReset();
+
+ void testSetSetMemberName();
+
+ void testReadCommands();
+
+ void testThreads();
+
+ void testRecursive();
+
+ void testCrossThreads();
+
+ css::uno::Any getKey(
+ rtl::OUString const & path, rtl::OUString const & relative) const;
+
+ void setKey(
+ rtl::OUString const & path, rtl::OUString const & name,
+ css::uno::Any const & value) const;
+
+ bool resetKey(rtl::OUString const & path, rtl::OUString const & name) const;
+
+ css::uno::Reference< css::uno::XInterface > createViewAccess(
+ rtl::OUString const & path) const;
+
+ css::uno::Reference< css::uno::XInterface > createUpdateAccess(
+ rtl::OUString const & path) const;
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testKeyFetch);
+ CPPUNIT_TEST(testKeySet);
+ CPPUNIT_TEST(testKeyReset);
+ CPPUNIT_TEST(testSetSetMemberName);
+ CPPUNIT_TEST(testReadCommands);
+ CPPUNIT_TEST(testThreads);
+ CPPUNIT_TEST(testRecursive);
+ CPPUNIT_TEST(testCrossThreads);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ css::uno::Reference< css::uno::XComponentContext > context_;
+ css::uno::Reference< css::lang::XMultiServiceFactory > provider_;
+};
+
+class TestThread: public osl::Thread {
+public:
+ TestThread(osl::Condition & stop);
+
+ bool getSuccess() const;
+
+protected:
+ virtual bool iteration() = 0;
+
+private:
+ virtual void SAL_CALL run();
+
+ osl::Condition & stop_;
+ bool success_;
+};
+
+TestThread::TestThread(
+ osl::Condition & stop):
+ stop_(stop), success_(true)
+{}
+
+bool TestThread::getSuccess() const {
+ return success_;
+}
+
+void TestThread::run() {
+ try {
+ while (!stop_.check()) {
+ if (!iteration()) {
+ success_ = false;
+ }
+ }
+ } catch (...) {
+ success_ = false;
+ }
+}
+
+class ReaderThread: public TestThread {
+public:
+ ReaderThread(
+ osl::Condition & stop, Test const & test, rtl::OUString const & path,
+ rtl::OUString const & relative);
+
+private:
+ virtual bool iteration();
+
+ Test const & test_;
+ rtl::OUString path_;
+ rtl::OUString relative_;
+};
+
+ReaderThread::ReaderThread(
+ osl::Condition & stop, Test const & test, rtl::OUString const & path,
+ rtl::OUString const & relative):
+ TestThread(stop), test_(test), path_(path), relative_(relative)
+{
+ create();
+}
+
+bool ReaderThread::iteration() {
+ return test_.getKey(path_, relative_).hasValue();
+}
+
+class WriterThread: public TestThread {
+public:
+ WriterThread(
+ osl::Condition & stop, Test const & test, rtl::OUString const & path,
+ rtl::OUString const & relative);
+
+private:
+ virtual bool iteration();
+
+ Test const & test_;
+ rtl::OUString path_;
+ rtl::OUString name_;
+ std::size_t index_;
+};
+
+WriterThread::WriterThread(
+ osl::Condition & stop, Test const & test, rtl::OUString const & path,
+ rtl::OUString const & relative):
+ TestThread(stop), test_(test), index_(0)
+{
+ normalize(path, relative, &path_, &name_);
+ create();
+}
+
+bool WriterThread::iteration() {
+ rtl::OUString options[] = {
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fish")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("chips")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("kippers")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bloaters")) };
+ test_.setKey(path_, name_, css::uno::makeAny(options[index_]));
+ index_ = (index_ + 1) % (sizeof options / sizeof (rtl::OUString));
+ return true;
+}
+
+class RecursiveTest:
+ public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >
+{
+public:
+ RecursiveTest(Test const & theTest, int count, bool * destroyed);
+
+ void test();
+
+protected:
+ virtual ~RecursiveTest();
+
+ virtual void step() const = 0;
+
+ Test const & test_;
+
+private:
+ virtual void SAL_CALL disposing(css::lang::EventObject const &)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL propertyChange(
+ css::beans::PropertyChangeEvent const &)
+ throw (css::uno::RuntimeException);
+
+ int count_;
+ bool * destroyed_;
+ css::uno::Reference< css::beans::XPropertySet > properties_;
+};
+
+RecursiveTest::RecursiveTest(
+ Test const & theTest, int count, bool * destroyed):
+ test_(theTest), count_(count), destroyed_(destroyed)
+{}
+
+void RecursiveTest::test() {
+ properties_ = css::uno::Reference< css::beans::XPropertySet >(
+ test_.createUpdateAccess(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/Commands/"
+ "dotuno:WebHtml"))),
+ css::uno::UNO_QUERY_THROW);
+ properties_->addPropertyChangeListener(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), this);
+ step();
+ CPPUNIT_ASSERT(count_ == 0);
+ css::uno::Reference< css::lang::XComponent >(
+ properties_, css::uno::UNO_QUERY_THROW)->dispose();
+}
+
+RecursiveTest::~RecursiveTest() {
+ *destroyed_ = true;
+}
+
+void RecursiveTest::disposing(css::lang::EventObject const & Source)
+ throw (css::uno::RuntimeException)
+{
+ CPPUNIT_ASSERT(properties_.is() && Source.Source == properties_);
+ properties_.clear();
+}
+
+void RecursiveTest::propertyChange(css::beans::PropertyChangeEvent const & evt)
+ throw (css::uno::RuntimeException)
+{
+ CPPUNIT_ASSERT(
+ evt.Source == properties_ &&
+ evt.PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Label")));
+ if (count_ > 0) {
+ --count_;
+ step();
+ }
+}
+
+class SimpleRecursiveTest: public RecursiveTest {
+public:
+ SimpleRecursiveTest(Test const & theTest, int count, bool * destroyed);
+
+private:
+ virtual void step() const;
+};
+
+SimpleRecursiveTest::SimpleRecursiveTest(
+ Test const & theTest, int count, bool * destroyed):
+ RecursiveTest(theTest, count, destroyed)
+{}
+
+void SimpleRecursiveTest::step() const {
+ test_.setKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/Commands/"
+ "dotuno:WebHtml")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")),
+ css::uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("step"))));
+}
+
+class CrossThreadTest: public RecursiveTest {
+public:
+ CrossThreadTest(Test const & theTest, int count, bool * destroyed);
+
+private:
+ virtual void step() const;
+};
+
+CrossThreadTest::CrossThreadTest(
+ Test const & theTest, int count, bool * destroyed):
+ RecursiveTest(theTest, count, destroyed)
+{}
+
+void CrossThreadTest::step() const {
+ osl::Condition stop;
+ stop.set();
+ WriterThread(
+ stop, test_,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/Commands/"
+ "dotuno:WebHtml")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))).join();
+ test_.resetKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/Commands/"
+ "dotuno:WebHtml")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")));
+}
+
+void Test::setUp() {
+ char const * forward = getForwardString();
+ rtl_uString * registry = 0;
+ CPPUNIT_ASSERT(
+ rtl_convertStringToUString(
+ &registry, forward, rtl_str_getLength(forward),
+ osl_getThreadTextEncoding(),
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)));
+ context_ = css::uno::Reference< css::uno::XComponentContext >(
+ css::uno::Reference< css::beans::XPropertySet >(
+ cppu::createRegistryServiceFactory(
+ rtl::OUString(registry, SAL_NO_ACQUIRE)),
+ css::uno::UNO_QUERY_THROW)->getPropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
+ css::uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(
+ context_->getValueByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/"
+ "com.sun.star.configuration.theDefaultProvider"))) >>=
+ provider_);
+}
+
+void Test::tearDown() {
+ css::uno::Reference< css::lang::XComponent >(
+ context_, css::uno::UNO_QUERY_THROW)->dispose();
+}
+
+void Test::testKeyFetch() {
+ rtl::OUString s;
+ CPPUNIT_ASSERT(
+ getKey(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale"))) >>=
+ s);
+ CPPUNIT_ASSERT(
+ getKey(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/AString"))) >>=
+ s);
+}
+
+void Test::testKeySet() {
+ setKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString")),
+ css::uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baa"))));
+ rtl::OUString s;
+ CPPUNIT_ASSERT(
+ getKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString"))) >>=
+ s);
+ CPPUNIT_ASSERT(s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("baa")));
+}
+
+void Test::testKeyReset() {
+ if (resetKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString"))))
+ {
+ rtl::OUString s;
+ CPPUNIT_ASSERT(
+ getKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/Test")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AString"))) >>=
+ s);
+ CPPUNIT_ASSERT(s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Foo")));
+ }
+}
+
+void Test::testSetSetMemberName() {
+ rtl::OUString s;
+ CPPUNIT_ASSERT(
+ getKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/Commands/"
+ ".uno:FontworkShapeType")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))) >>=
+ s);
+ CPPUNIT_ASSERT(
+ s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Fontwork Shape")));
+
+ css::uno::Reference< css::container::XNameAccess > access(
+ createUpdateAccess(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/"
+ "Commands"))),
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::container::XNamed > member;
+ access->getByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(".uno:FontworkGalleryFloater"))) >>=
+ member;
+ CPPUNIT_ASSERT(member.is());
+ member->setName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(".uno:FontworkShapeType")));
+ css::uno::Reference< css::util::XChangesBatch >(
+ access, css::uno::UNO_QUERY_THROW)->commitChanges();
+ css::uno::Reference< css::lang::XComponent >(
+ access, css::uno::UNO_QUERY_THROW)->dispose();
+
+ CPPUNIT_ASSERT(
+ getKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/Commands/"
+ ".uno:FontworkShapeType")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label"))) >>=
+ s);
+ CPPUNIT_ASSERT(
+ s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Fontwork Gallery")));
+}
+
+void Test::testReadCommands() {
+ css::uno::Reference< css::container::XNameAccess > access(
+ createViewAccess(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands/UserInterface/"
+ "Commands"))),
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence< rtl::OUString > names(access->getElementNames());
+ CPPUNIT_ASSERT(names.getLength() == 695);
+ // testSetSetMemberName() already removed ".uno:FontworkGalleryFloater"
+ sal_uInt32 n = osl_getGlobalTimer();
+ for (int i = 0; i < 8; ++i) {
+ for (sal_Int32 j = 0; j < names.getLength(); ++j) {
+ css::uno::Reference< css::container::XNameAccess > child;
+ if (access->getByName(names[j]) >>= child) {
+ CPPUNIT_ASSERT(child.is());
+ child->getByName(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")));
+ child->getByName(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContextLabel")));
+ child->getByName(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Properties")));
+ }
+ }
+ }
+ n = osl_getGlobalTimer() - n;
+ t_print("Reading elements took %" SAL_PRIuUINT32 " ms\n", n);
+ css::uno::Reference< css::lang::XComponent >(
+ access, css::uno::UNO_QUERY_THROW)->dispose();
+}
+
+void Test::testThreads() {
+ struct Entry { rtl::OUString path; rtl::OUString relative; };
+ Entry list[] = {
+ { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/AString")) },
+ { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/AString")) },
+ { rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands")),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "UserInterface/Commands/dotuno:WebHtml/Label")) },
+ { rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands")),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "UserInterface/Commands/dotuno:NewPresentation/Label")) },
+ { rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.UI.GenericCommands")),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "UserInterface/Commands/dotuno:RecentFileList/Label")) },
+ { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale")) },
+ { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test/ABoolean")) }
+ };
+ std::size_t const numReaders = sizeof list / sizeof (Entry);
+ std::size_t const numWriters = numReaders - 2;
+ ReaderThread * readers[numReaders];
+ WriterThread * writers[numWriters];
+ osl::Condition stop;
+ for (std::size_t i = 0; i < numReaders; ++i) {
+ CPPUNIT_ASSERT(getKey(list[i].path, list[i].relative).hasValue());
+ readers[i] = new ReaderThread(
+ stop, *this, list[i].path, list[i].relative);
+ }
+ for (std::size_t i = 0; i < numWriters; ++i) {
+ writers[i] = new WriterThread(
+ stop, *this, list[i].path, list[i].relative);
+ }
+ for (int i = 0; i < 5; ++i) {
+ for (std::size_t j = 0; j < numReaders; ++j) {
+ rtl::OUString path;
+ rtl::OUString name;
+ normalize(list[j].path, list[j].relative, &path, &name);
+ resetKey(path, name);
+ osl::Thread::yield();
+ }
+ }
+ stop.set();
+ bool success = true;
+ for (std::size_t i = 0; i < numReaders; ++i) {
+ readers[i]->join();
+ success = success && readers[i]->getSuccess();
+ delete readers[i];
+ }
+ for (std::size_t i = 0; i < numWriters; ++i) {
+ writers[i]->join();
+ success = success && writers[i]->getSuccess();
+ delete writers[i];
+ }
+ CPPUNIT_ASSERT(success);
+}
+
+void Test::testRecursive() {
+ bool destroyed = false;
+ rtl::Reference< RecursiveTest >(
+ new SimpleRecursiveTest(*this, 100, &destroyed))->test();
+ CPPUNIT_ASSERT(destroyed);
+}
+
+void Test::testCrossThreads() {
+ bool destroyed = false;
+ rtl::Reference< RecursiveTest >(
+ new SimpleRecursiveTest(*this, 10, &destroyed))->test();
+ CPPUNIT_ASSERT(destroyed);
+}
+
+css::uno::Any Test::getKey(
+ rtl::OUString const & path, rtl::OUString const & relative) const
+{
+ css::uno::Reference< css::container::XHierarchicalNameAccess > access(
+ createViewAccess(path), css::uno::UNO_QUERY_THROW);
+ css::uno::Any value(access->getByHierarchicalName(relative));
+ css::uno::Reference< css::lang::XComponent >(
+ access, css::uno::UNO_QUERY_THROW)->dispose();
+ return value;
+}
+
+void Test::setKey(
+ rtl::OUString const & path, rtl::OUString const & name,
+ css::uno::Any const & value) const
+{
+ css::uno::Reference< css::container::XNameReplace > access(
+ createUpdateAccess(path), css::uno::UNO_QUERY_THROW);
+ access->replaceByName(name, value);
+ css::uno::Reference< css::util::XChangesBatch >(
+ access, css::uno::UNO_QUERY_THROW)->commitChanges();
+ css::uno::Reference< css::lang::XComponent >(
+ access, css::uno::UNO_QUERY_THROW)->dispose();
+}
+
+bool Test::resetKey(rtl::OUString const & path, rtl::OUString const & name)
+ const
+{
+ //TODO: support setPropertyToDefault
+ css::uno::Reference< css::util::XChangesBatch > access(
+ createUpdateAccess(path), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::beans::XPropertyState > state(
+ access, css::uno::UNO_QUERY);
+ if (!state.is()) {
+ return false;
+ }
+ state->setPropertyToDefault(name);
+ access->commitChanges();
+ css::uno::Reference< css::lang::XComponent >(
+ access, css::uno::UNO_QUERY_THROW)->dispose();
+ return true;
+}
+
+css::uno::Reference< css::uno::XInterface > Test::createViewAccess(
+ rtl::OUString const & path) const
+{
+ css::uno::Any arg(
+ css::uno::makeAny(
+ css::beans::NamedValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ css::uno::makeAny(path))));
+ return provider_->createInstanceWithArguments(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess")),
+ css::uno::Sequence< css::uno::Any >(&arg, 1));
+}
+
+css::uno::Reference< css::uno::XInterface > Test::createUpdateAccess(
+ rtl::OUString const & path) const
+{
+ css::uno::Any arg(
+ css::uno::makeAny(
+ css::beans::NamedValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ css::uno::makeAny(path))));
+ return provider_->createInstanceWithArguments(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationUpdateAccess")),
+ css::uno::Sequence< css::uno::Any >(&arg, 1));
+}
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltest");
+
+}
+
+NOADDITIONAL;
diff --git a/configmgr/qa/unit/threading.cxx b/configmgr/qa/unit/threading.cxx
deleted file mode 100644
index 4ae68133b690..000000000000
--- a/configmgr/qa/unit/threading.cxx
+++ /dev/null
@@ -1,259 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "common.hxx"
-#include <osl/thread.hxx>
-#include <osl/conditn.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include "com/sun/star/beans/XPropertyChangeListener.hpp"
-
-class KeyTester : public osl::Thread
-{
- osl::Condition *m_pCond;
- protected:
- rtl::OString m_aPath;
- rtl::OString m_aKey;
- Test *m_pTest;
- public:
- KeyTester (osl::Condition *pCond, Test *pTest,
- const char *pPath, const char *pKey)
- : m_pCond (pCond)
- , m_aPath (pPath)
- , m_aKey (pKey)
- , m_pTest (pTest)
- {
- }
- virtual ~KeyTester ()
- {
- }
- virtual void SAL_CALL run ()
- {
- testIteration();
- while (!m_pCond->check())
- testIteration();
- }
- virtual void testIteration()
- {
- css::uno::Any a = m_pTest->getKey (m_aPath, m_aKey);
- CPPUNIT_ASSERT_MESSAGE ("no value", a.hasValue());
- }
-};
-
-class KeyReader : public KeyTester
-{
-public:
- KeyReader (osl::Condition *pCond, Test *pTest,
- const char *pPath, const char *pKey)
- : KeyTester (pCond, pTest, pPath, pKey)
- {
- // to ensure we have the right vtable when we hit 'run'
- create();
- }
-};
-
-class KeyWriter : public KeyTester
-{
- int curOpt;
- public:
- KeyWriter (osl::Condition *pCond, Test *pTest,
- const char *pPath, const char *pKey)
- : KeyTester (pCond, pTest, pPath, pKey)
- , curOpt(0)
- {
- m_pTest->normalizePathKey (m_aPath, m_aKey);
- create();
- }
- virtual void testIteration ()
- {
- try {
- static const char *options[] = { "fish", "chips", "kippers", "bloaters" };
-// fprintf (stderr, "set key %d\n",
-// (int) osl_getThreadIdentifier(NULL));
- m_pTest->setKey (m_aPath, rtl::OUString::createFromAscii (m_aKey),
- css::uno::makeAny (rtl::OUString::createFromAscii(options[(curOpt++ & 3)])));
- } CATCH_FAIL ("setting keys")
- }
-};
-
-void Test::threadTests()
-{
- osl::Condition stop;
- stop.reset();
-
- struct {
- const char *pPath;
- const char *pKey;
- } keyList[] = {
- { "/org.openoffice.Setup", "Test/AString" },
- { "/org.openoffice.Setup", "Test/AString" },
- { "/org.openoffice.UI.GenericCommands", "UserInterface/Commands/dotuno:WebHtml/Label" },
- { "/org.openoffice.UI.GenericCommands", "UserInterface/Commands/dotuno:NewPresentation/Label" },
- { "/org.openoffice.UI.GenericCommands", "UserInterface/Commands/dotuno:RecentFileList/Label" },
-
- { "/org.openoffice.Setup", "L10N/ooLocale" },
- { "/org.openoffice.Setup", "Test/ABoolean" }
- };
- const int numReaders = sizeof (keyList) / sizeof (keyList[0]);
- const int numWriters = (sizeof (keyList) / sizeof (keyList[0])) - 2;
- KeyReader *pReaders[numReaders];
- KeyWriter *pWriters[numReaders];
-
- int i;
- try {
- for (i = 0; i < numReaders; i++) {
- css::uno::Any a = getKey (keyList[i].pPath, keyList[i].pKey);
- CPPUNIT_ASSERT_MESSAGE ("check key", a.hasValue());
- }
-
- // a few readers
- for (i = 0; i < numReaders; i++)
- pReaders[i] = new KeyReader (&stop, this, keyList[i].pPath,
- keyList[i].pKey);
- // a few writers
- for (i = 0; i < numWriters; i++)
- pWriters[i] = new KeyWriter (&stop, this, keyList[i].pPath,
- keyList[i].pKey);
-
- // Threads are running ...
- const int numIters = 5;
- for (int j = 0; j < numIters; j++) {
- for (i = 0; i < numReaders; i++)
- {
- try {
- rtl::OString aPath (keyList[i].pPath);
- rtl::OString aKey (keyList[i].pKey);
- normalizePathKey (aPath, aKey);
- resetKey (aPath, rtl::OUString::createFromAscii (aKey));
- osl::Thread::yield();
- } CATCH_FAIL ("resetting keys");
- }
- }
- stop.set();
-
- for (i = 0; i < numReaders; i++) {
- pReaders[i]->join();
- delete pReaders[i];
- }
- for (i = 0; i < numWriters; i++) {
- pWriters[i]->join();
- delete pWriters[i];
- }
-
- } CATCH_FAIL ("checking keys exist")
-}
-
-class RecursiveListener : public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >
-{
-public:
- sal_Int32 m_nRecurse;
- css::uno::Reference< css::beans::XPropertySet > mxPropSet;
- protected:
- Test *m_pTest;
- rtl::OString m_pPath;
- rtl::OString m_pKey;
- public:
- RecursiveListener (Test *pTest, int nCount,
- const char *pPath, const char *pKey)
- : m_nRecurse (nCount)
- , m_pTest (pTest)
- , m_pPath (pPath)
- , m_pKey (pKey)
- {
- mxPropSet = css::uno::Reference< css::beans::XPropertySet > (
- pTest->createView (pPath, true), css::uno::UNO_QUERY_THROW );
-
- CPPUNIT_ASSERT_MESSAGE ("is prop set", mxPropSet.is());
- mxPropSet->addPropertyChangeListener (rtl::OUString::createFromAscii (m_pKey),
- css::uno::Reference<css::beans::XPropertyChangeListener>(this));
- }
- virtual ~RecursiveListener()
- {
- disposeComponent (mxPropSet);
- }
-
- virtual void SAL_CALL acquire() throw() { cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >::acquire(); }
- virtual void SAL_CALL release() throw() { cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >::acquire(); }
- // XPropertyChangeListener
- virtual void SAL_CALL propertyChange( const ::css::beans::PropertyChangeEvent& ) throw (::css::uno::RuntimeException)
- {
- if (m_nRecurse-- > 0)
- runTest();
- }
- // XEventListener
- virtual void SAL_CALL disposing( const ::css::lang::EventObject& ) throw (::css::uno::RuntimeException)
- {
- }
- virtual void runTest()
- {
- m_pTest->setKey (m_pPath, rtl::OUString::createFromAscii (m_pKey),
- css::uno::makeAny(
- rtl::OUString::valueOf (m_nRecurse) ) );
- }
-};
-
-class CrossThreadListener : public RecursiveListener
-{
- public:
- CrossThreadListener (Test *pTest, int nCount,
- const char *pPath, const char *pKey)
- : RecursiveListener (pTest, nCount, pPath, pKey)
- {
- }
- virtual ~CrossThreadListener()
- {
- }
- virtual void runTest()
- {
- osl::Condition stopAfterOne;
- stopAfterOne.set();
- KeyWriter aWriter (&stopAfterOne, m_pTest, m_pPath, m_pKey);
- aWriter.join();
-
- rtl::OString aPath (m_pPath), aKey (m_pKey);
- m_pTest->normalizePathKey (aPath, aKey);
- m_pTest->resetKey (aPath, rtl::OUString::createFromAscii (aKey));
- }
-};
-
-void Test::recursiveTests()
-{
- RecursiveListener *pList = new RecursiveListener(this, 100,
- "/org.openoffice.UI.GenericCommands/UserInterface/Commands/dotuno:WebHtml",
- "Label");
- css::uno::Reference< css::beans::XPropertyChangeListener > xListener(pList);
- pList->runTest();
-}
-
-void Test::eventTests()
-{
- CrossThreadListener *pList = new CrossThreadListener(this, 10,
- "/org.openoffice.UI.GenericCommands/UserInterface/Commands/dotuno:WebHtml",
- "Label");
- css::uno::Reference< css::beans::XPropertyChangeListener > xListener(pList);
- pList->runTest();
-}
-
diff --git a/configmgr/qa/unit/ubootstrap.cxx b/configmgr/qa/unit/ubootstrap.cxx
deleted file mode 100644
index 362ab31b842e..000000000000
--- a/configmgr/qa/unit/ubootstrap.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "common.hxx"
-#include <osl/file.hxx>
-
-// Do all those evil things to make the tests actually work ...
-Magic::Magic()
-{
- rtl_uString *curWd = NULL;
- osl_getProcessWorkingDir( &curWd );
-
- rtl::OUString aKey;
- rtl::OUString aValue( curWd );
-
- // Unless you do this, obviously you don't want your paths to be correct
- // or file access to work properly
- aKey = rtl::OUString::createFromAscii( "BaseInstallation" );
- rtl_bootstrap_set( aKey.pData, aValue.pData );
- // Unless you do this, obviously you don't deserve to have anything work
- aKey = rtl::OUString::createFromAscii( "CFG_INIFILE" );
- aValue += rtl::OUString::createFromAscii( "/configmgrrc" );
- rtl_bootstrap_set( aKey.pData, aValue.pData );
-
- // FIXME: Create a safe /tmp directory - unfotunately that
- // either requires dependencies we don't have, or some cut &
- // paste action of unotools/source/ucbhelper/tempfile.cxx
- if (osl::File::getTempDirURL(maTempDir) != osl::FileBase::E_None) {
- t_print ("no tmp dir");
- CPPUNIT_FAIL ("no tmp dir");
- }
- maTempDir += rtl::OUString::createFromAscii("/unittstconfig");
- osl::FileBase::RC err = osl::Directory::create (maTempDir);
-
- if (err != osl::FileBase::E_None) {
- t_print ("tmp dir '%s' already exists\n",
- rtl::OUStringToOString (maTempDir, RTL_TEXTENCODING_UTF8).getStr());
- CPPUNIT_FAIL ("tmp user config dir already exists!");
- }
-
- aKey = rtl::OUString::createFromAscii( "UserInstallation" );
- rtl_bootstrap_set( aKey.pData, maTempDir.pData );
-}
-
-void removeRecursive (const rtl::OUString& aPath)
-{
- sal_Int32 nMask = FileStatusMask_Type | FileStatusMask_FileURL;
-
-// fprintf (stderr, "Remove recursive '%s'\n", rtl::OUStringToOString (aPath, RTL_TEXTENCODING_UTF8).getStr());
-
- osl::DirectoryItem aItem;
- osl::FileStatus aStatus( nMask );
- osl::FileBase::RC nError;
-
- nError = osl::DirectoryItem::get( aPath, aItem );
- CPPUNIT_ASSERT_MESSAGE ("invalid path", nError == osl::FileBase::E_None);
-
- nError = aItem.getFileStatus( aStatus );
- CPPUNIT_ASSERT_MESSAGE ("invalid file", nError == osl::FileBase::E_None);
-
- if (aStatus.getFileType() == osl::FileStatus::Regular ||
- aStatus.getFileType() == osl::FileStatus::Link )
- {
- nError = osl::File::remove( aPath );
-// fprintf (stderr, "Remove file '%s'\n", rtl::OUStringToOString (aPath, RTL_TEXTENCODING_UTF8).getStr());
- CPPUNIT_ASSERT_MESSAGE ("removing file", nError == osl::FileBase::E_None);
- }
- else if (aStatus.getFileType() == osl::FileStatus::Directory)
- {
- osl::Directory aDirectory (aPath);
- nError = aDirectory.open();
- CPPUNIT_ASSERT_MESSAGE ("opening dir", nError == osl::FileBase::E_None);
-
- rtl::OUString name;
-
- while (true) {
- nError = aDirectory.getNextItem( aItem );
- if ( nError != osl::FileBase::E_None )
- break;
- nError = aItem.getFileStatus( aStatus );
- CPPUNIT_ASSERT_MESSAGE ("getting status", nError == osl::FileBase::E_None);
- removeRecursive (aStatus.getFileURL());
- }
- aDirectory.close();
-
- nError = osl::Directory::remove( aPath );
-// fprintf (stderr, "Remove dir '%s'\n", rtl::OUStringToOString (aPath, RTL_TEXTENCODING_UTF8).getStr());
-
- CPPUNIT_ASSERT_MESSAGE ("removing directory", nError == osl::FileBase::E_None);
- }
-}
-
-Magic::~Magic()
-{
- removeRecursive (maTempDir);
-}
diff --git a/configmgr/qa/unit/urebootstrap.ini b/configmgr/qa/unit/urebootstrap.ini
new file mode 100644
index 000000000000..c413645d0f43
--- /dev/null
+++ b/configmgr/qa/unit/urebootstrap.ini
@@ -0,0 +1,30 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+[Bootstrap]
+OOO_BASE_DIR = $ORIGIN/basis
+BRAND_BASE_DIR = $ORIGIN/brand
diff --git a/configmgr/qa/unit/version.map b/configmgr/qa/unit/version.map
new file mode 100644
index 000000000000..6b30413b896e
--- /dev/null
+++ b/configmgr/qa/unit/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+UDK_3_0_0 {
+ global:
+ registerAllTestFunction;
+
+ local:
+ *;
+};
diff --git a/configmgr/qa/unoapi/cfgmgr2.sce b/configmgr/qa/unoapi/cfgmgr2.sce
deleted file mode 100644
index e7c4adcb6e34..000000000000
--- a/configmgr/qa/unoapi/cfgmgr2.sce
+++ /dev/null
@@ -1,34 +0,0 @@
--o cfgmgr2.LocalSchemaSupplier
--o cfgmgr2.LocalSingleStratum
--o cfgmgr2.MultiStratumBackend
--o sysmgr1.SystemIntegration
-#i46913# -o cfgmgr2.BootstrapContext
--o cfgmgr2.LayerUpdateMerger
--o cfgmgr2.LayerWriter
--o cfgmgr2.LocalDataImporter
--o cfgmgr2.LocalHierarchyBrowser
--o cfgmgr2.LocalSingleBackend
--o cfgmgr2.MergeImporter
--o cfgmgr2.OConfigurationRegistry
--o cfgmgr2.OInnerGroupInfoAccess
--o cfgmgr2.OInnerGroupUpdateAccess
--o cfgmgr2.OInnerSetInfoAccess
-#i46185# -o cfgmgr2.OInnerTreeSetUpdateAccess
--o cfgmgr2.OInnerValueSetUpdateAccess
--o cfgmgr2.ORootElementGroupInfoAccess
--o cfgmgr2.ORootElementGroupUpdateAccess
--o cfgmgr2.ORootElementSetInfoAccess
-#i46185# -o cfgmgr2.ORootElementTreeSetUpdateAccess
--o cfgmgr2.ORootElementValueSetUpdateAccess
--o cfgmgr2.OSetElementGroupInfoAccess
--o cfgmgr2.OSetElementGroupUpdateAccess
--o cfgmgr2.OSetElementSetInfoAccess
-#i46185# -o cfgmgr2.OSetElementTreeSetUpdateAccess
-#i84221# -o cfgmgr2.OSetElementValueSetUpdateAccess
--o cfgmgr2.SchemaParser
--o cfgmgr2.SingleBackendAdapter
--o cfgmgr2.ConfigurationProviderWrapper
-#i87744# -o cfgmgr2.LayerParser
--o cfgmgr2.CopyImporter
--o cfgmgr2.AdministrationProvider
--o cfgmgr2.ConfigurationProvider
diff --git a/configmgr/qa/unoapi/knownissues.xcl b/configmgr/qa/unoapi/knownissues.xcl
deleted file mode 100644
index d8956a6e8d85..000000000000
--- a/configmgr/qa/unoapi/knownissues.xcl
+++ /dev/null
@@ -1,55 +0,0 @@
-### i84222 ###
-cfgmgr2.LocalSingleBackend::com::sun::star::configuration::backend::XMultiLayerStratum
-
-### i23145 ###
-cfgmgr2.OSetElementGroupUpdateAccess::com::sun::star::container::XChild
-
-### i38211 ###
-cfgmgr2.ConfigurationProvider::com::sun::star::lang::XComponent
-
-### i46185 ###
-cfgmgr2.OInnerTreeSetUpdateAccess::com::sun::star::container::XNameContainer
-cfgmgr2.OSetElementTreeSetUpdateAccess::com::sun::star::container::XNameContainer
-cfgmgr2.ORootElementTreeSetUpdateAccess::com::sun::star::container::XNameContainer
-# -> test is disbaled in cfgmgr2.sce
-
-### i46913 ###
-cfgmgr2.BootstrapContext::com::sun::star::uno::XComponentContext
-# -> test is disbaled in cfgmgr2.sce
-
-### i83881 ###
-cfgmgr2.OInnerValueSetUpdateAccess::com::sun::star::container::XNameReplace
-
-### i65847 ###
-cfgmgr2.OInnerTreeSetUpdateAccess::com::sun::star::beans::XPropertyWithState
-# -> test is disbaled in cfgmgr2.sce
-
-### i68673 ###
-cfgmgr2.ORootElementTreeSetUpdateAccess::com::sun::star::beans::XPropertyWithState
-# -> test is disbaled in cfgmgr2.sce
-
-### i79114 ###
-sysmgr1.SystemIntegration::com::sun::star::configuration::backend::XBackend
-
-### i83880 ###
-cfgmgr2.ORootElementValueSetUpdateAccess::com::sun::star::container::XNameReplace
-
-### i84221 ###
-cfgmgr2.OSetElementValueSetUpdateAccess
-
-### i87744 ###
-cfgmgr2.LayerParser
-# -> test is disbaled in cfgmgr2.sce
-
-### i88358 ###
-cfgmgr2.OInnerValueSetUpdateAccess::com::sun::star::container::XHierarchicalNameAccess
-cfgmgr2.OInnerValueSetUpdateAccess::com::sun::star::beans::XExactName
-
-### i88360 ###
-cfgmgr2.ORootElementValueSetUpdateAccess::com::sun::star::util::XChangesBatch
-
-### i89412 ###
-cfgmgr2.OInnerValueSetUpdateAccess::com::sun::star::container::XElementAccess
-
-### i89413 ###
-cfgmgr2.ORootElementValueSetUpdateAccess::com::sun::star::container::XHierarchicalNameAccess
diff --git a/configmgr/qa/unoapi/makefile.mk b/configmgr/qa/unoapi/makefile.mk
index 879e3bebde74..252e4a0d9af4 100644
--- a/configmgr/qa/unoapi/makefile.mk
+++ b/configmgr/qa/unoapi/makefile.mk
@@ -1,4 +1,5 @@
#*************************************************************************
+#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -21,6 +22,7 @@
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
+#
#***********************************************************************/
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
diff --git a/configmgr/qa/unoapi/module.sce b/configmgr/qa/unoapi/module.sce
new file mode 100644
index 000000000000..d9b1c8b540b3
--- /dev/null
+++ b/configmgr/qa/unoapi/module.sce
@@ -0,0 +1,29 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+-o configmgr.ConfigurationProvider
+-o configmgr.DefaultProvider