From e21f2f0f0187ebaa4a5b7c64a6e5c08d5efc6116 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 14 Sep 2010 09:15:02 +0200 Subject: sb129: #i113189# adapted tests; improved subsequenttests --- cppuhelper/qa/propertysetmixin/JavaSupplier.java | 5 -- .../qa/propertysetmixin/comp_propertysetmixin.cxx | 7 --- cppuhelper/qa/propertysetmixin/makefile.mk | 60 +++++++++++++--------- .../qa_propertysetmixin.cpp.component | 34 ++++++++++++ .../qa_propertysetmixin.java.component | 34 ++++++++++++ .../qa/propertysetmixin/test_propertysetmixin.cxx | 40 +++------------ 6 files changed, 111 insertions(+), 69 deletions(-) create mode 100644 cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component create mode 100644 cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component (limited to 'cppuhelper/qa/propertysetmixin') diff --git a/cppuhelper/qa/propertysetmixin/JavaSupplier.java b/cppuhelper/qa/propertysetmixin/JavaSupplier.java index 2d37c8901077..0aa267610801 100644 --- a/cppuhelper/qa/propertysetmixin/JavaSupplier.java +++ b/cppuhelper/qa/propertysetmixin/JavaSupplier.java @@ -75,11 +75,6 @@ public final class JavaSupplier extends WeakBase implements XSupplier { : null; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - implementationName, serviceName, regKey); - } - private static final String implementationName = JavaSupplier.class.getName(); private static final String serviceName diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx index 1159d1aed7a0..1ed996617ce5 100644 --- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx @@ -427,10 +427,3 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( { *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return cppu::component_writeInfoHelper( - serviceManager, registryKey, entries); -} diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index edd4795fc115..41b72d8a84aa 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -37,6 +37,8 @@ PACKAGE = test/cppuhelper/propertysetmixin/comp ENABLE_EXCEPTIONS := TRUE +my_components = $(TARGET).cpp $(TARGET).java + .INCLUDE: settings.mk .IF "$(OS)" == "WNT" @@ -75,51 +77,63 @@ JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar ALLTAR: test $(MISC)/$(TARGET)/types.urd: types.idl - - $(MKDIR) $(@:d) + $(MKDIRHIER) $(@:d) $(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $< $(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd - $(RM) $@ $(REGMERGE) $@ /UCR $< -$(MISC)/$(TARGET)/uno.rdb: $(MISC)/$(TARGET)/types.rdb $(SHL2TARGETN) \ - $(MISC)/$(TARGET)/$(TARGET).uno.jar $(MISC)/$(TARGET)/bootstrap.rdb - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)/types.rdb $@ - $(REGMERGE) $@ / $(MISC)/$(TARGET)/types.rdb - $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ - -c reflection.uno -c stocservices.uno -c $(SHL2TARGETN) - $(REGCOMP) -register -br $(MISC)/$(TARGET)/bootstrap.rdb -r $@ \ - -c $(my_file)$(PWD)/$(MISC)/$(TARGET)/$(TARGET).uno.jar \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) - -$(MISC)/$(TARGET)/bootstrap.rdb: - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)/types.rdb $@ - $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ - -c stocservices.uno - $(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb $(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \ - -X$(SOLARBINDIR)/types.rdb $< + -X$(SOLARBINDIR)/udkapi.rdb $< $(TOUCH) $@ $(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag $(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb - $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/types.rdb $< + $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/udkapi.rdb $< $(TOUCH) $@ $(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag +$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/services.input \ + $(my_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input + +$(MISC)/$(TARGET)/services.input .ERRREMOVE: + $(MKDIRHIER) $(@:d) + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ + +$(MISC)/$(TARGET)/$(TARGET).cpp.component .ERRREMOVE: \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component + +$(MISC)/$(TARGET)/$(TARGET).java.component .ERRREMOVE: \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_JAVA)$(TARGET).uno.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component + $(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \ $(MISC)/$(TARGET)/javamaker.flag manifest jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin -test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/uno.rdb +test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/$(TARGET).uno.jar \ + $(MISC)/$(TARGET)/types.rdb $(MISC)/$(TARGET)/services.rdb $(CPPUNITTESTER) $(SHL1TARGETN) \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb' \ + '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\ -env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \ - -env:arg-reg=$(MISC)/$(TARGET)/uno.rdb -env:arg-path=$(SOLARSHAREDBIN) + -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(PWD)/$(DLLDEST) \ + -env:OOO_INBUILD_JAR_DIR=$(my_file)$(PWD)/$(MISC)/$(TARGET) .END diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component new file mode 100644 index 000000000000..a654e07581a3 --- /dev/null +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component new file mode 100644 index 000000000000..9711563b758b --- /dev/null +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx index 06db4cfdad52..e4f1a4a78c3b 100644 --- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx @@ -52,21 +52,19 @@ #include "com/sun/star/beans/XPropertySetInfo.hpp" #include "com/sun/star/beans/XVetoableChangeListener.hpp" #include "com/sun/star/lang/XComponent.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.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/Type.hxx" #include "com/sun/star/uno/XComponentContext.hpp" +#include "cppuhelper/bootstrap.hxx" #include "cppuhelper/implbase1.hxx" -#include "cppuhelper/servicefactory.hxx" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" #include "osl/mutex.hxx" -#include "rtl/bootstrap.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" #include "rtl/textenc.h" @@ -98,14 +96,6 @@ std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) { out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]"; } -rtl::OUString getArgument(rtl::OUString const & name) { - rtl::OUString val; - CPPUNIT_ASSERT( - rtl::Bootstrap::get( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name, val)); - return val; -} - class BoundListener: public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > { @@ -178,7 +168,7 @@ class Test: public CppUnit::TestFixture { public: virtual void setUp(); - void finish(); + virtual void tearDown(); void testCppEmpty1() { testEmpty1(getCppSupplier()); } @@ -199,7 +189,6 @@ public: CPPUNIT_TEST(testJavaEmpty1); CPPUNIT_TEST(testJavaEmpty2); CPPUNIT_TEST(testJavaFull); - CPPUNIT_TEST(finish); CPPUNIT_TEST_SUITE_END(); private: @@ -221,30 +210,15 @@ private: css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > const & supplier) const; - static css::uno::Reference< css::uno::XComponentContext > m_context; + css::uno::Reference< css::uno::XComponentContext > m_context; }; void Test::setUp() { - // For whatever reason, on W32 it does not work to create/destroy a fresh - // component context for each test in Test::setUp/tearDown; therefore, a - // single component context is used for all tests and destroyed in the last - // pseudo-test "finish": - if (!m_context.is()) { - css::uno::Reference< css::lang::XMultiComponentFactory > factory( - cppu::createRegistryServiceFactory( - getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reg"))), - sal_False, - getArgument( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet >( - factory, css::uno::UNO_QUERY_THROW)->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))) - >>= m_context; - } + m_context = cppu::defaultBootstrap_InitialComponentContext(); + CPPUNIT_ASSERT(m_context.is()); } -void Test::finish() { +void Test::tearDown() { css::uno::Reference< css::lang::XComponent >( m_context, css::uno::UNO_QUERY_THROW)->dispose(); } @@ -671,8 +645,6 @@ void Test::testFull( } catch (css::beans::UnknownPropertyException &) {} } -css::uno::Reference< css::uno::XComponentContext > Test::m_context; - CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -- cgit