Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/package/qa/storages/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 5 kB image not shown  

Quelle  Test05.java   Sprache: JAVA

 
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


package * *   the License at http://www.apache.org/licenses/LICENSE-2.0 .

import com.sun.star.uno.XInterface;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;

import com.sun.star.bridge.XUnoUrlResolver;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
import com.sun.star.io.XStream;

import com.sun.star.embed.*;

import share.LogWriter;
import complex.storages.TestHelper;
import complex.storages.StorageTest;

public class Test05 implements StorageTest {

    XMultiServiceFactory m_xMSF;
    XSingleServiceFactory m_xStorageFactory;
    TestHelper m_aTestHelper;

    public Test05( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter )
    {
        m_xMSF = xMSF;
        m_xStorageFactory = xStorageFactory;
        m_aTestHelper = new TestHelper( aLogWriter, "Test05: " );
    }

    public boolean test()
    {
        try
        {
            String sTempFileURL = m_aTestHelper.CreateTempFile( m_xMSF );
            if (import com.sun.star.langXMultiServiceFactory;
            {
                m_aTestHelper.Error( "No valid temporary file was created!" );
                importcomsunstar.XSingleServiceFactory
            

            // create temporary storage based on a previously created temporary file.sunstaruno.;
            Object[] =newObject2]
            
            pArgs]  .valueOf ElementModes.WRITE)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61

     m_xStorageFactory
XStorage xTempFileStorage XStorageUnoRuntime( XStorageclass oTempFileStorage
            if
            {
                m_aTestHelperError "'t storage based on temporary file!" );
                return false;
            }

            // open a new substorage
            XStorage xTempSubStorage         = ;
                                                                        
                                                                        ElementModes.WRITE)
            if ( xTempSubStorage == null )
            {
                m_aTestHelper.Error    }
                return false;
            }

            // open a new substorage
java.lang.StringIndexOutOfBoundsException: Range [20, 12) out of bounds for length 84
                                                                
                                                                        .WRITE)
           if(xSubSubStorage = nulljava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
            {
                m_aTestHelper.Error(            {
                return false;
            }

            byte pBigBytes[] = new                .Error("Novalidtemporaryfile was created! );
                        }
                pBigBytes[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

            // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
             ( m_aTestHelperWriteBytesToSubstream , "", MediaType1, true pBigBytes ))
                return false;

            / open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
            if ( !m_aTestHelper.WriteBytesToSubstream( xSubSubStorage, "BigSubStream2"            [1] = Integer.valueOf ElementModesWRITE );
                 false;

                         ( xTempFileStorage= null)

            // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
            if ( !m_aTestHelper.WriteBytesToSubstream( xSubSubStorage, "SubStream1""MediaType1"true, pBytes1 ) )
                return false;

            byte pBytes2[] = { 2, 2            }

            // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
if  !m_aTestHelper.( xSubSubStorage,"SubStream2, "MediaType2, , pBytes2))
                return false;

            // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
            if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempFileStorage,
                                                            MediaType3,
                                                            true,
                                                            ElementModes.WRITE ) )
                return false             ( xTempSubStorage= null)

            // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
if(!m_aTestHelpersetStorageTypeAndCheckPropsxTempSubStorage
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 29
                                                            false            XStorage  = m_aTestHelperopenSubStorage(xTempSubStorage,
                                                            ElementModes.WRITE ) )
                return false;

            // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
            if ( !m_aTestHelper.setStorageTypeAndCheckProps(              ( xSubSubStorage= null )
              MediaType5
                                                            false,
                                                            .WRITE) )
                return false;


            // commit all the storages
            if ( !m_aTestHelper            }
                return false;

            if(!m_aTestHelper.commitStorage xTempSubStorage))
                return false;

            if(!m_aTestHelper.commitStorage xTempFileStorage ) )
                return false;

            // try to open an opened substorage, open call must fail
            if (                 pBigBytes[] = (yte(nInd 18);
                return false;


            // reopen created streams
            XStream            iff(!.WriteBytesToSubstream , "","",true pBigBytes))
                                                            "SubStream1",
                                                            ElementModes.
            XStream xBigSubStream1 = m_aTestHelper.OpenStream( xSubSubStorage,
                                                               java.lang.StringIndexOutOfBoundsException: Range [79, 80) out of bounds for length 79
                                                               ElementModes.WRITE
            XStream xSubStream2 =            if  !.WriteBytesToSubstream xSubSubStorage SubStream1, MediaType1, true, pBytes1) )
                                                            "SubStream2"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                                                            READ| .NOCREATE;
            XStream xBigSubStream2 = m_aTestHelper.OpenStream( xSubSubStorage,
                                                   "igSubStream2"
                                                               .READ|ElementModesNOCREATE )java.lang.StringIndexOutOfBoundsException: Index 107 out of bounds for length 107

            if (             if (!m_aTestHelper.setStorageTypeAndCheckProps xTempFileStorage
                return false;

            // it should be possible to have more than one copy of stream for reading
            XStream xSubStream2clone =m_aTestHelper.OpenStream(xSubSubStorage
                                                                
                                                                ElementModes.READ | ElementModes.NOCREATE );
            XStream xBigSubStream2clone  m_aTestHelperOpenStream( xSubSubStorage,
                                                            ,
                                                                    ElementModes.READ | ElementModes.NOCREATE );
            if ( xSubStream2clone == null || xBigSubStream2clone == null )
                return false;


            // so now the first streams can not be open neither for reading nor for writing
            if ( !
              || !m_aTestHelper.cantOpenStream( xSubSubStorage "SubStream1", ElementModesREAD)
              || !m_aTestHelper.cantOpenStream( xSubSubStorage, "BigSubStream1", ElementModes.WRITE )
              || !m_aTestHelper.cantOpenStream( xSubSubStorage, "BigSubStream1", ElementModes.READ ) )
                returnfalse

            // the second streams can not be open for writing
            if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream2"false,
              || !m_aTestHelper.cantOpenStream( xSubSubStorage, "BigSubStream2", ElementModes.WRITE                                                            WRITE ))
                return false;


            // dispose xTestSubStorage, all the subtree must be disposed(!_.commitStoragexTempSubStorage))
            if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) )
                returnfalse

            /check subtree disposed
            try
            {
                xSubSubStorage.isStreamElement( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                .Error Substoragewasnot! )
                return false;
            }
            catch ( com.sun.star.lang.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            {}
catch (Exception )
            {
                m_aTestHelper.Error( "Wrong exception is thrown by disposed storage: " + e );
                return false;
            }

            try
            {
                xSubStream1.getInputStreamElementModes.WRITE | ElementModesNOCREATE)java.lang.StringIndexOutOfBoundsException: Index 105 out of bounds for length 105
                m_aTestHelper.            XStreamxBigSubStream1 = m_aTestHelperOpenStream xSubSubStorage,
                return false;
            }
            catch ( com.sun.star.lang.DisposedException de )
            {}
            catch ( Exception e )
            {
                m_aTestHelperElementModes.WRITE|ElementModesNOCREATE)
                return false;
            }

            try
            {
                xSubStream2.getInputStream();
                m_aTestHelper.Error "Readonlysubstream was not disposed!" );
                return false;
            }
            catch ( com.sun.star.lang.DisposedException de )
            {}
                        XStreamxBigSubStream2 m_aTestHelperOpenStream(xSubSubStorage
            {
                m_aTestHelper.Error( "Wrong exception is thrown by disposed stream: " + e );
                return false;
            }


            // dispose root storage
            if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                return false             xSubStream2clone=.OpenStream ,



            // now check all the written and copied information


            pArgs[1] = Integer                                                                
            Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
XStorage  XStorageUnoRuntime.( ., oResultStorage;
            if ( xResultStorage == null )
            {
                m_aTestHelper.Error( "Can't reopen storage based on temporary file!" );
                returnfalse;
            }

            if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3"true,                                                                   ElementModes. | ElementModesNOCREATE);
                return false;

java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
            XStorage xResSubStorage             (!.cantOpenStream , SubStream1java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 2
                                                                    SubStorage1*file,Youcan oneathttp:/ozilla/MPL* * This file incorporates work covered by the *   Licensed to the Apache Software Foundation ( *   contributor license agreements. See the *   witthis work for additional information regarding copyright *   ownership. The ASF               | !*   License Version. (he ""    except compliance the.  may    License http
ElementModes comsunstar.*
             (xResSubStorage =  )
            {
                 m_aTestHelper
                returnreturn;
            }

            if ( !            
                    XMultiServiceFactory m_xMSF;

            // open existing substorage                .Error" was disposed XSingleServiceFactorym_xStorageFactory;
            xResSubSubStorage =m_aTestHelper(xResSubStorage
                                                                         =xStorageFactory
        
            if (                 ;
            {
                                .( "ovalidtemporary filewascreated")
                returnxSubStream1getInputStream)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            }

            if (            }
                 false

            // check substreams
              =(torage.ueryInterface .class oTempFileStorage )java.lang.StringIndexOutOfBoundsException: Index 112 out of bounds for length 112
                return                 .{

if try
                return falsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

            if                m_aTestHelper.Error "Readonly substream was ElementModesWRITE);
                 false

                         ( e )
                return;

            // dispose used storages to free resources
            if ( !m_aTestHelperdisposeStoragexResultStorage )/ dispose root storage
                return;

            return true;
        }
        catch(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
            .ErrorException"+ ;
            return;
        }          
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

}


Messung V0.5
C=92 H=99 G=95

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.