1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 package complex.storages;
28 
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.lang.XMultiComponentFactory;
31 import com.sun.star.connection.XConnector;
32 import com.sun.star.connection.XConnection;
33 
34 import com.sun.star.bridge.XUnoUrlResolver;
35 import com.sun.star.uno.UnoRuntime;
36 import com.sun.star.uno.XInterface;
37 import com.sun.star.uno.XNamingService;
38 import com.sun.star.uno.XComponentContext;
39 
40 import com.sun.star.container.*;
41 import com.sun.star.beans.*;
42 import com.sun.star.lang.*;
43 
44 import complexlib.ComplexTestCase;
45 
46 import complex.storages.*;
47 
48 import util.utils;
49 import java.util.*;
50 import java.io.*;
51 
52 /* This unit test for storage objects is designed to
53  * test most important statements from storage service
54  * specification.
55  *
56  * Regression tests are added to extend the tested
57  * functionalities.
58  */
59 public class StorageUnitTest  extends ComplexTestCase
60 {
61 	private XMultiServiceFactory m_xMSF = null;
62 	private XSingleServiceFactory m_xStorageFactory = null;
63 
64     public String[] getTestMethodNames()
65 	{
66         return new String[] {
67 								"ExecuteTest01",
68 								"ExecuteTest02",
69 								"ExecuteTest03",
70 								"ExecuteTest04",
71 								"ExecuteTest05",
72 								"ExecuteTest06",
73 								"ExecuteTest07",
74 								"ExecuteTest08",
75 								"ExecuteTest09",
76 								"ExecuteTest10",
77 								"ExecuteTest11",
78 								"ExecuteTest12",
79 								"ExecuteTest13",
80 								"ExecuteTest14",
81 								"ExecuteTest15",
82 								"ExecuteTest16",
83 								"ExecuteTest17",
84 								"ExecuteTest18",
85 								"ExecuteRegressionTest_114358",
86 								"ExecuteRegressionTest_i29169",
87 								"ExecuteRegressionTest_i30400",
88 								"ExecuteRegressionTest_i29321",
89 								"ExecuteRegressionTest_i30677",
90 								"ExecuteRegressionTest_i27773",
91 								"ExecuteRegressionTest_i46848",
92 								"ExecuteRegressionTest_i55821",
93 								"ExecuteRegressionTest_i35095",
94 								"ExecuteRegressionTest_i49755",
95 								"ExecuteRegressionTest_i59886",
96 								"ExecuteRegressionTest_i61909",
97 								"ExecuteRegressionTest_i84234",
98 								"ExecuteRegressionTest_125919"
99                                 };
100     }
101 
102     public String getTestObjectName()
103 	{
104         return "StorageUnitTest";
105     }
106 
107     public void before()
108 	{
109         m_xMSF = (XMultiServiceFactory)param.getMSF();
110 		if ( m_xMSF == null )
111 		{
112 			failed( "Can't create service factory!" );
113 			return;
114 		}
115 
116 		try {
117 			Object oStorageFactory = m_xMSF.createInstance( "com.sun.star.embed.StorageFactory" );
118 			m_xStorageFactory = (XSingleServiceFactory)UnoRuntime.queryInterface( XSingleServiceFactory.class,
119 																				oStorageFactory );
120 		}
121 		catch( Exception e )
122 		{
123 			failed( "Can't create storage factory!" );
124 			return;
125 		}
126 
127 		if ( m_xStorageFactory == null )
128 		{
129 			failed( "Can't create service factory!" );
130 			return;
131 		}
132     }
133 
134 	public void ExecuteTest01()
135 	{
136 		StorageTest aTest = new Test01( m_xMSF, m_xStorageFactory, log );
137 		assure( "Test01 failed!", aTest.test() );
138 	}
139 
140 	public void ExecuteTest02()
141 	{
142 		StorageTest aTest = new Test02( m_xMSF, m_xStorageFactory, log );
143 		assure( "Test02 failed!", aTest.test() );
144 	}
145 
146 	public void ExecuteTest03()
147 	{
148 		StorageTest aTest = new Test03( m_xMSF, m_xStorageFactory, log );
149 		assure( "Test03 failed!", aTest.test() );
150 	}
151 
152 	public void ExecuteTest04()
153 	{
154 		StorageTest aTest = new Test04( m_xMSF, m_xStorageFactory, log );
155 		assure( "Test04 failed!", aTest.test() );
156 	}
157 
158 	public void ExecuteTest05()
159 	{
160 		StorageTest aTest = new Test05( m_xMSF, m_xStorageFactory, log );
161 		assure( "Test05 failed!", aTest.test() );
162 	}
163 
164 	public void ExecuteTest06()
165 	{
166 		StorageTest aTest = new Test06( m_xMSF, m_xStorageFactory, log );
167 		assure( "Test06 failed!", aTest.test() );
168 	}
169 
170 	public void ExecuteTest07()
171 	{
172 		StorageTest aTest = new Test07( m_xMSF, m_xStorageFactory, log );
173 		assure( "Test07 failed!", aTest.test() );
174 	}
175 
176 	public void ExecuteTest08()
177 	{
178 		StorageTest aTest = new Test08( m_xMSF, m_xStorageFactory, log );
179 		assure( "Test08 failed!", aTest.test() );
180 	}
181 
182 	public void ExecuteTest09()
183 	{
184 		StorageTest aTest = new Test09( m_xMSF, m_xStorageFactory, log );
185 		assure( "Test09 failed!", aTest.test() );
186 	}
187 
188 	public void ExecuteTest10()
189 	{
190 		StorageTest aTest = new Test10( m_xMSF, m_xStorageFactory, log );
191 		assure( "Test10 failed!", aTest.test() );
192 	}
193 
194 	public void ExecuteTest11()
195 	{
196 		StorageTest aTest = new Test11( m_xMSF, m_xStorageFactory, log );
197 		assure( "Test11 failed!", aTest.test() );
198 	}
199 
200 	public void ExecuteTest12()
201 	{
202 		StorageTest aTest = new Test12( m_xMSF, m_xStorageFactory, log );
203 		assure( "Test12 failed!", aTest.test() );
204 	}
205 
206 	public void ExecuteTest13()
207 	{
208 		StorageTest aTest = new Test13( m_xMSF, m_xStorageFactory, log );
209 		assure( "Test13 failed!", aTest.test() );
210 	}
211 
212 	public void ExecuteTest14()
213 	{
214 		StorageTest aTest = new Test14( m_xMSF, m_xStorageFactory, log );
215 		assure( "Test14 failed!", aTest.test() );
216 	}
217 
218 	public void ExecuteTest15()
219 	{
220 		StorageTest aTest = new Test15( m_xMSF, m_xStorageFactory, log );
221 		assure( "Test15 failed!", aTest.test() );
222 	}
223 
224 	public void ExecuteTest16()
225 	{
226 		StorageTest aTest = new Test16( m_xMSF, m_xStorageFactory, log );
227 		assure( "Test16 failed!", aTest.test() );
228 	}
229 
230 	public void ExecuteTest17()
231 	{
232 		StorageTest aTest = new Test17( m_xMSF, m_xStorageFactory, log );
233 		assure( "Test17 failed!", aTest.test() );
234 	}
235 
236 	public void ExecuteTest18()
237 	{
238 		StorageTest aTest = new Test18( m_xMSF, m_xStorageFactory, log );
239 		assure( "Test18 failed!", aTest.test() );
240 	}
241 
242 	public void ExecuteRegressionTest_114358()
243 	{
244 		StorageTest aTest = new RegressionTest_114358( m_xMSF, m_xStorageFactory, log );
245 		assure( "RegressionTest_114358 failed!", aTest.test() );
246 	}
247 
248 	public void ExecuteRegressionTest_i29169()
249 	{
250 		StorageTest aTest = new RegressionTest_i29169( m_xMSF, m_xStorageFactory, log );
251 		assure( "RegressionTest_i29169 failed!", aTest.test() );
252 	}
253 
254 	public void ExecuteRegressionTest_i30400()
255 	{
256 		StorageTest aTest = new RegressionTest_i30400( m_xMSF, m_xStorageFactory, log );
257 		assure( "RegressionTest_i30400 failed!", aTest.test() );
258 	}
259 
260 	public void ExecuteRegressionTest_i29321()
261 	{
262 		StorageTest aTest = new RegressionTest_i29321( m_xMSF, m_xStorageFactory, log );
263 		assure( "RegressionTest_i29321 failed!", aTest.test() );
264 	}
265 
266 	public void ExecuteRegressionTest_i30677()
267 	{
268 		StorageTest aTest = new RegressionTest_i30677( m_xMSF, m_xStorageFactory, log );
269 		assure( "RegressionTest_i30677 failed!", aTest.test() );
270 	}
271 
272 	public void ExecuteRegressionTest_i27773()
273 	{
274 		StorageTest aTest = new RegressionTest_i27773( m_xMSF, m_xStorageFactory, log );
275 		assure( "RegressionTest_i27773 failed!", aTest.test() );
276 	}
277 
278 	public void ExecuteRegressionTest_i46848()
279 	{
280 		StorageTest aTest = new RegressionTest_i46848( m_xMSF, m_xStorageFactory, log );
281 		assure( "RegressionTest_i46848 failed!", aTest.test() );
282 	}
283 
284 	public void ExecuteRegressionTest_i55821()
285 	{
286 		StorageTest aTest = new RegressionTest_i55821( m_xMSF, m_xStorageFactory, log );
287 		assure( "RegressionTest_i55821 failed!", aTest.test() );
288 	}
289 
290 	public void ExecuteRegressionTest_i35095()
291 	{
292 		StorageTest aTest = new RegressionTest_i35095( m_xMSF, m_xStorageFactory, log );
293 		assure( "RegressionTest_i35095 failed!", aTest.test() );
294 	}
295 
296 	public void ExecuteRegressionTest_i49755()
297 	{
298 		StorageTest aTest = new RegressionTest_i49755( m_xMSF, m_xStorageFactory, log );
299 		assure( "RegressionTest_i49755 failed!", aTest.test() );
300 	}
301 
302 	public void ExecuteRegressionTest_i59886()
303 	{
304 		StorageTest aTest = new RegressionTest_i59886( m_xMSF, m_xStorageFactory, log );
305 		assure( "RegressionTest_i59886 failed!", aTest.test() );
306 	}
307 
308 	public void ExecuteRegressionTest_i61909()
309 	{
310 		StorageTest aTest = new RegressionTest_i61909( m_xMSF, m_xStorageFactory, log );
311 		assure( "RegressionTest_i61909 failed!", aTest.test() );
312 	}
313 
314 	public void ExecuteRegressionTest_i84234()
315 	{
316 		StorageTest aTest = new RegressionTest_i84234( m_xMSF, m_xStorageFactory, log );
317 		assure( "RegressionTest_i84234 failed!", aTest.test() );
318 	}
319 
320 	public void ExecuteRegressionTest_125919()
321 	{
322 		StorageTest aTest = new RegressionTest_125919( m_xMSF, m_xStorageFactory, log );
323 		assure( "RegressionTest_125919 failed!", aTest.test() );
324 	}
325 }
326 
327