xref: /aoo41x/main/io/test/stm/datatest.cxx (revision 3716f815)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_io.hxx"
26 
27 #include <stdio.h>
28 
29 #include <com/sun/star/test/XSimpleTest.hpp>
30 #include <com/sun/star/io/XActiveDataSink.hpp>
31 #include <com/sun/star/io/XActiveDataSource.hpp>
32 #include <com/sun/star/io/XObjectInputStream.hpp>
33 #include <com/sun/star/io/XObjectOutputStream.hpp>
34 #include <com/sun/star/io/XMarkableStream.hpp>
35 #include <com/sun/star/io/XConnectable.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/lang/WrappedTargetException.hpp>
38 
39 #include <com/sun/star/lang/IllegalArgumentException.hpp>
40 
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 
43 #include <cppuhelper/factory.hxx>
44 
45 #include <cppuhelper/implbase1.hxx>
46 #include <cppuhelper/implbase2.hxx>
47 
48 #include <osl/conditn.hxx>
49 #include <osl/mutex.hxx>
50 
51 #include <string.h>
52 
53 using namespace ::rtl;
54 using namespace ::osl;
55 using namespace ::cppu;
56 //using namespace ::vos;
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::io;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star::test;
61 using namespace ::com::sun::star::beans;
62 // streams
63 
64 #include "testfactreg.hxx"
65 
66 #define DATASTREAM_TEST_MAX_HANDLE 1
67 
68 /****
69 * The following test class tests XDataInputStream and XDataOutputStream at equal terms,
70 * so when errors occur, it may be in either one implementation.
71 * The class also  uses stardiv.uno.io.pipe. If problems occur, make sure to run also the
72 * pipe test routines ( test.com.sun.star.io.pipe ).
73 *
74 *
75 *****/
76 
77 class ODataStreamTest :
78 		public WeakImplHelper1< XSimpleTest >
79 {
80 public:
ODataStreamTest(const Reference<XMultiServiceFactory> & rFactory)81 	ODataStreamTest( const Reference < XMultiServiceFactory > & rFactory ) :
82 		m_rFactory( rFactory )
83 		{}
84 
85 public:
86     virtual void SAL_CALL testInvariant(const OUString& TestName, const Reference < XInterface >& TestObject)
87 		throw (	IllegalArgumentException,
88 					RuntimeException);
89 
90     virtual sal_Int32 SAL_CALL test(	const OUString& TestName,
91 										const Reference < XInterface >& TestObject,
92 										sal_Int32 hTestHandle)
93 		throw (	IllegalArgumentException,
94 				RuntimeException);
95 
96     virtual sal_Bool SAL_CALL testPassed(void) 								throw (	RuntimeException);
97     virtual Sequence< OUString > SAL_CALL getErrors(void) 				throw (RuntimeException);
98     virtual Sequence< Any > SAL_CALL getErrorExceptions(void) 		throw (RuntimeException);
99     virtual Sequence< OUString > SAL_CALL getWarnings(void) 				throw (RuntimeException);
100 
101 private:
102 	void testSimple( const Reference < XDataInputStream > & , const Reference < XDataOutputStream > &);
103 
104 protected:
105 	Sequence<Any>  m_seqExceptions;
106 	Sequence<OUString> m_seqErrors;
107 	Sequence<OUString> m_seqWarnings;
108 
109 	Reference < XMultiServiceFactory > m_rFactory;
110 };
111 
112 
113 
114 
testInvariant(const OUString & TestName,const Reference<XInterface> & TestObject)115 void ODataStreamTest::testInvariant(
116 	const OUString& TestName,
117 	const Reference < XInterface >& TestObject )
118 	throw (	IllegalArgumentException,
119 			RuntimeException)
120 {
121 	if( OUString::createFromAscii("com.sun.star.io.DataInputStream") == TestName ) {
122 		Reference < XConnectable > connect( TestObject , UNO_QUERY );
123 		Reference < XActiveDataSink > active( TestObject , UNO_QUERY );
124 		Reference < XInputStream >  input( TestObject , UNO_QUERY );
125 		Reference < XDataInputStream > dataInput( TestObject , UNO_QUERY );
126 
127 		WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" );
128 		WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" );
129 		ERROR_ASSERT( input.is() , "XInputStream cannot be queried" );
130 		ERROR_ASSERT( dataInput.is() , "XDataInputStream cannot be queried" );
131 
132 
133 	}
134 	else if( OUString::createFromAscii("com.sun.star.io.DataInputStream") == TestName ) {
135 		Reference < XConnectable >  connect( TestObject , UNO_QUERY );
136 		Reference < XActiveDataSource > active( TestObject , UNO_QUERY );
137 		Reference < XOutputStream > output( TestObject , UNO_QUERY );
138 		Reference < XDataOutputStream > dataOutput( TestObject , UNO_QUERY );
139 
140 		WARNING_ASSERT( connect.is(), 		"XConnectable cannot be queried" );
141 		WARNING_ASSERT( active.is() , 	"XActiveDataSink cannot be queried" );
142 		ERROR_ASSERT( 	output.is() ,	"XInputStream cannot be queried" );
143 		ERROR_ASSERT( 	dataOutput.is(),	"XDataInputStream cannot be queried" );
144 
145 	}
146 
147 	Reference < XServiceInfo >  info( TestObject, UNO_QUERY );
148 	ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
149 	if( info.is() )
150 	{
151 		ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
152 		ERROR_ASSERT( ! info->supportsService( OUString::createFromAscii("bla bluzb") ) , "XServiceInfo test failed" );
153 	}
154 
155 }
156 
157 
test(const OUString & TestName,const Reference<XInterface> & TestObject,sal_Int32 hTestHandle)158 sal_Int32 ODataStreamTest::test(
159 	const OUString& TestName,
160 	const Reference < XInterface >& TestObject,
161 	sal_Int32 hTestHandle)
162 	throw (	IllegalArgumentException,
163 			RuntimeException)
164 {
165 	if( OUString::createFromAscii("com.sun.star.io.DataInputStream") == TestName ||
166 		OUString::createFromAscii("com.sun.star.io.DataOutputStream") == TestName )  {
167 
168 		try
169 		{
170 			if( 0 == hTestHandle ) {
171 				testInvariant( TestName , TestObject );
172 			}
173 			else {
174 				Reference <XActiveDataSink > rSink( TestObject, UNO_QUERY );
175 				Reference <XActiveDataSource > rSource( TestObject , UNO_QUERY );
176 
177 				Reference < XDataInputStream > rInput( TestObject , UNO_QUERY );
178 				Reference < XDataOutputStream > rOutput( TestObject , UNO_QUERY );
179 
180 
181 				Reference < XInterface > x = m_rFactory->createInstance(
182 					OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe" )));
183 
184 				Reference < XInputStream >   rPipeInput( x , UNO_QUERY );
185 				Reference < XOutputStream >  rPipeOutput( x , UNO_QUERY );
186 
187 				if( ! rSink.is() ) {
188 					x = m_rFactory->createInstance(
189 						OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.DataInputStream")) );
190 					rInput = Reference < XDataInputStream > ( x , UNO_QUERY);
191 					rSink = Reference<  XActiveDataSink > ( x , UNO_QUERY );
192 				}
193 				else if ( !rSource.is() )
194 				{
195 					x = m_rFactory->createInstance(
196 						OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.DataOutputStream") ) );
197 					rOutput = Reference< XDataOutputStream > ( x , UNO_QUERY );
198 					rSource = Reference< XActiveDataSource > ( x, UNO_QUERY );
199 				}
200 
201 				OSL_ASSERT( rPipeInput.is() );
202 				OSL_ASSERT( rPipeOutput.is() );
203 				rSink->setInputStream( rPipeInput );
204 				rSource->setOutputStream( rPipeOutput );
205 
206 				OSL_ASSERT( rSink->getInputStream().is() );
207 				OSL_ASSERT( rSource->getOutputStream().is() );
208 
209 				if( 1 == hTestHandle ) {
210 					testSimple( rInput , rOutput );
211 				}
212 			}
213 		}
214 		catch( Exception & e )
215 		{
216 			OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
217 			BUILD_ERROR( 0 , o.getStr() );
218 		}
219 		catch( ... )
220 		{
221 			BUILD_ERROR( 0 , "unknown exception (Exception is  not base class)" );
222 		}
223 
224 		hTestHandle ++;
225 
226 		if( hTestHandle >= 2) {
227 			// all tests finished.
228 			hTestHandle = -1;
229 		}
230 	}
231 	else {
232 		BUILD_ERROR( 0 , "service not supported by test." );
233 	}
234 	return hTestHandle;
235 }
236 
237 
238 
testPassed(void)239 sal_Bool ODataStreamTest::testPassed(void) 										throw (RuntimeException)
240 {
241 	return m_seqErrors.getLength() == 0;
242 }
243 
244 
getErrors(void)245 Sequence< OUString > ODataStreamTest::getErrors(void) 							throw (RuntimeException)
246 {
247 	return m_seqErrors;
248 }
249 
250 
getErrorExceptions(void)251 Sequence< Any > ODataStreamTest::getErrorExceptions(void) 					throw (RuntimeException)
252 {
253 	return m_seqExceptions;
254 }
255 
256 
getWarnings(void)257 Sequence< OUString > ODataStreamTest::getWarnings(void) 						throw (RuntimeException)
258 {
259 	return m_seqWarnings;
260 }
261 
testSimple(const Reference<XDataInputStream> & rInput,const Reference<XDataOutputStream> & rOutput)262 void ODataStreamTest::testSimple( 	const Reference < XDataInputStream > &rInput,
263 									const Reference < XDataOutputStream > &rOutput )
264 {
265 	rOutput->writeLong( 0x34ff3c );
266 	rOutput->writeLong( 0x34ff3d );
267 	rOutput->writeLong( -1027 );
268 
269 	ERROR_ASSERT( 0x34ff3c ==  rInput->readLong() , "long read/write mismatch" );
270 	ERROR_ASSERT( 0x34ff3d ==  rInput->readLong() , "long read/write mismatch" );
271 	ERROR_ASSERT( -1027    ==  rInput->readLong() , "long read/write mismatch" );
272 
273 	rOutput->writeByte( 0x77 );
274 	ERROR_ASSERT( 0x77 == rInput->readByte() , "byte read/write mismatch" );
275 
276 	rOutput->writeBoolean( 25 );
277 	ERROR_ASSERT( rInput->readBoolean() , "boolean read/write mismatch" );
278 
279 	rOutput->writeBoolean( sal_False );
280 	ERROR_ASSERT( ! rInput->readBoolean() , "boolean read/write mismatch" );
281 
282 	rOutput->writeFloat( (float) 42.42 );
283 	ERROR_ASSERT( rInput->readFloat() == ((float)42.42) , "float read/write mismatch" );
284 
285 	rOutput->writeDouble( (double) 42.42 );
286 	ERROR_ASSERT( rInput->readDouble() == 42.42 , "double read/write mismatch" );
287 
288 	rOutput->writeHyper( 0x123456789abcdefLL );
289 	ERROR_ASSERT( rInput->readHyper() == 0x123456789abcdefLL , "int64 read/write mismatch" );
290 
291 	rOutput->writeUTF( OUString::createFromAscii("Live long and prosper !") );
292 	ERROR_ASSERT( rInput->readUTF() == OUString::createFromAscii("Live long and prosper !") ,
293 					"UTF read/write mismatch" );
294 
295 	Sequence<sal_Unicode> wc(0x10001);
296 	for( int i = 0 ; i < 0x10000  ; i ++ ) {
297 		wc.getArray()[i] = L'c';
298 	}
299 	wc.getArray()[0x10000] = 0;
300 	OUString str( wc.getArray() , 0x10000 );
301 	rOutput->writeUTF( str );
302 	ERROR_ASSERT( rInput->readUTF() == str , "error reading 64k block" );
303 
304 	rOutput->closeOutput();
305 	try
306 	{
307 		rInput->readLong();
308 		ERROR_ASSERT( 0 , "eof-exception does not occur !" );
309 	}
310 	catch ( IOException & )
311 	{
312 		//ok
313 	}
314 	catch( ... )
315 	{
316 		ERROR_ASSERT( 0 , "wrong exception after reading beyond eof" );
317 	}
318 
319 	Sequence<sal_Int8> dummy (1);
320 	ERROR_ASSERT( ! rInput->readBytes( dummy , 1 ),
321 					"stream must be on eof !" );
322 
323 	rInput->closeInput();
324 
325 	try
326 	{
327 		rOutput->writeByte( 1 );
328 		ERROR_ASSERT( 0 , "writing still possible though chain must be interrupted" );
329 	}
330 	catch( IOException & )
331 	{
332 		// ok
333 	}
334 	catch( ... ) {
335 		ERROR_ASSERT( 0 , "IOException	expected, but another exception was thrown" );
336 	}
337 
338 }
339 
340 
341 
342 /**
343 * for external binding
344 *
345 *
346 **/
ODataStreamTest_CreateInstance(const Reference<XMultiServiceFactory> & rSMgr)347 Reference < XInterface > SAL_CALL ODataStreamTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
348 {
349 	ODataStreamTest *p = new ODataStreamTest( rSMgr );
350 	return Reference < XInterface > ( SAL_STATIC_CAST( OWeakObject * , p ) );
351 }
352 
ODataStreamTest_getSupportedServiceNames(int i)353 Sequence<OUString> ODataStreamTest_getSupportedServiceNames( int i) throw ()
354 {
355 	Sequence<OUString> aRet(1);
356 
357 	aRet.getArray()[0] = ODataStreamTest_getImplementationName( i);
358 
359 
360 	return aRet;
361 }
362 
ODataStreamTest_getServiceName(int i)363 OUString     ODataStreamTest_getServiceName( int i) throw ()
364 {
365 	if( 1 == i ) {
366 		return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.io.DataInputStream" ));
367 	}
368 	else {
369 		return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.io.DataOutputStream" ));
370 	}
371 }
372 
ODataStreamTest_getImplementationName(int i)373 OUString 	ODataStreamTest_getImplementationName( int i) throw ()
374 {
375 	if( 1 == i ) {
376 		return OUString(
377 			RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.comp.extensions.stm.DataInputStream") );
378 	}
379 	else {
380 		return OUString( RTL_CONSTASCII_USTRINGPARAM(
381 			"test.com.sun.star.comp.extensions.stm.DataOutputStream" ) );
382 	}
383 }
384 
385 
386 /**------------------------------------------------------
387 *
388 *
389 *
390 *
391 *
392 *------------------------------------------------------*/
393 class MyPersistObject : public WeakImplHelper2< XPersistObject , XPropertySet >
394 {
395 public:
MyPersistObject()396 	MyPersistObject( ) : m_sServiceName( OMyPersistObject_getServiceName() ) ,
397         m_l( -392 ),
398         m_f( 7883.2 ),
399         m_d( -123923.5 ),
400         m_b( sal_True ),
401         m_byte( 42 ),
402         m_c( 429 ),
403         m_s( OUString( RTL_CONSTASCII_USTRINGPARAM( "foo" ) ) )
404 		{}
MyPersistObject(const OUString & sServiceName)405 	MyPersistObject( const OUString & sServiceName ) : m_sServiceName( sServiceName )
406 		{}
407 
408 
409 public:
410     virtual OUString SAL_CALL getServiceName(void)  throw (RuntimeException);
411     virtual void SAL_CALL write( const Reference< XObjectOutputStream >& OutStream )
412 		throw (IOException, RuntimeException);
413     virtual void SAL_CALL read(const Reference< XObjectInputStream >& InStream)
414 		throw (IOException, RuntimeException);
415 
416 public:
417 
418     virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(void)
419 		throw (RuntimeException);
420 
421 	virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const Any& aValue)
422 		throw (	UnknownPropertyException,
423 				PropertyVetoException,
424 				IllegalArgumentException,
425 				WrappedTargetException,
426 				RuntimeException);
427     virtual Any SAL_CALL getPropertyValue(const OUString& PropertyName)
428 		throw (	UnknownPropertyException,
429 				WrappedTargetException,
430 				RuntimeException);
431     virtual void SAL_CALL addPropertyChangeListener(
432 		const OUString& aPropertyName,
433 		const Reference < XPropertyChangeListener > & xListener)
434 		throw (	UnknownPropertyException,
435 				WrappedTargetException,
436 				RuntimeException);
437 
438 	virtual void SAL_CALL removePropertyChangeListener(
439 		const OUString& aPropertyName,
440 		const Reference< XPropertyChangeListener > & aListener)
441 		throw (	UnknownPropertyException,
442 				WrappedTargetException,
443 				RuntimeException);
444     virtual void SAL_CALL addVetoableChangeListener(
445 		const OUString& PropertyName,
446 		const Reference< XVetoableChangeListener > & aListener)
447 		throw (	UnknownPropertyException,
448 				WrappedTargetException,
449 				RuntimeException);
450 
451     virtual void SAL_CALL removeVetoableChangeListener(
452 		const OUString& PropertyName,
453 		const Reference<  XVetoableChangeListener >& aListener)
454 		throw (	UnknownPropertyException,
455 				WrappedTargetException,
456 				RuntimeException);
457 
458 public:
459 	sal_Int32	m_l;
460 	float	m_f;
461 	double	m_d;
462 	sal_Bool	m_b;
463 	sal_Int8	m_byte;
464 	sal_Unicode	m_c;
465 	OUString	m_s;
466 	Reference< XPersistObject > m_ref;
467 	OUString m_sServiceName;
468 };
469 
470 
471 
getPropertySetInfo(void)472 Reference <XPropertySetInfo > MyPersistObject::getPropertySetInfo(void)
473 	throw (RuntimeException)
474 {
475 	return Reference< XPropertySetInfo >();
476 }
477 
setPropertyValue(const OUString & aPropertyName,const Any & aValue)478 void MyPersistObject::setPropertyValue(
479 	const OUString& aPropertyName,
480 	const Any& aValue)
481 	throw (	UnknownPropertyException,
482 			PropertyVetoException,
483 			IllegalArgumentException,
484 			WrappedTargetException,
485 			RuntimeException)
486 {
487 	if( 0 == aPropertyName.compareToAscii("long")  ) {
488 		aValue >>= m_l;
489 	}
490 	else if ( 0 == aPropertyName.compareToAscii("float") ) {
491 		aValue >>= m_f;
492 	}
493 	else if( 0 == aPropertyName.compareToAscii("double") ) {
494 		aValue >>= m_d;
495 	}
496 	else if( 0  == aPropertyName.compareToAscii("bool") ) {
497 		aValue >>= m_b;
498 	}
499 	else if( 0 == aPropertyName.compareToAscii("byte" ) ) {
500 		aValue >>= m_byte;
501 	}
502 	else if( 0 == aPropertyName.compareToAscii("char") ) {
503 		aValue >>= m_c;
504 	}
505 	else if( 0 == aPropertyName.compareToAscii("string") ) {
506 		aValue >>= m_s;
507 	}
508 	else if( 0 == aPropertyName.compareToAscii("object") ) {
509 		if( aValue.getValueType() == getCppuType( (Reference< XPersistObject> *)0 ) )
510 		{
511 			aValue >>= m_ref;
512 		}
513 		else
514 		{
515 			m_ref = 0;
516 		}
517 	}
518 }
519 
520 
getPropertyValue(const OUString & aPropertyName)521 Any MyPersistObject::getPropertyValue(const OUString& aPropertyName)
522 	throw (	UnknownPropertyException,
523 			WrappedTargetException,
524 			RuntimeException)
525 {
526 	Any aValue;
527 	if( 0 == aPropertyName.compareToAscii("long" )  ) {
528 		aValue <<= m_l;
529 	}
530 	else if ( 0 == aPropertyName.compareToAscii("float") ) {
531 		aValue <<= m_f;
532 	}
533 	else if( 0 == aPropertyName.compareToAscii("double") ) {
534 		aValue <<= m_d;
535 	}
536 	else if( 0 == aPropertyName.compareToAscii("bool") ) {
537 		aValue <<= m_b;
538 	}
539 	else if( 0 == aPropertyName.compareToAscii("byte") ) {
540 		aValue <<= m_byte;
541 	}
542 	else if( 0 == aPropertyName.compareToAscii("char" ) ) {
543 		aValue <<= m_c;
544 	}
545 	else if( 0 == aPropertyName.compareToAscii("string") ) {
546 		aValue <<= m_s;
547 	}
548 	else if( 0 == aPropertyName.compareToAscii("object" ) )
549 	{
550 		aValue <<= m_ref;
551 	}
552 	return aValue;
553 }
554 
555 
addPropertyChangeListener(const OUString & aPropertyName,const Reference<XPropertyChangeListener> & xListener)556 void MyPersistObject::addPropertyChangeListener(
557 	const OUString& aPropertyName,
558 	const Reference< XPropertyChangeListener > & xListener)
559 	throw (	UnknownPropertyException,
560 			WrappedTargetException,
561 			RuntimeException)
562 {
563 
564 }
565 
removePropertyChangeListener(const OUString & aPropertyName,const Reference<XPropertyChangeListener> & aListener)566 void MyPersistObject::removePropertyChangeListener(
567 	const OUString& aPropertyName,
568 	const Reference < XPropertyChangeListener > & aListener)
569 	throw (	UnknownPropertyException,
570 			WrappedTargetException,
571 			RuntimeException)
572 {
573 }
574 
575 
addVetoableChangeListener(const OUString & PropertyName,const Reference<XVetoableChangeListener> & aListener)576 void MyPersistObject::addVetoableChangeListener(
577 	const OUString& PropertyName,
578 	const Reference <XVetoableChangeListener >& aListener)
579 	throw (	UnknownPropertyException,
580 			WrappedTargetException,
581 			RuntimeException)
582 {
583 
584 }
585 
removeVetoableChangeListener(const OUString & PropertyName,const Reference<XVetoableChangeListener> & aListener)586 void MyPersistObject::removeVetoableChangeListener(
587 	const OUString& PropertyName,
588 	const Reference < XVetoableChangeListener > & aListener)
589 	throw (	UnknownPropertyException,
590 			WrappedTargetException,
591 			RuntimeException)
592 {
593 
594 }
595 
596 
597 
598 
getServiceName()599 OUString MyPersistObject::getServiceName() throw (RuntimeException)
600 {
601 	return m_sServiceName;
602 }
603 
write(const Reference<XObjectOutputStream> & rOut)604 void MyPersistObject::write( const Reference< XObjectOutputStream >  & rOut )
605 	throw (IOException,RuntimeException)
606 {
607 	rOut->writeLong( m_l);
608 	rOut->writeFloat( m_f );
609 	rOut->writeDouble( m_d );
610 	rOut->writeBoolean( m_b );
611 	rOut->writeByte( m_byte );
612 	rOut->writeChar( m_c );
613 	rOut->writeUTF( m_s );
614 	rOut->writeObject( m_ref );
615 }
616 
617 
read(const Reference<XObjectInputStream> & rIn)618 void MyPersistObject::read( const Reference< XObjectInputStream > & rIn )
619 	throw (IOException, RuntimeException)
620 {
621 	m_l = rIn->readLong();
622 	m_f = rIn->readFloat();
623 	m_d = rIn->readDouble();
624 	m_b = rIn->readBoolean();
625 	m_byte = rIn->readByte();
626 	m_c = rIn->readChar();
627 	m_s = rIn->readUTF();
628 	m_ref = rIn->readObject();
629 }
630 
OMyPersistObject_CreateInstance(const Reference<XMultiServiceFactory> & rSMgr)631 Reference < XInterface > SAL_CALL OMyPersistObject_CreateInstance(
632 	const Reference < XMultiServiceFactory > & rSMgr )
633 	throw(Exception)
634 {
635 	MyPersistObject *p = new MyPersistObject( );
636 	return Reference < XInterface > ( SAL_STATIC_CAST( OWeakObject * , p ) );
637 }
638 
OMyPersistObject_getSupportedServiceNames()639 Sequence<OUString> OMyPersistObject_getSupportedServiceNames( ) throw ()
640 {
641 	Sequence<OUString> aRet(1);
642 	aRet.getArray()[0] = OMyPersistObject_getImplementationName();
643 	return aRet;
644 }
645 
OMyPersistObject_getServiceName()646 OUString     OMyPersistObject_getServiceName( ) throw ()
647 {
648 	return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.io.PersistTest" ));
649 }
650 
OMyPersistObject_getImplementationName()651 OUString 	OMyPersistObject_getImplementationName( ) throw ()
652 {
653 	return OUString( RTL_CONSTASCII_USTRINGPARAM( "test.com.sun.star.io.PersistTest" ) );
654 }
655 
656 
657 // ---------------------------------------------
658 // -----------------------------------------------
659 class OObjectStreamTest :
660 		public ODataStreamTest
661 {
662 public:
OObjectStreamTest(const Reference<XMultiServiceFactory> & r)663 	OObjectStreamTest( const Reference < XMultiServiceFactory > &r) : ODataStreamTest(r) {}
664 
665 public:
666     virtual void SAL_CALL testInvariant(const OUString& TestName,
667 							   const Reference < XInterface >& TestObject)
668 		throw (	IllegalArgumentException,
669 				RuntimeException);
670 
671     virtual sal_Int32 SAL_CALL test(
672 		const OUString& TestName,
673 		const Reference < XInterface >& TestObject,
674 		sal_Int32 hTestHandle)
675 		throw (	IllegalArgumentException,
676 				RuntimeException);
677 
678 
679 private:
680 	void OObjectStreamTest::testObject( 	const Reference <XObjectOutputStream > &rOut,
681 											const Reference <XObjectInputStream> &rIn );
682 
683 private:
684 };
685 
686 
testInvariant(const OUString & TestName,const Reference<XInterface> & TestObject)687 void OObjectStreamTest::testInvariant( const OUString& TestName,
688 									   const Reference < XInterface >& TestObject )
689 	throw (	IllegalArgumentException, RuntimeException)
690 {
691 
692 	if( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.ObjectInputStream" ) )
693 				  == TestName )
694 	{
695 		ODataStreamTest::testInvariant( TestName , TestObject );
696 		Reference< XObjectInputStream > dataInput( TestObject , UNO_QUERY );
697 		Reference< XMarkableStream >  markable( TestObject , UNO_QUERY );
698 		ERROR_ASSERT( dataInput.is() , "XObjectInputStream cannot be queried" );
699 		ERROR_ASSERT(   markable.is() , "XMarkableStream cannot be queried" );
700 	}
701 	else if( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.ObjectOutputStream") )
702 			 == TestName )
703 	{
704 		ODataStreamTest::testInvariant( TestName , TestObject );
705 		Reference < XMarkableStream > markable( TestObject , UNO_QUERY );
706 		Reference < XObjectOutputStream > dataOutput( TestObject , UNO_QUERY );
707 		ERROR_ASSERT( 	dataOutput.is(),	"XObjectOutputStream cannot be queried" );
708 		ERROR_ASSERT(   markable.is() , "XMarkableStream cannot be queried" );
709 	}
710 
711 	Reference < XServiceInfo > info( TestObject, UNO_QUERY );
712 	ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
713 	if( info.is() )
714 	{
715 		ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
716 		ERROR_ASSERT( ! info->supportsService( OUString::createFromAscii("bla bluzb") ) , "XServiceInfo test failed" );
717 	}
718 
719 }
720 
test(const OUString & TestName,const Reference<XInterface> & TestObject,sal_Int32 hTestHandle)721 sal_Int32 OObjectStreamTest::test(	const OUString& TestName,
722     					const Reference < XInterface >& TestObject,
723     					sal_Int32 hTestHandle)
724 	throw (	IllegalArgumentException,
725 			RuntimeException)
726 {
727 	if( 0 == TestName.compareToAscii("com.sun.star.io.ObjectInputStream") ||
728 		0 == TestName.compareToAscii("com.sun.star.io.ObjectOutputStream" ) )  {
729 
730 		try
731 		{
732 			if( 0 == hTestHandle ) {
733 				testInvariant( TestName , TestObject );
734 			}
735 			else if( DATASTREAM_TEST_MAX_HANDLE >= hTestHandle ) {
736 				sal_Int32 hOldHandle = hTestHandle;
737 				hTestHandle = ODataStreamTest::test(
738 					OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.DataInputStream" )),
739 					TestObject , hTestHandle );
740 				if( hTestHandle == -1 ){
741 					hTestHandle = hOldHandle;
742 				}
743 			}
744 			else {
745 
746 				Reference<XActiveDataSink >  rSink( TestObject, UNO_QUERY );
747 				Reference<XActiveDataSource >  rSource( TestObject , UNO_QUERY );
748 
749 				Reference< XObjectInputStream >  rInput( TestObject , UNO_QUERY );
750 				Reference< XObjectOutputStream > rOutput( TestObject , UNO_QUERY );
751 
752 
753 				Reference < XInterface > x = m_rFactory->createInstance(
754 					OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe" )) );
755 
756 				Reference <XInputStream > rPipeInput( x , UNO_QUERY );
757 				Reference <XOutputStream >  rPipeOutput( x , UNO_QUERY );
758 
759 				x = m_rFactory->createInstance(
760 					OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.MarkableInputStream") ) );
761 
762 				Reference <XInputStream > markableInput( x , UNO_QUERY );
763 				Reference <XActiveDataSink> markableSink( x , UNO_QUERY );
764 
765 				x = m_rFactory->createInstance( OUString(
766 					RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.MarkableOutputStream" ) ) );
767 				Reference <XOutputStream > 	markableOutput( x , UNO_QUERY );
768 				Reference <XActiveDataSource >	markableSource( x , UNO_QUERY );
769 
770 				OSL_ASSERT( markableInput.is() 	);
771 				OSL_ASSERT( markableOutput.is() );
772 				OSL_ASSERT( markableSink.is() 	);
773 				OSL_ASSERT( markableSource.is() );
774 
775 				markableSink->setInputStream( rPipeInput );
776 				markableSource->setOutputStream( rPipeOutput );
777 
778 				if( ! rSink.is() ) {
779 					x = m_rFactory->createInstance(
780 						OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.ObjectInputStream") ));
781 					rInput = Reference < XObjectInputStream > ( x , UNO_QUERY );
782 					rSink = Reference < XActiveDataSink > ( x , UNO_QUERY );
783 				}
784 				else if ( !rSource.is() ) {
785 					x = m_rFactory->createInstance(
786 						OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.ObjectOutputStream" )));
787 					rOutput = Reference <XObjectOutputStream > ( x , UNO_QUERY );
788 					rSource = Reference <XActiveDataSource>( x, UNO_QUERY );
789 				}
790 
791 				OSL_ASSERT( rPipeInput.is() );
792 				OSL_ASSERT( rPipeOutput.is() );
793 
794 				rSink->setInputStream( markableInput );
795 				rSource->setOutputStream( markableOutput );
796 
797 				OSL_ASSERT( rSink->getInputStream().is() );
798 				OSL_ASSERT( rSource->getOutputStream().is() );
799 
800 				if( 1 + DATASTREAM_TEST_MAX_HANDLE == hTestHandle ) {
801 					testObject( rOutput , rInput);
802 				}
803 				rInput->closeInput();
804 				rOutput->closeOutput();
805 
806 			}
807 		}
808 		catch( Exception &e )  {
809 			OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
810 			BUILD_ERROR( 0 , o.getStr() );
811 		}
812 		catch( ... ) {
813 			BUILD_ERROR( 0 , "unknown exception (Exception is  not base class)" );
814 		}
815 
816 		hTestHandle ++;
817 
818 		if( hTestHandle > 1 +DATASTREAM_TEST_MAX_HANDLE ) {
819 			// all tests finished.
820 			hTestHandle = -1;
821 		}
822 	}
823 	else {
824 		BUILD_ERROR( 0 , "service not supported by test." );
825 	}
826 	return hTestHandle;
827 }
828 
829 
compareMyPropertySet(Reference<XPropertySet> & r1,Reference<XPropertySet> & r2)830 sal_Bool compareMyPropertySet( Reference< XPropertySet > &r1 , Reference < XPropertySet > &r2 )
831 {
832 	sal_Bool b = sal_True;
833 
834 	if( r1->getPropertyValue( OUString::createFromAscii("long") ).getValueType() == getCppuVoidType() ||
835 		r2->getPropertyValue( OUString::createFromAscii("long") ).getValueType() == getCppuVoidType() ) {
836 
837 		// one of the objects is not the correct propertyset !
838         fprintf( stderr, "compareMyPropertySet: 1\n" );
839 		return sal_False;
840 	}
841 
842 	b = b && ( 	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("long")) ) ==
843 				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("long")) ) );
844     if( ! b ) fprintf( stderr, "compareMyPropertySet: 2\n" );
845 
846 	b = b && ( 	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("float")) ) ==
847 				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("float")) ) );
848     if( ! b ){
849         float f1(0.0);
850         float f2(0.0);
851         r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("float")) ) >>= f1;
852         r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("float")) ) >>= f2;
853         fprintf( stderr, "compareMyPropertySet: %f %f 3\n",f1,f2 );
854     }
855 
856 	b = b && ( 	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("double")) ) ==
857 				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("double" ))) );
858     if( ! b ) fprintf( stderr, "compareMyPropertySet: 4\n" );
859 
860 	sal_Bool b1(sal_False), b2(sal_False);
861 	Any a =r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("bool")) );
862 	a >>= b1;
863 	a = r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("bool")) );
864 	a >>= b2;
865 	b = b && ( (b1 && b2) || b1 == b2 );
866     if( ! b ) fprintf( stderr, "compareMyPropertySet: 5\n" );
867 
868 //  	b = b &&	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("bool")) ) ==
869 //  				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("bool")) ) );
870 
871 	b = b && ( 	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("byte")) ) ==
872 				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("byte")) ) );
873     if( ! b ) fprintf( stderr, "compareMyPropertySet: 6\n" );
874 
875 	b = b && ( 	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("char")) ) ==
876 				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("char")) ) );
877     if( ! b ) fprintf( stderr, "compareMyPropertySet: 7\n" );
878 
879 	b = b && ( 	r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("string")) ) ==
880 				r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("string")) ));
881     if( ! b ) fprintf( stderr, "compareMyPropertySet: 8\n" );
882 
883 	Any o1 = r1->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("object")) );
884 	Any o2 = r2->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("object")) );
885 
886 	if( o1.getValueType() == getCppuType( (Reference<XPersistObject>*)0 ) ) {
887 
888 		if( o2.getValueType() == getCppuType( (Reference<XPersistObject>*)0 ) ) {
889 			Reference < XPersistObject > rPersist1;
890 			Reference < XPersistObject > rPersist2;
891 			o1 >>= rPersist1;
892 			o2 >>= rPersist2;
893 			Reference <XPropertySet > rProp1( rPersist1 , UNO_QUERY );
894 			Reference < XPropertySet > rProp2( rPersist2 , UNO_QUERY );
895 
896 			if( rProp1.is() && rProp2.is() && ! ( rProp1 == rProp2 )
897 				&&( rProp1 != r1 )) {
898 					b = b && compareMyPropertySet( rProp1 , rProp2 );
899 			}
900 		}
901 		else {
902 			b = sal_False;
903 		}
904         if( ! b ) fprintf( stderr, "compareMyPropertySet: 9\n" );
905 	}
906 	else {
907 		if( o2.getValueType()  == getCppuType( (Reference<XPersistObject>*)0 ) ) {
908 			b = sal_False;
909 		}
910         if( ! b ) fprintf( stderr, "compareMyPropertySet: 10\n" );
911 	}
912 
913 	return b;
914 }
915 
testObject(const Reference<XObjectOutputStream> & rOut,const Reference<XObjectInputStream> & rIn)916 void OObjectStreamTest::testObject( 	const Reference<  XObjectOutputStream >  &rOut,
917 										const Reference < XObjectInputStream > &rIn )
918 {
919 	ERROR_ASSERT( rOut.is() , "no objectOutputStream" );
920 	ERROR_ASSERT( rIn.is() , "no objectInputStream" );
921 
922 
923 
924 	// tests, if saving an object with an unknown service name allows
925 	// reading the data behind the object !
926 	{
927 		Reference < XInterface > x = * new MyPersistObject(
928 			OUString( RTL_CONSTASCII_USTRINGPARAM("bla blubs")) );
929 
930 		Reference< XPersistObject > persistRef( x , UNO_QUERY );
931 		ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" );
932 
933 		rOut->writeObject( persistRef );
934 		rOut->writeLong( (sal_Int32) 0xdeadbeef );
935 
936 		ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
937 
938 		try
939 		{
940 			Reference <XPersistObject >  xReadPersistRef = rIn->readObject();
941 			ERROR_ASSERT( 0 , "expected exception not thrown" );
942 		}
943 		catch( IOException & )
944 		{
945 			// all is ok
946 		}
947 
948 		ERROR_ASSERT( (sal_Int32) 0xdeadbeef == rIn->readLong() ,
949 					  "wrong data after object with unknown service name." );
950 	}
951 
952 	{
953 		Reference < XInterface > x = m_rFactory->createInstance(
954 			OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.io.PersistTest")));
955 		Reference< XPersistObject > persistRef( x , UNO_QUERY );
956 
957 		ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" );
958 
959 		Reference < XPropertySet > rProp( persistRef , UNO_QUERY );
960 		ERROR_ASSERT( rProp.is() , "test object is no property set " );
961 
962 		Any any;
963 		sal_Int32 i = 0x83482;
964 		any <<= i;
965 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("long")) , any );
966 
967 		float f = (float)42.23;
968 		any <<= f;
969 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("float")) , any );
970 
971 		double d = 233.321412;
972 		any <<= d;
973 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("double")) , any );
974 
975 		sal_Bool b = sal_True;
976 		any.setValue( &b , getCppuBooleanType() );
977 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("bool")) , any );
978 
979 		sal_Int8 by = 120;
980 		any <<= by;
981 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("byte")) , any );
982 
983 		sal_Unicode c = 'h';
984 		any.setValue( &c , getCppuCharType() );
985 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("char")) , any );
986 
987 		OUString str( RTL_CONSTASCII_USTRINGPARAM( "hi du !" ) );
988 		any <<= str;
989 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("string")) , any );
990 
991 		any <<= persistRef;
992 		rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("object")) , any );
993 
994 		// do read and write
995 		rOut->writeObject( persistRef );
996 		ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
997 		Reference< XPersistObject > xReadPersist	= 	rIn->readObject( );
998 
999 		Reference< XPropertySet >  rPropRead( xReadPersist , UNO_QUERY );
1000 		ERROR_ASSERT( compareMyPropertySet( rProp , rPropRead ) , "objects has not been read properly !" );
1001 
1002 		// destroy selfreferences
1003 		rProp->setPropertyValue( OUString::createFromAscii("object"), Any() );
1004 		rPropRead->setPropertyValue( OUString::createFromAscii("object"), Any() );
1005 	}
1006 
1007 	{
1008 		Reference< XMarkableStream > markableOut( rOut , UNO_QUERY );
1009 		ERROR_ASSERT( markableOut.is() , "markable stream cannot be queried" );
1010 
1011 		// do the same thing multiple times to check if
1012 		// buffering and marks work correctly
1013 		for( int i = 0 ; i < 2000 ; i ++ ) {
1014 
1015 			Reference < XInterface > x = m_rFactory->createInstance(OUString::createFromAscii("test.com.sun.star.io.PersistTest"));
1016 			Reference< XPersistObject >  persistRef( x , UNO_QUERY );
1017 
1018 			Reference < XPropertySet >  rProp( persistRef , UNO_QUERY );
1019 			ERROR_ASSERT( rProp.is() , "test object is no property set " );
1020 
1021 			Any any;
1022 			sal_Int32 i = 0x83482;
1023 			any <<= i;
1024 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("long")) , any );
1025 
1026 			float f = 42.23;
1027 			any <<= f;
1028 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("float")) , any );
1029 
1030 			double d = 233.321412;
1031 			any <<= d;
1032 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("double")) , any );
1033 
1034 			sal_Bool b = sal_True;
1035 			any.setValue( &b , getCppuBooleanType() );
1036 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("bool")) , any );
1037 
1038 			sal_Int8 by = 120;
1039 			any <<= by;
1040 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("byte")) , any );
1041 
1042 			sal_Unicode c = 'h';
1043 			any.setValue( &c , getCppuCharType() );
1044 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("char")) , any );
1045 
1046 			OUString str( RTL_CONSTASCII_USTRINGPARAM( "hi du !" ) );
1047 			any <<= str;
1048 			rProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("string")) , any );
1049 
1050 			x = m_rFactory->createInstance(OUString::createFromAscii("test.com.sun.star.io.PersistTest"));
1051 			Reference <XPersistObject > persist2ndRef( x , UNO_QUERY );
1052 
1053 			// Note : persist2ndRef contains coincident values, but also coincident values must be
1054 			// saved properly !
1055 			any <<= persist2ndRef;
1056 			rProp->setPropertyValue( OUString::createFromAscii("object") , any );
1057 
1058 			// simply test, if markable operations and object operations do not interfere
1059 			sal_Int32 nMark = markableOut->createMark();
1060 
1061 			// do read and write
1062 			rOut->writeObject( persistRef );
1063 
1064 			// further markable tests !
1065 			sal_Int32 nOffset = markableOut->offsetToMark( nMark );
1066 			markableOut->jumpToMark( nMark );
1067 			markableOut->deleteMark( nMark );
1068 			markableOut->jumpToFurthest();
1069 
1070 
1071 
1072 
1073 
1074 			ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
1075 			Reference < XPersistObject > xReadPersistRef	= 	rIn->readObject( );
1076 
1077 			Reference< XPropertySet > rProp1( persistRef , UNO_QUERY );
1078 			Reference< XPropertySet >  rProp2( xReadPersistRef , UNO_QUERY );
1079 			ERROR_ASSERT( compareMyPropertySet( rProp1, rProp2) ,
1080 						  "objects has not been read properly !" );
1081 		}
1082 	}
1083 }
1084 
1085 
OObjectStreamTest_CreateInstance(const Reference<XMultiServiceFactory> & rSMgr)1086 Reference < XInterface > SAL_CALL OObjectStreamTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
1087 {
1088 	OObjectStreamTest *p = new OObjectStreamTest( rSMgr );
1089 	return Reference < XInterface > ( SAL_STATIC_CAST( OWeakObject * , p ) );
1090 }
1091 
OObjectStreamTest_getSupportedServiceNames(int i)1092 Sequence<OUString> OObjectStreamTest_getSupportedServiceNames( int i) throw ()
1093 {
1094 	Sequence<OUString> aRet(1);
1095 	aRet.getArray()[0] = OObjectStreamTest_getImplementationName( i);
1096 	return aRet;
1097 }
1098 
OObjectStreamTest_getServiceName(int i)1099 OUString     OObjectStreamTest_getServiceName( int i) throw ()
1100 {
1101 	if( 1 == i ) {
1102 		return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.io.ObjectInputStream" ));
1103 	}
1104 	else {
1105 		return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.io.ObjectOutputStream"));
1106 	}
1107 }
1108 
OObjectStreamTest_getImplementationName(int i)1109 OUString 	OObjectStreamTest_getImplementationName( int i) throw ()
1110 {
1111 	if( 1 == i ) {
1112 		return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.comp.extensions.stm.ObjectInputStream" ));
1113 	}
1114 	else {
1115 		return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.comp.extensions.stm.ObjectOutputStream"));
1116 	}
1117 }
1118 
1119 
1120