summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-05-10 16:27:03 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-05-10 16:27:03 +0000
commit641a53315b6793e82014fe81e25b85fdcfba7e5f (patch)
treee485f277a8abcaf25b8ea56f94a122f42d0e628f
parentfa26b75000f5201103756ecc7e2118b4a21323b3 (diff)
INTEGRATION: CWS fwkbugfix02 (1.2.12); FILE MERGED
2004/04/01 14:33:47 mav 1.2.12.2: #116056# adopt implementation to the design change 2004/03/17 11:39:23 mav 1.2.12.1: #115957# Extend the cloning functionality
-rw-r--r--package/qa/storages/Test10.java66
-rw-r--r--package/qa/storages/Test11.java59
2 files changed, 105 insertions, 20 deletions
diff --git a/package/qa/storages/Test10.java b/package/qa/storages/Test10.java
index 8328fd6d90a1..a2154cf0ec12 100644
--- a/package/qa/storages/Test10.java
+++ b/package/qa/storages/Test10.java
@@ -53,7 +53,7 @@ public class Test10 implements StorageTest {
// open a new substorage
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
"SubStorage1",
- ElementModes.ELEMENT_WRITE );
+ ElementModes.WRITE );
if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" );
@@ -70,13 +70,13 @@ public class Test10 implements StorageTest {
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage,
"MediaType3",
true,
- ElementModes.ELEMENT_WRITE ) )
+ ElementModes.WRITE ) )
return false;
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage,
"MediaType4",
false,
- ElementModes.ELEMENT_WRITE ) )
+ ElementModes.WRITE ) )
return false;
// ==============================
@@ -84,7 +84,7 @@ public class Test10 implements StorageTest {
// ==============================
// the new storage still was not commited so the clone must be empty
- XStorage xClonedSubStorage = m_aTestHelper.cloneSubStorage( xTempStorage, "SubStorage1" );
+ XStorage xClonedSubStorage = m_aTestHelper.cloneSubStorage( m_xStorageFactory, xTempStorage, "SubStorage1" );
if ( xClonedSubStorage == null )
{
@@ -99,7 +99,7 @@ public class Test10 implements StorageTest {
return false;
}
- if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "", true, ElementModes.ELEMENT_READ ) )
+ if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "", true, ElementModes.WRITE ) )
return false;
if ( xClonedNameAccess.hasElements() )
@@ -130,19 +130,71 @@ public class Test10 implements StorageTest {
if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
return false;
- xClonedSubStorage = m_aTestHelper.cloneSubStorage( xTempStorage, "SubStorage1" );
+ xClonedSubStorage = m_aTestHelper.cloneSubStorage( m_xStorageFactory, xTempStorage, "SubStorage1" );
if ( xClonedSubStorage == null )
{
m_aTestHelper.Error( "The result of clone is empty!" );
return false;
}
- if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "MediaType4", true, ElementModes.ELEMENT_READ ) )
+ if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "MediaType4", true, ElementModes.WRITE ) )
return false;
if ( !m_aTestHelper.checkStream( xClonedSubStorage, "SubStream2", "MediaType2", pBytes2 ) )
return false;
+ XStorage xCloneOfRoot = m_aTestHelper.cloneStorage( m_xStorageFactory, xTempStorage );
+ if ( xCloneOfRoot == null )
+ {
+ m_aTestHelper.Error( "The result of root clone is empty!" );
+ return false;
+ }
+
+ XNameAccess xCloneOfRootNA = (XNameAccess) UnoRuntime.queryInterface( XNameAccess.class, xCloneOfRoot );
+ if ( xCloneOfRootNA == null )
+ {
+ m_aTestHelper.Error( "XNameAccess is not implemented by the root clone!" );
+ return false;
+ }
+
+ if ( xCloneOfRootNA.hasElements() )
+ {
+ m_aTestHelper.Error( "The root storage still was not commited so it's clone must be empty!" );
+ return false;
+ }
+
+ if ( !m_aTestHelper.disposeStorage( xCloneOfRoot ) )
+ return false;
+
+ xCloneOfRoot = null;
+
+ // ==============================
+ // commit root storage and check cloning
+ // ==============================
+
+ if ( !m_aTestHelper.commitStorage( xTempStorage ) )
+ return false;
+
+ xCloneOfRoot = m_aTestHelper.cloneStorage( m_xStorageFactory, xTempStorage );
+ if ( xCloneOfRoot == null )
+ {
+ m_aTestHelper.Error( "The result of root clone is empty!" );
+ return false;
+ }
+
+ XStorage xSubStorageOfClone = xCloneOfRoot.openStorageElement( "SubStorage1", ElementModes.READ );
+ if ( xSubStorageOfClone == null )
+ {
+ m_aTestHelper.Error( "The result of root clone is wrong!" );
+ return false;
+ }
+
+ if ( !m_aTestHelper.checkStorageProperties( xSubStorageOfClone, "MediaType4", false, ElementModes.READ ) )
+ return false;
+
+ if ( !m_aTestHelper.checkStream( xSubStorageOfClone, "SubStream2", "MediaType2", pBytes2 ) )
+ return false;
+
return true;
}
catch( Exception e )
diff --git a/package/qa/storages/Test11.java b/package/qa/storages/Test11.java
index 98a4626c01c1..d3ae5f84e242 100644
--- a/package/qa/storages/Test11.java
+++ b/package/qa/storages/Test11.java
@@ -44,41 +44,41 @@ public class Test11 implements StorageTest {
return false;
}
- byte pPass1[] = { 11, 11, 11, 11, 11 };
+ String sPass1 = "111111111";
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.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", true, pBytes1, pPass1 ) )
+ if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", true, pBytes1, sPass1 ) )
return false;
// open a new substorage
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
"SubStorage1",
- ElementModes.ELEMENT_WRITE );
+ ElementModes.WRITE );
if ( xTempSubStorage == null )
{
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
- byte pPass2[] = { 22, 22, 22, 22, 22 };
+ String sPass2 = "2222222222";
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.WriteBytesToEncrSubstream( xTempSubStorage, "SubStream2", "MediaType2", true, pBytes2, pPass2 ) )
+ if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "SubStream2", "MediaType2", true, pBytes2, sPass2 ) )
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.ELEMENT_WRITE ) )
+ ElementModes.WRITE ) )
return false;
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage,
"MediaType4",
false,
- ElementModes.ELEMENT_WRITE ) )
+ ElementModes.WRITE ) )
return false;
// ==============================
@@ -86,7 +86,7 @@ public class Test11 implements StorageTest {
// ==============================
// the new storage still was not commited so the clone must be empty
- XStorage xClonedSubStorage = m_aTestHelper.cloneSubStorage( xTempStorage, "SubStorage1" );
+ XStorage xClonedSubStorage = m_aTestHelper.cloneSubStorage( m_xStorageFactory, xTempStorage, "SubStorage1" );
if ( xClonedSubStorage == null )
{
@@ -101,7 +101,7 @@ public class Test11 implements StorageTest {
return false;
}
- if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "", true, ElementModes.ELEMENT_READ ) )
+ if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "", true, ElementModes.WRITE ) )
return false;
if ( xClonedNameAccess.hasElements() )
@@ -118,7 +118,7 @@ public class Test11 implements StorageTest {
// the new stream was opened, written and closed, that means flashed
// so the clone must contain all the information
- XStream xClonedSubStream = m_aTestHelper.cloneEncrSubStream( xTempStorage, "SubStream1", pPass1 );
+ XStream xClonedSubStream = m_aTestHelper.cloneEncrSubStream( xTempStorage, "SubStream1", sPass1 );
if ( !m_aTestHelper.InternalCheckStream( xClonedSubStream, "SubStream1", "MediaType1", pBytes1 ) )
return false;
@@ -132,17 +132,50 @@ public class Test11 implements StorageTest {
if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
return false;
- xClonedSubStorage = m_aTestHelper.cloneSubStorage( xTempStorage, "SubStorage1" );
+ xClonedSubStorage = m_aTestHelper.cloneSubStorage( m_xStorageFactory, xTempStorage, "SubStorage1" );
if ( xClonedSubStorage == null )
{
m_aTestHelper.Error( "The result of clone is empty!" );
return false;
}
- if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "MediaType4", true, ElementModes.ELEMENT_READ ) )
+ if ( !m_aTestHelper.checkStorageProperties( xClonedSubStorage, "MediaType4", true, ElementModes.WRITE ) )
return false;
- if ( !m_aTestHelper.checkEncrStream( xClonedSubStorage, "SubStream2", "MediaType2", pBytes2, pPass2 ) )
+ if ( !m_aTestHelper.checkEncrStream( xClonedSubStorage, "SubStream2", "MediaType2", pBytes2, sPass2 ) )
+ return false;
+
+ // ==============================
+ // commit the root storage and check cloning
+ // ==============================
+
+ if ( !m_aTestHelper.commitStorage( xTempStorage ) )
+ return false;
+
+ XStorage xCloneOfRoot = m_aTestHelper.cloneStorage( m_xStorageFactory, xTempStorage );
+ if ( xCloneOfRoot == null )
+ {
+ m_aTestHelper.Error( "The result of root clone is empty!" );
+ return false;
+ }
+
+ if ( !m_aTestHelper.checkStorageProperties( xCloneOfRoot, "MediaType3", true, ElementModes.WRITE ) )
+ return false;
+
+ if ( !m_aTestHelper.checkEncrStream( xCloneOfRoot, "SubStream1", "MediaType1", pBytes1, sPass1 ) )
+ return false;
+
+ XStorage xSubStorageOfClone = xCloneOfRoot.openStorageElement( "SubStorage1", ElementModes.READ );
+ if ( xSubStorageOfClone == null )
+ {
+ m_aTestHelper.Error( "The result of root clone is wrong!" );
+ return false;
+ }
+
+ if ( !m_aTestHelper.checkStorageProperties( xSubStorageOfClone, "MediaType4", false, ElementModes.READ ) )
+ return false;
+
+ if ( !m_aTestHelper.checkEncrStream( xSubStorageOfClone, "SubStream2", "MediaType2", pBytes2, sPass2 ) )
return false;
return true;