1   /*
2    * Created on 2005-9-10
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package org.huihoo.jfox.soaf.services.persistence;
8   
9   import junit.framework.TestCase;
10  
11  import org.huihoo.jfox.soaf.container.ServiceFactory;
12  import org.huihoo.jfox.soaf.container.ServiceLoader;
13  import org.huihoo.jfox.soaf.exception.DAOException;
14  import org.huihoo.jfox.soaf.services.jdbc.DataSourceService;
15  
16  import com.jenkov.mrpersister.itf.PersistenceException;
17  
18  /***
19   * @author peter.cheng
20   * 
21   * TODO To change the template for this generated type comment go to Window -
22   * Preferences - Java - Code Style - Code Templates
23   */
24  public class MrPersisterServiceImplTest extends TestCase {
25  
26  	private MrPersisterService mrPersisterService;
27  	
28  	private DataSourceService dsService;
29  
30  	private ServiceLoader sl = ServiceLoader.getInstance();
31  
32  	private ServiceFactory sf = ServiceFactory.getInstance();
33  
34  	private final static String SQL = "CREATE TABLE employees (employee_id varchar(255) NOT NULL,"
35  		                              + "name varchar(255) NOT NULL, job_title varchar(255) NOT NULL,"
36  									  + "job_description varchar(255) default NULL, employed_since"
37  									  + " datetime, monthly_salary int(4), PRIMARY KEY  (employee_id))";
38  	
39  	private final static String DROP_TABLE_SQL = "drop table employees";
40  	
41  	/*
42  	 * @see TestCase#setUp()
43  	 */
44  	protected void setUp() throws Exception {
45  		super.setUp();
46  		if (!sl.isServiceLoaded()) {
47  			sl.initService("jfoxsoaf-config.xml");
48  		}
49  		mrPersisterService = (MrPersisterService) sf
50  				.getService(MrPersisterService.class);
51  		dsService = (DataSourceService) sf.getService(DataSourceService.class);
52  		//super.assertNotNull(dsService.getDataSource(null));
53  		mrPersisterService.setDataSource(dsService.getDataSource(null));
54  	}
55  
56  	/*
57  	 * @see TestCase#tearDown()
58  	 */
59  	protected void tearDown() throws Exception {
60  		super.tearDown();
61  	}
62  
63  	public void testSetDataSource() {
64  	}
65  
66  	/*
67  	 * Class under test for int delete(Connection, Object)
68  	 */
69  	public void testDeleteConnectionObject() {
70  	}
71  
72  	/*
73  	 * Class under test for int delete(Object)
74  	 */
75  	public void testDeleteObject() {
76  	}
77  
78  	/*
79  	 * Class under test for int delete(Object, Object)
80  	 */
81  	public void testDeleteObjectObject() {
82  	}
83  
84  	/*
85  	 * Class under test for int delete(Connection, Object, Object)
86  	 */
87  	public void testDeleteConnectionObjectObject() {
88  	}
89  
90  	/*
91  	 * Class under test for int[] deleteBatch(Collection)
92  	 */
93  	public void testDeleteBatchCollection() {
94  	}
95  
96  	/*
97  	 * Class under test for int[] deleteBatch(Connection, Collection)
98  	 */
99  	public void testDeleteBatchConnectionCollection() {
100 	}
101 
102 	/*
103 	 * Class under test for int[] deleteBatch(Connection, Object, Collection)
104 	 */
105 	public void testDeleteBatchConnectionObjectCollection() {
106 	}
107 
108 	/*
109 	 * Class under test for int[] deleteBatch(Object, Collection)
110 	 */
111 	public void testDeleteBatchObjectCollection() {
112 	}
113 
114 	/*
115 	 * Class under test for int deleteByPrimaryKey(Connection, Object, Object)
116 	 */
117 	public void testDeleteByPrimaryKeyConnectionObjectObject() {
118 	}
119 
120 	/*
121 	 * Class under test for int deleteByPrimaryKey(Object, Object)
122 	 */
123 	public void testDeleteByPrimaryKeyObjectObject() {
124 	}
125 
126 	/*
127 	 * Class under test for int[] deleteBatchByPrimaryKeys(Object, Collection)
128 	 */
129 	public void testDeleteBatchByPrimaryKeysObjectCollection() {
130 	}
131 
132 	/*
133 	 * Class under test for int[] deleteBatchByPrimaryKeys(Connection, Object,
134 	 * Collection)
135 	 */
136 	public void testDeleteBatchByPrimaryKeysConnectionObjectCollection() {
137 	}
138 
139 	/*
140 	 * Class under test for int executeUpdate(String, Collection)
141 	 */
142 	public void testExecuteUpdateStringCollection() {
143 	}
144 
145 	/*
146 	 * Class under test for int executeUpdate(Connection, String, Collection)
147 	 */
148 	public void testExecuteUpdateConnectionStringCollection() {
149 	}
150 
151 	/*
152 	 * Class under test for int executeUpdate(String, Object[])
153 	 */
154 	public void testExecuteUpdateStringObjectArray() {
155 	}
156 
157 	/*
158 	 * Class under test for int executeUpdate(Connection, String, Object[])
159 	 */
160 	public void testExecuteUpdateConnectionStringObjectArray() {
161 	}
162 
163 	/*
164 	 * Class under test for int executeUpdate(String)
165 	 */
166 	public void testExecuteUpdateString() {
167 		
168 		try {
169 			mrPersisterService.executeUpdate(DROP_TABLE_SQL);
170 		} catch (DAOException e1) {
171 			e1.printStackTrace();
172 		} catch (PersistenceException e1) {
173 			e1.printStackTrace();
174 		}
175 		
176 		try {
177 			mrPersisterService.executeUpdate(SQL);
178 		} catch (DAOException e) {			
179 			e.printStackTrace();
180 		} catch (PersistenceException e) {
181 			e.printStackTrace();
182 		}
183 		
184 		
185 	}
186 
187 	/*
188 	 * Class under test for int executeUpdate(Connection, String)
189 	 */
190 	public void testExecuteUpdateConnectionString() {
191 	}
192 
193 	/*
194 	 * Class under test for int insert(Object, Object)
195 	 */
196 	public void testInsertObjectObject() {
197 	}
198 
199 	/*
200 	 * Class under test for int insert(Connection, Object, Object)
201 	 */
202 	public void testInsertConnectionObjectObject() {
203 	}
204 
205 	/*
206 	 * Class under test for int insert(Object)
207 	 */
208 	public void testInsertObject() {
209 	}
210 
211 	/*
212 	 * Class under test for int insert(Connection, Object)
213 	 */
214 	public void testInsertConnectionObject() {
215 	}
216 
217 	/*
218 	 * Class under test for int[] insertBatch(Collection)
219 	 */
220 	public void testInsertBatchCollection() {
221 	}
222 
223 	/*
224 	 * Class under test for int[] insertBatch(Object, Collection)
225 	 */
226 	public void testInsertBatchObjectCollection() {
227 	}
228 
229 	/*
230 	 * Class under test for int[] insertBatch(Connection, Collection)
231 	 */
232 	public void testInsertBatchConnectionCollection() {
233 	}
234 
235 	/*
236 	 * Class under test for Object read(Object, PreparedStatement)
237 	 */
238 	public void testReadObjectPreparedStatement() {
239 	}
240 
241 	/*
242 	 * Class under test for Object read(Connection, Object, PreparedStatement)
243 	 */
244 	public void testReadConnectionObjectPreparedStatement() {
245 	}
246 
247 	/*
248 	 * Class under test for Object read(Object, ResultSet)
249 	 */
250 	public void testReadObjectResultSet() {
251 	}
252 
253 	/*
254 	 * Class under test for Object read(Connection, Object, ResultSet)
255 	 */
256 	public void testReadConnectionObjectResultSet() {
257 	}
258 
259 	/*
260 	 * Class under test for Object read(Object, Statement, String)
261 	 */
262 	public void testReadObjectStatementString() {
263 	}
264 
265 	/*
266 	 * Class under test for Object read(Connection, Object, Statement, String)
267 	 */
268 	public void testReadConnectionObjectStatementString() {
269 	}
270 
271 	/*
272 	 * Class under test for Object read(Object, String, Collection)
273 	 */
274 	public void testReadObjectStringCollection() {
275 	}
276 
277 	/*
278 	 * Class under test for Object read(Connection, Object, String, Collection)
279 	 */
280 	public void testReadConnectionObjectStringCollection() {
281 	}
282 
283 	/*
284 	 * Class under test for Object read(Object, String, Object[])
285 	 */
286 	public void testReadObjectStringObjectArray() {
287 	}
288 
289 	/*
290 	 * Class under test for Object read(Connection, Object, String, Object[])
291 	 */
292 	public void testReadConnectionObjectStringObjectArray() {
293 	}
294 
295 	/*
296 	 * Class under test for Object read(Object, String)
297 	 */
298 	public void testReadObjectString() {
299 	}
300 
301 	/*
302 	 * Class under test for Object read(Connection, Object, String)
303 	 */
304 	public void testReadConnectionObjectString() {
305 	}
306 
307 	/*
308 	 * Class under test for Object readByPrimaryKey(Object, Object)
309 	 */
310 	public void testReadByPrimaryKeyObjectObject() {
311 	}
312 
313 	/*
314 	 * Class under test for Object readByPrimaryKey(Connection, Object, Object)
315 	 */
316 	public void testReadByPrimaryKeyConnectionObjectObject() {
317 	}
318 
319 	/*
320 	 * Class under test for List readList(Object, PreparedStatement,
321 	 * IReadFilter)
322 	 */
323 	public void testReadListObjectPreparedStatementIReadFilter() {
324 	}
325 
326 	/*
327 	 * Class under test for List readList(Connection, Object, PreparedStatement,
328 	 * IReadFilter)
329 	 */
330 	public void testReadListConnectionObjectPreparedStatementIReadFilter() {
331 	}
332 
333 	/*
334 	 * Class under test for List readList(Object, PreparedStatement)
335 	 */
336 	public void testReadListObjectPreparedStatement() {
337 	}
338 
339 	/*
340 	 * Class under test for List readList(Connection, Object, PreparedStatement)
341 	 */
342 	public void testReadListConnectionObjectPreparedStatement() {
343 	}
344 
345 	/*
346 	 * Class under test for List readList(Object, ResultSet, IReadFilter)
347 	 */
348 	public void testReadListObjectResultSetIReadFilter() {
349 	}
350 
351 	/*
352 	 * Class under test for List readList(Connection, Object, ResultSet,
353 	 * IReadFilter)
354 	 */
355 	public void testReadListConnectionObjectResultSetIReadFilter() {
356 	}
357 
358 	/*
359 	 * Class under test for List readList(Object, ResultSet)
360 	 */
361 	public void testReadListObjectResultSet() {
362 	}
363 
364 	/*
365 	 * Class under test for List readList(Connection, Object, ResultSet)
366 	 */
367 	public void testReadListConnectionObjectResultSet() {
368 	}
369 
370 	/*
371 	 * Class under test for List readList(Object, Statement, String)
372 	 */
373 	public void testReadListObjectStatementString() {
374 	}
375 
376 	/*
377 	 * Class under test for List readList(Connection, Object, Statement, String)
378 	 */
379 	public void testReadListConnectionObjectStatementString() {
380 	}
381 
382 	/*
383 	 * Class under test for List readList(Object, String, Collection,
384 	 * IReadFilter)
385 	 */
386 	public void testReadListObjectStringCollectionIReadFilter() {
387 	}
388 
389 	/*
390 	 * Class under test for List readList(Connection, Object, String,
391 	 * Collection, IReadFilter)
392 	 */
393 	public void testReadListConnectionObjectStringCollectionIReadFilter() {
394 	}
395 
396 	/*
397 	 * Class under test for List readList(Object, Statement, String,
398 	 * IReadFilter)
399 	 */
400 	public void testReadListObjectStatementStringIReadFilter() {
401 	}
402 
403 	/*
404 	 * Class under test for List readList(Connection, Object, Statement, String,
405 	 * IReadFilter)
406 	 */
407 	public void testReadListConnectionObjectStatementStringIReadFilter() {
408 	}
409 
410 	/*
411 	 * Class under test for List readList(Object, String, Collection)
412 	 */
413 	public void testReadListObjectStringCollection() {
414 	}
415 
416 	/*
417 	 * Class under test for List readList(Connection, Object, String,
418 	 * Collection)
419 	 */
420 	public void testReadListConnectionObjectStringCollection() {
421 	}
422 
423 	/*
424 	 * Class under test for List readList(Object, String, IReadFilter)
425 	 */
426 	public void testReadListObjectStringIReadFilter() {
427 	}
428 
429 	/*
430 	 * Class under test for List readList(Connection, Object, String,
431 	 * IReadFilter)
432 	 */
433 	public void testReadListConnectionObjectStringIReadFilter() {
434 	}
435 
436 	/*
437 	 * Class under test for List readList(Object, String, Object[], IReadFilter)
438 	 */
439 	public void testReadListObjectStringObjectArrayIReadFilter() {
440 	}
441 
442 	/*
443 	 * Class under test for List readList(Connection, Object, String, Object[],
444 	 * IReadFilter)
445 	 */
446 	public void testReadListConnectionObjectStringObjectArrayIReadFilter() {
447 	}
448 
449 	/*
450 	 * Class under test for List readList(Object, String, Object[])
451 	 */
452 	public void testReadListObjectStringObjectArray() {
453 	}
454 
455 	/*
456 	 * Class under test for List readList(Connection, Object, String, Object[])
457 	 */
458 	public void testReadListConnectionObjectStringObjectArray() {
459 	}
460 
461 	/*
462 	 * Class under test for List readList(Object, String)
463 	 */
464 	public void testReadListObjectString() {
465 	}
466 
467 	/*
468 	 * Class under test for List readList(Connection, Object, String)
469 	 */
470 	public void testReadListConnectionObjectString() {
471 	}
472 
473 	/*
474 	 * Class under test for List readListByPrimaryKeys(Object, Collection)
475 	 */
476 	public void testReadListByPrimaryKeysObjectCollection() {
477 	}
478 
479 	/*
480 	 * Class under test for List readListByPrimaryKeys(Connection, Object,
481 	 * Collection)
482 	 */
483 	public void testReadListByPrimaryKeysConnectionObjectCollection() {
484 	}
485 
486 	/*
487 	 * Class under test for int update(Object, Object)
488 	 */
489 	public void testUpdateObjectObject() {
490 	}
491 
492 	/*
493 	 * Class under test for int update(Connection, Object, Object)
494 	 */
495 	public void testUpdateConnectionObjectObject() {
496 	}
497 
498 	/*
499 	 * Class under test for int update(Object)
500 	 */
501 	public void testUpdateObject() {
502 	}
503 
504 	/*
505 	 * Class under test for int update(Connection, Object)
506 	 */
507 	public void testUpdateConnectionObject() {
508 	}
509 
510 	/*
511 	 * Class under test for int[] updateBatch(Collection)
512 	 */
513 	public void testUpdateBatchCollection() {
514 	}
515 
516 	/*
517 	 * Class under test for int[] updateBatch(Connection, Collection)
518 	 */
519 	public void testUpdateBatchConnectionCollection() {
520 	}
521 
522 	/*
523 	 * Class under test for int[] updateBatch(Object, Collection)
524 	 */
525 	public void testUpdateBatchObjectCollection() {
526 	}
527 
528 	/*
529 	 * Class under test for int[] updateBatch(Connection, Object, Collection)
530 	 */
531 	public void testUpdateBatchConnectionObjectCollection() {
532 	}
533 
534 	/*
535 	 * Class under test for int[] updateBatchByPrimaryKeys(Collection,
536 	 * Collection)
537 	 */
538 	public void testUpdateBatchByPrimaryKeysCollectionCollection() {
539 	}
540 
541 	/*
542 	 * Class under test for int[] updateBatchByPrimaryKeys(Connection,
543 	 * Collection, Collection)
544 	 */
545 	public void testUpdateBatchByPrimaryKeysConnectionCollectionCollection() {
546 	}
547 
548 	/*
549 	 * Class under test for int[] updateBatchByPrimaryKeys(Object, Collection,
550 	 * Collection)
551 	 */
552 	public void testUpdateBatchByPrimaryKeysObjectCollectionCollection() {
553 	}
554 
555 	/*
556 	 * Class under test for int[] updateBatchByPrimaryKeys(Connection, Object,
557 	 * Collection, Collection)
558 	 */
559 	public void testUpdateBatchByPrimaryKeysConnectionObjectCollectionCollection() {
560 	}
561 
562 	/*
563 	 * Class under test for int updateByPrimaryKey(Object, Object, Object)
564 	 */
565 	public void testUpdateByPrimaryKeyObjectObjectObject() {
566 	}
567 
568 	/*
569 	 * Class under test for int updateByPrimaryKey(Connection, Object, Object,
570 	 * Object)
571 	 */
572 	public void testUpdateByPrimaryKeyConnectionObjectObjectObject() {
573 	}
574 
575 	/*
576 	 * Class under test for int updateByPrimaryKey(Object, Object)
577 	 */
578 	public void testUpdateByPrimaryKeyObjectObject() {
579 	}
580 
581 	/*
582 	 * Class under test for int updateByPrimaryKey(Connection, Object, Object)
583 	 */
584 	public void testUpdateByPrimaryKeyConnectionObjectObject() {
585 	}
586 
587 }