1*2a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*2a97ec55SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*2a97ec55SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*2a97ec55SAndrew Rist * distributed with this work for additional information
6*2a97ec55SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*2a97ec55SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*2a97ec55SAndrew Rist * "License"); you may not use this file except in compliance
9*2a97ec55SAndrew Rist * with the License. You may obtain a copy of the License at
10*2a97ec55SAndrew Rist *
11*2a97ec55SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*2a97ec55SAndrew Rist *
13*2a97ec55SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*2a97ec55SAndrew Rist * software distributed under the License is distributed on an
15*2a97ec55SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2a97ec55SAndrew Rist * KIND, either express or implied. See the License for the
17*2a97ec55SAndrew Rist * specific language governing permissions and limitations
18*2a97ec55SAndrew Rist * under the License.
19*2a97ec55SAndrew Rist *
20*2a97ec55SAndrew Rist *************************************************************/
21*2a97ec55SAndrew Rist
22*2a97ec55SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir #include <smart/com/sun/star/test/XSimpleTest.hxx>
27cdf0e10cSrcweir #include <smart/com/sun/star/io/XOutputStream.hxx>
28cdf0e10cSrcweir #include <smart/com/sun/star/io/XInputStream.hxx>
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <smart/com/sun/star/lang/XServiceInfo.hxx>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <usr/factoryhlp.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir #include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
35cdf0e10cSrcweir #include <usr/weak.hxx> // OWeakObject
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <vos/conditn.hxx>
38cdf0e10cSrcweir #include <vos/mutex.hxx>
39cdf0e10cSrcweir #include <vos/thread.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include <string.h>
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include "testfactreg.hxx"
44cdf0e10cSrcweir #define IMPLEMENTATION_NAME L"test.com.sun.star.comp.extensions.stm.Pipe"
45cdf0e10cSrcweir #define SERVICE_NAME L"test.com.sun.star.io.Pipe"
46cdf0e10cSrcweir
47cdf0e10cSrcweir using namespace vos;
48cdf0e10cSrcweir using namespace usr;
49cdf0e10cSrcweir
50cdf0e10cSrcweir class WriteToStreamThread :
51cdf0e10cSrcweir public OThread
52cdf0e10cSrcweir {
53cdf0e10cSrcweir
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir
WriteToStreamThread(XOutputStreamRef xOutput,int iMax)56cdf0e10cSrcweir WriteToStreamThread( XOutputStreamRef xOutput , int iMax )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir m_output = xOutput;
59cdf0e10cSrcweir m_iMax = iMax;
60cdf0e10cSrcweir }
61cdf0e10cSrcweir
~WriteToStreamThread()62cdf0e10cSrcweir virtual ~WriteToStreamThread() {}
63cdf0e10cSrcweir
64cdf0e10cSrcweir
65cdf0e10cSrcweir protected:
66cdf0e10cSrcweir
67cdf0e10cSrcweir /// Working method which should be overridden.
run()68cdf0e10cSrcweir virtual void run() {
69cdf0e10cSrcweir for( int i = 0 ; i < m_iMax ; i ++ ) {
70cdf0e10cSrcweir m_output->writeBytes( createIntSeq(i) );
71cdf0e10cSrcweir }
72cdf0e10cSrcweir m_output->closeOutput();
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir /** Called when run() is done.
76cdf0e10cSrcweir * You might want to override it to do some cleanup.
77cdf0e10cSrcweir */
onTerminated()78cdf0e10cSrcweir virtual void onTerminated()
79cdf0e10cSrcweir {
80cdf0e10cSrcweir delete this;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir
83cdf0e10cSrcweir
84cdf0e10cSrcweir private:
85cdf0e10cSrcweir
86cdf0e10cSrcweir XOutputStreamRef m_output;
87cdf0e10cSrcweir int m_iMax;
88cdf0e10cSrcweir };
89cdf0e10cSrcweir
90cdf0e10cSrcweir
91cdf0e10cSrcweir
92cdf0e10cSrcweir class OPipeTest :
93cdf0e10cSrcweir public XSimpleTest,
94cdf0e10cSrcweir public OWeakObject
95cdf0e10cSrcweir {
96cdf0e10cSrcweir public:
97cdf0e10cSrcweir OPipeTest( const XMultiServiceFactoryRef & rFactory );
98cdf0e10cSrcweir ~OPipeTest();
99cdf0e10cSrcweir
100cdf0e10cSrcweir public: // refcounting
101cdf0e10cSrcweir BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
acquire()102cdf0e10cSrcweir void acquire() { OWeakObject::acquire(); }
release()103cdf0e10cSrcweir void release() { OWeakObject::release(); }
getImplementation(Reflection * p)104cdf0e10cSrcweir void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
105cdf0e10cSrcweir
106cdf0e10cSrcweir public: // implementation names
107cdf0e10cSrcweir static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () );
108cdf0e10cSrcweir static UString getImplementationName_Static() THROWS( () );
109cdf0e10cSrcweir
110cdf0e10cSrcweir public:
111cdf0e10cSrcweir virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
112cdf0e10cSrcweir THROWS( ( IllegalArgumentException,
113cdf0e10cSrcweir UsrSystemException) );
114cdf0e10cSrcweir
115cdf0e10cSrcweir virtual INT32 test( const UString& TestName,
116cdf0e10cSrcweir const XInterfaceRef& TestObject,
117cdf0e10cSrcweir INT32 hTestHandle) THROWS( ( IllegalArgumentException,
118cdf0e10cSrcweir UsrSystemException) );
119cdf0e10cSrcweir
120cdf0e10cSrcweir virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
121cdf0e10cSrcweir virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
122cdf0e10cSrcweir virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
123cdf0e10cSrcweir virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
124cdf0e10cSrcweir
125cdf0e10cSrcweir private:
126cdf0e10cSrcweir void testSimple( const XInterfaceRef & );
127cdf0e10cSrcweir void testBufferResizing( const XInterfaceRef & );
128cdf0e10cSrcweir void testMultithreading( const XInterfaceRef & );
129cdf0e10cSrcweir
130cdf0e10cSrcweir private:
131cdf0e10cSrcweir Sequence<UsrAny> m_seqExceptions;
132cdf0e10cSrcweir Sequence<UString> m_seqErrors;
133cdf0e10cSrcweir Sequence<UString> m_seqWarnings;
134cdf0e10cSrcweir
135cdf0e10cSrcweir };
136cdf0e10cSrcweir
137cdf0e10cSrcweir
138cdf0e10cSrcweir
OPipeTest(const XMultiServiceFactoryRef & rFactory)139cdf0e10cSrcweir OPipeTest::OPipeTest( const XMultiServiceFactoryRef &rFactory )
140cdf0e10cSrcweir {
141cdf0e10cSrcweir
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
~OPipeTest()144cdf0e10cSrcweir OPipeTest::~OPipeTest()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
149cdf0e10cSrcweir
queryInterface(Uik uik,XInterfaceRef & rOut)150cdf0e10cSrcweir BOOL OPipeTest::queryInterface( Uik uik , XInterfaceRef &rOut )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir if( XSimpleTest::getSmartUik() == uik ) {
153cdf0e10cSrcweir rOut = (XSimpleTest *) this;
154cdf0e10cSrcweir }
155cdf0e10cSrcweir else {
156cdf0e10cSrcweir return OWeakObject::queryInterface( uik , rOut );
157cdf0e10cSrcweir }
158cdf0e10cSrcweir return TRUE;
159cdf0e10cSrcweir }
160cdf0e10cSrcweir
161cdf0e10cSrcweir
testInvariant(const UString & TestName,const XInterfaceRef & TestObject)162cdf0e10cSrcweir void OPipeTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
163cdf0e10cSrcweir THROWS( ( IllegalArgumentException,
164cdf0e10cSrcweir UsrSystemException) )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir XServiceInfoRef info( TestObject, USR_QUERY );
167cdf0e10cSrcweir ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
168cdf0e10cSrcweir if( info.is() )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
171cdf0e10cSrcweir ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" );
172cdf0e10cSrcweir }
173cdf0e10cSrcweir
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir
test(const UString & TestName,const XInterfaceRef & TestObject,INT32 hTestHandle)177cdf0e10cSrcweir INT32 OPipeTest::test( const UString& TestName,
178cdf0e10cSrcweir const XInterfaceRef& TestObject,
179cdf0e10cSrcweir INT32 hTestHandle) THROWS( ( IllegalArgumentException,
180cdf0e10cSrcweir UsrSystemException) )
181cdf0e10cSrcweir {
182cdf0e10cSrcweir if( L"com.sun.star.io.Pipe" == TestName ) {
183cdf0e10cSrcweir try {
184cdf0e10cSrcweir if( 0 == hTestHandle ) {
185cdf0e10cSrcweir testInvariant( TestName , TestObject );
186cdf0e10cSrcweir }
187cdf0e10cSrcweir else if( 1 == hTestHandle ) {
188cdf0e10cSrcweir testSimple( TestObject );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir else if( 2 == hTestHandle ) {
191cdf0e10cSrcweir testBufferResizing( TestObject );
192cdf0e10cSrcweir }
193cdf0e10cSrcweir else if( 3 == hTestHandle ) {
194cdf0e10cSrcweir testMultithreading( TestObject );
195cdf0e10cSrcweir }
196cdf0e10cSrcweir }
197cdf0e10cSrcweir catch( Exception& e ) {
198cdf0e10cSrcweir BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
199cdf0e10cSrcweir }
200cdf0e10cSrcweir catch(...) {
201cdf0e10cSrcweir BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
202cdf0e10cSrcweir }
203cdf0e10cSrcweir
204cdf0e10cSrcweir hTestHandle ++;
205cdf0e10cSrcweir
206cdf0e10cSrcweir if( 4 == hTestHandle ) {
207cdf0e10cSrcweir // all tests finished.
208cdf0e10cSrcweir hTestHandle = -1;
209cdf0e10cSrcweir }
210cdf0e10cSrcweir }
211cdf0e10cSrcweir else {
212cdf0e10cSrcweir THROW( IllegalArgumentException() );
213cdf0e10cSrcweir }
214cdf0e10cSrcweir return hTestHandle;
215cdf0e10cSrcweir }
216cdf0e10cSrcweir
217cdf0e10cSrcweir
218cdf0e10cSrcweir
testPassed(void)219cdf0e10cSrcweir BOOL OPipeTest::testPassed(void) THROWS( (UsrSystemException) )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir return m_seqErrors.getLen() == 0;
222cdf0e10cSrcweir }
223cdf0e10cSrcweir
224cdf0e10cSrcweir
getErrors(void)225cdf0e10cSrcweir Sequence< UString > OPipeTest::getErrors(void) THROWS( (UsrSystemException) )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir return m_seqErrors;
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir
getErrorExceptions(void)231cdf0e10cSrcweir Sequence< UsrAny > OPipeTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
232cdf0e10cSrcweir {
233cdf0e10cSrcweir return m_seqExceptions;
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
236cdf0e10cSrcweir
getWarnings(void)237cdf0e10cSrcweir Sequence< UString > OPipeTest::getWarnings(void) THROWS( (UsrSystemException) )
238cdf0e10cSrcweir {
239cdf0e10cSrcweir return m_seqWarnings;
240cdf0e10cSrcweir }
241cdf0e10cSrcweir
242cdf0e10cSrcweir
243cdf0e10cSrcweir /***
244cdf0e10cSrcweir * the test methods
245cdf0e10cSrcweir *
246cdf0e10cSrcweir ****/
247cdf0e10cSrcweir
248cdf0e10cSrcweir
testSimple(const XInterfaceRef & r)249cdf0e10cSrcweir void OPipeTest::testSimple( const XInterfaceRef &r )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir
252cdf0e10cSrcweir XInputStreamRef input( r , USR_QUERY );
253cdf0e10cSrcweir XOutputStreamRef output( r , USR_QUERY );
254cdf0e10cSrcweir
255cdf0e10cSrcweir ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" );
256cdf0e10cSrcweir ERROR_ASSERT( output.is() , "queryInterface onXOutputStream failed" );
257cdf0e10cSrcweir
258cdf0e10cSrcweir // basic read/write
259cdf0e10cSrcweir Sequence<BYTE> seqWrite = createSeq( "Hallo, du Ei !" );
260cdf0e10cSrcweir
261cdf0e10cSrcweir Sequence<BYTE> seqRead;
262cdf0e10cSrcweir for( int i = 0 ; i < 5000 ; i ++ ) {
263cdf0e10cSrcweir output->writeBytes( seqWrite );
264cdf0e10cSrcweir input->readBytes( seqRead , input->available() );
265cdf0e10cSrcweir
266cdf0e10cSrcweir ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) ,
267cdf0e10cSrcweir "error during read/write/skip" );
268cdf0e10cSrcweir ERROR_ASSERT( 0 == input->available() ,
269cdf0e10cSrcweir "error during read/write/skip" );
270cdf0e10cSrcweir
271cdf0e10cSrcweir // available shouldn't return a negative value
272cdf0e10cSrcweir input->skipBytes( seqWrite.getLen() - 5 );
273cdf0e10cSrcweir ERROR_ASSERT( 0 == input->available() , "wrong available after skip" );
274cdf0e10cSrcweir
275cdf0e10cSrcweir // 5 bytes should be available
276cdf0e10cSrcweir output->writeBytes( seqWrite );
277cdf0e10cSrcweir ERROR_ASSERT( 5 == input->available() , "wrong available after skip/write " );
278cdf0e10cSrcweir
279cdf0e10cSrcweir input->readBytes( seqRead , 5 );
280cdf0e10cSrcweir ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() ,
281cdf0e10cSrcweir (char*) &( seqWrite.getArray()[seqWrite.getLen()-5] ) ),
282cdf0e10cSrcweir "write/read mismatich" );
283cdf0e10cSrcweir
284cdf0e10cSrcweir }
285cdf0e10cSrcweir
286cdf0e10cSrcweir output->writeBytes( seqWrite );
287cdf0e10cSrcweir ERROR_ASSERT( seqWrite.getLen() == input->available(), "wrong available() after write" );
288cdf0e10cSrcweir
289cdf0e10cSrcweir ERROR_ASSERT( 10 == input->readSomeBytes( seqRead , 10 ) , "maximal number of bytes ignored" );
290cdf0e10cSrcweir ERROR_ASSERT( seqWrite.getLen() -10 == input->readSomeBytes( seqRead , 100 ) ,
291cdf0e10cSrcweir "something wrong with readSomeBytes" );
292cdf0e10cSrcweir
293cdf0e10cSrcweir
294cdf0e10cSrcweir output->closeOutput();
295cdf0e10cSrcweir try {
296cdf0e10cSrcweir output->writeBytes( Sequence<BYTE> (100) );
297cdf0e10cSrcweir ERROR_ASSERT( 0 , "writing on a closed stream does not cause an exception" );
298cdf0e10cSrcweir }
299cdf0e10cSrcweir catch (IOException& e ) {
300cdf0e10cSrcweir e; // just to suppress warning during compile
301cdf0e10cSrcweir }
302cdf0e10cSrcweir
303cdf0e10cSrcweir ERROR_ASSERT(! input->readBytes( seqRead , 1 ), "eof not found !" );
304cdf0e10cSrcweir
305cdf0e10cSrcweir input->closeInput();
306cdf0e10cSrcweir try {
307cdf0e10cSrcweir input->readBytes( seqRead , 1 );
308cdf0e10cSrcweir ERROR_ASSERT( 0 , "reading from a closed stream does not cause an exception" );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir catch( IOException& e ) {
311cdf0e10cSrcweir e; // just to suppress warning during compile
312cdf0e10cSrcweir }
313cdf0e10cSrcweir
314cdf0e10cSrcweir }
315cdf0e10cSrcweir
testBufferResizing(const XInterfaceRef & r)316cdf0e10cSrcweir void OPipeTest::testBufferResizing( const XInterfaceRef &r )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir
319cdf0e10cSrcweir int iMax = 20000;
320cdf0e10cSrcweir XInputStreamRef input( r , USR_QUERY );
321cdf0e10cSrcweir XOutputStreamRef output( r , USR_QUERY );
322cdf0e10cSrcweir
323cdf0e10cSrcweir ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" );
324cdf0e10cSrcweir ERROR_ASSERT( output.is() , "queryInterface on XOutputStream failed" );
325cdf0e10cSrcweir
326cdf0e10cSrcweir Sequence<BYTE> seqRead;
327cdf0e10cSrcweir
328cdf0e10cSrcweir // this is just to better check the
329cdf0e10cSrcweir // internal buffers
330cdf0e10cSrcweir output->writeBytes( Sequence<BYTE>(100) );
331cdf0e10cSrcweir input->readBytes( Sequence<BYTE>() , 100);
332cdf0e10cSrcweir
333cdf0e10cSrcweir for( int i = 0 ; i < iMax ; i ++ ) {
334cdf0e10cSrcweir output->writeBytes( createIntSeq( i ) );
335cdf0e10cSrcweir }
336cdf0e10cSrcweir
337cdf0e10cSrcweir for( i = 0 ; i < iMax ; i ++ ) {
338cdf0e10cSrcweir input->readBytes( seqRead, createIntSeq(i).getLen() );
339cdf0e10cSrcweir ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() ,
340cdf0e10cSrcweir (char*) createIntSeq(i).getArray() ) ,
341cdf0e10cSrcweir "written/read mismatch\n" );
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir output->closeOutput();
345cdf0e10cSrcweir ERROR_ASSERT( ! input->readBytes( seqRead , 1 ) , "eof not reached !" );
346cdf0e10cSrcweir input->closeInput();
347cdf0e10cSrcweir }
348cdf0e10cSrcweir
349cdf0e10cSrcweir
350cdf0e10cSrcweir
testMultithreading(const XInterfaceRef & r)351cdf0e10cSrcweir void OPipeTest::testMultithreading( const XInterfaceRef &r )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir
354cdf0e10cSrcweir
355cdf0e10cSrcweir int iMax = 30000;
356cdf0e10cSrcweir
357cdf0e10cSrcweir XInputStreamRef input( r , USR_QUERY );
358cdf0e10cSrcweir XOutputStreamRef output( r , USR_QUERY );
359cdf0e10cSrcweir
360cdf0e10cSrcweir ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" );
361cdf0e10cSrcweir ERROR_ASSERT( output.is() , "queryInterface on XOutputStream failed" );
362cdf0e10cSrcweir
363cdf0e10cSrcweir Sequence<BYTE> seqRead;
364cdf0e10cSrcweir
365cdf0e10cSrcweir // deletes itself
366cdf0e10cSrcweir OThread *p = new WriteToStreamThread( output, iMax );
367cdf0e10cSrcweir
368cdf0e10cSrcweir ERROR_ASSERT( p , "couldn't create thread for testing !\n" );
369cdf0e10cSrcweir
370cdf0e10cSrcweir p->create();
371cdf0e10cSrcweir
372cdf0e10cSrcweir for(int i = 0 ; TRUE ; i ++ ) {
373cdf0e10cSrcweir if( 0 == input->readBytes( seqRead, createIntSeq(i).getLen() ) ) {
374cdf0e10cSrcweir // eof reached !
375cdf0e10cSrcweir break;
376cdf0e10cSrcweir }
377cdf0e10cSrcweir
378cdf0e10cSrcweir ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() ,
379cdf0e10cSrcweir (char*) createIntSeq(i).getArray() ) ,
380cdf0e10cSrcweir "written/read mismatch\n" );
381cdf0e10cSrcweir }
382cdf0e10cSrcweir
383cdf0e10cSrcweir ERROR_ASSERT( i == iMax , "less elements read than written !");
384cdf0e10cSrcweir input->closeInput();
385cdf0e10cSrcweir }
386cdf0e10cSrcweir
387cdf0e10cSrcweir /* {
388cdf0e10cSrcweir try {
389cdf0e10cSrcweir XInterfaceRef x = xSMgr->createInstance( strService );
390cdf0e10cSrcweir
391cdf0e10cSrcweir XInputStreamRef input( x , USR_QUERY );
392cdf0e10cSrcweir XOutputStreamRef output( x , USR_QUERY );
393cdf0e10cSrcweir
394cdf0e10cSrcweir OSL_ASSERT( output.is() );
395cdf0e10cSrcweir while( TRUE ) {
396cdf0e10cSrcweir // basic read/write
397cdf0e10cSrcweir Sequence<BYTE> seqWrite( 500 );
398cdf0e10cSrcweir output->writeBytes( seqWrite );
399cdf0e10cSrcweir
400cdf0e10cSrcweir }
401cdf0e10cSrcweir }
402cdf0e10cSrcweir catch( IOException& e ) {
403cdf0e10cSrcweir printf( "%s %s\n" , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ,
404cdf0e10cSrcweir UStringToString( e.Message , CHARSET_SYSTEM ).GetCharStr() );
405cdf0e10cSrcweir }
406cdf0e10cSrcweir }
407cdf0e10cSrcweir */
408cdf0e10cSrcweir
409cdf0e10cSrcweir
410cdf0e10cSrcweir
411cdf0e10cSrcweir
412cdf0e10cSrcweir /**
413cdf0e10cSrcweir * for external binding
414cdf0e10cSrcweir *
415cdf0e10cSrcweir *
416cdf0e10cSrcweir **/
OPipeTest_CreateInstance(const XMultiServiceFactoryRef & rSMgr)417cdf0e10cSrcweir XInterfaceRef OPipeTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
418cdf0e10cSrcweir {
419cdf0e10cSrcweir OPipeTest *p = new OPipeTest( rSMgr );
420cdf0e10cSrcweir XInterfaceRef xService = *p;
421cdf0e10cSrcweir return xService;
422cdf0e10cSrcweir }
423cdf0e10cSrcweir
424cdf0e10cSrcweir
425cdf0e10cSrcweir
OPipeTest_getSupportedServiceNames(void)426cdf0e10cSrcweir Sequence<UString> OPipeTest_getSupportedServiceNames(void) THROWS( () )
427cdf0e10cSrcweir {
428cdf0e10cSrcweir Sequence<UString> aRet(1);
429cdf0e10cSrcweir aRet.getArray()[0] = OPipeTest_getImplementationName();
430cdf0e10cSrcweir
431cdf0e10cSrcweir return aRet;
432cdf0e10cSrcweir }
433cdf0e10cSrcweir
OPipeTest_getServiceName()434cdf0e10cSrcweir UString OPipeTest_getServiceName() THROWS( () )
435cdf0e10cSrcweir {
436cdf0e10cSrcweir return SERVICE_NAME;
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
OPipeTest_getImplementationName()439cdf0e10cSrcweir UString OPipeTest_getImplementationName() THROWS( () )
440cdf0e10cSrcweir {
441cdf0e10cSrcweir return IMPLEMENTATION_NAME;
442cdf0e10cSrcweir }
443