xref: /AOO41X/main/package/qa/storages/RegressionTest_i30400.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir package complex.storages;
2*cdf0e10cSrcweir 
3*cdf0e10cSrcweir import com.sun.star.uno.XInterface;
4*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
5*cdf0e10cSrcweir import com.sun.star.lang.XSingleServiceFactory;
6*cdf0e10cSrcweir 
7*cdf0e10cSrcweir import com.sun.star.bridge.XUnoUrlResolver;
8*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
9*cdf0e10cSrcweir import com.sun.star.uno.XInterface;
10*cdf0e10cSrcweir import com.sun.star.io.XStream;
11*cdf0e10cSrcweir import com.sun.star.io.XInputStream;
12*cdf0e10cSrcweir 
13*cdf0e10cSrcweir import com.sun.star.embed.*;
14*cdf0e10cSrcweir 
15*cdf0e10cSrcweir import share.LogWriter;
16*cdf0e10cSrcweir import complex.storages.TestHelper;
17*cdf0e10cSrcweir import complex.storages.StorageTest;
18*cdf0e10cSrcweir 
19*cdf0e10cSrcweir public class RegressionTest_i30400 implements StorageTest {
20*cdf0e10cSrcweir 
21*cdf0e10cSrcweir 	XMultiServiceFactory m_xMSF;
22*cdf0e10cSrcweir 	XSingleServiceFactory m_xStorageFactory;
23*cdf0e10cSrcweir 	TestHelper m_aTestHelper;
24*cdf0e10cSrcweir 
25*cdf0e10cSrcweir 	public RegressionTest_i30400( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter )
26*cdf0e10cSrcweir 	{
27*cdf0e10cSrcweir 		m_xMSF = xMSF;
28*cdf0e10cSrcweir 		m_xStorageFactory = xStorageFactory;
29*cdf0e10cSrcweir 		m_aTestHelper = new TestHelper( aLogWriter, "RegressionTest_i30400: " );
30*cdf0e10cSrcweir 	}
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir     public boolean test()
33*cdf0e10cSrcweir 	{
34*cdf0e10cSrcweir 		try
35*cdf0e10cSrcweir 		{
36*cdf0e10cSrcweir 			// ================================================
37*cdf0e10cSrcweir 			// create a temporary stream and a storage based on it
38*cdf0e10cSrcweir 			// fill the storage with the data that will be used for testing
39*cdf0e10cSrcweir 			// ================================================
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 			XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
42*cdf0e10cSrcweir 			if ( xTempFileStream == null )
43*cdf0e10cSrcweir 				return false;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir 			// create storage based on the temporary stream
46*cdf0e10cSrcweir 			Object pArgs[] = new Object[2];
47*cdf0e10cSrcweir 			pArgs[0] = (Object) xTempFileStream;
48*cdf0e10cSrcweir 			pArgs[1] = new Integer( ElementModes.WRITE );
49*cdf0e10cSrcweir 			byte pBytes1[] = { 1, 1, 1, 1, 1 };
50*cdf0e10cSrcweir 			String pPass1 = "1, 2, 3, 4, 5";
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 			Object oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
53*cdf0e10cSrcweir 			XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage );
54*cdf0e10cSrcweir 			if ( xTempStorage == null )
55*cdf0e10cSrcweir 			{
56*cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create temporary storage representation!" );
57*cdf0e10cSrcweir 				return false;
58*cdf0e10cSrcweir 			}
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
61*cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToSubstream( xTempStorage, "Stream1", "MediaType1", true, pBytes1 ) )
62*cdf0e10cSrcweir 				return false;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
65*cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "EncrStream1", "MediaType2", true, pBytes1, pPass1 ) )
66*cdf0e10cSrcweir 				return false;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 			// open a new substorage
70*cdf0e10cSrcweir 			XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
71*cdf0e10cSrcweir 																	"SubStorage1",
72*cdf0e10cSrcweir 																	ElementModes.WRITE );
73*cdf0e10cSrcweir 			if ( xTempSubStorage == null )
74*cdf0e10cSrcweir 			{
75*cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
76*cdf0e10cSrcweir 				return false;
77*cdf0e10cSrcweir 			}
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
80*cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream1", "MediaType3", true, pBytes1 ) )
81*cdf0e10cSrcweir 				return false;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
84*cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "SubEncrStream1", "MediaType4", true, pBytes1, pPass1 ) )
85*cdf0e10cSrcweir 				return false;
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 			// open a new substorage in the existing substorage
88*cdf0e10cSrcweir 			XStorage xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage,
89*cdf0e10cSrcweir 																		"SubSubStorage1",
90*cdf0e10cSrcweir 																		ElementModes.WRITE );
91*cdf0e10cSrcweir 			if ( xTempSubStorage == null )
92*cdf0e10cSrcweir 			{
93*cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
94*cdf0e10cSrcweir 				return false;
95*cdf0e10cSrcweir 			}
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
98*cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubSubStorage, "SubSubStream1", "MediaType5", true, pBytes1 ) )
99*cdf0e10cSrcweir 				return false;
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 			// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
102*cdf0e10cSrcweir 			if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubSubStorage,
103*cdf0e10cSrcweir 															"MediaType6",
104*cdf0e10cSrcweir 															false,
105*cdf0e10cSrcweir 															ElementModes.WRITE ) )
106*cdf0e10cSrcweir 				return false;
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 			// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
110*cdf0e10cSrcweir 			if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage,
111*cdf0e10cSrcweir 															"MediaType7",
112*cdf0e10cSrcweir 															false,
113*cdf0e10cSrcweir 															ElementModes.WRITE ) )
114*cdf0e10cSrcweir 				return false;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 			// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
117*cdf0e10cSrcweir 			if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage,
118*cdf0e10cSrcweir 															"MediaType8",
119*cdf0e10cSrcweir 															true,
120*cdf0e10cSrcweir 															ElementModes.WRITE ) )
121*cdf0e10cSrcweir 				return false;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 			// ================================================
124*cdf0e10cSrcweir 			// check the copying with renaming
125*cdf0e10cSrcweir 			// ================================================
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 			if ( !TestCopyWithRenaming( xTempStorage, xTempSubStorage, xTempSubSubStorage ) )
128*cdf0e10cSrcweir 				return false;
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 			// ================================================
131*cdf0e10cSrcweir 			// commit the storages
132*cdf0e10cSrcweir 			// ================================================
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 			// commit lowlevel substorage
135*cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubSubStorage ) )
136*cdf0e10cSrcweir 				return false;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 			// commit substorage
139*cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
140*cdf0e10cSrcweir 				return false;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 			// commit the root storage so the contents must be stored now
143*cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempStorage ) )
144*cdf0e10cSrcweir 				return false;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 			// ================================================
147*cdf0e10cSrcweir 			// dispose the storages
148*cdf0e10cSrcweir 			// ================================================
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 			// dispose lowerest substorage
151*cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempSubSubStorage ) )
152*cdf0e10cSrcweir 				return false;
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 			// dispose substorage
155*cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) )
156*cdf0e10cSrcweir 				return false;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 			// dispose the temporary storage
159*cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempStorage ) )
160*cdf0e10cSrcweir 				return false;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 			// ================================================
163*cdf0e10cSrcweir 			// reopen the target storage readonly, and check the copying with renaming
164*cdf0e10cSrcweir 			// ================================================
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 			pArgs[1] = new Integer( ElementModes.READ );
167*cdf0e10cSrcweir 			oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
168*cdf0e10cSrcweir 			xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage );
169*cdf0e10cSrcweir 			if ( xTempStorage == null )
170*cdf0e10cSrcweir 			{
171*cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create temporary storage representation!" );
172*cdf0e10cSrcweir 				return false;
173*cdf0e10cSrcweir 			}
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 			// open the substorages
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 			xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
178*cdf0e10cSrcweir 															"SubStorage1",
179*cdf0e10cSrcweir 															ElementModes.READ );
180*cdf0e10cSrcweir 			if ( xTempSubStorage == null )
181*cdf0e10cSrcweir 			{
182*cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
183*cdf0e10cSrcweir 				return false;
184*cdf0e10cSrcweir 			}
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 			// open the lowlevel substorages
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 			xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage,
189*cdf0e10cSrcweir 																"SubSubStorage1",
190*cdf0e10cSrcweir 																ElementModes.READ );
191*cdf0e10cSrcweir 			if ( xTempSubSubStorage == null )
192*cdf0e10cSrcweir 			{
193*cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
194*cdf0e10cSrcweir 				return false;
195*cdf0e10cSrcweir 			}
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 			// test the copying with renaming
198*cdf0e10cSrcweir 			if ( !TestCopyWithRenaming( xTempStorage, xTempSubStorage, xTempSubSubStorage ) )
199*cdf0e10cSrcweir 				return false;
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 			// the storage is based on the temporary stream so it can be left undisposed, since it does not lock
203*cdf0e10cSrcweir 			// any resource, later the garbage collector will release the object and it must die by refcount
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 			return true;
206*cdf0e10cSrcweir 		}
207*cdf0e10cSrcweir 		catch( Exception e )
208*cdf0e10cSrcweir 		{
209*cdf0e10cSrcweir 			m_aTestHelper.Error( "Exception: " + e );
210*cdf0e10cSrcweir 			return false;
211*cdf0e10cSrcweir 		}
212*cdf0e10cSrcweir     }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 	public boolean TestCopyWithRenaming( XStorage xTempStorage, XStorage xTempSubStorage, XStorage xTempSubSubStorage )
216*cdf0e10cSrcweir 		throws com.sun.star.uno.Exception
217*cdf0e10cSrcweir 	{
218*cdf0e10cSrcweir 		// ================================================
219*cdf0e10cSrcweir 		// create a second temporary stream and copy all the staff there
220*cdf0e10cSrcweir 		// with renaming, check the success
221*cdf0e10cSrcweir 		// ================================================
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 		XStream xTempFileStream2 = m_aTestHelper.CreateTempFileStream( m_xMSF );
224*cdf0e10cSrcweir 		if ( xTempFileStream2 == null )
225*cdf0e10cSrcweir 			return false;
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 		Object pArgs[] = new Object[2];
228*cdf0e10cSrcweir 		pArgs[0] = (Object) xTempFileStream2;
229*cdf0e10cSrcweir 		pArgs[1] = new Integer( ElementModes.WRITE );
230*cdf0e10cSrcweir 		byte pBytes1[] = { 1, 1, 1, 1, 1 };
231*cdf0e10cSrcweir 		String pPass1 = "1, 2, 3, 4, 5";
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 		Object oTempStorage2 = m_xStorageFactory.createInstanceWithArguments( pArgs );
234*cdf0e10cSrcweir 		XStorage xTempStorage2 = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage2 );
235*cdf0e10cSrcweir 		if ( xTempStorage2 == null )
236*cdf0e10cSrcweir 		{
237*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create temporary storage representation!" );
238*cdf0e10cSrcweir 			return false;
239*cdf0e10cSrcweir 		}
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 		// open a new substorage
242*cdf0e10cSrcweir 		XStorage xTempSubStorage2 = m_aTestHelper.openSubStorage( xTempStorage2,
243*cdf0e10cSrcweir 																"SubStorage1_target",
244*cdf0e10cSrcweir 																ElementModes.WRITE );
245*cdf0e10cSrcweir 		if ( xTempSubStorage2 == null )
246*cdf0e10cSrcweir 		{
247*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
248*cdf0e10cSrcweir 			return false;
249*cdf0e10cSrcweir 		}
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 		// open a new substorage in the existing substorage
252*cdf0e10cSrcweir 		XStorage xTempSubSubStorage2 = m_aTestHelper.openSubStorage( xTempSubStorage2,
253*cdf0e10cSrcweir 																	"SubSubStorage1_target",
254*cdf0e10cSrcweir 																	ElementModes.WRITE );
255*cdf0e10cSrcweir 		if ( xTempSubSubStorage2 == null )
256*cdf0e10cSrcweir 		{
257*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
258*cdf0e10cSrcweir 			return false;
259*cdf0e10cSrcweir 		}
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 		// make a copy with renaming on lowerest level
262*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempSubSubStorage, "SubSubStream1", xTempSubSubStorage2, "SubSubStream1_renamed" ) )
263*cdf0e10cSrcweir 			return false;
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir 		// make a copy with renaming on the next level
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempSubStorage, "SubStream1", xTempSubStorage2, "SubStream1_renamed" ) )
268*cdf0e10cSrcweir 			return false;
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempSubStorage, "SubEncrStream1", xTempSubStorage2, "SubEncrStream1_renamed" ) )
271*cdf0e10cSrcweir 			return false;
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempSubStorage, "SubSubStorage1", xTempSubStorage2, "SubSubStorage1_renamed" ) )
274*cdf0e10cSrcweir 			return false;
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 		// make a copy with renaming of subelements of the root storage
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempStorage, "Stream1", xTempStorage2, "Stream1_renamed" ) )
279*cdf0e10cSrcweir 			return false;
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempStorage, "EncrStream1", xTempStorage2, "EncrStream1_renamed" ) )
282*cdf0e10cSrcweir 			return false;
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 		if ( !m_aTestHelper.copyElementTo( xTempStorage, "SubStorage1", xTempStorage2, "SubStorage1_renamed" ) )
285*cdf0e10cSrcweir 			return false;
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 		// ================================================
288*cdf0e10cSrcweir 		// commit the storages, and check the renaming in all stages
289*cdf0e10cSrcweir 		// ================================================
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 		// commit substorage to let the renaming take place
292*cdf0e10cSrcweir 		if ( !m_aTestHelper.commitStorage( xTempSubSubStorage2 ) )
293*cdf0e10cSrcweir 			return false;
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		// commit substorage to let the renaming take place
296*cdf0e10cSrcweir 		if ( !m_aTestHelper.commitStorage( xTempSubStorage2 ) )
297*cdf0e10cSrcweir 			return false;
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 		// commit the root storage so the contents must be stored now
300*cdf0e10cSrcweir 		if ( !m_aTestHelper.commitStorage( xTempStorage2 ) )
301*cdf0e10cSrcweir 			return false;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 		// ================================================
304*cdf0e10cSrcweir 		// dispose the storages
305*cdf0e10cSrcweir 		// ================================================
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 		// dispose lowerest substorage
308*cdf0e10cSrcweir 		if ( !m_aTestHelper.disposeStorage( xTempSubSubStorage2 ) )
309*cdf0e10cSrcweir 			return false;
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 		// dispose substorage
312*cdf0e10cSrcweir 		if ( !m_aTestHelper.disposeStorage( xTempSubStorage2 ) )
313*cdf0e10cSrcweir 			return false;
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 		// dispose the temporary storage
316*cdf0e10cSrcweir 		if ( !m_aTestHelper.disposeStorage( xTempStorage2 ) )
317*cdf0e10cSrcweir 			return false;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 		// ================================================
320*cdf0e10cSrcweir 		// reopen the target storage readonly, and check the contents
321*cdf0e10cSrcweir 		// ================================================
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 		pArgs[1] = new Integer( ElementModes.READ );
324*cdf0e10cSrcweir 		oTempStorage2 = m_xStorageFactory.createInstanceWithArguments( pArgs );
325*cdf0e10cSrcweir 		xTempStorage2 = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage2 );
326*cdf0e10cSrcweir 		if ( xTempStorage2 == null )
327*cdf0e10cSrcweir 		{
328*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create temporary storage representation!" );
329*cdf0e10cSrcweir 			return false;
330*cdf0e10cSrcweir 		}
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 		// open the substorages
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 		XStorage xTempSubStorage2_target = m_aTestHelper.openSubStorage( xTempStorage2,
335*cdf0e10cSrcweir 																"SubStorage1_target",
336*cdf0e10cSrcweir 																ElementModes.READ );
337*cdf0e10cSrcweir 		if ( xTempSubStorage2_target == null )
338*cdf0e10cSrcweir 		{
339*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
340*cdf0e10cSrcweir 			return false;
341*cdf0e10cSrcweir 		}
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir 		XStorage xTempSubStorage2_renamed = m_aTestHelper.openSubStorage( xTempStorage2,
344*cdf0e10cSrcweir 																"SubStorage1_renamed",
345*cdf0e10cSrcweir 																ElementModes.READ );
346*cdf0e10cSrcweir 		if ( xTempSubStorage2_renamed == null )
347*cdf0e10cSrcweir 		{
348*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
349*cdf0e10cSrcweir 			return false;
350*cdf0e10cSrcweir 		}
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 		// open the lowlevel substorages
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 		XStorage xTempSubSubStorage2_inRenamed = m_aTestHelper.openSubStorage( xTempSubStorage2_renamed,
355*cdf0e10cSrcweir 																				"SubSubStorage1",
356*cdf0e10cSrcweir 																				ElementModes.READ );
357*cdf0e10cSrcweir 		if ( xTempSubSubStorage2_inRenamed == null )
358*cdf0e10cSrcweir 		{
359*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
360*cdf0e10cSrcweir 			return false;
361*cdf0e10cSrcweir 		}
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 		XStorage xTempSubSubStorage2_renamed = m_aTestHelper.openSubStorage( xTempSubStorage2_target,
364*cdf0e10cSrcweir 																			"SubSubStorage1_renamed",
365*cdf0e10cSrcweir 																			ElementModes.READ );
366*cdf0e10cSrcweir 		if ( xTempSubSubStorage2_renamed == null )
367*cdf0e10cSrcweir 		{
368*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
369*cdf0e10cSrcweir 			return false;
370*cdf0e10cSrcweir 		}
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 		XStorage xTempSubSubStorage2_target = m_aTestHelper.openSubStorage( xTempSubStorage2_target,
373*cdf0e10cSrcweir 																			"SubSubStorage1_target",
374*cdf0e10cSrcweir 																			ElementModes.READ );
375*cdf0e10cSrcweir 		if ( xTempSubSubStorage2_target == null )
376*cdf0e10cSrcweir 		{
377*cdf0e10cSrcweir 			m_aTestHelper.Error( "Can't create substorage!" );
378*cdf0e10cSrcweir 			return false;
379*cdf0e10cSrcweir 		}
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 		// check the storages
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStorageProperties( xTempSubSubStorage2_inRenamed, "MediaType6", false, ElementModes.READ ) )
384*cdf0e10cSrcweir 			return false;
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStorageProperties( xTempSubSubStorage2_renamed, "MediaType6", false, ElementModes.READ ) )
387*cdf0e10cSrcweir 			return false;
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStorageProperties( xTempSubStorage2_renamed, "MediaType7", false, ElementModes.READ ) )
390*cdf0e10cSrcweir 			return false;
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 		// check the streams
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 		// sub sub level
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStream( xTempSubSubStorage2_inRenamed, "SubSubStream1", "MediaType5", true, pBytes1 ) )
399*cdf0e10cSrcweir 			return false;
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStream( xTempSubSubStorage2_renamed, "SubSubStream1", "MediaType5", true, pBytes1 ) )
402*cdf0e10cSrcweir 			return false;
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStream( xTempSubSubStorage2_target, "SubSubStream1_renamed", "MediaType5", true, pBytes1 ) )
405*cdf0e10cSrcweir 			return false;
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 		// sub level
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStream( xTempSubStorage2_renamed, "SubStream1", "MediaType3", true, pBytes1 ) )
410*cdf0e10cSrcweir 			return false;
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkEncrStream( xTempSubStorage2_renamed, "SubEncrStream1", "MediaType4", pBytes1, pPass1 ) )
413*cdf0e10cSrcweir 			return false;
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStream( xTempSubStorage2_target, "SubStream1_renamed", "MediaType3", true, pBytes1 ) )
416*cdf0e10cSrcweir 			return false;
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkEncrStream( xTempSubStorage2_target, "SubEncrStream1_renamed", "MediaType4", pBytes1, pPass1 ) )
419*cdf0e10cSrcweir 			return false;
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 		// root storage level
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkStream( xTempStorage2, "Stream1_renamed", "MediaType1", true, pBytes1 ) )
424*cdf0e10cSrcweir 			return false;
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 		if ( !m_aTestHelper.checkEncrStream( xTempStorage2, "EncrStream1_renamed", "MediaType2", pBytes1, pPass1 ) )
427*cdf0e10cSrcweir 			return false;
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 		// the storage is based on the temporary stream so it can be left undisposed, since it does not lock
430*cdf0e10cSrcweir 		// any resource, later the garbage collector will release the object and it must die by refcount
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 		return true;
433*cdf0e10cSrcweir 	}
434*cdf0e10cSrcweir }
435*cdf0e10cSrcweir 
436