From bbef3ea39fc3fe0bed5bc6307e396fd434e02296 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Thu, 12 Feb 2009 10:27:21 +0000 Subject: CWS-TOOLING: integrate CWS mav44 2009-01-18 22:39:43 +0100 mav r266467 : #i97073# the soffice file should be a shell script, adjust the plugin 2009-01-18 22:35:15 +0100 mav r266466 : #i97073# the soffice file should be a shell script, integrate fix from hro41 cws 2009-01-16 15:32:10 +0100 mav r266426 : #i96456# fix link resolving 2009-01-16 12:21:39 +0100 mav r266413 : #i97073# the soffice file is no more a shell script 2009-01-16 09:58:05 +0100 mav r266402 : #i95409# add complex test using unicode names 2009-01-15 20:27:03 +0100 mav r266392 : #i95408# fix include list 2009-01-15 20:09:28 +0100 mav r266390 : #i95408# deliver new header 2009-01-15 16:16:33 +0100 mav r266382 : #i95408# rebase to m38 2009-01-15 16:11:16 +0100 mav r266380 : #i95408# rebase to m38 2009-01-15 15:38:16 +0100 mav r266376 : CWS-TOOLING: rebase CWS mav44 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 13:23:55 +0100 mav r266294 : #i97073# let the presentation slideshow be started in window mode in plugin 2009-01-13 17:27:52 +0100 mav r266241 : #i95409#,#i95408# support UTF8 encoding for entry names, check the validity of the entries 2009-01-13 16:35:39 +0100 mav r266236 : #i95408# function to check whether a zip entry name is acceptable 2009-01-13 12:00:18 +0100 mav r266205 : #i94003# a readonly document can not be modified 2009-01-09 13:24:49 +0100 mav r266078 : #i95951# let the title be changed 2009-01-09 11:34:49 +0100 mav r266068 : #i80862# close the link only if was closed by the container, othewise leave it open 2009-01-08 11:30:13 +0100 mav r265989 : #i97071# disable Toolbars during window-based slide show in ActiveX control 2009-01-08 08:23:23 +0100 mav r265983 : #i97071# setVisible does not trigger layout in case there is not MenuBar 2009-01-06 12:39:39 +0100 mav r265908 : #i96185# let the MediaDescriptor get the target URL 2009-01-05 08:46:45 +0100 mav r265856 : #i93473# integrate the patch 2009-01-02 17:45:17 +0100 mav r265845 : #i94468#,#i96456# try to follow links 2009-01-02 16:53:41 +0100 mav r265841 : #i94468#,#i96456# use the same parsing mechanics in sharing control file and document lock file 2009-01-02 16:51:24 +0100 mav r265839 : #i94468#,#i96456# use the same parsing mechanics in sharing control file and document lock file --- package/qa/storages/StorageUnitTest.java | 8 ++ package/qa/storages/Test16.java | 159 +++++++++++++++++++++++++++++++ package/qa/storages/makefile.mk | 1 + 3 files changed, 168 insertions(+) create mode 100644 package/qa/storages/Test16.java (limited to 'package/qa') diff --git a/package/qa/storages/StorageUnitTest.java b/package/qa/storages/StorageUnitTest.java index dc868c9f9b03..83bfd79358e7 100644 --- a/package/qa/storages/StorageUnitTest.java +++ b/package/qa/storages/StorageUnitTest.java @@ -82,6 +82,7 @@ public class StorageUnitTest extends ComplexTestCase "ExecuteTest13", "ExecuteTest14", "ExecuteTest15", + "ExecuteTest16", "ExecuteRegressionTest_114358", "ExecuteRegressionTest_i29169", "ExecuteRegressionTest_i30400", @@ -220,6 +221,13 @@ public class StorageUnitTest extends ComplexTestCase assure( "Test15 failed!", aTest.test() ); } + public void ExecuteTest16() + { + StorageTest aTest = new Test16( m_xMSF, m_xStorageFactory, log ); + assure( "Test16 failed!", aTest.test() ); + } + + public void ExecuteRegressionTest_114358() { StorageTest aTest = new RegressionTest_114358( m_xMSF, m_xStorageFactory, log ); diff --git a/package/qa/storages/Test16.java b/package/qa/storages/Test16.java new file mode 100644 index 000000000000..6f432b0da730 --- /dev/null +++ b/package/qa/storages/Test16.java @@ -0,0 +1,159 @@ +package complex.storages; + +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.embed.*; + +import share.LogWriter; +import complex.storages.TestHelper; +import complex.storages.StorageTest; + +public class Test16 implements StorageTest { + + XMultiServiceFactory m_xMSF; + XSingleServiceFactory m_xStorageFactory; + TestHelper m_aTestHelper; + + public Test16( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter ) + { + m_xMSF = xMSF; + m_xStorageFactory = xStorageFactory; + m_aTestHelper = new TestHelper( aLogWriter, "Test16: " ); + } + + public boolean test() + { + try + { + String sTempFileURL = m_aTestHelper.CreateTempFile( m_xMSF ); + if ( sTempFileURL == null || sTempFileURL == "" ) + { + m_aTestHelper.Error( "No valid temporary file was created!" ); + return false; + } + + // create temporary storage based on arbitrary medium + // after such a storage is closed it is lost + Object oTempStorage = m_xStorageFactory.createInstance(); + XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage ); + if ( xTempStorage == null ) + { + m_aTestHelper.Error( "Can't create temporary storage representation!" ); + return false; + } + + // open a new substorage + XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, + "SubStorage\u0442\u0435\u0441\u04421", + ElementModes.WRITE ); + if ( xTempSubStorage == null ) + { + m_aTestHelper.Error( "Can't create substorage!" ); + return false; + } + + byte pBytes1[] = { 1, 1, 1, 1, 1 }; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream\u0442\u0435\u0441\u04421", "MediaType1", true, pBytes1 ) ) + return false; + + byte pBytes2[] = { 2, 2, 2, 2, 2 }; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream\u0442\u0435\u0441\u04422", "MediaType2", false, pBytes2 ) ) + return false; + + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly + if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, + "MediaType3", + true, + ElementModes.WRITE ) ) + return false; + + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly + if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, + "MediaType4", + false, + ElementModes.WRITE ) ) + return false; + + // create temporary storage based on a previously created temporary file + Object pArgs[] = new Object[2]; + pArgs[0] = (Object) sTempFileURL; + pArgs[1] = new Integer( ElementModes.WRITE ); + + Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); + XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); + if ( xTempFileStorage == null ) + { + m_aTestHelper.Error( "Can't create storage based on temporary file!" ); + return false; + } + + // copy xTempStorage to xTempFileStorage + // xTempFileStorage will be automatically commited + if ( !m_aTestHelper.copyStorage( xTempStorage, xTempFileStorage ) ) + return false; + + // dispose used storages to free resources + if ( !m_aTestHelper.disposeStorage( xTempStorage ) || !m_aTestHelper.disposeStorage( xTempFileStorage ) ) + return false; + + // ================================================ + // now check all the written and copied information + // ================================================ + + // the temporary file must not be locked any more after storage disposing + pArgs[1] = new Integer( ElementModes.WRITE ); + Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); + XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); + if ( xResultStorage == null ) + { + m_aTestHelper.Error( "Can't reopen storage based on temporary file!" ); + return false; + } + + if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3", true, ElementModes.WRITE ) ) + return false; + + // open existing substorage + XStorage xResultSubStorage = m_aTestHelper.openSubStorage( xResultStorage, + "SubStorage\u0442\u0435\u0441\u04421", + ElementModes.READ ); + if ( xResultSubStorage == null ) + { + m_aTestHelper.Error( "Can't open existing substorage!" ); + return false; + } + + if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType4", false, ElementModes.READ ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream\u0442\u0435\u0441\u04421", "MediaType1", true, pBytes1 ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream\u0442\u0435\u0441\u04422", "MediaType2", false, pBytes2 ) ) + return false; + + // dispose used storages to free resources + if ( !m_aTestHelper.disposeStorage( xResultStorage ) ) + return false; + + return true; + } + catch( Exception e ) + { + m_aTestHelper.Error( "Exception: " + e ); + return false; + } + } + +} + diff --git a/package/qa/storages/makefile.mk b/package/qa/storages/makefile.mk index d78f51a6051e..7caa832a543d 100644 --- a/package/qa/storages/makefile.mk +++ b/package/qa/storages/makefile.mk @@ -62,6 +62,7 @@ JAVAFILES =\ Test13.java\ Test14.java\ Test15.java\ + Test16.java\ RegressionTest_114358.java\ RegressionTest_i29169.java\ RegressionTest_i30400.java\ -- cgit