1*647a425cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*647a425cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*647a425cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*647a425cSAndrew Rist  * distributed with this work for additional information
6*647a425cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*647a425cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*647a425cSAndrew Rist  * "License"); you may not use this file except in compliance
9*647a425cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*647a425cSAndrew Rist  *
11*647a425cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*647a425cSAndrew Rist  *
13*647a425cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*647a425cSAndrew Rist  * software distributed under the License is distributed on an
15*647a425cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*647a425cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*647a425cSAndrew Rist  * specific language governing permissions and limitations
18*647a425cSAndrew Rist  * under the License.
19*647a425cSAndrew Rist  *
20*647a425cSAndrew Rist  *************************************************************/
21*647a425cSAndrew Rist 
22*647a425cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_stoc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySet.hpp"
28cdf0e10cSrcweir #include "com/sun/star/container/XHierarchicalNameAccess.hpp"
29cdf0e10cSrcweir #include "com/sun/star/lang/XMain.hpp"
30cdf0e10cSrcweir #include "com/sun/star/lang/XSingleComponentFactory.hpp"
31cdf0e10cSrcweir #include "com/sun/star/reflection/XCompoundTypeDescription.hpp"
32cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp"
33cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp"
34cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp"
35cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceTypeDescription2.hpp"
36cdf0e10cSrcweir #include "com/sun/star/reflection/XPublished.hpp"
37cdf0e10cSrcweir #include "com/sun/star/reflection/XServiceTypeDescription2.hpp"
38cdf0e10cSrcweir #include "com/sun/star/reflection/XSingletonTypeDescription2.hpp"
39cdf0e10cSrcweir #include "com/sun/star/reflection/XStructTypeDescription.hpp"
40cdf0e10cSrcweir #include "com/sun/star/reflection/XTypeDescription.hpp"
41cdf0e10cSrcweir #include "com/sun/star/registry/InvalidRegistryException.hpp"
42cdf0e10cSrcweir #include "com/sun/star/registry/XRegistryKey.hpp"
43cdf0e10cSrcweir #include "com/sun/star/uno/Any.hxx"
44cdf0e10cSrcweir #include "com/sun/star/uno/Exception.hpp"
45cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
46cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
47cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx"
48cdf0e10cSrcweir #include "com/sun/star/uno/TypeClass.hpp"
49cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp"
50cdf0e10cSrcweir #include "com/sun/star/uno/XInterface.hpp"
51cdf0e10cSrcweir #include "cppuhelper/factory.hxx"
52cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx"
53cdf0e10cSrcweir #include "cppuhelper/weak.hxx"
54cdf0e10cSrcweir #include "rtl/textenc.h"
55cdf0e10cSrcweir #include "rtl/ustring.h"
56cdf0e10cSrcweir #include "rtl/ustring.hxx"
57cdf0e10cSrcweir #include "sal/types.h"
58cdf0e10cSrcweir #include "uno/environment.h"
59cdf0e10cSrcweir #include "uno/lbnames.h"
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #include /*MSVC trouble: <cstdlib>*/ <stdlib.h>
62cdf0e10cSrcweir #include <iostream>
63cdf0e10cSrcweir #include <ostream>
64cdf0e10cSrcweir 
65cdf0e10cSrcweir namespace css = com::sun::star;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir namespace {
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class Service: public cppu::WeakImplHelper1< css::lang::XMain > {
70cdf0e10cSrcweir public:
71cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
72cdf0e10cSrcweir     run(css::uno::Sequence< rtl::OUString > const & arguments)
73cdf0e10cSrcweir         throw (css::uno::RuntimeException);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     static rtl::OUString getImplementationName();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     static css::uno::Sequence< rtl::OUString > getSupportedServiceNames();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
80cdf0e10cSrcweir         css::uno::Reference< css::uno::XComponentContext > const & context)
81cdf0e10cSrcweir         throw (css::uno::Exception);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir private:
Service(css::uno::Reference<css::uno::XComponentContext> const & context)84cdf0e10cSrcweir     explicit Service(
85cdf0e10cSrcweir         css::uno::Reference< css::uno::XComponentContext > const & context):
86cdf0e10cSrcweir         m_context(context)
87cdf0e10cSrcweir     {}
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     css::uno::Reference< css::uno::XComponentContext > m_context;
90cdf0e10cSrcweir };
91cdf0e10cSrcweir 
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir namespace {
95cdf0e10cSrcweir 
operator <<(std::ostream & out,rtl::OUString const & value)96cdf0e10cSrcweir std::ostream & operator <<(std::ostream & out, rtl::OUString const & value) {
97cdf0e10cSrcweir     return out << rtl::OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr();
98cdf0e10cSrcweir }
99cdf0e10cSrcweir 
assertTrue(bool argument)100cdf0e10cSrcweir void assertTrue(bool argument) {
101cdf0e10cSrcweir     if (!argument) {
102cdf0e10cSrcweir         std::cerr
103cdf0e10cSrcweir             << "assertTrue(" << argument << ") failed" << std::endl;
104cdf0e10cSrcweir         /*MSVC trouble: std::*/abort();
105cdf0e10cSrcweir     }
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
assertFalse(bool argument)108cdf0e10cSrcweir void assertFalse(bool argument) {
109cdf0e10cSrcweir     if (argument) {
110cdf0e10cSrcweir         std::cerr
111cdf0e10cSrcweir             << "assertFalse(" << argument << ") failed" << std::endl;
112cdf0e10cSrcweir         /*MSVC trouble: std::*/abort();
113cdf0e10cSrcweir     }
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
assertEqual(T const & value,T const & argument)116cdf0e10cSrcweir template< typename T > void assertEqual(T const & value, T const & argument) {
117cdf0e10cSrcweir     if (argument != value) {
118cdf0e10cSrcweir         std::cerr
119cdf0e10cSrcweir             << "assertEqual(" << value << ", " << argument << ") failed"
120cdf0e10cSrcweir             << std::endl;
121cdf0e10cSrcweir         /*MSVC trouble: std::*/abort();
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
run(css::uno::Sequence<rtl::OUString> const &)127cdf0e10cSrcweir sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const &)
128cdf0e10cSrcweir     throw (css::uno::RuntimeException)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     css::uno::Reference< css::lang::XMultiComponentFactory > factory(
131cdf0e10cSrcweir         m_context->getServiceManager());
132cdf0e10cSrcweir     assertTrue(factory.is());
133cdf0e10cSrcweir     css::uno::Sequence< css::uno::Any > args(1);
134cdf0e10cSrcweir     args[0] = css::uno::Reference< css::beans::XPropertySet >(
135cdf0e10cSrcweir         factory, css::uno::UNO_QUERY_THROW)->getPropertyValue(
136cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Registry")));
137cdf0e10cSrcweir     css::uno::Reference< css::container::XHierarchicalNameAccess > provider(
138cdf0e10cSrcweir         factory->createInstanceWithArgumentsAndContext(
139cdf0e10cSrcweir             rtl::OUString(
140cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
141cdf0e10cSrcweir                     "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider")),
142cdf0e10cSrcweir             args, m_context),
143cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     // The following assumes that interface members are sorted by increasing
146cdf0e10cSrcweir     // values of XInterfaceMemberTypeDescription.getPosition, the exceptions
147cdf0e10cSrcweir     // of interface attributes and interface methods, the constructors of
148cdf0e10cSrcweir     // services, and the exceptions of service constructors are sorted as given
149cdf0e10cSrcweir     // in the UNOIDL source code:
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     assertEqual< bool >(
152cdf0e10cSrcweir         false,
153cdf0e10cSrcweir         provider->hasByHierarchicalName(
154cdf0e10cSrcweir             rtl::OUString(
155cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM("[][]boolean"))));
156cdf0e10cSrcweir     assertEqual< bool >(
157cdf0e10cSrcweir         false,
158cdf0e10cSrcweir         provider->hasByHierarchicalName(
159cdf0e10cSrcweir             rtl::OUString(
160cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
161cdf0e10cSrcweir                     "test.registrytdprovider.Struct3<boolean,boolean>"))));
162cdf0e10cSrcweir     assertEqual< bool >(
163cdf0e10cSrcweir         false,
164cdf0e10cSrcweir         provider->hasByHierarchicalName(
165cdf0e10cSrcweir             rtl::OUString(
166cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
167cdf0e10cSrcweir                     "com.sun.star.uno.XComponentContext::getValueByName"))));
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     css::uno::Reference< css::reflection::XCompoundTypeDescription > exception;
170cdf0e10cSrcweir     exception
171cdf0e10cSrcweir         = css::uno::Reference< css::reflection::XCompoundTypeDescription >(
172cdf0e10cSrcweir             provider->getByHierarchicalName(
173cdf0e10cSrcweir                 rtl::OUString(
174cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception"))),
175cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
176cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_EXCEPTION, exception->getTypeClass());
177cdf0e10cSrcweir     assertEqual(
178cdf0e10cSrcweir         rtl::OUString(
179cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")),
180cdf0e10cSrcweir         exception->getName());
181cdf0e10cSrcweir     assertFalse(exception->getBaseType().is());
182cdf0e10cSrcweir     exception
183cdf0e10cSrcweir         = css::uno::Reference< css::reflection::XCompoundTypeDescription >(
184cdf0e10cSrcweir             provider->getByHierarchicalName(
185cdf0e10cSrcweir                 rtl::OUString(
186cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
187cdf0e10cSrcweir                         "com.sun.star.uno.RuntimeException"))),
188cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
189cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_EXCEPTION, exception->getTypeClass());
190cdf0e10cSrcweir     assertEqual(
191cdf0e10cSrcweir         rtl::OUString(
192cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
193cdf0e10cSrcweir         exception->getName());
194cdf0e10cSrcweir     assertEqual(
195cdf0e10cSrcweir         rtl::OUString(
196cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")),
197cdf0e10cSrcweir         exception->getBaseType()->getName());
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     css::uno::Reference< css::reflection::XStructTypeDescription > structure;
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     structure = css::uno::Reference< css::reflection::XStructTypeDescription >(
202cdf0e10cSrcweir         provider->getByHierarchicalName(
203cdf0e10cSrcweir             rtl::OUString(
204cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
205cdf0e10cSrcweir                     "test.registrytdprovider.Struct2"))),
206cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
207cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_STRUCT, structure->getTypeClass());
208cdf0e10cSrcweir     assertEqual(
209cdf0e10cSrcweir         rtl::OUString(
210cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct2")),
211cdf0e10cSrcweir         structure->getName());
212cdf0e10cSrcweir     assertFalse(structure->getBaseType().is());
213cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, structure->getMemberTypes().getLength());
214cdf0e10cSrcweir     assertEqual(
215cdf0e10cSrcweir         rtl::OUString(
216cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct1")),
217cdf0e10cSrcweir         structure->getMemberTypes()[0]->getName());
218cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, structure->getMemberNames().getLength());
219cdf0e10cSrcweir     assertEqual(
220cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s1")),
221cdf0e10cSrcweir         structure->getMemberNames()[0]);
222cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, structure->getTypeParameters().getLength());
223cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength());
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     structure = css::uno::Reference< css::reflection::XStructTypeDescription >(
226cdf0e10cSrcweir         provider->getByHierarchicalName(
227cdf0e10cSrcweir             rtl::OUString(
228cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
229cdf0e10cSrcweir                     "test.registrytdprovider.Struct3"))),
230cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
231cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_STRUCT, structure->getTypeClass());
232cdf0e10cSrcweir     assertEqual(
233cdf0e10cSrcweir         rtl::OUString(
234cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct3")),
235cdf0e10cSrcweir         structure->getName());
236cdf0e10cSrcweir     assertFalse(structure->getBaseType().is());
237cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, structure->getMemberTypes().getLength());
238cdf0e10cSrcweir     assertEqual(
239cdf0e10cSrcweir         css::uno::TypeClass_UNKNOWN,
240cdf0e10cSrcweir         structure->getMemberTypes()[0]->getTypeClass());
241cdf0e10cSrcweir     assertEqual(
242cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("U")),
243cdf0e10cSrcweir         structure->getMemberTypes()[0]->getName());
244cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, structure->getMemberNames().getLength());
245cdf0e10cSrcweir     assertEqual(
246cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s2")),
247cdf0e10cSrcweir         structure->getMemberNames()[0]);
248cdf0e10cSrcweir     assertEqual< sal_Int32 >(2, structure->getTypeParameters().getLength());
249cdf0e10cSrcweir     assertEqual(
250cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("T")),
251cdf0e10cSrcweir         structure->getTypeParameters()[0]);
252cdf0e10cSrcweir     assertEqual(
253cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("U")),
254cdf0e10cSrcweir         structure->getTypeParameters()[1]);
255cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength());
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     structure = css::uno::Reference< css::reflection::XStructTypeDescription >(
258cdf0e10cSrcweir         provider->getByHierarchicalName(
259cdf0e10cSrcweir             rtl::OUString(
260cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
261cdf0e10cSrcweir                     "test.registrytdprovider.Struct4"))),
262cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
263cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_STRUCT, structure->getTypeClass());
264cdf0e10cSrcweir     assertEqual(
265cdf0e10cSrcweir         rtl::OUString(
266cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct4")),
267cdf0e10cSrcweir         structure->getName());
268cdf0e10cSrcweir     assertEqual(
269cdf0e10cSrcweir         rtl::OUString(
270cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct2")),
271cdf0e10cSrcweir         structure->getBaseType()->getName());
272cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, structure->getMemberTypes().getLength());
273cdf0e10cSrcweir     assertEqual(
274cdf0e10cSrcweir         rtl::OUString(
275cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM(
276cdf0e10cSrcweir                 "test.registrytdprovider.Struct3<"
277cdf0e10cSrcweir                 "test.registrytdprovider.Struct2,"
278cdf0e10cSrcweir                 "test.registrytdprovider.Struct3<boolean,any>>")),
279cdf0e10cSrcweir         structure->getMemberTypes()[0]->getName());
280cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, structure->getMemberNames().getLength());
281cdf0e10cSrcweir     assertEqual(
282cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s2")),
283cdf0e10cSrcweir         structure->getMemberNames()[0]);
284cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, structure->getTypeParameters().getLength());
285cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength());
286cdf0e10cSrcweir 
287cdf0e10cSrcweir     css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
288cdf0e10cSrcweir         interface;
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     interface
291cdf0e10cSrcweir         = css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >(
292cdf0e10cSrcweir             provider->getByHierarchicalName(
293cdf0e10cSrcweir                 rtl::OUString(
294cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
295cdf0e10cSrcweir                         "test.registrytdprovider.XTest1"))),
296cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
297cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_INTERFACE, interface->getTypeClass());
298cdf0e10cSrcweir     assertEqual(
299cdf0e10cSrcweir         rtl::OUString(
300cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")),
301cdf0e10cSrcweir         interface->getName());
302cdf0e10cSrcweir     css::uno::Sequence<
303cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription > > bases(
304cdf0e10cSrcweir             interface->getBaseTypes());
305cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, bases.getLength());
306cdf0e10cSrcweir     assertEqual(
307cdf0e10cSrcweir         rtl::OUString(
308cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")),
309cdf0e10cSrcweir         bases[0]->getName());
310cdf0e10cSrcweir     css::uno::Sequence<
311cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription > >
312cdf0e10cSrcweir             optionalBases(interface->getOptionalBaseTypes());
313cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, optionalBases.getLength());
314cdf0e10cSrcweir     assertEqual(
315cdf0e10cSrcweir         rtl::OUString(
316cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XBase")),
317cdf0e10cSrcweir         optionalBases[0]->getName());
318cdf0e10cSrcweir     css::uno::Sequence<
319cdf0e10cSrcweir         css::uno::Reference<
320cdf0e10cSrcweir             css::reflection::XInterfaceMemberTypeDescription > > members(
321cdf0e10cSrcweir                 interface->getMembers());
322cdf0e10cSrcweir     assertEqual< sal_Int32 >(5, members.getLength());
323cdf0e10cSrcweir 
324cdf0e10cSrcweir     css::uno::Reference< css::reflection::XInterfaceAttributeTypeDescription2 >
325cdf0e10cSrcweir         attribute;
326cdf0e10cSrcweir     css::uno::Sequence<
327cdf0e10cSrcweir         css::uno::Reference< css::reflection::XCompoundTypeDescription > >
328cdf0e10cSrcweir             getExceptions;
329cdf0e10cSrcweir     css::uno::Sequence<
330cdf0e10cSrcweir         css::uno::Reference< css::reflection::XCompoundTypeDescription > >
331cdf0e10cSrcweir             setExceptions;
332cdf0e10cSrcweir     css::uno::Reference< css::reflection::XInterfaceMethodTypeDescription >
333cdf0e10cSrcweir         method;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     attribute = css::uno::Reference<
336cdf0e10cSrcweir         css::reflection::XInterfaceAttributeTypeDescription2 >(
337cdf0e10cSrcweir             members[0], css::uno::UNO_QUERY_THROW);
338cdf0e10cSrcweir     assertEqual(
339cdf0e10cSrcweir         css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass());
340cdf0e10cSrcweir     assertEqual(
341cdf0e10cSrcweir         rtl::OUString(
342cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::a1")),
343cdf0e10cSrcweir         attribute->getName());
344cdf0e10cSrcweir     assertEqual(
345cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a1")),
346cdf0e10cSrcweir         attribute->getMemberName());
347cdf0e10cSrcweir     assertEqual< sal_Int32 >(3, attribute->getPosition());
348cdf0e10cSrcweir     assertEqual< bool >(false, attribute->isReadOnly());
349cdf0e10cSrcweir     assertEqual(
350cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("short")),
351cdf0e10cSrcweir         attribute->getType()->getName());
352cdf0e10cSrcweir     assertEqual< bool >(true, attribute->isBound());
353cdf0e10cSrcweir     getExceptions = attribute->getGetExceptions();
354cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, getExceptions.getLength());
355cdf0e10cSrcweir     setExceptions = attribute->getSetExceptions();
356cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, setExceptions.getLength());
357cdf0e10cSrcweir 
358cdf0e10cSrcweir     attribute = css::uno::Reference<
359cdf0e10cSrcweir         css::reflection::XInterfaceAttributeTypeDescription2 >(
360cdf0e10cSrcweir             members[1], css::uno::UNO_QUERY_THROW);
361cdf0e10cSrcweir     assertEqual(
362cdf0e10cSrcweir         css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass());
363cdf0e10cSrcweir     assertEqual(
364cdf0e10cSrcweir         rtl::OUString(
365cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::a2")),
366cdf0e10cSrcweir         attribute->getName());
367cdf0e10cSrcweir     assertEqual(
368cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a2")),
369cdf0e10cSrcweir         attribute->getMemberName());
370cdf0e10cSrcweir     assertEqual< sal_Int32 >(4, attribute->getPosition());
371cdf0e10cSrcweir     assertEqual< bool >(false, attribute->isReadOnly());
372cdf0e10cSrcweir     assertEqual(
373cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("long")),
374cdf0e10cSrcweir         attribute->getType()->getName());
375cdf0e10cSrcweir     assertEqual< bool >(false, attribute->isBound());
376cdf0e10cSrcweir     getExceptions = attribute->getGetExceptions();
377cdf0e10cSrcweir     assertEqual< sal_Int32 >(2, getExceptions.getLength());
378cdf0e10cSrcweir     assertEqual(
379cdf0e10cSrcweir         rtl::OUString(
380cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM(
381cdf0e10cSrcweir                 "com.sun.star.lang.WrappedTargetException")),
382cdf0e10cSrcweir         getExceptions[0]->getName());
383cdf0e10cSrcweir     assertEqual(
384cdf0e10cSrcweir         rtl::OUString(
385cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
386cdf0e10cSrcweir         getExceptions[1]->getName());
387cdf0e10cSrcweir     setExceptions = attribute->getSetExceptions();
388cdf0e10cSrcweir     assertEqual< sal_Int32 >(2, setExceptions.getLength());
389cdf0e10cSrcweir     assertEqual(
390cdf0e10cSrcweir         rtl::OUString(
391cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")),
392cdf0e10cSrcweir         setExceptions[0]->getName());
393cdf0e10cSrcweir     assertEqual(
394cdf0e10cSrcweir         rtl::OUString(
395cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM(
396cdf0e10cSrcweir                 "com.sun.star.lang.WrappedTargetException")),
397cdf0e10cSrcweir         setExceptions[1]->getName());
398cdf0e10cSrcweir 
399cdf0e10cSrcweir     attribute = css::uno::Reference<
400cdf0e10cSrcweir         css::reflection::XInterfaceAttributeTypeDescription2 >(
401cdf0e10cSrcweir             members[2], css::uno::UNO_QUERY_THROW);
402cdf0e10cSrcweir     assertEqual(
403cdf0e10cSrcweir         css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass());
404cdf0e10cSrcweir     assertEqual(
405cdf0e10cSrcweir         rtl::OUString(
406cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::a3")),
407cdf0e10cSrcweir         attribute->getName());
408cdf0e10cSrcweir     assertEqual(
409cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a3")),
410cdf0e10cSrcweir         attribute->getMemberName());
411cdf0e10cSrcweir     assertEqual< sal_Int32 >(5, attribute->getPosition());
412cdf0e10cSrcweir     assertEqual< bool >(true, attribute->isReadOnly());
413cdf0e10cSrcweir     assertEqual(
414cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hyper")),
415cdf0e10cSrcweir         attribute->getType()->getName());
416cdf0e10cSrcweir     assertEqual< bool >(true, attribute->isBound());
417cdf0e10cSrcweir     getExceptions = attribute->getGetExceptions();
418cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, getExceptions.getLength());
419cdf0e10cSrcweir     assertEqual(
420cdf0e10cSrcweir         rtl::OUString(
421cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM(
422cdf0e10cSrcweir                 "com.sun.star.lang.WrappedTargetException")),
423cdf0e10cSrcweir         getExceptions[0]->getName());
424cdf0e10cSrcweir     setExceptions = attribute->getSetExceptions();
425cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, setExceptions.getLength());
426cdf0e10cSrcweir 
427cdf0e10cSrcweir     method = css::uno::Reference<
428cdf0e10cSrcweir         css::reflection::XInterfaceMethodTypeDescription >(
429cdf0e10cSrcweir             members[3], css::uno::UNO_QUERY_THROW);
430cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_INTERFACE_METHOD, method->getTypeClass());
431cdf0e10cSrcweir     assertEqual(
432cdf0e10cSrcweir         rtl::OUString(
433cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::f1")),
434cdf0e10cSrcweir         method->getName());
435cdf0e10cSrcweir     assertEqual(
436cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("f1")),
437cdf0e10cSrcweir         method->getMemberName());
438cdf0e10cSrcweir     assertEqual< sal_Int32 >(6, method->getPosition());
439cdf0e10cSrcweir     assertEqual< bool >(false, method->isOneway());
440cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, method->getParameters().getLength());
441cdf0e10cSrcweir     assertEqual(
442cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("p")),
443cdf0e10cSrcweir         method->getParameters()[0]->getName());
444cdf0e10cSrcweir     assertEqual(
445cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")),
446cdf0e10cSrcweir         method->getParameters()[0]->getType()->getName());
447cdf0e10cSrcweir     assertEqual< bool >(false, method->getParameters()[0]->isIn());
448cdf0e10cSrcweir     assertEqual< bool >(true, method->getParameters()[0]->isOut());
449cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, method->getParameters()[0]->getPosition());
450cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, method->getExceptions().getLength());
451cdf0e10cSrcweir     assertEqual(
452cdf0e10cSrcweir         rtl::OUString(
453cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
454cdf0e10cSrcweir         method->getExceptions()[0]->getName());
455cdf0e10cSrcweir 
456cdf0e10cSrcweir     method = css::uno::Reference<
457cdf0e10cSrcweir         css::reflection::XInterfaceMethodTypeDescription >(
458cdf0e10cSrcweir             members[4], css::uno::UNO_QUERY_THROW);
459cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_INTERFACE_METHOD, method->getTypeClass());
460cdf0e10cSrcweir     assertEqual(
461cdf0e10cSrcweir         rtl::OUString(
462cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::f2")),
463cdf0e10cSrcweir         method->getName());
464cdf0e10cSrcweir     assertEqual(
465cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("f2")),
466cdf0e10cSrcweir         method->getMemberName());
467cdf0e10cSrcweir     assertEqual< sal_Int32 >(7, method->getPosition());
468cdf0e10cSrcweir     assertEqual< bool >(true, method->isOneway());
469cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, method->getParameters().getLength());
470cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, method->getExceptions().getLength());
471cdf0e10cSrcweir 
472cdf0e10cSrcweir     interface
473cdf0e10cSrcweir         = css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >(
474cdf0e10cSrcweir             provider->getByHierarchicalName(
475cdf0e10cSrcweir                 rtl::OUString(
476cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
477cdf0e10cSrcweir                         "test.registrytdprovider.XTest2"))),
478cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
479cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_INTERFACE, interface->getTypeClass());
480cdf0e10cSrcweir     assertEqual(
481cdf0e10cSrcweir         rtl::OUString(
482cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest2")),
483cdf0e10cSrcweir         interface->getName());
484cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, interface->getBaseTypes().getLength());
485cdf0e10cSrcweir     assertEqual(
486cdf0e10cSrcweir         rtl::OUString(
487cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Typedef2")),
488cdf0e10cSrcweir         interface->getBaseTypes()[0]->getName());
489cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, interface->getOptionalBaseTypes().getLength());
490cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, interface->getMembers().getLength());
491cdf0e10cSrcweir 
492cdf0e10cSrcweir     css::uno::Reference< css::reflection::XServiceTypeDescription2 > service;
493cdf0e10cSrcweir 
494cdf0e10cSrcweir     service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >(
495cdf0e10cSrcweir         provider->getByHierarchicalName(
496cdf0e10cSrcweir             rtl::OUString(
497cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
498cdf0e10cSrcweir                     "test.registrytdprovider.Service1"))),
499cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
500cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_SERVICE, service->getTypeClass());
501cdf0e10cSrcweir     assertEqual(
502cdf0e10cSrcweir         rtl::OUString(
503cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service1")),
504cdf0e10cSrcweir         service->getName());
505cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getMandatoryServices().getLength());
506cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getOptionalServices().getLength());
507cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getMandatoryInterfaces().getLength());
508cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getOptionalInterfaces().getLength());
509cdf0e10cSrcweir     assertEqual< bool >(true, service->isSingleInterfaceBased());
510cdf0e10cSrcweir     assertEqual(
511cdf0e10cSrcweir         rtl::OUString(
512cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")),
513cdf0e10cSrcweir         service->getInterface()->getName());
514cdf0e10cSrcweir     assertEqual< sal_Int32 >(2, service->getConstructors().getLength());
515cdf0e10cSrcweir     assertEqual(
516cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c1")),
517cdf0e10cSrcweir         service->getConstructors()[0]->getName());
518cdf0e10cSrcweir     assertEqual< sal_Int32 >(
519cdf0e10cSrcweir         0, service->getConstructors()[0]->getParameters().getLength());
520cdf0e10cSrcweir     assertEqual< sal_Int32 >(
521cdf0e10cSrcweir         0, service->getConstructors()[0]->getExceptions().getLength());
522cdf0e10cSrcweir     assertEqual(
523cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c2")),
524cdf0e10cSrcweir         service->getConstructors()[1]->getName());
525cdf0e10cSrcweir     assertEqual< sal_Int32 >(
526cdf0e10cSrcweir         1, service->getConstructors()[1]->getParameters().getLength());
527cdf0e10cSrcweir     assertEqual(
528cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("p")),
529cdf0e10cSrcweir         service->getConstructors()[1]->getParameters()[0]->getName());
530cdf0e10cSrcweir     assertEqual(
531cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")),
532cdf0e10cSrcweir         (service->getConstructors()[1]->getParameters()[0]->getType()->
533cdf0e10cSrcweir          getName()));
534cdf0e10cSrcweir     assertEqual< bool >(
535cdf0e10cSrcweir         true, service->getConstructors()[1]->getParameters()[0]->isIn());
536cdf0e10cSrcweir     assertEqual< bool >(
537cdf0e10cSrcweir         false, service->getConstructors()[1]->getParameters()[0]->isOut());
538cdf0e10cSrcweir     assertEqual< sal_Int32 >(
539cdf0e10cSrcweir         0, service->getConstructors()[1]->getParameters()[0]->getPosition());
540cdf0e10cSrcweir     assertEqual< bool >(
541cdf0e10cSrcweir         true,
542cdf0e10cSrcweir         service->getConstructors()[1]->getParameters()[0]->isRestParameter());
543cdf0e10cSrcweir     assertEqual< sal_Int32 >(
544cdf0e10cSrcweir         1, service->getConstructors()[1]->getExceptions().getLength());
545cdf0e10cSrcweir     assertEqual(
546cdf0e10cSrcweir         rtl::OUString(
547cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
548cdf0e10cSrcweir         service->getConstructors()[1]->getExceptions()[0]->getName());
549cdf0e10cSrcweir 
550cdf0e10cSrcweir     service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >(
551cdf0e10cSrcweir         provider->getByHierarchicalName(
552cdf0e10cSrcweir             rtl::OUString(
553cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
554cdf0e10cSrcweir                     "test.registrytdprovider.Service2"))),
555cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
556cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_SERVICE, service->getTypeClass());
557cdf0e10cSrcweir     assertEqual(
558cdf0e10cSrcweir         rtl::OUString(
559cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service2")),
560cdf0e10cSrcweir         service->getName());
561cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getMandatoryServices().getLength());
562cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getOptionalServices().getLength());
563cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, service->getMandatoryInterfaces().getLength());
564cdf0e10cSrcweir     assertEqual(
565cdf0e10cSrcweir         rtl::OUString(
566cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")),
567cdf0e10cSrcweir         service->getMandatoryInterfaces()[0]->getName());
568cdf0e10cSrcweir     assertEqual< sal_Int32 >(1, service->getOptionalInterfaces().getLength());
569cdf0e10cSrcweir     assertEqual(
570cdf0e10cSrcweir         rtl::OUString(
571cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XBase")),
572cdf0e10cSrcweir         service->getOptionalInterfaces()[0]->getName());
573cdf0e10cSrcweir     assertEqual< bool >(false, service->isSingleInterfaceBased());
574cdf0e10cSrcweir     assertFalse(service->getInterface().is());
575cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getConstructors().getLength());
576cdf0e10cSrcweir 
577cdf0e10cSrcweir     service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >(
578cdf0e10cSrcweir         provider->getByHierarchicalName(
579cdf0e10cSrcweir             rtl::OUString(
580cdf0e10cSrcweir                 RTL_CONSTASCII_USTRINGPARAM(
581cdf0e10cSrcweir                     "test.registrytdprovider.Service3"))),
582cdf0e10cSrcweir         css::uno::UNO_QUERY_THROW);
583cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_SERVICE, service->getTypeClass());
584cdf0e10cSrcweir     assertEqual(
585cdf0e10cSrcweir         rtl::OUString(
586cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service3")),
587cdf0e10cSrcweir         service->getName());
588cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getMandatoryServices().getLength());
589cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getOptionalServices().getLength());
590cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getMandatoryInterfaces().getLength());
591cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getOptionalInterfaces().getLength());
592cdf0e10cSrcweir     assertEqual< bool >(true, service->isSingleInterfaceBased());
593cdf0e10cSrcweir     assertEqual(
594cdf0e10cSrcweir         rtl::OUString(
595cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Typedef2")),
596cdf0e10cSrcweir         service->getInterface()->getName());
597cdf0e10cSrcweir     assertEqual< sal_Int32 >(0, service->getConstructors().getLength());
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     css::uno::Reference< css::reflection::XSingletonTypeDescription2 >
600cdf0e10cSrcweir         singleton;
601cdf0e10cSrcweir 
602cdf0e10cSrcweir     singleton = css::uno::Reference<
603cdf0e10cSrcweir         css::reflection::XSingletonTypeDescription2 >(
604cdf0e10cSrcweir             provider->getByHierarchicalName(
605cdf0e10cSrcweir                 rtl::OUString(
606cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
607cdf0e10cSrcweir                         "test.registrytdprovider.Singleton1"))),
608cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
609cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_SINGLETON, singleton->getTypeClass());
610cdf0e10cSrcweir     assertEqual(
611cdf0e10cSrcweir         rtl::OUString(
612cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Singleton1")),
613cdf0e10cSrcweir         singleton->getName());
614cdf0e10cSrcweir     assertFalse(singleton->getService().is());
615cdf0e10cSrcweir     assertEqual< bool >(true, singleton->isInterfaceBased());
616cdf0e10cSrcweir     assertEqual(
617cdf0e10cSrcweir         rtl::OUString(
618cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")),
619cdf0e10cSrcweir         singleton->getInterface()->getName());
620cdf0e10cSrcweir 
621cdf0e10cSrcweir     singleton = css::uno::Reference<
622cdf0e10cSrcweir         css::reflection::XSingletonTypeDescription2 >(
623cdf0e10cSrcweir             provider->getByHierarchicalName(
624cdf0e10cSrcweir                 rtl::OUString(
625cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
626cdf0e10cSrcweir                         "test.registrytdprovider.Singleton2"))),
627cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
628cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_SINGLETON, singleton->getTypeClass());
629cdf0e10cSrcweir     assertEqual(
630cdf0e10cSrcweir         rtl::OUString(
631cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Singleton2")),
632cdf0e10cSrcweir         singleton->getName());
633cdf0e10cSrcweir     assertEqual(
634cdf0e10cSrcweir         rtl::OUString(
635cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service1")),
636cdf0e10cSrcweir         singleton->getService()->getName());
637cdf0e10cSrcweir     assertEqual< bool >(false, singleton->isInterfaceBased());
638cdf0e10cSrcweir     assertFalse(singleton->getInterface().is());
639cdf0e10cSrcweir 
640cdf0e10cSrcweir     singleton = css::uno::Reference<
641cdf0e10cSrcweir         css::reflection::XSingletonTypeDescription2 >(
642cdf0e10cSrcweir             provider->getByHierarchicalName(
643cdf0e10cSrcweir                 rtl::OUString(
644cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
645cdf0e10cSrcweir                         "test.registrytdprovider.Singleton3"))),
646cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW);
647cdf0e10cSrcweir     assertEqual(css::uno::TypeClass_SINGLETON, singleton->getTypeClass());
648cdf0e10cSrcweir     assertEqual(
649cdf0e10cSrcweir         rtl::OUString(
650cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Singleton3")),
651cdf0e10cSrcweir         singleton->getName());
652cdf0e10cSrcweir     assertFalse(singleton->getService().is());
653cdf0e10cSrcweir     assertEqual< bool >(true, singleton->isInterfaceBased());
654cdf0e10cSrcweir     assertEqual(
655cdf0e10cSrcweir         rtl::OUString(
656cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Typedef2")),
657cdf0e10cSrcweir         singleton->getInterface()->getName());
658cdf0e10cSrcweir 
659cdf0e10cSrcweir     css::uno::Reference< css::reflection::XPublished > published;
660cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
661cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
662cdf0e10cSrcweir             provider->getByHierarchicalName(
663cdf0e10cSrcweir                 rtl::OUString(
664cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
665cdf0e10cSrcweir                         "test.registrytdprovider.Enum1"))),
666cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
667cdf0e10cSrcweir         css::uno::UNO_QUERY);
668cdf0e10cSrcweir     assertTrue(published.is());
669cdf0e10cSrcweir     assertTrue(published->isPublished());
670cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
671cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
672cdf0e10cSrcweir             provider->getByHierarchicalName(
673cdf0e10cSrcweir                 rtl::OUString(
674cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
675cdf0e10cSrcweir                         "test.registrytdprovider.Enum2"))),
676cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
677cdf0e10cSrcweir         css::uno::UNO_QUERY);
678cdf0e10cSrcweir     assertTrue(published.is());
679cdf0e10cSrcweir     assertFalse(published->isPublished());
680cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
681cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
682cdf0e10cSrcweir             provider->getByHierarchicalName(
683cdf0e10cSrcweir                 rtl::OUString(
684cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
685cdf0e10cSrcweir                         "test.registrytdprovider.Struct1"))),
686cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
687cdf0e10cSrcweir         css::uno::UNO_QUERY);
688cdf0e10cSrcweir     assertTrue(published.is());
689cdf0e10cSrcweir     assertTrue(published->isPublished());
690cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
691cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
692cdf0e10cSrcweir             provider->getByHierarchicalName(
693cdf0e10cSrcweir                 rtl::OUString(
694cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
695cdf0e10cSrcweir                         "test.registrytdprovider.Struct2"))),
696cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
697cdf0e10cSrcweir         css::uno::UNO_QUERY);
698cdf0e10cSrcweir     assertTrue(published.is());
699cdf0e10cSrcweir     assertFalse(published->isPublished());
700cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
701cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
702cdf0e10cSrcweir             provider->getByHierarchicalName(
703cdf0e10cSrcweir                 rtl::OUString(
704cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
705cdf0e10cSrcweir                         "test.registrytdprovider.Struct3"))),
706cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
707cdf0e10cSrcweir         css::uno::UNO_QUERY);
708cdf0e10cSrcweir     assertTrue(published.is());
709cdf0e10cSrcweir     assertTrue(published->isPublished());
710cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
711cdf0e10cSrcweir         css::uno::Reference< css::reflection::XStructTypeDescription >(
712cdf0e10cSrcweir             provider->getByHierarchicalName(
713cdf0e10cSrcweir                 rtl::OUString(
714cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
715cdf0e10cSrcweir                         "test.registrytdprovider.Struct3"))),
716cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW)->getMemberTypes()[0],
717cdf0e10cSrcweir         css::uno::UNO_QUERY);
718cdf0e10cSrcweir     assertFalse(published.is());
719cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
720cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
721cdf0e10cSrcweir             provider->getByHierarchicalName(
722cdf0e10cSrcweir                 rtl::OUString(
723cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
724cdf0e10cSrcweir                         "test.registrytdprovider.Struct3a"))),
725cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
726cdf0e10cSrcweir         css::uno::UNO_QUERY);
727cdf0e10cSrcweir     assertTrue(published.is());
728cdf0e10cSrcweir     assertFalse(published->isPublished());
729cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
730cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
731cdf0e10cSrcweir             provider->getByHierarchicalName(
732cdf0e10cSrcweir                 rtl::OUString(
733cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
734cdf0e10cSrcweir                         "test.registrytdprovider.Exception1"))),
735cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
736cdf0e10cSrcweir         css::uno::UNO_QUERY);
737cdf0e10cSrcweir     assertTrue(published.is());
738cdf0e10cSrcweir     assertTrue(published->isPublished());
739cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
740cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
741cdf0e10cSrcweir             provider->getByHierarchicalName(
742cdf0e10cSrcweir                 rtl::OUString(
743cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
744cdf0e10cSrcweir                         "test.registrytdprovider.Exception2"))),
745cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
746cdf0e10cSrcweir         css::uno::UNO_QUERY);
747cdf0e10cSrcweir     assertTrue(published.is());
748cdf0e10cSrcweir     assertFalse(published->isPublished());
749cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
750cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
751cdf0e10cSrcweir             provider->getByHierarchicalName(
752cdf0e10cSrcweir                 rtl::OUString(
753cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
754cdf0e10cSrcweir                         "test.registrytdprovider.XTest1"))),
755cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
756cdf0e10cSrcweir         css::uno::UNO_QUERY);
757cdf0e10cSrcweir     assertTrue(published.is());
758cdf0e10cSrcweir     assertTrue(published->isPublished());
759cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
760cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
761cdf0e10cSrcweir             provider->getByHierarchicalName(
762cdf0e10cSrcweir                 rtl::OUString(
763cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
764cdf0e10cSrcweir                         "test.registrytdprovider.XTest2"))),
765cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
766cdf0e10cSrcweir         css::uno::UNO_QUERY);
767cdf0e10cSrcweir     assertTrue(published.is());
768cdf0e10cSrcweir     assertFalse(published->isPublished());
769cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
770cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
771cdf0e10cSrcweir             provider->getByHierarchicalName(
772cdf0e10cSrcweir                 rtl::OUString(
773cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
774cdf0e10cSrcweir                         "test.registrytdprovider.Typedef1"))),
775cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
776cdf0e10cSrcweir         css::uno::UNO_QUERY);
777cdf0e10cSrcweir     assertTrue(published.is());
778cdf0e10cSrcweir     assertTrue(published->isPublished());
779cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
780cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
781cdf0e10cSrcweir             provider->getByHierarchicalName(
782cdf0e10cSrcweir                 rtl::OUString(
783cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
784cdf0e10cSrcweir                         "test.registrytdprovider.Typedef2"))),
785cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
786cdf0e10cSrcweir         css::uno::UNO_QUERY);
787cdf0e10cSrcweir     assertTrue(published.is());
788cdf0e10cSrcweir     assertFalse(published->isPublished());
789cdf0e10cSrcweir     //TODO: check constants test.registrytdprovider.Const1 (published),
790cdf0e10cSrcweir     // test.registrytdprovider.Const2 (unpublished), and
791cdf0e10cSrcweir     // test.registrytdprovider.Consts1.C (no XPublished), which are not
792cdf0e10cSrcweir     // accessible via provider->getByHierarchicalName (see #i31428)
793cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
794cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
795cdf0e10cSrcweir             provider->getByHierarchicalName(
796cdf0e10cSrcweir                 rtl::OUString(
797cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
798cdf0e10cSrcweir                         "test.registrytdprovider.Consts1"))),
799cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
800cdf0e10cSrcweir         css::uno::UNO_QUERY);
801cdf0e10cSrcweir     assertTrue(published.is());
802cdf0e10cSrcweir     assertTrue(published->isPublished());
803cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
804cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
805cdf0e10cSrcweir             provider->getByHierarchicalName(
806cdf0e10cSrcweir                 rtl::OUString(
807cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
808cdf0e10cSrcweir                         "test.registrytdprovider.Consts2"))),
809cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
810cdf0e10cSrcweir         css::uno::UNO_QUERY);
811cdf0e10cSrcweir     assertTrue(published.is());
812cdf0e10cSrcweir     assertFalse(published->isPublished());
813cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
814cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
815cdf0e10cSrcweir             provider->getByHierarchicalName(
816cdf0e10cSrcweir                 rtl::OUString(
817cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider"))),
818cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
819cdf0e10cSrcweir         css::uno::UNO_QUERY);
820cdf0e10cSrcweir     assertFalse(published.is());
821cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
822cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
823cdf0e10cSrcweir             provider->getByHierarchicalName(
824cdf0e10cSrcweir                 rtl::OUString(
825cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
826cdf0e10cSrcweir                         "test.registrytdprovider.Service1"))),
827cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
828cdf0e10cSrcweir         css::uno::UNO_QUERY);
829cdf0e10cSrcweir     assertTrue(published.is());
830cdf0e10cSrcweir     assertTrue(published->isPublished());
831cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
832cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
833cdf0e10cSrcweir             provider->getByHierarchicalName(
834cdf0e10cSrcweir                 rtl::OUString(
835cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
836cdf0e10cSrcweir                         "test.registrytdprovider.Service2"))),
837cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
838cdf0e10cSrcweir         css::uno::UNO_QUERY);
839cdf0e10cSrcweir     assertTrue(published.is());
840cdf0e10cSrcweir     assertFalse(published->isPublished());
841cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
842cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
843cdf0e10cSrcweir             provider->getByHierarchicalName(
844cdf0e10cSrcweir                 rtl::OUString(
845cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
846cdf0e10cSrcweir                         "test.registrytdprovider.Singleton2"))),
847cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
848cdf0e10cSrcweir         css::uno::UNO_QUERY);
849cdf0e10cSrcweir     assertTrue(published.is());
850cdf0e10cSrcweir     assertTrue(published->isPublished());
851cdf0e10cSrcweir     published = css::uno::Reference< css::reflection::XPublished >(
852cdf0e10cSrcweir         css::uno::Reference< css::reflection::XTypeDescription >(
853cdf0e10cSrcweir             provider->getByHierarchicalName(
854cdf0e10cSrcweir                 rtl::OUString(
855cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
856cdf0e10cSrcweir                         "test.registrytdprovider.Singleton1"))),
857cdf0e10cSrcweir             css::uno::UNO_QUERY_THROW),
858cdf0e10cSrcweir         css::uno::UNO_QUERY);
859cdf0e10cSrcweir     assertTrue(published.is());
860cdf0e10cSrcweir     assertFalse(published->isPublished());
861cdf0e10cSrcweir 
862cdf0e10cSrcweir     return 0;
863cdf0e10cSrcweir }
864cdf0e10cSrcweir 
getImplementationName()865cdf0e10cSrcweir rtl::OUString Service::getImplementationName() {
866cdf0e10cSrcweir     return rtl::OUString::createFromAscii("test.registrytdprovider.impl");
867cdf0e10cSrcweir }
868cdf0e10cSrcweir 
getSupportedServiceNames()869cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames() {
870cdf0e10cSrcweir     return css::uno::Sequence< rtl::OUString >();
871cdf0e10cSrcweir }
872cdf0e10cSrcweir 
createInstance(css::uno::Reference<css::uno::XComponentContext> const & context)873cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > Service::createInstance(
874cdf0e10cSrcweir     css::uno::Reference< css::uno::XComponentContext > const & context)
875cdf0e10cSrcweir     throw (css::uno::Exception)
876cdf0e10cSrcweir {
877cdf0e10cSrcweir     return static_cast< cppu::OWeakObject * >(new Service(context));
878cdf0e10cSrcweir }
879cdf0e10cSrcweir 
component_getImplementationEnvironment(char const ** envTypeName,uno_Environment **)880cdf0e10cSrcweir extern "C" void SAL_CALL component_getImplementationEnvironment(
881cdf0e10cSrcweir     char const ** envTypeName, uno_Environment **)
882cdf0e10cSrcweir {
883cdf0e10cSrcweir     if (envTypeName != 0) {
884cdf0e10cSrcweir         *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
885cdf0e10cSrcweir     }
886cdf0e10cSrcweir }
887cdf0e10cSrcweir 
component_getFactory(char const * implName,void * serviceManager,void *)888cdf0e10cSrcweir extern "C" void * SAL_CALL component_getFactory(char const * implName,
889cdf0e10cSrcweir                                                 void * serviceManager, void *) {
890cdf0e10cSrcweir     void * p = 0;
891cdf0e10cSrcweir     if (serviceManager != 0) {
892cdf0e10cSrcweir         css::uno::Reference< css::lang::XSingleComponentFactory > f;
893cdf0e10cSrcweir         if (Service::getImplementationName().equalsAscii(implName)) {
894cdf0e10cSrcweir             f = cppu::createSingleComponentFactory(
895cdf0e10cSrcweir                 &Service::createInstance, Service::getImplementationName(),
896cdf0e10cSrcweir                 Service::getSupportedServiceNames());
897cdf0e10cSrcweir         }
898cdf0e10cSrcweir         if (f.is()) {
899cdf0e10cSrcweir             f->acquire();
900cdf0e10cSrcweir             p = f.get();
901cdf0e10cSrcweir         }
902cdf0e10cSrcweir     }
903cdf0e10cSrcweir     return p;
904cdf0e10cSrcweir }
905cdf0e10cSrcweir 
906cdf0e10cSrcweir namespace {
907cdf0e10cSrcweir 
writeInfo(void * registryKey,rtl::OUString const & implementationName,css::uno::Sequence<rtl::OUString> const & serviceNames)908cdf0e10cSrcweir bool writeInfo(void * registryKey, rtl::OUString const & implementationName,
909cdf0e10cSrcweir                css::uno::Sequence< rtl::OUString > const & serviceNames) {
910cdf0e10cSrcweir     rtl::OUString keyName(rtl::OUString::createFromAscii("/"));
911cdf0e10cSrcweir     keyName += implementationName;
912cdf0e10cSrcweir     keyName += rtl::OUString::createFromAscii("/UNO/SERVICES");
913cdf0e10cSrcweir     css::uno::Reference< css::registry::XRegistryKey > key;
914cdf0e10cSrcweir     try {
915cdf0e10cSrcweir         key = static_cast< css::registry::XRegistryKey * >(registryKey)->
916cdf0e10cSrcweir             createKey(keyName);
917cdf0e10cSrcweir     } catch (css::registry::InvalidRegistryException &) {}
918cdf0e10cSrcweir     if (!key.is()) {
919cdf0e10cSrcweir         return false;
920cdf0e10cSrcweir     }
921cdf0e10cSrcweir     bool success = true;
922cdf0e10cSrcweir     for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
923cdf0e10cSrcweir         try {
924cdf0e10cSrcweir             key->createKey(serviceNames[i]);
925cdf0e10cSrcweir         } catch (css::registry::InvalidRegistryException &) {
926cdf0e10cSrcweir             success = false;
927cdf0e10cSrcweir             break;
928cdf0e10cSrcweir         }
929cdf0e10cSrcweir     }
930cdf0e10cSrcweir     return success;
931cdf0e10cSrcweir }
932cdf0e10cSrcweir 
933cdf0e10cSrcweir }
934cdf0e10cSrcweir 
component_writeInfo(void *,void * registryKey)935cdf0e10cSrcweir extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) {
936cdf0e10cSrcweir     return registryKey
937cdf0e10cSrcweir         && writeInfo(registryKey, Service::getImplementationName(),
938cdf0e10cSrcweir                      Service::getSupportedServiceNames());
939cdf0e10cSrcweir }
940