summaryrefslogtreecommitdiff
path: root/extensions/test/stm/datatest.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/test/stm/datatest.cxx')
-rw-r--r--extensions/test/stm/datatest.cxx502
1 files changed, 251 insertions, 251 deletions
diff --git a/extensions/test/stm/datatest.cxx b/extensions/test/stm/datatest.cxx
index 6886f99f8b31..7fb7bde49b00 100644
--- a/extensions/test/stm/datatest.cxx
+++ b/extensions/test/stm/datatest.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -77,25 +77,25 @@ public:
ODataStreamTest( const XMultiServiceFactoryRef & rFactory ) : m_rFactory( rFactory ){}
public: // refcounting
- BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
- void acquire() { OWeakObject::acquire(); }
- void release() { OWeakObject::release(); }
- void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
public:
virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
- THROWS( ( IllegalArgumentException,
+ THROWS( ( IllegalArgumentException,
UsrSystemException) );
- virtual INT32 test( const UString& TestName,
+ virtual INT32 test( const UString& TestName,
const XInterfaceRef& TestObject,
- INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
UsrSystemException) );
- virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
- virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
- virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
- virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
private:
void testSimple( const XDataInputStreamRef & , const XDataOutputStreamRef &);
@@ -122,7 +122,7 @@ BOOL ODataStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut )
void ODataStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
- THROWS( ( IllegalArgumentException,
+ THROWS( ( IllegalArgumentException,
UsrSystemException) )
{
if( L"com.sun.star.io.DataInputStream" == TestName ) {
@@ -144,10 +144,10 @@ void ODataStreamTest::testInvariant( const UString& TestName, const XInterfaceRe
XOutputStreamRef output( TestObject , USR_QUERY );
XDataOutputStreamRef dataOutput( TestObject , USR_QUERY );
- WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" );
- WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" );
- ERROR_ASSERT( output.is() , "XInputStream cannot be queried" );
- ERROR_ASSERT( dataOutput.is(), "XDataInputStream cannot be queried" );
+ WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" );
+ WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" );
+ ERROR_ASSERT( output.is() , "XInputStream cannot be queried" );
+ ERROR_ASSERT( dataOutput.is(), "XDataInputStream cannot be queried" );
}
@@ -162,14 +162,14 @@ void ODataStreamTest::testInvariant( const UString& TestName, const XInterfaceRe
}
-INT32 ODataStreamTest::test( const UString& TestName,
+INT32 ODataStreamTest::test( const UString& TestName,
const XInterfaceRef& TestObject,
- INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
UsrSystemException) )
{
- if( L"com.sun.star.io.DataInputStream" == TestName ||
+ if( L"com.sun.star.io.DataInputStream" == TestName ||
L"com.sun.star.io.DataOutputStream" == TestName ) {
-
+
try {
if( 0 == hTestHandle ) {
testInvariant( TestName , TestObject );
@@ -181,13 +181,13 @@ INT32 ODataStreamTest::test( const UString& TestName,
XDataInputStreamRef rInput( TestObject , USR_QUERY );
XDataOutputStreamRef rOutput( TestObject , USR_QUERY );
-
+
XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe");
XInputStreamRef rPipeInput( x , USR_QUERY );
XOutputStreamRef rPipeOutput( x , USR_QUERY );
-
- if( ! rSink.is() ) {
+
+ if( ! rSink.is() ) {
x = m_rFactory->createInstance( L"com.sun.star.io.DataInputStream" );
x->queryInterface( XDataInputStream::getSmartUik() , rInput );
x->queryInterface( XActiveDataSink::getSmartUik() , rSink );
@@ -209,7 +209,7 @@ INT32 ODataStreamTest::test( const UString& TestName,
if( 1 == hTestHandle ) {
testSimple( rInput , rOutput );
- }
+ }
}
}
catch( Exception& e ) {
@@ -218,9 +218,9 @@ INT32 ODataStreamTest::test( const UString& TestName,
catch(...) {
BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
}
-
+
hTestHandle ++;
-
+
if( hTestHandle >= 2) {
// all tests finished.
hTestHandle = -1;
@@ -230,34 +230,34 @@ INT32 ODataStreamTest::test( const UString& TestName,
BUILD_ERROR( 0 , "service not supported by test." );
}
return hTestHandle;
-}
+}
-BOOL ODataStreamTest::testPassed(void) THROWS( (UsrSystemException) )
+BOOL ODataStreamTest::testPassed(void) THROWS( (UsrSystemException) )
{
- return m_seqErrors.getLen() == 0;
+ return m_seqErrors.getLen() == 0;
}
-Sequence< UString > ODataStreamTest::getErrors(void) THROWS( (UsrSystemException) )
+Sequence< UString > ODataStreamTest::getErrors(void) THROWS( (UsrSystemException) )
{
return m_seqErrors;
}
-Sequence< UsrAny > ODataStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+Sequence< UsrAny > ODataStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
{
return m_seqExceptions;
}
-Sequence< UString > ODataStreamTest::getWarnings(void) THROWS( (UsrSystemException) )
+Sequence< UString > ODataStreamTest::getWarnings(void) THROWS( (UsrSystemException) )
{
return m_seqWarnings;
}
-void ODataStreamTest::testSimple( const XDataInputStreamRef &rInput,
+void ODataStreamTest::testSimple( const XDataInputStreamRef &rInput,
const XDataOutputStreamRef &rOutput )
{
rOutput->writeLong( 0x34ff3c );
@@ -265,89 +265,89 @@ void ODataStreamTest::testSimple( const XDataInputStreamRef &rInput,
ERROR_ASSERT( 0x34ff3c == rInput->readLong() , "long read/write mismatch" );
ERROR_ASSERT( 0x34ff3d == rInput->readLong() , "long read/write mismatch" );
-
+
rOutput->writeByte( 0x87 );
ERROR_ASSERT( 0x87 == rInput->readByte() , "byte read/write mismatch" );
-
+
rOutput->writeBoolean( 25 );
ERROR_ASSERT( rInput->readBoolean() , "boolean read/write mismatch" );
-
+
rOutput->writeBoolean( FALSE );
ERROR_ASSERT( ! rInput->readBoolean() , "boolean read/write mismatch" );
-
+
rOutput->writeFloat( (float) 42.42 );
ERROR_ASSERT( rInput->readFloat() == ((float)42.42) , "float read/write mismatch" );
-
+
rOutput->writeDouble( (double) 42.42 );
ERROR_ASSERT( rInput->readDouble() == 42.42 , "double read/write mismatch" );
-
+
rOutput->writeUTF( L"Live long and prosper !" );
ERROR_ASSERT( rInput->readUTF() == L"Live long and prosper !" ,
"UTF read/write mismatch" );
-
+
Sequence<wchar_t> wc(0x10001);
for( int i = 0 ; i < 0x10000 ; i ++ ) {
- wc.getArray()[i] = L'c';
+ wc.getArray()[i] = L'c';
}
wc.getArray()[0x10000] = 0;
UString str( wc.getArray() , 0x10000 );
rOutput->writeUTF( str );
ERROR_ASSERT( rInput->readUTF() == str , "error reading 64k block" );
-
+
rOutput->closeOutput();
try {
rInput->readLong();
- ERROR_ASSERT( 0 , "eof-exception does not occur !" );
+ ERROR_ASSERT( 0 , "eof-exception does not occur !" );
}
catch ( IOException& e ){
- //ok
+ //ok
e.getName();
}
- catch(...) {
+ catch(...) {
ERROR_ASSERT( 0 , "wrong exception after reading beyond eof" );
}
-
- ERROR_ASSERT( ! rInput->readBytes( Sequence<BYTE> (1) , 1 ),
+
+ ERROR_ASSERT( ! rInput->readBytes( Sequence<BYTE> (1) , 1 ),
"stream must be on eof !" );
-
+
rInput->closeInput();
-
+
try {
rOutput->writeByte( 1 );
ERROR_ASSERT( 0 , "writing still possible though chain must be interrupted" );
}
- catch( IOException& e )
+ catch( IOException& e )
{
e.getName();
- // ok
+ // ok
}
catch( ... ) {
- ERROR_ASSERT( 0 , "IOException expected, but another exception was thrown" );
+ ERROR_ASSERT( 0 , "IOException expected, but another exception was thrown" );
}
-
+
}
-/**
+/**
* for external binding
*
*
**/
XInterfaceRef ODataStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
-{
+{
ODataStreamTest *p = new ODataStreamTest( rSMgr );
- XInterfaceRef xService = *p;
+ XInterfaceRef xService = *p;
return xService;
}
Sequence<UString> ODataStreamTest_getSupportedServiceNames( int i) THROWS( () )
{
Sequence<UString> aRet(1);
-
+
aRet.getArray()[0] = ODataStreamTest_getImplementationName( i);
-
-
+
+
return aRet;
}
@@ -355,19 +355,19 @@ UString ODataStreamTest_getServiceName( int i) THROWS( () )
{
if( 1 == i ) {
return L"test.com.sun.star.io.DataInputStream";
- }
+ }
else {
- return L"test.com.sun.star.io.DataOutputStream";
+ return L"test.com.sun.star.io.DataOutputStream";
}
}
-UString ODataStreamTest_getImplementationName( int i) THROWS( () )
+UString ODataStreamTest_getImplementationName( int i) THROWS( () )
{
if( 1 == i ) {
return L"test.com.sun.star.comp.extensions.stm.DataInputStream";
}
else {
- return L"test.com.sun.star.comp.extensions.stm.DataOutputStream";
+ return L"test.com.sun.star.comp.extensions.stm.DataOutputStream";
}
}
@@ -379,7 +379,7 @@ UString ODataStreamTest_getImplementationName( int i) THROWS( () )
*
*
*------------------------------------------------------*/
-class MyPersistObject :
+class MyPersistObject :
public XPersistObject,
public XPropertySet,
public OWeakObject
@@ -391,12 +391,12 @@ public:
{}
~MyPersistObject()
{}
-
+
public:
- BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
- void acquire() { OWeakObject::acquire(); }
- void release() { OWeakObject::release(); }
- void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
public:
virtual UString getServiceName(void) const THROWS( (UsrSystemException) );
@@ -405,72 +405,72 @@ public:
public:
- virtual XPropertySetInfoRef getPropertySetInfo(void) const THROWS( (UsrSystemException) );
- virtual void setPropertyValue(const UString& aPropertyName, const UsrAny& aValue)
- THROWS( ( UnknownPropertyException,
- PropertyVetoException,
+ virtual XPropertySetInfoRef getPropertySetInfo(void) const THROWS( (UsrSystemException) );
+ virtual void setPropertyValue(const UString& aPropertyName, const UsrAny& aValue)
+ THROWS( ( UnknownPropertyException,
+ PropertyVetoException,
IllegalArgumentException,
- WrappedTargetException,
+ WrappedTargetException,
UsrSystemException) );
- virtual UsrAny getPropertyValue(const UString& PropertyName) const
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+ virtual UsrAny getPropertyValue(const UString& PropertyName) const
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) );
- virtual void addPropertyChangeListener( const UString& aPropertyName,
- const XPropertyChangeListenerRef& xListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+ virtual void addPropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& xListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) );
- virtual void removePropertyChangeListener( const UString& aPropertyName,
- const XPropertyChangeListenerRef& aListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+ virtual void removePropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) );
- virtual void addVetoableChangeListener( const UString& PropertyName,
- const XVetoableChangeListenerRef& aListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+ virtual void addVetoableChangeListener( const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) );
- virtual void removeVetoableChangeListener( const UString& PropertyName,
- const XVetoableChangeListenerRef& aListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+ virtual void removeVetoableChangeListener( const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) );
public:
- INT32 m_l;
- float m_f;
- double m_d;
- BOOL m_b;
- BYTE m_byte;
- wchar_t m_c;
- UString m_s;
- XPersistObjectRef m_ref;
+ INT32 m_l;
+ float m_f;
+ double m_d;
+ BOOL m_b;
+ BYTE m_byte;
+ wchar_t m_c;
+ UString m_s;
+ XPersistObjectRef m_ref;
UString m_sServiceName;
};
-XPropertySetInfoRef MyPersistObject::getPropertySetInfo(void) const THROWS( (UsrSystemException) )
+XPropertySetInfoRef MyPersistObject::getPropertySetInfo(void) const THROWS( (UsrSystemException) )
{
- return XPropertySetInfoRef();
+ return XPropertySetInfoRef();
}
-void MyPersistObject::setPropertyValue(const UString& aPropertyName, const UsrAny& aValue)
- THROWS( ( UnknownPropertyException,
- PropertyVetoException,
+void MyPersistObject::setPropertyValue(const UString& aPropertyName, const UsrAny& aValue)
+ THROWS( ( UnknownPropertyException,
+ PropertyVetoException,
IllegalArgumentException,
- WrappedTargetException,
+ WrappedTargetException,
UsrSystemException) )
{
if( L"long" == aPropertyName ) {
- m_l = aValue.getINT32();
+ m_l = aValue.getINT32();
}
else if ( L"float" == aPropertyName ) {
- m_f = aValue.getFloat();
+ m_f = aValue.getFloat();
}
else if( L"double" == aPropertyName ) {
- m_d = aValue.getDouble();
+ m_d = aValue.getDouble();
}
else if( L"bool" == aPropertyName ) {
m_b = aValue.getBOOL();
@@ -479,14 +479,14 @@ void MyPersistObject::setPropertyValue(const UString& aPropertyName, const UsrAn
m_byte = aValue.getBYTE();
}
else if( L"char" == aPropertyName ) {
- m_c = aValue.getChar();
+ m_c = aValue.getChar();
}
else if( L"string" == aPropertyName ) {
- m_s = aValue.getString();
+ m_s = aValue.getString();
}
else if( L"object" == aPropertyName ) {
if( aValue.getReflection() == XPersistObject_getReflection() ) {
- XPersistObjectRef *pRef = (XPersistObjectRef*) aValue.get();
+ XPersistObjectRef *pRef = (XPersistObjectRef*) aValue.get();
if( pRef ) {
m_ref = *pRef;
}
@@ -502,20 +502,20 @@ void MyPersistObject::setPropertyValue(const UString& aPropertyName, const UsrAn
}
-UsrAny MyPersistObject::getPropertyValue(const UString& aPropertyName) const
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+UsrAny MyPersistObject::getPropertyValue(const UString& aPropertyName) const
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) )
{
UsrAny aValue;
if( L"long" == aPropertyName ) {
- aValue.setINT32( m_l );
+ aValue.setINT32( m_l );
}
else if ( L"float" == aPropertyName ) {
- aValue.setFloat( m_f );
+ aValue.setFloat( m_f );
}
else if( L"double" == aPropertyName ) {
- aValue.setDouble( m_d );
+ aValue.setDouble( m_d );
}
else if( L"bool" == aPropertyName ) {
aValue.setBOOL( m_b );
@@ -524,10 +524,10 @@ UsrAny MyPersistObject::getPropertyValue(const UString& aPropertyName) const
aValue.setBYTE( m_byte );
}
else if( L"char" == aPropertyName ) {
- aValue.setChar( m_c );
+ aValue.setChar( m_c );
}
else if( L"string" == aPropertyName ) {
- aValue.setString( m_s );
+ aValue.setString( m_s );
}
else if( L"object" == aPropertyName ) {
aValue.set( &m_ref , XPersistObject_getReflection() );
@@ -536,53 +536,53 @@ UsrAny MyPersistObject::getPropertyValue(const UString& aPropertyName) const
}
-void MyPersistObject::addPropertyChangeListener( const UString& aPropertyName,
- const XPropertyChangeListenerRef& xListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+void MyPersistObject::addPropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& xListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) )
{
-
+
}
-void MyPersistObject::removePropertyChangeListener( const UString& aPropertyName,
- const XPropertyChangeListenerRef& aListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+void MyPersistObject::removePropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) )
{
}
-void MyPersistObject::addVetoableChangeListener(const UString& PropertyName,
- const XVetoableChangeListenerRef& aListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+void MyPersistObject::addVetoableChangeListener(const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) )
{
-
+
}
-void MyPersistObject::removeVetoableChangeListener( const UString& PropertyName,
- const XVetoableChangeListenerRef& aListener)
- THROWS( ( UnknownPropertyException,
- WrappedTargetException,
+void MyPersistObject::removeVetoableChangeListener( const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
UsrSystemException) )
{
-
+
}
-
+
BOOL MyPersistObject::queryInterface( Uik aUik , XInterfaceRef &rOut )
{
if( XPersistObject::getSmartUik() == aUik ) {
- rOut = ( XPersistObject * ) this;
+ rOut = ( XPersistObject * ) this;
}
else if( XPropertySet::getSmartUik() == aUik ) {
- rOut = ( XPropertySet * ) this;
+ rOut = ( XPropertySet * ) this;
}
else
return OWeakObject::queryInterface( aUik , rOut );
-
+
return TRUE;
}
@@ -591,7 +591,7 @@ UString MyPersistObject::getServiceName() const THROWS( (UsrSystemException) )
return m_sServiceName;
}
-void MyPersistObject::write( const XObjectOutputStreamRef & rOut )
+void MyPersistObject::write( const XObjectOutputStreamRef & rOut )
THROWS( (IOException,UsrSystemException))
{
rOut->writeLong( m_l);
@@ -605,7 +605,7 @@ void MyPersistObject::write( const XObjectOutputStreamRef & rOut )
}
-void MyPersistObject::read( const XObjectInputStreamRef & rIn )
+void MyPersistObject::read( const XObjectInputStreamRef & rIn )
THROWS( (IOException, UsrSystemException) )
{
m_l = rIn->readLong();
@@ -618,11 +618,11 @@ void MyPersistObject::read( const XObjectInputStreamRef & rIn )
m_ref = rIn->readObject();
}
-XInterfaceRef OMyPersistObject_CreateInstance( const XMultiServiceFactoryRef & rSMgr )
+XInterfaceRef OMyPersistObject_CreateInstance( const XMultiServiceFactoryRef & rSMgr )
THROWS((Exception))
-{
+{
MyPersistObject *p = new MyPersistObject( );
- XInterfaceRef xService = *p;
+ XInterfaceRef xService = *p;
return xService;
}
@@ -638,7 +638,7 @@ UString OMyPersistObject_getServiceName( ) THROWS( () )
return L"test.com.sun.star.io.PersistTest";
}
-UString OMyPersistObject_getImplementationName( ) THROWS( () )
+UString OMyPersistObject_getImplementationName( ) THROWS( () )
{
return L"test.com.sun.star.io.PersistTest";
}
@@ -651,22 +651,22 @@ class OObjectStreamTest :
{
public:
OObjectStreamTest( const XMultiServiceFactoryRef &r) : ODataStreamTest(r) {}
-public: // refcounting
- BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
-public:
- virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
- THROWS( ( IllegalArgumentException,
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
UsrSystemException) );
- virtual INT32 test( const UString& TestName,
- const XInterfaceRef& TestObject,
- INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
UsrSystemException) );
private:
- void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
+ void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
const XObjectInputStreamRef &rIn );
private:
@@ -679,23 +679,23 @@ BOOL OObjectStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut )
{
if( XSimpleTest::getSmartUik() == uik ) {
rOut = (XSimpleTest *) this;
- }
+ }
else {
return ODataStreamTest::queryInterface( uik , rOut );
- }
+ }
return TRUE;
}
-void OObjectStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
- THROWS( ( IllegalArgumentException,
+void OObjectStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
UsrSystemException) )
{
-
+
if( L"com.sun.star.io.ObjectInputStream" == TestName ) {
ODataStreamTest::testInvariant( TestName , TestObject );
- XObjectInputStreamRef dataInput( TestObject , USR_QUERY );
+ XObjectInputStreamRef dataInput( TestObject , USR_QUERY );
XMarkableStreamRef markable( TestObject , USR_QUERY );
ERROR_ASSERT( dataInput.is() , "XObjectInputStream cannot be queried" );
ERROR_ASSERT( markable.is() , "XMarkableStream cannot be queried" );
@@ -704,7 +704,7 @@ void OObjectStreamTest::testInvariant( const UString& TestName, const XInterface
ODataStreamTest::testInvariant( TestName , TestObject );
XMarkableStreamRef markable( TestObject , USR_QUERY );
XObjectOutputStreamRef dataOutput( TestObject , USR_QUERY );
- ERROR_ASSERT( dataOutput.is(), "XObjectOutputStream cannot be queried" );
+ ERROR_ASSERT( dataOutput.is(), "XObjectOutputStream cannot be queried" );
ERROR_ASSERT( markable.is() , "XMarkableStream cannot be queried" );
}
@@ -718,57 +718,57 @@ void OObjectStreamTest::testInvariant( const UString& TestName, const XInterface
}
-INT32 OObjectStreamTest::test( const UString& TestName,
- const XInterfaceRef& TestObject,
- INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+INT32 OObjectStreamTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
UsrSystemException) )
{
- if( L"com.sun.star.io.ObjectInputStream" == TestName ||
+ if( L"com.sun.star.io.ObjectInputStream" == TestName ||
L"com.sun.star.io.ObjectOutputStream" == TestName ) {
-
+
try {
if( 0 == hTestHandle ) {
testInvariant( TestName , TestObject );
}
else if( DATASTREAM_TEST_MAX_HANDLE >= hTestHandle ) {
INT32 hOldHandle = hTestHandle;
- hTestHandle = ODataStreamTest::test( L"com.sun.star.io.DataInputStream" ,
+ hTestHandle = ODataStreamTest::test( L"com.sun.star.io.DataInputStream" ,
TestObject , hTestHandle );
if( hTestHandle == -1 ){
hTestHandle = hOldHandle;
}
}
else {
-
+
XActiveDataSinkRef rSink( TestObject, USR_QUERY );
XActiveDataSourceRef rSource( TestObject , USR_QUERY );
XObjectInputStreamRef rInput( TestObject , USR_QUERY );
XObjectOutputStreamRef rOutput( TestObject , USR_QUERY );
-
+
XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe");
XInputStreamRef rPipeInput( x , USR_QUERY );
XOutputStreamRef rPipeOutput( x , USR_QUERY );
-
+
x = m_rFactory->createInstance( L"com.sun.star.io.MarkableInputStream" );
- XInputStreamRef markableInput( x , USR_QUERY );
+ XInputStreamRef markableInput( x , USR_QUERY );
XActiveDataSinkRef markableSink( x , USR_QUERY );
-
+
x = m_rFactory->createInstance( L"com.sun.star.io.MarkableOutputStream" );
- XOutputStreamRef markableOutput( x , USR_QUERY );
- XActiveDataSourceRef markableSource( x , USR_QUERY );
-
- OSL_ASSERT( markableInput.is() );
+ XOutputStreamRef markableOutput( x , USR_QUERY );
+ XActiveDataSourceRef markableSource( x , USR_QUERY );
+
+ OSL_ASSERT( markableInput.is() );
OSL_ASSERT( markableOutput.is() );
- OSL_ASSERT( markableSink.is() );
+ OSL_ASSERT( markableSink.is() );
OSL_ASSERT( markableSource.is() );
markableSink->setInputStream( rPipeInput );
markableSource->setOutputStream( rPipeOutput );
- if( ! rSink.is() ) {
+ if( ! rSink.is() ) {
x = m_rFactory->createInstance( L"com.sun.star.io.ObjectInputStream" );
x->queryInterface( XObjectInputStream::getSmartUik() , rInput );
x->queryInterface( XActiveDataSink::getSmartUik() , rSink );
@@ -781,7 +781,7 @@ INT32 OObjectStreamTest::test( const UString& TestName,
OSL_ASSERT( rPipeInput.is() );
OSL_ASSERT( rPipeOutput.is() );
-
+
rSink->setInputStream( markableInput );
rSource->setOutputStream( markableOutput );
@@ -793,7 +793,7 @@ INT32 OObjectStreamTest::test( const UString& TestName,
}
rInput->closeInput();
rOutput->closeOutput();
-
+
}
}
catch( Exception& e ) {
@@ -802,9 +802,9 @@ INT32 OObjectStreamTest::test( const UString& TestName,
catch(...) {
BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
}
-
+
hTestHandle ++;
-
+
if( hTestHandle > 1 +DATASTREAM_TEST_MAX_HANDLE ) {
// all tests finished.
hTestHandle = -1;
@@ -814,7 +814,7 @@ INT32 OObjectStreamTest::test( const UString& TestName,
BUILD_ERROR( 0 , "service not supported by test." );
}
return hTestHandle;
-}
+}
BOOL compareMyPropertySet( XPropertySetRef &r1 , XPropertySetRef &r2 )
@@ -823,35 +823,35 @@ BOOL compareMyPropertySet( XPropertySetRef &r1 , XPropertySetRef &r2 )
if( r1->getPropertyValue( L"long" ).getReflection() == Void_getReflection() ||
r2->getPropertyValue( L"long" ).getReflection() == Void_getReflection() ) {
-
+
// one of the objects is not the correct propertyset !
return FALSE;
}
-
- b = b && ( r1->getPropertyValue( L"long" ).getINT32() ==
+
+ b = b && ( r1->getPropertyValue( L"long" ).getINT32() ==
r2->getPropertyValue( L"long" ).getINT32() );
- b = b && ( r1->getPropertyValue( L"float" ).getFloat() ==
+ b = b && ( r1->getPropertyValue( L"float" ).getFloat() ==
r2->getPropertyValue( L"float" ).getFloat() );
-
- b = b && ( r1->getPropertyValue( L"double" ).getDouble() ==
+
+ b = b && ( r1->getPropertyValue( L"double" ).getDouble() ==
r2->getPropertyValue( L"double" ).getDouble() );
- b = b && ( r1->getPropertyValue( L"bool" ).getBOOL() ==
+ b = b && ( r1->getPropertyValue( L"bool" ).getBOOL() ==
r2->getPropertyValue( L"bool" ).getBOOL() );
-
- b = b && ( r1->getPropertyValue( L"byte" ).getBYTE() ==
+
+ b = b && ( r1->getPropertyValue( L"byte" ).getBYTE() ==
r2->getPropertyValue( L"byte" ).getBYTE() );
-
- b = b && ( r1->getPropertyValue( L"char" ).getChar() ==
+
+ b = b && ( r1->getPropertyValue( L"char" ).getChar() ==
r2->getPropertyValue( L"char" ).getChar() );
- b = b && ( r1->getPropertyValue( L"string" ).getString() ==
+ b = b && ( r1->getPropertyValue( L"string" ).getString() ==
r2->getPropertyValue( L"string" ).getString() );
UsrAny o1 = r1->getPropertyValue( L"object" );
UsrAny o2 = r2->getPropertyValue( L"object" );
-
+
if( o1.getReflection() == XPersistObject_getReflection() ) {
if( o2.getReflection() == XPersistObject_getReflection() ) {
@@ -859,34 +859,34 @@ BOOL compareMyPropertySet( XPropertySetRef &r1 , XPropertySetRef &r2 )
XPersistObjectRef rPersist2 = *((XPersistObjectRef*) o2.get());
XPropertySetRef rProp1( rPersist1 , USR_QUERY );
XPropertySetRef rProp2( rPersist2 , USR_QUERY );
-
- if( rProp1.is() && rProp2.is() && ! ( rProp1 == rProp2 )
+
+ if( rProp1.is() && rProp2.is() && ! ( rProp1 == rProp2 )
&&( rProp1 != r1 )) {
compareMyPropertySet( rProp1 , rProp2 );
- }
+ }
}
else {
- b = FALSE;
+ b = FALSE;
}
}
else {
if( o2.getReflection() == XPersistObject_getReflection() ) {
- b = FALSE;
+ b = FALSE;
}
}
return b;
}
-void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
+void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
const XObjectInputStreamRef &rIn )
{
ERROR_ASSERT( rOut.is() , "no objectOutputStream" );
ERROR_ASSERT( rIn.is() , "no objectInputStream" );
-
+
XMultiServiceFactoryRef xProv = getProcessServiceManager();
ERROR_ASSERT( xProv.is() , "no global service manager" );
-
+
// tests, if saving an object with an unknown service name allows
// reading the data behind the object !
@@ -920,40 +920,40 @@ void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
XPersistObjectRef persistRef( x , USR_QUERY );
ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" );
-
+
XPropertySetRef rProp( persistRef , USR_QUERY );
ERROR_ASSERT( rProp.is() , "test object is no property set " );
-
+
UsrAny any;
any.setINT32( 0x83482 );
rProp->setPropertyValue( L"long" , any );
-
+
any.setFloat( 42.23 );
rProp->setPropertyValue( L"float" , any );
- any.setDouble( 233.321412 );
+ any.setDouble( 233.321412 );
rProp->setPropertyValue( L"double" , any );
-
+
any.setBOOL( TRUE );
rProp->setPropertyValue( L"bool" , any );
any.setBYTE( 130 );
rProp->setPropertyValue( L"byte" , any );
-
+
any.setChar( 'h' );
rProp->setPropertyValue( L"char" , any );
-
+
any.setString( L"hi du !" );
rProp->setPropertyValue( L"string" , any );
-
+
any.set( &persistRef, XPersistObject_getReflection() ); // try a self reference
rProp->setPropertyValue( L"object" , any );
-
- // do read and write
- rOut->writeObject( persistRef );
+
+ // do read and write
+ rOut->writeObject( persistRef );
ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
- XPersistObjectRef xReadPersistRef = rIn->readObject( );
-
+ XPersistObjectRef xReadPersistRef = rIn->readObject( );
+
XPropertySetRef rPropRead( xReadPersistRef , USR_QUERY );
ERROR_ASSERT( compareMyPropertySet( rProp , rPropRead ) , "objects has not been read properly !" );
@@ -965,68 +965,68 @@ void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
{
XMarkableStreamRef markableOut( rOut , USR_QUERY );
ERROR_ASSERT( markableOut.is() , "markable stream cannot be queried" );
-
+
// do the same thing multiple times to check if
// buffering and marks work correctly
for( int i = 0 ; i < 2000 ; i ++ ) {
XInterfaceRef x = xProv->createInstance(L"test.com.sun.star.io.PersistTest");
XPersistObjectRef persistRef( x , USR_QUERY );
-
+
XPropertySetRef rProp( persistRef , USR_QUERY );
ERROR_ASSERT( rProp.is() , "test object is no property set " );
-
+
UsrAny any;
any.setINT32( 0x83482 );
rProp->setPropertyValue( L"long" , any );
-
+
any.setFloat( 42.23 );
rProp->setPropertyValue( L"float" , any );
-
- any.setDouble( 233.321412 );
+
+ any.setDouble( 233.321412 );
rProp->setPropertyValue( L"double" , any );
-
+
any.setBOOL( TRUE );
rProp->setPropertyValue( L"bool" , any );
-
+
any.setBYTE( 130 );
rProp->setPropertyValue( L"byte" , any );
-
+
any.setChar( 'h' );
rProp->setPropertyValue( L"char" , any );
-
+
any.setString( L"hi du !" );
rProp->setPropertyValue( L"string" , any );
-
-
+
+
x = xProv->createInstance(L"test.com.sun.star.io.PersistTest");
XPersistObjectRef persist2ndRef( x , USR_QUERY );
-
-
+
+
// Note : persist2ndRef contains coincident values, but also coincident values must be
- // saved properly !
+ // saved properly !
any.set( &persist2ndRef, XPersistObject_getReflection() ); // try a self reference
rProp->setPropertyValue( L"object" , any );
-
+
// simply test, if markable operations and object operations do not interfere
INT32 nMark = markableOut->createMark();
- // do read and write
- rOut->writeObject( persistRef );
-
+ // do read and write
+ rOut->writeObject( persistRef );
+
// further markable tests !
INT32 nOffset = markableOut->offsetToMark( nMark );
markableOut->jumpToMark( nMark );
markableOut->deleteMark( nMark );
markableOut->jumpToFurthest();
-
+
ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
- XPersistObjectRef xReadPersistRef = rIn->readObject( );
-
+ XPersistObjectRef xReadPersistRef = rIn->readObject( );
+
XPropertySetRef rProp1( persistRef , USR_QUERY );
XPropertySetRef rProp2( xReadPersistRef , USR_QUERY );
ERROR_ASSERT( compareMyPropertySet( rProp1, rProp2) , "objects has not been read properly !" );
@@ -1036,9 +1036,9 @@ void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
XInterfaceRef OObjectStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
-{
+{
OObjectStreamTest *p = new OObjectStreamTest( rSMgr );
- XInterfaceRef xService = *p;
+ XInterfaceRef xService = *p;
return xService;
}
@@ -1053,19 +1053,19 @@ UString OObjectStreamTest_getServiceName( int i) THROWS( () )
{
if( 1 == i ) {
return L"test.com.sun.star.io.ObjectInputStream";
- }
+ }
else {
- return L"test.com.sun.star.io.ObjectOutputStream";
+ return L"test.com.sun.star.io.ObjectOutputStream";
}
}
-UString OObjectStreamTest_getImplementationName( int i) THROWS( () )
+UString OObjectStreamTest_getImplementationName( int i) THROWS( () )
{
if( 1 == i ) {
return L"test.com.sun.star.comp.extensions.stm.ObjectInputStream";
}
else {
- return L"test.com.sun.star.comp.extensions.stm.ObjectOutputStream";
+ return L"test.com.sun.star.comp.extensions.stm.ObjectOutputStream";
}
}