sb129: #i113189# adapted tests; improved subsequenttests

This commit is contained in:
sb 2010-09-14 09:15:02 +02:00
parent 1ea60d1183
commit e21f2f0f01
8 changed files with 134 additions and 77 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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 \
'<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
> $@
$(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

View file

@ -0,0 +1,34 @@
<?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.
*
**********************************************************************-->
<component loader="com.sun.star.loader.SharedLibrary"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="test.cppuhelper.propertysetmixin.comp.CppSupplier">
<service name="test.cppuhelper.propertysetmixin.CppSupplier"/>
</implementation>
</component>

View file

@ -0,0 +1,34 @@
<?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.
*
**********************************************************************-->
<component loader="com.sun.star.loader.Java2"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="test.cppuhelper.propertysetmixin.comp.JavaSupplier">
<service name="test.cppuhelper.propertysetmixin.JavaSupplier"/>
</implementation>
</component>

View file

@ -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);
}

View file

@ -380,9 +380,15 @@ SAL_CALL defaultBootstrap_InitialComponentContext(
Bootstrap const & bootstrap )
SAL_THROW( (Exception) )
{
OUString bootstrapPath( get_this_libpath() );
OUString iniDir;
OUString bootstrapPath;
if (!bootstrap.getFrom(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")),
bootstrapPath))
{
bootstrapPath = get_this_libpath();
}
OUString iniDir;
osl_getProcessWorkingDir(&iniDir.pData);
Reference<lang::XMultiComponentFactory> smgr_XMultiComponentFactory(

View file

@ -35,6 +35,8 @@ TARGET := test_uriproc
ENABLE_EXCEPTIONS := TRUE
my_components = stocservices
.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
@ -62,14 +64,21 @@ ALLTAR: test
test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb
$(CPPUNITTESTER) $(SHL1TARGETN) \
-env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb \
-env:OOO_TEST_PREFIX=$(my_file)$(PWD)/$(DLLDEST)/
-env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
-env:URE_INTERNAL_LIB_DIR=$(my_file)$(PWD)/$(DLLDEST)
$(MISC)/$(TARGET)/services.rdb:
$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \
$(MISC)/$(TARGET)/services.input \
$(my_components:^"$(MISC)/":+".component")
$(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \
$(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
$(MISC)/$(TARGET)/services.input .ERRREMOVE:
$(MKDIRHIER) $(@:d)
$(RM) $@
$(REGCOMP) -register -r $@ -wop=vnd.sun.star.expand:\$${{OOO_TEST_PREFIX}} \
-c $(DLLDEST)/stocservices.uno$(DLLPOST)
- $(RM) $@
echo \
'<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
> $@
.END