1*a740f2aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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 
22*a740f2aaSAndrew Rist 
23cdf0e10cSrcweir package complex.storages;
24cdf0e10cSrcweir 
25cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
26cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory;
27cdf0e10cSrcweir import com.sun.star.connection.XConnector;
28cdf0e10cSrcweir import com.sun.star.connection.XConnection;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir import com.sun.star.bridge.XUnoUrlResolver;
31cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
32cdf0e10cSrcweir import com.sun.star.uno.XInterface;
33cdf0e10cSrcweir import com.sun.star.uno.XNamingService;
34cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir import com.sun.star.container.*;
37cdf0e10cSrcweir import com.sun.star.beans.*;
38cdf0e10cSrcweir import com.sun.star.lang.*;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir import complexlib.ComplexTestCase;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir import complex.storages.*;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir import util.utils;
45cdf0e10cSrcweir import java.util.*;
46cdf0e10cSrcweir import java.io.*;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir /* This unit test for storage objects is designed to
49cdf0e10cSrcweir  * test most important statements from storage service
50cdf0e10cSrcweir  * specification.
51cdf0e10cSrcweir  *
52cdf0e10cSrcweir  * Regression tests are added to extend the tested
53cdf0e10cSrcweir  * functionalities.
54cdf0e10cSrcweir  */
55cdf0e10cSrcweir public class StorageUnitTest  extends ComplexTestCase
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	private XMultiServiceFactory m_xMSF = null;
58cdf0e10cSrcweir 	private XSingleServiceFactory m_xStorageFactory = null;
59cdf0e10cSrcweir 
getTestMethodNames()60cdf0e10cSrcweir     public String[] getTestMethodNames()
61cdf0e10cSrcweir 	{
62cdf0e10cSrcweir         return new String[] {
63cdf0e10cSrcweir 								"ExecuteTest01",
64cdf0e10cSrcweir 								"ExecuteTest02",
65cdf0e10cSrcweir 								"ExecuteTest03",
66cdf0e10cSrcweir 								"ExecuteTest04",
67cdf0e10cSrcweir 								"ExecuteTest05",
68cdf0e10cSrcweir 								"ExecuteTest06",
69cdf0e10cSrcweir 								"ExecuteTest07",
70cdf0e10cSrcweir 								"ExecuteTest08",
71cdf0e10cSrcweir 								"ExecuteTest09",
72cdf0e10cSrcweir 								"ExecuteTest10",
73cdf0e10cSrcweir 								"ExecuteTest11",
74cdf0e10cSrcweir 								"ExecuteTest12",
75cdf0e10cSrcweir 								"ExecuteTest13",
76cdf0e10cSrcweir 								"ExecuteTest14",
77cdf0e10cSrcweir 								"ExecuteTest15",
78cdf0e10cSrcweir 								"ExecuteTest16",
79cdf0e10cSrcweir 								"ExecuteTest17",
80cdf0e10cSrcweir 								"ExecuteTest18",
81cdf0e10cSrcweir 								"ExecuteRegressionTest_114358",
82cdf0e10cSrcweir 								"ExecuteRegressionTest_i29169",
83cdf0e10cSrcweir 								"ExecuteRegressionTest_i30400",
84cdf0e10cSrcweir 								"ExecuteRegressionTest_i29321",
85cdf0e10cSrcweir 								"ExecuteRegressionTest_i30677",
86cdf0e10cSrcweir 								"ExecuteRegressionTest_i27773",
87cdf0e10cSrcweir 								"ExecuteRegressionTest_i46848",
88cdf0e10cSrcweir 								"ExecuteRegressionTest_i55821",
89cdf0e10cSrcweir 								"ExecuteRegressionTest_i35095",
90cdf0e10cSrcweir 								"ExecuteRegressionTest_i49755",
91cdf0e10cSrcweir 								"ExecuteRegressionTest_i59886",
92cdf0e10cSrcweir 								"ExecuteRegressionTest_i61909",
93cdf0e10cSrcweir 								"ExecuteRegressionTest_i84234",
94cdf0e10cSrcweir 								"ExecuteRegressionTest_125919"
95cdf0e10cSrcweir                                 };
96cdf0e10cSrcweir     }
97cdf0e10cSrcweir 
getTestObjectName()98cdf0e10cSrcweir     public String getTestObjectName()
99cdf0e10cSrcweir 	{
100cdf0e10cSrcweir         return "StorageUnitTest";
101cdf0e10cSrcweir     }
102cdf0e10cSrcweir 
before()103cdf0e10cSrcweir     public void before()
104cdf0e10cSrcweir 	{
105cdf0e10cSrcweir         m_xMSF = (XMultiServiceFactory)param.getMSF();
106cdf0e10cSrcweir 		if ( m_xMSF == null )
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			failed( "Can't create service factory!" );
109cdf0e10cSrcweir 			return;
110cdf0e10cSrcweir 		}
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		try {
113cdf0e10cSrcweir 			Object oStorageFactory = m_xMSF.createInstance( "com.sun.star.embed.StorageFactory" );
114cdf0e10cSrcweir 			m_xStorageFactory = (XSingleServiceFactory)UnoRuntime.queryInterface( XSingleServiceFactory.class,
115cdf0e10cSrcweir 																				oStorageFactory );
116cdf0e10cSrcweir 		}
117cdf0e10cSrcweir 		catch( Exception e )
118cdf0e10cSrcweir 		{
119cdf0e10cSrcweir 			failed( "Can't create storage factory!" );
120cdf0e10cSrcweir 			return;
121cdf0e10cSrcweir 		}
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 		if ( m_xStorageFactory == null )
124cdf0e10cSrcweir 		{
125cdf0e10cSrcweir 			failed( "Can't create service factory!" );
126cdf0e10cSrcweir 			return;
127cdf0e10cSrcweir 		}
128cdf0e10cSrcweir     }
129cdf0e10cSrcweir 
ExecuteTest01()130cdf0e10cSrcweir 	public void ExecuteTest01()
131cdf0e10cSrcweir 	{
132cdf0e10cSrcweir 		StorageTest aTest = new Test01( m_xMSF, m_xStorageFactory, log );
133cdf0e10cSrcweir 		assure( "Test01 failed!", aTest.test() );
134cdf0e10cSrcweir 	}
135cdf0e10cSrcweir 
ExecuteTest02()136cdf0e10cSrcweir 	public void ExecuteTest02()
137cdf0e10cSrcweir 	{
138cdf0e10cSrcweir 		StorageTest aTest = new Test02( m_xMSF, m_xStorageFactory, log );
139cdf0e10cSrcweir 		assure( "Test02 failed!", aTest.test() );
140cdf0e10cSrcweir 	}
141cdf0e10cSrcweir 
ExecuteTest03()142cdf0e10cSrcweir 	public void ExecuteTest03()
143cdf0e10cSrcweir 	{
144cdf0e10cSrcweir 		StorageTest aTest = new Test03( m_xMSF, m_xStorageFactory, log );
145cdf0e10cSrcweir 		assure( "Test03 failed!", aTest.test() );
146cdf0e10cSrcweir 	}
147cdf0e10cSrcweir 
ExecuteTest04()148cdf0e10cSrcweir 	public void ExecuteTest04()
149cdf0e10cSrcweir 	{
150cdf0e10cSrcweir 		StorageTest aTest = new Test04( m_xMSF, m_xStorageFactory, log );
151cdf0e10cSrcweir 		assure( "Test04 failed!", aTest.test() );
152cdf0e10cSrcweir 	}
153cdf0e10cSrcweir 
ExecuteTest05()154cdf0e10cSrcweir 	public void ExecuteTest05()
155cdf0e10cSrcweir 	{
156cdf0e10cSrcweir 		StorageTest aTest = new Test05( m_xMSF, m_xStorageFactory, log );
157cdf0e10cSrcweir 		assure( "Test05 failed!", aTest.test() );
158cdf0e10cSrcweir 	}
159cdf0e10cSrcweir 
ExecuteTest06()160cdf0e10cSrcweir 	public void ExecuteTest06()
161cdf0e10cSrcweir 	{
162cdf0e10cSrcweir 		StorageTest aTest = new Test06( m_xMSF, m_xStorageFactory, log );
163cdf0e10cSrcweir 		assure( "Test06 failed!", aTest.test() );
164cdf0e10cSrcweir 	}
165cdf0e10cSrcweir 
ExecuteTest07()166cdf0e10cSrcweir 	public void ExecuteTest07()
167cdf0e10cSrcweir 	{
168cdf0e10cSrcweir 		StorageTest aTest = new Test07( m_xMSF, m_xStorageFactory, log );
169cdf0e10cSrcweir 		assure( "Test07 failed!", aTest.test() );
170cdf0e10cSrcweir 	}
171cdf0e10cSrcweir 
ExecuteTest08()172cdf0e10cSrcweir 	public void ExecuteTest08()
173cdf0e10cSrcweir 	{
174cdf0e10cSrcweir 		StorageTest aTest = new Test08( m_xMSF, m_xStorageFactory, log );
175cdf0e10cSrcweir 		assure( "Test08 failed!", aTest.test() );
176cdf0e10cSrcweir 	}
177cdf0e10cSrcweir 
ExecuteTest09()178cdf0e10cSrcweir 	public void ExecuteTest09()
179cdf0e10cSrcweir 	{
180cdf0e10cSrcweir 		StorageTest aTest = new Test09( m_xMSF, m_xStorageFactory, log );
181cdf0e10cSrcweir 		assure( "Test09 failed!", aTest.test() );
182cdf0e10cSrcweir 	}
183cdf0e10cSrcweir 
ExecuteTest10()184cdf0e10cSrcweir 	public void ExecuteTest10()
185cdf0e10cSrcweir 	{
186cdf0e10cSrcweir 		StorageTest aTest = new Test10( m_xMSF, m_xStorageFactory, log );
187cdf0e10cSrcweir 		assure( "Test10 failed!", aTest.test() );
188cdf0e10cSrcweir 	}
189cdf0e10cSrcweir 
ExecuteTest11()190cdf0e10cSrcweir 	public void ExecuteTest11()
191cdf0e10cSrcweir 	{
192cdf0e10cSrcweir 		StorageTest aTest = new Test11( m_xMSF, m_xStorageFactory, log );
193cdf0e10cSrcweir 		assure( "Test11 failed!", aTest.test() );
194cdf0e10cSrcweir 	}
195cdf0e10cSrcweir 
ExecuteTest12()196cdf0e10cSrcweir 	public void ExecuteTest12()
197cdf0e10cSrcweir 	{
198cdf0e10cSrcweir 		StorageTest aTest = new Test12( m_xMSF, m_xStorageFactory, log );
199cdf0e10cSrcweir 		assure( "Test12 failed!", aTest.test() );
200cdf0e10cSrcweir 	}
201cdf0e10cSrcweir 
ExecuteTest13()202cdf0e10cSrcweir 	public void ExecuteTest13()
203cdf0e10cSrcweir 	{
204cdf0e10cSrcweir 		StorageTest aTest = new Test13( m_xMSF, m_xStorageFactory, log );
205cdf0e10cSrcweir 		assure( "Test13 failed!", aTest.test() );
206cdf0e10cSrcweir 	}
207cdf0e10cSrcweir 
ExecuteTest14()208cdf0e10cSrcweir 	public void ExecuteTest14()
209cdf0e10cSrcweir 	{
210cdf0e10cSrcweir 		StorageTest aTest = new Test14( m_xMSF, m_xStorageFactory, log );
211cdf0e10cSrcweir 		assure( "Test14 failed!", aTest.test() );
212cdf0e10cSrcweir 	}
213cdf0e10cSrcweir 
ExecuteTest15()214cdf0e10cSrcweir 	public void ExecuteTest15()
215cdf0e10cSrcweir 	{
216cdf0e10cSrcweir 		StorageTest aTest = new Test15( m_xMSF, m_xStorageFactory, log );
217cdf0e10cSrcweir 		assure( "Test15 failed!", aTest.test() );
218cdf0e10cSrcweir 	}
219cdf0e10cSrcweir 
ExecuteTest16()220cdf0e10cSrcweir 	public void ExecuteTest16()
221cdf0e10cSrcweir 	{
222cdf0e10cSrcweir 		StorageTest aTest = new Test16( m_xMSF, m_xStorageFactory, log );
223cdf0e10cSrcweir 		assure( "Test16 failed!", aTest.test() );
224cdf0e10cSrcweir 	}
225cdf0e10cSrcweir 
ExecuteTest17()226cdf0e10cSrcweir 	public void ExecuteTest17()
227cdf0e10cSrcweir 	{
228cdf0e10cSrcweir 		StorageTest aTest = new Test17( m_xMSF, m_xStorageFactory, log );
229cdf0e10cSrcweir 		assure( "Test17 failed!", aTest.test() );
230cdf0e10cSrcweir 	}
231cdf0e10cSrcweir 
ExecuteTest18()232cdf0e10cSrcweir 	public void ExecuteTest18()
233cdf0e10cSrcweir 	{
234cdf0e10cSrcweir 		StorageTest aTest = new Test18( m_xMSF, m_xStorageFactory, log );
235cdf0e10cSrcweir 		assure( "Test18 failed!", aTest.test() );
236cdf0e10cSrcweir 	}
237cdf0e10cSrcweir 
ExecuteRegressionTest_114358()238cdf0e10cSrcweir 	public void ExecuteRegressionTest_114358()
239cdf0e10cSrcweir 	{
240cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_114358( m_xMSF, m_xStorageFactory, log );
241cdf0e10cSrcweir 		assure( "RegressionTest_114358 failed!", aTest.test() );
242cdf0e10cSrcweir 	}
243cdf0e10cSrcweir 
ExecuteRegressionTest_i29169()244cdf0e10cSrcweir 	public void ExecuteRegressionTest_i29169()
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i29169( m_xMSF, m_xStorageFactory, log );
247cdf0e10cSrcweir 		assure( "RegressionTest_i29169 failed!", aTest.test() );
248cdf0e10cSrcweir 	}
249cdf0e10cSrcweir 
ExecuteRegressionTest_i30400()250cdf0e10cSrcweir 	public void ExecuteRegressionTest_i30400()
251cdf0e10cSrcweir 	{
252cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i30400( m_xMSF, m_xStorageFactory, log );
253cdf0e10cSrcweir 		assure( "RegressionTest_i30400 failed!", aTest.test() );
254cdf0e10cSrcweir 	}
255cdf0e10cSrcweir 
ExecuteRegressionTest_i29321()256cdf0e10cSrcweir 	public void ExecuteRegressionTest_i29321()
257cdf0e10cSrcweir 	{
258cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i29321( m_xMSF, m_xStorageFactory, log );
259cdf0e10cSrcweir 		assure( "RegressionTest_i29321 failed!", aTest.test() );
260cdf0e10cSrcweir 	}
261cdf0e10cSrcweir 
ExecuteRegressionTest_i30677()262cdf0e10cSrcweir 	public void ExecuteRegressionTest_i30677()
263cdf0e10cSrcweir 	{
264cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i30677( m_xMSF, m_xStorageFactory, log );
265cdf0e10cSrcweir 		assure( "RegressionTest_i30677 failed!", aTest.test() );
266cdf0e10cSrcweir 	}
267cdf0e10cSrcweir 
ExecuteRegressionTest_i27773()268cdf0e10cSrcweir 	public void ExecuteRegressionTest_i27773()
269cdf0e10cSrcweir 	{
270cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i27773( m_xMSF, m_xStorageFactory, log );
271cdf0e10cSrcweir 		assure( "RegressionTest_i27773 failed!", aTest.test() );
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir 
ExecuteRegressionTest_i46848()274cdf0e10cSrcweir 	public void ExecuteRegressionTest_i46848()
275cdf0e10cSrcweir 	{
276cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i46848( m_xMSF, m_xStorageFactory, log );
277cdf0e10cSrcweir 		assure( "RegressionTest_i46848 failed!", aTest.test() );
278cdf0e10cSrcweir 	}
279cdf0e10cSrcweir 
ExecuteRegressionTest_i55821()280cdf0e10cSrcweir 	public void ExecuteRegressionTest_i55821()
281cdf0e10cSrcweir 	{
282cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i55821( m_xMSF, m_xStorageFactory, log );
283cdf0e10cSrcweir 		assure( "RegressionTest_i55821 failed!", aTest.test() );
284cdf0e10cSrcweir 	}
285cdf0e10cSrcweir 
ExecuteRegressionTest_i35095()286cdf0e10cSrcweir 	public void ExecuteRegressionTest_i35095()
287cdf0e10cSrcweir 	{
288cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i35095( m_xMSF, m_xStorageFactory, log );
289cdf0e10cSrcweir 		assure( "RegressionTest_i35095 failed!", aTest.test() );
290cdf0e10cSrcweir 	}
291cdf0e10cSrcweir 
ExecuteRegressionTest_i49755()292cdf0e10cSrcweir 	public void ExecuteRegressionTest_i49755()
293cdf0e10cSrcweir 	{
294cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i49755( m_xMSF, m_xStorageFactory, log );
295cdf0e10cSrcweir 		assure( "RegressionTest_i49755 failed!", aTest.test() );
296cdf0e10cSrcweir 	}
297cdf0e10cSrcweir 
ExecuteRegressionTest_i59886()298cdf0e10cSrcweir 	public void ExecuteRegressionTest_i59886()
299cdf0e10cSrcweir 	{
300cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i59886( m_xMSF, m_xStorageFactory, log );
301cdf0e10cSrcweir 		assure( "RegressionTest_i59886 failed!", aTest.test() );
302cdf0e10cSrcweir 	}
303cdf0e10cSrcweir 
ExecuteRegressionTest_i61909()304cdf0e10cSrcweir 	public void ExecuteRegressionTest_i61909()
305cdf0e10cSrcweir 	{
306cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i61909( m_xMSF, m_xStorageFactory, log );
307cdf0e10cSrcweir 		assure( "RegressionTest_i61909 failed!", aTest.test() );
308cdf0e10cSrcweir 	}
309cdf0e10cSrcweir 
ExecuteRegressionTest_i84234()310cdf0e10cSrcweir 	public void ExecuteRegressionTest_i84234()
311cdf0e10cSrcweir 	{
312cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_i84234( m_xMSF, m_xStorageFactory, log );
313cdf0e10cSrcweir 		assure( "RegressionTest_i84234 failed!", aTest.test() );
314cdf0e10cSrcweir 	}
315cdf0e10cSrcweir 
ExecuteRegressionTest_125919()316cdf0e10cSrcweir 	public void ExecuteRegressionTest_125919()
317cdf0e10cSrcweir 	{
318cdf0e10cSrcweir 		StorageTest aTest = new RegressionTest_125919( m_xMSF, m_xStorageFactory, log );
319cdf0e10cSrcweir 		assure( "RegressionTest_125919 failed!", aTest.test() );
320cdf0e10cSrcweir 	}
321cdf0e10cSrcweir }
322cdf0e10cSrcweir 
323