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