25#include "com/sun/star/beans/Introspection.hpp"
26#include "com/sun/star/beans/theIntrospection.hpp"
27#include "com/sun/star/bridge/BridgeFactory.hpp"
28#include "com/sun/star/bridge/UnoUrlResolver.hpp"
29#include "com/sun/star/connection/Acceptor.hpp"
30#include "com/sun/star/connection/Connector.hpp"
31#include "com/sun/star/io/Pipe.hpp"
32#include "com/sun/star/io/TextInputStream.hpp"
33#include "com/sun/star/io/TextOutputStream.hpp"
34#include "com/sun/star/java/JavaVirtualMachine.hpp"
35#include "com/sun/star/lang/XMain.hpp"
36#include "com/sun/star/loader/Java.hpp"
37#include "com/sun/star/loader/SharedLibrary.hpp"
38#include "com/sun/star/reflection/ProxyFactory.hpp"
39#include "com/sun/star/registry/ImplementationRegistration.hpp"
40#include "com/sun/star/registry/SimpleRegistry.hpp"
41#include "com/sun/star/script/Converter.hpp"
42#include "com/sun/star/script/Invocation.hpp"
43#include "com/sun/star/security/AccessController.hpp"
44#include "com/sun/star/security/Policy.hpp"
45#include "com/sun/star/uno/Exception.hpp"
46#include "com/sun/star/uno/NamingService.hpp"
47#include "com/sun/star/uno/Reference.hxx"
48#include "com/sun/star/uno/RuntimeException.hpp"
49#include "com/sun/star/uno/Sequence.hxx"
50#include "com/sun/star/uno/XComponentContext.hpp"
51#include "com/sun/star/uno/XInterface.hpp"
52#include "com/sun/star/uri/ExternalUriReferenceTranslator.hpp"
53#include "com/sun/star/uri/UriReferenceFactory.hpp"
54#include "com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.hpp"
55#include "com/sun/star/util/theMacroExpander.hpp"
62#include "osl/thread.h"
63#include "rtl/malformeduriexception.hxx"
64#include "rtl/string.h"
65#include "rtl/ustring.h"
66#include "rtl/ustring.hxx"
69#include "uno/current_context.hxx"
70#include "uno/environment.h"
72#include "test/types/CppTest.hpp"
73#include "test/types/JavaTest.hpp"
74#include "test/types/TestException.hpp"
75#include "test/types/XTest.hpp"
82 css::uno::Reference< css::uno::XComponentContext >
const & context):
85 virtual ::sal_Int32 SAL_CALL
run(
86 css::uno::Sequence< ::rtl::OUString >
const &);
95 css::uno::Reference< test::types::XTest >
const &
test,
96 ::rtl::OUString
const & name);
98 css::uno::Reference< css::uno::XComponentContext >
context_;
101::sal_Int32 Service::run(css::uno::Sequence< ::rtl::OUString >
const &) {
102 osl_getThreadIdentifier(0);
104 css::uno::getCurrentContext();
106 std::auto_ptr< cppu::UnoUrl > dummy(
new cppu::UnoUrl(rtl::OUString()));
107 }
catch (rtl::MalformedUriException &) {}
108 static char const *
const services[] = {
109 "com.sun.star.io.DataInputStream",
110 "com.sun.star.io.DataOutputStream",
111 "com.sun.star.io.MarkableInputStream",
112 "com.sun.star.io.MarkableOutputStream",
113 "com.sun.star.io.ObjectInputStream",
114 "com.sun.star.io.ObjectOutputStream",
115 "com.sun.star.io.Pump",
116 "com.sun.star.lang.RegistryServiceManager",
117 "com.sun.star.lang.ServiceManager",
118 "com.sun.star.reflection.CoreReflection",
119 "com.sun.star.registry.NestedRegistry",
120 "com.sun.star.script.InvocationAdapterFactory",
121 "com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript"
124 ::rtl::OUString
name(::rtl::OUString::createFromAscii(services[i]));
125 css::uno::Reference< css::uno::XInterface > instance;
127 instance =
context_->getServiceManager()->createInstanceWithContext(
129 }
catch (css::uno::RuntimeException &) {
131 }
catch (css::uno::Exception &) {
132 throw css::uno::RuntimeException(
133 ::rtl::OUString(
"error creating instance"),
136 if (!instance.is()) {
137 throw css::uno::RuntimeException(
138 "no instance: " + name,
142 css::beans::Introspection::create(context_);
143 css::beans::theIntrospection::get(context_);
144 css::bridge::BridgeFactory::create(context_);
145 css::bridge::UnoUrlResolver::create(context_);
146 css::connection::Acceptor::create(context_);
147 css::connection::Connector::create(context_);
148 css::io::Pipe::create(context_);
149 css::io::TextInputStream::create(context_);
150 css::io::TextOutputStream::create(context_);
151 css::java::JavaVirtualMachine::create(context_);
152 css::loader::Java::create(context_);
153 css::loader::SharedLibrary::create(context_);
154 css::reflection::ProxyFactory::create(context_);
155 css::registry::ImplementationRegistration::create(context_);
156 css::registry::SimpleRegistry::create(context_);
157 css::script::Converter::create(context_);
158 css::script::Invocation::create(context_);
159 css::security::AccessController::create(context_);
160 css::security::Policy::create(context_);
161 css::uno::NamingService::create(context_);
162 css::uri::ExternalUriReferenceTranslator::create(context_);
163 css::uri::UriReferenceFactory::create(context_);
164 css::uri::VndSunStarPkgUrlReferenceFactory::create(context_);
165 static char const *
const singletons[] = {
166 "com.sun.star.reflection.theTypeDescriptionManager"
169 css::uno::Reference< css::uno::XInterface > instance(
171 "/singletons/" + rtl::OUString::createFromAscii(singletons[i])),
172 css::uno::UNO_QUERY_THROW);
174 css::util::theMacroExpander::get(context_);
176 ::test::types::CppTest::create(context_),
177 ::rtl::OUString(
"test.types.CppTest"));
179 ::test::types::JavaTest::create(context_),
180 ::rtl::OUString(
"test.types.JavaTest"));
185 css::uno::Reference< test::types::XTest >
const &
test,
186 ::rtl::OUString
const & name)
190 test->throwException();
195 throw css::uno::RuntimeException(
197 + ::rtl::OUString(
".throwException failed")),
204css::uno::Reference< css::uno::XInterface >
create(
205 css::uno::Reference< css::uno::XComponentContext >
const & context)
211 return rtl::OUString(
"test.cpp.cppmain.Component");
215 return css::uno::Sequence< ::rtl::OUString >();
221 { CppMain::create, CppMain::getImplementationName,
222 CppMain::getSupportedServiceNames, ::cppu::createSingleComponentFactory,
224 { 0, 0, 0, 0, 0, 0 } };
229 void * serviceManager,
void * registryKey)
231 return ::cppu::component_writeInfoHelper(
232 serviceManager, registryKey, entries);
236 char const * implName,
void * serviceManager,
void * registryKey)
238 return ::cppu::component_getFactoryHelper(
239 implName, serviceManager, registryKey, entries);
OWeakObject &SAL_CALL operator=(const OWeakObject &)
SAL_DLLPUBLIC_EXPORT void *SAL_CALL component_getFactory(char const *implName, void *serviceManager, void *registryKey)
SAL_DLLPUBLIC_EXPORT::sal_Bool SAL_CALL component_writeInfo(void *serviceManager, void *registryKey)
#define SAL_N_ELEMENTS(arr)
def run(arg=None, arg2=-1)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
uno::Reference< uno::XComponentContext > context_