[Libreoffice-commits] core.git: 2 commits - dbaccess/util extensions/source framework/source framework/util include/sal postprocess/CppunitTest_services.mk postprocess/qa
Stephan Bergmann
sbergman at redhat.com
Thu Dec 19 13:47:03 PST 2013
dbaccess/util/dba.component | 1
extensions/source/logging/log.component | 1
extensions/source/resource/res.component | 1
extensions/source/resource/resourceservices.cxx | 1
framework/source/services/ContextChangeEventMultiplexer.cxx | 11 -
framework/util/fwk.component | 1
include/sal/log-areas.dox | 1
postprocess/CppunitTest_services.mk | 10 +
postprocess/qa/services.cxx | 67 ++++--------
9 files changed, 39 insertions(+), 55 deletions(-)
New commits:
commit 014fbd610e80c7b89e1f1d280d09d934ab4f3007
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 19 22:46:34 2013 +0100
Improve CppunitTest_services
Change-Id: I4b22ce7e5fa91d5008f72e1f351d25063065ba43
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 58ffbaa..5168e81 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -435,6 +435,7 @@ certain functionality.
@li @c helpcompiler
@li @c linguistic
@li @c oox
+ at li @c postprocess.cppunit
@li @c reportdesign
@li @c rsc
@li @c sax
diff --git a/postprocess/CppunitTest_services.mk b/postprocess/CppunitTest_services.mk
index c80f251..5a8a65d 100644
--- a/postprocess/CppunitTest_services.mk
+++ b/postprocess/CppunitTest_services.mk
@@ -29,7 +29,17 @@ $(eval $(call gb_CppunitTest_use_sdk_api,services))
$(eval $(call gb_CppunitTest_use_ure,services))
$(eval $(call gb_CppunitTest_use_rdb,services,services))
+ifneq ($(DISABLE_PYTHON),TRUE)
+$(eval $(call gb_CppunitTest_use_rdb,services,pyuno))
+endif
$(eval $(call gb_CppunitTest_use_configuration,services))
+ifeq ($(ENABLE_JAVA),TRUE)
+$(call gb_CppunitTest_get_target,services): $(call gb_Jar_get_target,unoil)
+$(eval $(call gb_CppunitTest_add_arguments,services, \
+ -env:URE_MORE_JAVA_TYPES=$(call gb_Helper_make_url,$(call gb_Jar_get_target,unoil)) \
+))
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx
index ea21ab5..bc901f7 100644
--- a/postprocess/qa/services.cxx
+++ b/postprocess/qa/services.cxx
@@ -23,9 +23,6 @@ namespace {
class ServicesTest: public test::BootstrapFixture
{
public:
- virtual void setUp();
- virtual void tearDown();
-
void test();
CPPUNIT_TEST_SUITE(ServicesTest);
@@ -33,58 +30,46 @@ public:
CPPUNIT_TEST_SUITE_END();
};
-void ServicesTest::setUp()
-{
- test::BootstrapFixture::setUp();
-}
-
-void ServicesTest::tearDown()
-{
- test::BootstrapFixture::tearDown();
-}
-
void ServicesTest::test()
{
Reference< XHierarchicalNameAccess > xTypeManager(
m_xContext->getValueByName(
"/singletons/com.sun.star.reflection.theTypeDescriptionManager"),
UNO_QUERY_THROW );
- Sequence<OUString> seq = m_xContext->getServiceManager()->getAvailableServiceNames();
- OUString *s = seq.getArray();
- for (sal_Int32 i = 0; i < seq.getLength(); i++)
+ Sequence<OUString> s = m_xContext->getServiceManager()->getAvailableServiceNames();
+ for (sal_Int32 i = 0; i < s.getLength(); i++)
{
if (!xTypeManager->hasByHierarchicalName(s[i]))
{
+ SAL_WARN(
+ "postprocess.cppunit",
+ "fantasy service name \"" << s[i] << "\"");
continue;
}
Reference< XServiceTypeDescription2 > xDesc(
- xTypeManager->getByHierarchicalName(s[i]), UNO_QUERY);
- if (!xDesc.is())
- {
- // Does happen for singletons?
- continue;
- }
+ xTypeManager->getByHierarchicalName(s[i]), UNO_QUERY_THROW);
Sequence< Reference< XServiceConstructorDescription > > xseq = xDesc->getConstructors();
- bool bHasDefault = false;
for (sal_Int32 c = 0; c < xseq.getLength(); c++)
- if (xseq[c]->isDefaultConstructor())
- bHasDefault = true;
-
- try
- {
- if (bHasDefault
- && s[i] != "com.sun.star.deployment.test.SmoketestCommandEnvironment")
- // TODO: com.sun.star.deployment.test.SmoketestCommandEnvironment throws
- // "Can not activate the factory for org.libreoffice.smoketest.SmoketestCommandEnvironment
- // because java.lang.NoClassDefFoundError: com/sun/star/ucb/XCommandEnvironment"
- m_xContext->getServiceManager()->createInstanceWithContext(s[i], m_xContext);
- }
- catch(const Exception & e)
- {
- OString exc = "Exception thrown while creating " +
- OUStringToOString(s[i] + ": " + e.Message, RTL_TEXTENCODING_UTF8);
- CPPUNIT_FAIL(exc.getStr());
- }
+ if (!xseq[c]->getParameters().hasElements())
+ try
+ {
+ CPPUNIT_ASSERT_MESSAGE(
+ OUStringToOString(s[i], RTL_TEXTENCODING_UTF8).getStr(),
+ ((xseq[c]->isDefaultConstructor()
+ ? (m_xContext->getServiceManager()
+ ->createInstanceWithContext(s[i], m_xContext))
+ : (m_xContext->getServiceManager()
+ ->createInstanceWithArgumentsAndContext(
+ s[i], css::uno::Sequence<css::uno::Any>(),
+ m_xContext)))
+ .is()));
+ }
+ catch(const Exception & e)
+ {
+ OString exc = "Exception thrown while creating " +
+ OUStringToOString(s[i] + ": " + e.Message, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_FAIL(exc.getStr());
+ }
}
}
commit a94390d20c50125e25e29431ca15ca2ca6683d17
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 19 22:45:59 2013 +0100
A singleton is not a service
Change-Id: I9059370e21e753a9578f231fd0c0eb0a1d6a981e
diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component
index 89b92a2..fd68855 100644
--- a/dbaccess/util/dba.component
+++ b/dbaccess/util/dba.component
@@ -23,7 +23,6 @@
<service name="com.sun.star.chart2.data.DatabaseDataProvider"/>
</implementation>
<implementation name="com.sun.star.comp.dba.DataAccessDescriptorFactory">
- <service name="com.sun.star.sdb.DataAccessDescriptorFactory"/>
<singleton name="com.sun.star.sdb.DataAccessDescriptorFactory"/>
</implementation>
<implementation name="com.sun.star.comp.dba.OCommandDefinition">
diff --git a/extensions/source/logging/log.component b/extensions/source/logging/log.component
index cf91ac5..8352c91 100644
--- a/extensions/source/logging/log.component
+++ b/extensions/source/logging/log.component
@@ -29,7 +29,6 @@
<service name="com.sun.star.logging.FileHandler"/>
</implementation>
<implementation name="com.sun.star.comp.extensions.LoggerPool">
- <service name="com.sun.star.logging.LoggerPool"/>
<singleton name="com.sun.star.logging.LoggerPool"/>
</implementation>
<implementation name="com.sun.star.comp.extensions.PlainTextFormatter">
diff --git a/extensions/source/resource/res.component b/extensions/source/resource/res.component
index 561feed..4a57306 100644
--- a/extensions/source/resource/res.component
+++ b/extensions/source/resource/res.component
@@ -20,7 +20,6 @@
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="res" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.resource.OpenOfficeResourceLoader">
- <service name="com.sun.star.resource.OfficeResourceLoader"/>
<singleton name="com.sun.star.resource.OfficeResourceLoader"/>
</implementation>
<implementation name="org.libreoffice.extensions.resource.ResourceIndexAccess">
diff --git a/extensions/source/resource/resourceservices.cxx b/extensions/source/resource/resourceservices.cxx
index f45615b..f8e1f5e 100644
--- a/extensions/source/resource/resourceservices.cxx
+++ b/extensions/source/resource/resourceservices.cxx
@@ -23,6 +23,7 @@ const sdecl::ServiceDecl ResourceIndexAccessDecl(
"org.libreoffice.extensions.resource.ResourceIndexAccess",
"org.libreoffice.resource.ResourceIndexAccess");
+//TOOD: this is a singleton, not a service:
const sdecl::ServiceDecl OpenOfficeResourceLoaderDecl(
OpenOfficeResourceLoaderServiceImpl,
"com.sun.star.comp.resource.OpenOfficeResourceLoader",
diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx b/framework/source/services/ContextChangeEventMultiplexer.cxx
index db8f8f1..37f6000 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -27,9 +27,6 @@ using namespace cssu;
namespace framework {
#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer"
-#define SERVICE_NAME "com.sun.star.ui.ContextChangeEventMultiplexer"
-#define SINGLETON_NAME "org.apache.openoffice.comp.framework.ContextChangeEventMultiplexerSigleton"
-
ContextChangeEventMultiplexer::ContextChangeEventMultiplexer (
const cssu::Reference<cssu::XComponentContext>& rxContext)
@@ -347,15 +344,9 @@ OUString SAL_CALL ContextChangeEventMultiplexer::impl_getStaticImplementationNam
cssu::Sequence<OUString> SAL_CALL ContextChangeEventMultiplexer::static_GetSupportedServiceNames (void)
{
- cssu::Sequence<OUString> aServiceNames (2);
- aServiceNames[0] = SERVICE_NAME;
- aServiceNames[1] = SINGLETON_NAME;
- return aServiceNames;
+ return css::uno::Sequence<OUString>();
}
-
-
-
cssu::Reference<cssu::XInterface> ContextChangeEventMultiplexer::impl_createFactory (
const cssu::Reference<cssl::XMultiServiceFactory>& rxServiceManager)
{
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 98ae10b..bbdce62 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -38,7 +38,6 @@
<service name="com.sun.star.ui.DocumentAcceleratorConfiguration"/>
</implementation>
<implementation name="org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer">
- <service name="com.sun.star.ui.ContextChangeEventMultiplexer"/>
<singleton name="com.sun.star.ui.ContextChangeEventMultiplexer"/>
</implementation>
<implementation name="com.sun.star.comp.framework.Frame">
More information about the Libreoffice-commits
mailing list