summaryrefslogtreecommitdiff
path: root/configmgr/qa
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2009-09-11 10:11:42 +0200
committersb <sb@openoffice.org>2009-09-11 10:11:42 +0200
commit37f2edbc91a1800b1f68eee5fd908938ab817ae2 (patch)
treeb3fabd8b949827c0b58526f7593b5d049305f892 /configmgr/qa
parent0fdd5ada8bad6d7058c5ad117ff6b230ce1a9619 (diff)
#101955# transfered (and adapted) unit test from old configmgr/qa/unit to new configmgr2/qa/unit; fixed errors in new configmgr2 code revealed by that unit test
Diffstat (limited to 'configmgr/qa')
-rw-r--r--configmgr/qa/unit/common.hxx114
-rw-r--r--configmgr/qa/unit/performance.cxx271
-rw-r--r--configmgr/qa/unit/threading.cxx262
3 files changed, 0 insertions, 647 deletions
diff --git a/configmgr/qa/unit/common.hxx b/configmgr/qa/unit/common.hxx
deleted file mode 100644
index d53d52d55ad7..000000000000
--- a/configmgr/qa/unit/common.hxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: common.hxx,v $
- * $Revision: 1.3 $
- *
- * 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 "cppunit/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/performance.cxx b/configmgr/qa/unit/performance.cxx
deleted file mode 100644
index a1e338bf16be..000000000000
--- a/configmgr/qa/unit/performance.cxx
+++ /dev/null
@@ -1,271 +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 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: performance.cxx,v $
- * $Revision: 1.3 $
- *
- * 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/threading.cxx b/configmgr/qa/unit/threading.cxx
deleted file mode 100644
index 1531e9f49138..000000000000
--- a/configmgr/qa/unit/threading.cxx
+++ /dev/null
@@ -1,262 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: threading.cxx,v $
- * $Revision: 1.3 $
- *
- * 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 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();
-}
-