1*a740f2aaSAndrew Rist /**************************************************************
2*a740f2aaSAndrew Rist  *
3*a740f2aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a740f2aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a740f2aaSAndrew Rist  * distributed with this work for additional information
6*a740f2aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a740f2aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a740f2aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*a740f2aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a740f2aaSAndrew Rist  *
11*a740f2aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a740f2aaSAndrew Rist  *
13*a740f2aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a740f2aaSAndrew Rist  * software distributed under the License is distributed on an
15*a740f2aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a740f2aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*a740f2aaSAndrew Rist  * specific language governing permissions and limitations
18*a740f2aaSAndrew Rist  * under the License.
19*a740f2aaSAndrew Rist  *
20*a740f2aaSAndrew Rist  *************************************************************/
21*a740f2aaSAndrew Rist 
22cdf0e10cSrcweir package complex.storages;
23cdf0e10cSrcweir 
24cdf0e10cSrcweir import com.sun.star.uno.XInterface;
25cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
26cdf0e10cSrcweir import com.sun.star.lang.XSingleServiceFactory;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import com.sun.star.bridge.XUnoUrlResolver;
29cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
30cdf0e10cSrcweir import com.sun.star.uno.XInterface;
31cdf0e10cSrcweir import com.sun.star.io.XStream;
32cdf0e10cSrcweir import com.sun.star.io.XInputStream;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir import com.sun.star.embed.*;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir import share.LogWriter;
37cdf0e10cSrcweir import complex.storages.TestHelper;
38cdf0e10cSrcweir import complex.storages.StorageTest;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir public class RegressionTest_i29169 implements StorageTest {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	XMultiServiceFactory m_xMSF;
43cdf0e10cSrcweir 	XSingleServiceFactory m_xStorageFactory;
44cdf0e10cSrcweir 	TestHelper m_aTestHelper;
45cdf0e10cSrcweir 
RegressionTest_i29169( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter )46cdf0e10cSrcweir 	public RegressionTest_i29169( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter )
47cdf0e10cSrcweir 	{
48cdf0e10cSrcweir 		m_xMSF = xMSF;
49cdf0e10cSrcweir 		m_xStorageFactory = xStorageFactory;
50cdf0e10cSrcweir 		m_aTestHelper = new TestHelper( aLogWriter, "RegressionTest_i29169: " );
51cdf0e10cSrcweir 	}
52cdf0e10cSrcweir 
test()53cdf0e10cSrcweir     public boolean test()
54cdf0e10cSrcweir 	{
55cdf0e10cSrcweir 		try
56cdf0e10cSrcweir 		{
57cdf0e10cSrcweir 			XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
58cdf0e10cSrcweir 			if ( xTempFileStream == null )
59cdf0e10cSrcweir 				return false;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 			// create storage based on the temporary stream
62cdf0e10cSrcweir 			Object pArgs[] = new Object[2];
63cdf0e10cSrcweir 			pArgs[0] = (Object) xTempFileStream;
64cdf0e10cSrcweir 			pArgs[1] = new Integer( ElementModes.WRITE );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 			Object oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
67cdf0e10cSrcweir 			XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage );
68cdf0e10cSrcweir 			if ( xTempStorage == null )
69cdf0e10cSrcweir 			{
70cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create temporary storage representation!" );
71cdf0e10cSrcweir 				return false;
72cdf0e10cSrcweir 			}
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 			// open a new substorage
75cdf0e10cSrcweir 			XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
76cdf0e10cSrcweir 																	"SubStorage1",
77cdf0e10cSrcweir 																	ElementModes.WRITE );
78cdf0e10cSrcweir 			if ( xTempSubStorage == null )
79cdf0e10cSrcweir 			{
80cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
81cdf0e10cSrcweir 				return false;
82cdf0e10cSrcweir 			}
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 			byte pBytes1[] = { 1, 1, 1, 1, 1 };
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
87cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) )
88cdf0e10cSrcweir 				return false;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 			// open a new substorage in the existing substorage
91cdf0e10cSrcweir 			XStorage xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage,
92cdf0e10cSrcweir 																		"SubSubStorage1",
93cdf0e10cSrcweir 																		ElementModes.WRITE );
94cdf0e10cSrcweir 			if ( xTempSubStorage == null )
95cdf0e10cSrcweir 			{
96cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
97cdf0e10cSrcweir 				return false;
98cdf0e10cSrcweir 			}
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 			// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
101cdf0e10cSrcweir 			if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubSubStorage, "SubSubStream1", "MediaType2", true, pBytes1 ) )
102cdf0e10cSrcweir 				return false;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 			// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
105cdf0e10cSrcweir 			if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubSubStorage,
106cdf0e10cSrcweir 															"MediaType3",
107cdf0e10cSrcweir 															false,
108cdf0e10cSrcweir 															ElementModes.WRITE ) )
109cdf0e10cSrcweir 				return false;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 			// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
113cdf0e10cSrcweir 			if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage,
114cdf0e10cSrcweir 															"MediaType4",
115cdf0e10cSrcweir 															false,
116cdf0e10cSrcweir 															ElementModes.WRITE ) )
117cdf0e10cSrcweir 				return false;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 			// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
120cdf0e10cSrcweir 			if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage,
121cdf0e10cSrcweir 															"MediaType5",
122cdf0e10cSrcweir 															true,
123cdf0e10cSrcweir 															ElementModes.WRITE ) )
124cdf0e10cSrcweir 				return false;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 			// ================================================
127cdf0e10cSrcweir 			// commit the storages, and check the renaming in all stages
128cdf0e10cSrcweir 			// ================================================
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 			// rename the storage before it is commited
131cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage1", "SubSubStorage2" ) )
132cdf0e10cSrcweir 				return false;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 			// rename the stream
135cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream1", "SubStream2" ) )
136cdf0e10cSrcweir 				return false;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 			// commit lowlevel substorage first
139cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubSubStorage ) )
140cdf0e10cSrcweir 				return false;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 			// rename the storage after it is commited
143cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage2", "SubSubStorage3" ) )
144cdf0e10cSrcweir 				return false;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 			// rename the stream one more time
147cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream2", "SubStream3" ) )
148cdf0e10cSrcweir 				return false;
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 			// commit substorage
151cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
152cdf0e10cSrcweir 				return false;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 			// rename the storage after it`s parent is commited
155cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage3", "SubSubStorage4" ) )
156cdf0e10cSrcweir 				return false;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 			// rename the stream after it`s parent is commited
159cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream3", "SubStream4" ) )
160cdf0e10cSrcweir 				return false;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 			// commit substorage to let the renaming take place
163cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
164cdf0e10cSrcweir 				return false;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 			// commit the root storage so the contents must be stored now
167cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempStorage ) )
168cdf0e10cSrcweir 				return false;
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 			// rename the storage after the package is commited
171cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage4", "SubSubStorage5" ) )
172cdf0e10cSrcweir 				return false;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 			// rename the stream after it`s parent is commited
175cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream4", "SubStream5" ) )
176cdf0e10cSrcweir 				return false;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 			// commit substorage to let the renaming take place
179cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
180cdf0e10cSrcweir 				return false;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 			// commit the root storage so the contents must be stored now
183cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempStorage ) )
184cdf0e10cSrcweir 				return false;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 			// ================================================
187cdf0e10cSrcweir 			// dispose the storages
188cdf0e10cSrcweir 			// ================================================
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 			// dispose lowerest substorage
191cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempSubSubStorage ) )
192cdf0e10cSrcweir 				return false;
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 			// dispose substorage
195cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) )
196cdf0e10cSrcweir 				return false;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 			// dispose the temporary storage
199cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempStorage ) )
200cdf0e10cSrcweir 				return false;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 			// ================================================
203cdf0e10cSrcweir 			// create a new storage based on the stream and check the substreams and substorages
204cdf0e10cSrcweir 			// ================================================
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 			oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
207cdf0e10cSrcweir 			xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage );
208cdf0e10cSrcweir 			if ( xTempStorage == null )
209cdf0e10cSrcweir 			{
210cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create temporary storage representation!" );
211cdf0e10cSrcweir 				return false;
212cdf0e10cSrcweir 			}
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 			// open the substorage
215cdf0e10cSrcweir 			xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
216cdf0e10cSrcweir 															"SubStorage1",
217cdf0e10cSrcweir 															ElementModes.WRITE );
218cdf0e10cSrcweir 			if ( xTempSubStorage == null )
219cdf0e10cSrcweir 			{
220cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
221cdf0e10cSrcweir 				return false;
222cdf0e10cSrcweir 			}
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 			// open the lowlevel substorage
225cdf0e10cSrcweir 			xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage,
226cdf0e10cSrcweir 																		"SubSubStorage5",
227cdf0e10cSrcweir 																		ElementModes.WRITE );
228cdf0e10cSrcweir 			if ( xTempSubStorage == null )
229cdf0e10cSrcweir 			{
230cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
231cdf0e10cSrcweir 				return false;
232cdf0e10cSrcweir 			}
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 			// check the storages and streams
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStorageProperties( xTempSubSubStorage, "MediaType3", false, ElementModes.WRITE ) )
237cdf0e10cSrcweir 				return false;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStorageProperties( xTempSubStorage, "MediaType4", false, ElementModes.WRITE ) )
240cdf0e10cSrcweir 				return false;
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStorageProperties( xTempStorage, "MediaType5", true, ElementModes.WRITE ) )
243cdf0e10cSrcweir 				return false;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStream( xTempSubStorage, "SubStream5", "MediaType1", true, pBytes1 ) )
246cdf0e10cSrcweir 				return false;
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStream( xTempSubSubStorage, "SubSubStream1", "MediaType2", true, pBytes1 ) )
249cdf0e10cSrcweir 				return false;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 			// ================================================
252cdf0e10cSrcweir 			// rename the reopened storages and streams
253cdf0e10cSrcweir 			// ================================================
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 			// rename the storage before it is commited
256cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage5", "SubSubStorage6" ) )
257cdf0e10cSrcweir 				return false;
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 			// rename the stream
260cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream5", "SubStream6" ) )
261cdf0e10cSrcweir 				return false;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 			// commit lowlevel substorage first
264cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubSubStorage ) )
265cdf0e10cSrcweir 				return false;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 			// rename the storage after it is commited
268cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage6", "SubSubStorage7" ) )
269cdf0e10cSrcweir 				return false;
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 			// rename the stream one more time
272cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream6", "SubStream7" ) )
273cdf0e10cSrcweir 				return false;
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 			// commit substorage
276cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
277cdf0e10cSrcweir 				return false;
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 			// rename the storage after it`s parent is commited
280cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage7", "SubSubStorage8" ) )
281cdf0e10cSrcweir 				return false;
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 			// rename the stream after it`s parent is commited
284cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream7", "SubStream8" ) )
285cdf0e10cSrcweir 				return false;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 			// commit substorage to let the renaming take place
288cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
289cdf0e10cSrcweir 				return false;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 			// commit the root storage so the contents must be stored now
292cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempStorage ) )
293cdf0e10cSrcweir 				return false;
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 			// rename the storage after the package is commited
296cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubSubStorage8", "SubSubStorage9" ) )
297cdf0e10cSrcweir 				return false;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 			// rename the stream after it`s parent is commited
300cdf0e10cSrcweir 			if ( !m_aTestHelper.renameElement( xTempSubStorage, "SubStream8", "SubStream9" ) )
301cdf0e10cSrcweir 				return false;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 			// commit substorage to let the renaming take place
304cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
305cdf0e10cSrcweir 				return false;
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 			// commit the root storage so the contents must be stored now
308cdf0e10cSrcweir 			if ( !m_aTestHelper.commitStorage( xTempStorage ) )
309cdf0e10cSrcweir 				return false;
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 			// ================================================
312cdf0e10cSrcweir 			// dispose the storages
313cdf0e10cSrcweir 			// ================================================
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 			// dispose lowerest substorage
316cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempSubSubStorage ) )
317cdf0e10cSrcweir 				return false;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 			// dispose substorage
320cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) )
321cdf0e10cSrcweir 				return false;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 			// dispose the temporary storage
324cdf0e10cSrcweir 			if ( !m_aTestHelper.disposeStorage( xTempStorage ) )
325cdf0e10cSrcweir 				return false;
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 			// ================================================
329cdf0e10cSrcweir 			// create a new readonly storage based on the stream and check the contents
330cdf0e10cSrcweir 			// ================================================
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 			pArgs[1] = new Integer( ElementModes.READ );
333cdf0e10cSrcweir 			oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
334cdf0e10cSrcweir 			xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage );
335cdf0e10cSrcweir 			if ( xTempStorage == null )
336cdf0e10cSrcweir 			{
337cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create temporary storage representation!" );
338cdf0e10cSrcweir 				return false;
339cdf0e10cSrcweir 			}
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 			// open the substorage
342cdf0e10cSrcweir 			xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
343cdf0e10cSrcweir 															"SubStorage1",
344cdf0e10cSrcweir 															ElementModes.READ );
345cdf0e10cSrcweir 			if ( xTempSubStorage == null )
346cdf0e10cSrcweir 			{
347cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
348cdf0e10cSrcweir 				return false;
349cdf0e10cSrcweir 			}
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 			// open the lowlevel substorage
352cdf0e10cSrcweir 			xTempSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage,
353cdf0e10cSrcweir 																		"SubSubStorage9",
354cdf0e10cSrcweir 																		ElementModes.READ );
355cdf0e10cSrcweir 			if ( xTempSubStorage == null )
356cdf0e10cSrcweir 			{
357cdf0e10cSrcweir 				m_aTestHelper.Error( "Can't create substorage!" );
358cdf0e10cSrcweir 				return false;
359cdf0e10cSrcweir 			}
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 			// check the storages and streams
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStorageProperties( xTempSubSubStorage, "MediaType3", false, ElementModes.READ ) )
364cdf0e10cSrcweir 				return false;
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStorageProperties( xTempSubStorage, "MediaType4", false, ElementModes.READ ) )
367cdf0e10cSrcweir 				return false;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStorageProperties( xTempStorage, "MediaType5", true, ElementModes.READ ) )
370cdf0e10cSrcweir 				return false;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStream( xTempSubStorage, "SubStream9", "MediaType1", true, pBytes1 ) )
373cdf0e10cSrcweir 				return false;
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 			if ( !m_aTestHelper.checkStream( xTempSubSubStorage, "SubSubStream1", "MediaType2", true, pBytes1 ) )
376cdf0e10cSrcweir 				return false;
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 			// the storage is based on the temporary stream so it can be left undisposed, since it does not lock
379cdf0e10cSrcweir 			// any resource, later the garbage collector will release the object and it must die by refcount
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 			return true;
382cdf0e10cSrcweir 		}
383cdf0e10cSrcweir 		catch( Exception e )
384cdf0e10cSrcweir 		{
385cdf0e10cSrcweir 			m_aTestHelper.Error( "Exception: " + e );
386cdf0e10cSrcweir 			return false;
387cdf0e10cSrcweir 		}
388cdf0e10cSrcweir     }
389cdf0e10cSrcweir }
390cdf0e10cSrcweir 
391