Hi Mikhail,

Thanks for your help in our last IRC meeting, the exception is eliminated, now I got another com.sun.star.io.NotConnectedException in line 96, Test.java, when the statement below is executed:
xTempStream[i].getOutputStream ().writeBytes (pBytesOut[i]);

I debugged the test and found the sub-streams had always been zero-lengthed in the entire test, I could not find out why I got this result, could you please give me some help on this?

Thanks and Best Regards,
Felix.


Zhang Xiaofei 写道:
Hi Mikhail,

The attachment is the unit test for OLESimpleStorage, right now I have a problem running it: a java.lang.ClassCastException in Test01.java, line 89, could you please help me on this? Thanks!

Best Regards,
Felix.

Mikhail Voitenko 写道:
Hi Felix,

Sorry, something seems to go wrong with the mail system. I did not get this mail although I was in CC. Good that it was also sent to dev@framework.openoffice.org

There seems to be no attachments to review, but we have discussed the problems already. So since you have adjusted the tests and they are executed as expected, it is ok to attach them to the related issue I think. I will integrate them along with the changes for TempFile service after the vacation.

The only documentation for the OleSimpleStorage service is the idl-specification written by you :) If you would like to see an example of service usage, please take a look to the embeddedobj project, the service is used in the following files: embeddedobj/source/msole/olepersist.cxx
embeddedobj/source/msole/ownview.cxx

Best Regards,
Mikhail.

Zhang Xiaofei wrote:
Hi Mikhail,

Sorry for the delay, I was tracking a bug all day long yesterday and did not sent out the TempFile tests. I guess this version is functionally OK now. Please check the attachment to review them.

And now that I am to write the test for OleSimpleStorage, could you recommend to me some references on it please? Any example tests or documents on the service/interface could be helpful to me.

Again, thanks very much for your help during the task. :-)

Best Regards,
Felix.


Mikhail Voitenko 写道:
Hi Felix,

Sorry for the delay with the answer.
I think that it will be enough to introduce only one test for OleSimpleStorage based on the scenario that I have already mentioned. Further tests will need additional .doc test files integrated in the test, that is relative complex. So if you want to introduce them, let do it after my vacation, so that I can answer the questions.

Please prepare the test for OleSimpleStorage so we can integrate it together with the service reimplementation. The test suite can be extended in future.

By the way, how is it going with the TempFile tests? You was going to send me the final version. If there are any questions please do not hesitate to ask, so that I can answer before the Friday ( my vacation starts on Friday ).

Thanks,
Mikhail.



------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
package complex.olesimplestorage;

/*
import com.sun.star.io.BufferSizeExceededException;
import com.sun.star.io.IOException;
import com.sun.star.io.NotConnectedException;
 */
import complexlib.ComplexTestCase;

import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.io.XInputStream;
import com.sun.star.io.XOutputStream;
import com.sun.star.io.XTempFile;
import com.sun.star.embed.*;
import com.sun.star.uno.UnoRuntime;
import java.util.Random;

import share.LogWriter;

public class Test01 implements OLESimpleStorageTest
{
    LogWriter m_aLogWriter;
    XMultiServiceFactory m_xMSF = null;
    TestHelper m_aTestHelper = null;
    
    public Test01 ( XMultiServiceFactory xMSF, LogWriter aLogWriter )
    {
        m_xMSF = xMSF;
        m_aTestHelper = new TestHelper (aLogWriter, "Test01: ");
    }
    
    public boolean test ()
    {
        try
        {
            //create a new temporary stream
            Object oTempFile = m_xMSF.createInstance ( "com.sun.star.io.TempFile" );
            XTempFile xTempFile = (XTempFile) UnoRuntime.queryInterface ( XTempFile.class, oTempFile );
            
            //create OLESimpleStorage based on it
            Object pArgs[] = new Object[2];
            pArgs[0] = (Object) xTempFile;
            pArgs[1] = new Boolean( true );
            Object oOLESimpleStorage = m_xMSF.createInstanceWithArguments ( "com.sun.star.embed.OLESimpleStorage", pArgs );
            XOLESimpleStorage xOLESimpleStorage = (XOLESimpleStorage) UnoRuntime.queryInterface ( XOLESimpleStorage.class, oOLESimpleStorage );
            
            //fill it with some streams
            final int pStreamCnt = 5;
            final int pBytesCnt = 10;
            Object oStream[] = new Object[pStreamCnt];
            byte pBytesIn[][][] = new byte [pStreamCnt][1][pBytesCnt];
            byte pBytesOut[][] = new byte [pStreamCnt][pBytesCnt];
            XTempFile xTempStream[] = new XTempFile[pStreamCnt];
            Random oRandom = new Random ();
            final String sSubStreamPrefix = "SubStream";
            for ( int i = 0; i < pStreamCnt; i++ )
            {
                oRandom.nextBytes (pBytesIn[i][0]);
                oStream[i] = m_xMSF.createInstance ( "com.sun.star.io.TempFile" );
                xTempStream[i] = (XTempFile) UnoRuntime.queryInterface ( XTempFile.class, oStream[i] );
                xTempStream[i].seek (0);
                xTempStream[i].getInputStream ().readBytes (pBytesIn[i], pBytesIn[i][0].length+1);
                 if (xOLESimpleStorage.hasByName (sSubStreamPrefix + i))
                {
                    xOLESimpleStorage.replaceByName ( sSubStreamPrefix + i, xTempStream[i] );
                }
                else
                {
                    xOLESimpleStorage.insertByName ( sSubStreamPrefix + i, xTempStream[i] );
                }
            }
            
            //commit the storage and close it
            xOLESimpleStorage.commit ();
            xOLESimpleStorage.dispose ();
            for ( int i = 0; i < pStreamCnt; ++i )
            {
                xTempStream[i].setRemoveFile ( true );
                xTempStream[i].getInputStream ().closeInput ();
                xTempStream[i].getOutputStream ().closeOutput ();
            }
            
            //open the same stream with the constructor for inputstream
            pArgs[0] = (Object)xTempFile.getInputStream ();
            oOLESimpleStorage = m_xMSF.createInstanceWithArguments ( "com.sun.star.embed.OLESimpleStorage", pArgs );
            xOLESimpleStorage = (XOLESimpleStorage)UnoRuntime.queryInterface ( XOLESimpleStorage.class, oOLESimpleStorage );
            
            //check that all the streams contain correct information
            for ( int i = 0; i < pStreamCnt; ++i )
            {
                if ( xOLESimpleStorage.hasByName (sSubStreamPrefix + i) )
                {
                    xTempStream[i] = (XTempFile)UnoRuntime.queryInterface ( 
                            XTempFile.class, xOLESimpleStorage.getByName (sSubStreamPrefix + i) );
                    m_aTestHelper.Message ( "pong" );
                    xTempStream[i].getOutputStream ().writeBytes (pBytesOut[i]);
                    m_aTestHelper.Message ( "ping" );
                    for ( int j = 0; j < pBytesCnt; ++j )
                    {
                        if ( pBytesIn[i][0][j] != pBytesOut[i][j] )
                        {
                            m_aTestHelper.Error ( "Wrong data in stream " + i + " byte " + j + "!");
                            return false;
                        }
                    }
                }
                else
                {
                    m_aTestHelper.Error( "Stream " + i + " is lost!");
                    return false;
                }
            }
        }
        catch ( Exception e )
        {
            m_aTestHelper.Error ( "Exception: " + e );
        }
        return true;
    }
}
dmake: Executing shell macro: echo %_cwd
dmake: Executing shell macro: echo %_4ver
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
dmake: Executing shell macro: -ls -1 $(JARDIR) | $(GREP) "^$i"
java -cp 
.;..\..\..\wntmsci10.pro\class;d:\OOEnv\J2SDK1~1.2_0\jre\lib\rt.jar;.;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\ridl.jar;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\unoil.jar;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\jurt.jar;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\juh.jar;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\jut.jar;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\java_uno.jar;f:\OOo\SRC680_m217\solver\680\wntmsci10.pro\bin\OOoRunner.jar
 org.openoffice.Runner -TestBase java_complex  -o 
complex.olesimplestorage.OLESimpleStorageUnitTest OLESimpleStorageTest 
TestHelper Test01
TestJob: -o complex.olesimplestorage.OLESimpleStorageUnitTest
Searching Class: complex.olesimplestorage.OLESimpleStorageUnitTest
Got test: [EMAIL PROTECTED]
LOG> Log started 04.08.2007 - 16:56:23
LOG> Starting ExecuteTest01
LOG> Test01: pong
LOG> Test01: Error: Exception: com.sun.star.io.NotConnectedException: 
LOG> Finished ExecuteTest01
***** State for complex.olesimplestorage.OLESimpleStorageUnitTest ******
Whole unit: PASSED.OK
************************************************************************
Job -o complex.olesimplestorage.OLESimpleStorageUnitTest done
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to