1 /**
2 *
3 */
4 package org.melati.poem.test.throwing;
5
6 import java.sql.Connection;
7 import java.sql.ResultSet;
8 import java.sql.Statement;
9
10 import org.melati.poem.Database;
11 import org.melati.poem.PoemDatabaseFactory;
12 import org.melati.poem.SQLPoemException;
13 import org.melati.poem.SQLSeriousPoemException;
14 import org.melati.poem.UnexpectedExceptionPoemException;
15 import org.melati.poem.dbms.test.sql.Thrower;
16
17 /**
18 * @author timp
19 * @since 10 Feb 2007
20 *
21 */
22 public class PoemDatabaseTest extends org.melati.poem.test.PoemDatabaseTest {
23
24 /**
25 * @param arg0
26 */
27 public PoemDatabaseTest(String arg0) {
28 super(arg0);
29 }
30
31 protected void setUp() throws Exception {
32 PoemDatabaseFactory.removeDatabase(getDatabaseName());
33 super.setUp();
34 assertEquals("org.melati.poem.dbms.test.HsqldbThrower",getDb().getDbms().getClass().getName());
35 }
36
37 protected void tearDown() throws Exception {
38 try {
39 super.tearDown();
40 } finally {
41 PoemDatabaseFactory.removeDatabase(getDatabaseName());
42 }
43 }
44
45 public Database getDatabase(String name) {
46 maxTrans = 8;
47 Database db = PoemDatabaseFactory.getDatabase(name,
48 "jdbc:hsqldb:mem:" + name,
49 "sa",
50 "",
51 "org.melati.poem.PoemDatabase",
52 "org.melati.poem.dbms.test.HsqldbThrower",
53 false,
54 false,
55 false, maxTrans);
56 return db;
57 }
58
59 public void testAddConstraints() {
60 // ThrowingConnection.startThrowing("prepareStatement");
61
62 // super.testAddConstraints();
63 // ThrowingConnection.stopThrowing("prepareStatement");
64 }
65
66 public void testAdministerCapability() {
67 // ThrowingConnection.startThrowing("prepareStatement");
68
69 // super.testAdministerCapability();
70 // ThrowingConnection.stopThrowing("prepareStatement");
71 }
72
73 public void testBeginExclusiveLock() {
74 // ThrowingConnection.startThrowing("prepareStatement");
75
76 // super.testBeginExclusiveLock();
77 // ThrowingConnection.stopThrowing("prepareStatement");
78 }
79
80 public void testBeginSession() {
81 // ThrowingConnection.startThrowing("prepareStatement");
82
83 // super.testBeginSession();
84 // ThrowingConnection.stopThrowing("prepareStatement");
85 }
86
87 public void testColumns() {
88 // ThrowingConnection.startThrowing("prepareStatement");
89
90 // super.testColumns();
91 // ThrowingConnection.stopThrowing("prepareStatement");
92 }
93
94 public void testConnect() {
95 // ThrowingConnection.startThrowing("prepareStatement");
96
97 // super.testConnect();
98 // ThrowingConnection.stopThrowing("prepareStatement");
99 }
100
101 public void testDisconnect() {
102 // ThrowingConnection.startThrowing("prepareStatement");
103
104 // super.testDisconnect();
105 // ThrowingConnection.stopThrowing("prepareStatement");
106 }
107
108 public void testDump() {
109 // ThrowingConnection.startThrowing("prepareStatement");
110
111 // super.testDump();
112 // ThrowingConnection.stopThrowing("prepareStatement");
113 }
114
115 public void testDumpCacheAnalysis() {
116 // ThrowingConnection.startThrowing("prepareStatement");
117
118 // super.testDumpCacheAnalysis();
119 // ThrowingConnection.stopThrowing("prepareStatement");
120 }
121
122 public void testEndExclusiveLock() {
123 // ThrowingConnection.startThrowing("prepareStatement");
124
125 // super.testEndExclusiveLock();
126 // ThrowingConnection.stopThrowing("prepareStatement");
127 }
128
129 public void testEndSession() {
130 // ThrowingConnection.startThrowing("prepareStatement");
131
132 // super.testEndSession();
133 // ThrowingConnection.stopThrowing("prepareStatement");
134 }
135
136 public void testGetCanAdminister() {
137 // ThrowingConnection.startThrowing("prepareStatement");
138
139 // super.testGetCanAdminister();
140 // ThrowingConnection.stopThrowing("prepareStatement");
141 }
142
143 public void testGetCapabilityTable() {
144 // ThrowingConnection.startThrowing("prepareStatement");
145
146 // super.testGetCapabilityTable();
147 // ThrowingConnection.stopThrowing("prepareStatement");
148 }
149
150 public void testGetColumnInfoTable() {
151 // ThrowingConnection.startThrowing("prepareStatement");
152
153 // super.testGetColumnInfoTable();
154 // ThrowingConnection.stopThrowing("prepareStatement");
155 }
156
157 public void testGetCommittedConnection() {
158 // ThrowingConnection.startThrowing("prepareStatement");
159
160 // super.testGetCommittedConnection();
161 // ThrowingConnection.stopThrowing("prepareStatement");
162 }
163
164 public void testGetDbms() {
165 // ThrowingConnection.startThrowing("prepareStatement");
166
167 // super.testGetDbms();
168 // ThrowingConnection.stopThrowing("prepareStatement");
169 }
170
171 public void testGetDisplayTables() {
172 // ThrowingConnection.startThrowing("prepareStatement");
173
174 // super.testGetDisplayTables();
175 // ThrowingConnection.stopThrowing("prepareStatement");
176 }
177
178 public void testGetFreeTransactionsCount() {
179 // ThrowingConnection.startThrowing("prepareStatement");
180
181 // super.testGetFreeTransactionsCount();
182 // ThrowingConnection.stopThrowing("prepareStatement");
183 }
184
185 public void testGetGroupCapabilityTable() {
186 // ThrowingConnection.startThrowing("prepareStatement");
187
188 // super.testGetGroupCapabilityTable();
189 // ThrowingConnection.stopThrowing("prepareStatement");
190 }
191
192 public void testGetGroupMembershipTable() {
193 // ThrowingConnection.startThrowing("prepareStatement");
194
195 // super.testGetGroupMembershipTable();
196 // ThrowingConnection.stopThrowing("prepareStatement");
197 }
198
199 public void testGetGroupTable() {
200 // ThrowingConnection.startThrowing("prepareStatement");
201
202 // super.testGetGroupTable();
203 // ThrowingConnection.stopThrowing("prepareStatement");
204 }
205
206 public void testGetSettingTable() {
207 // ThrowingConnection.startThrowing("prepareStatement");
208
209 // super.testGetSettingTable();
210 // ThrowingConnection.stopThrowing("prepareStatement");
211 }
212
213 public void testGetTable() {
214 // ThrowingConnection.startThrowing("prepareStatement");
215
216 // super.testGetTable();
217 // ThrowingConnection.stopThrowing("prepareStatement");
218 }
219
220 public void testGetTableCategoryTable() {
221 // ThrowingConnection.startThrowing("prepareStatement");
222
223 // super.testGetTableCategoryTable();
224 // ThrowingConnection.stopThrowing("prepareStatement");
225 }
226
227 public void testGetTableInfoTable() {
228 // ThrowingConnection.startThrowing("prepareStatement");
229
230 // super.testGetTableInfoTable();
231 // ThrowingConnection.stopThrowing("prepareStatement");
232 }
233
234 public void testGetTransactionsCount() {
235 // ThrowingConnection.startThrowing("prepareStatement");
236
237 // super.testGetTransactionsCount();
238 // ThrowingConnection.stopThrowing("prepareStatement");
239 }
240
241 public void testGetUserTable() {
242 // ThrowingConnection.startThrowing("prepareStatement");
243
244 // super.testGetUserTable();
245 // ThrowingConnection.stopThrowing("prepareStatement");
246 }
247
248 public void testGivesCapabilitySQL() {
249 //ThrowingResultSet.startThrowing("next");
250 //super.testGivesCapabilitySQL();
251 //ThrowingResultSet.stopThrowing("next");
252 }
253
254 public void testGuestAccessToken() {
255 // ThrowingConnection.startThrowing("prepareStatement");
256
257 // super.testGuestAccessToken();
258 // ThrowingConnection.stopThrowing("prepareStatement");
259 }
260
261 public void testHasCapability() {
262 Thrower.startThrowing(Statement.class, "executeQuery");
263 try {
264 super.testHasCapability();
265 } catch (UnexpectedExceptionPoemException e) {
266 assertEquals("Statement bombed", e.innermostException().getMessage());
267 Thrower.stopThrowing(Statement.class, "executeQuery");
268 }
269 Thrower.startThrowing(ResultSet.class, "next");
270 Thrower.startThrowing(ResultSet.class, "close");
271 try {
272 super.testHasCapability();
273 } catch (SQLSeriousPoemException e) {
274 assertEquals("ResultSet bombed", e.innermostException().getMessage());
275 Thrower.stopThrowing(ResultSet.class, "next");
276 Thrower.stopThrowing(ResultSet.class, "close");
277 }
278 }
279
280 public void testInSession() {
281 // ThrowingConnection.startThrowing("prepareStatement");
282
283 // super.testInSession();
284 // ThrowingConnection.stopThrowing("prepareStatement");
285 }
286
287 public void testIsFree() {
288 // ThrowingConnection.startThrowing("prepareStatement");
289
290 // super.testIsFree();
291 // ThrowingConnection.stopThrowing("prepareStatement");
292 }
293
294 public void testLogCommits() {
295 // ThrowingConnection.startThrowing("prepareStatement");
296
297 // super.testLogCommits();
298 // ThrowingConnection.stopThrowing("prepareStatement");
299 }
300
301 public void testLogSQL() {
302 // ThrowingConnection.startThrowing("prepareStatement");
303
304 // super.testLogSQL();
305 // ThrowingConnection.stopThrowing("prepareStatement");
306 }
307
308 public void testPoemTransaction() {
309 // ThrowingConnection.startThrowing("prepareStatement");
310
311 // super.testPoemTransaction();
312 // ThrowingConnection.stopThrowing("prepareStatement");
313 }
314
315 public void testQuotedName() {
316 // ThrowingConnection.startThrowing("prepareStatement");
317
318 // super.testQuotedName();
319 // ThrowingConnection.stopThrowing("prepareStatement");
320 }
321
322 public void testReferencesToPersistent() {
323 Thrower.startThrowing(Connection.class, "prepareStatement");
324 try {
325 super.testReferencesToPersistent();
326 fail("Should have bombed");
327 } catch (SQLPoemException e) {
328 assertEquals("Connection bombed", e.innermostException().getMessage());
329 Thrower.stopThrowing(Connection.class, "prepareStatement");
330 }
331 }
332
333 public void testReferencesToTable() {
334 // ThrowingConnection.startThrowing("prepareStatement");
335
336 // super.testReferencesToTable();
337 // ThrowingConnection.stopThrowing("prepareStatement");
338 }
339
340 public void testSetCanAdminister() {
341 Thrower.startThrowing(Connection.class, "prepareStatement");
342 try {
343 getDb().setCanAdminister();
344 assertEquals(getDb().getCapabilityTable().get("_administer_"), getDb()
345 .getCanAdminister());
346 getDb().setCanAdminister("testing");
347 assertEquals(getDb().getCapabilityTable().get("testing"), getDb()
348 .getCanAdminister());
349 getDb().setCanAdminister();
350 getDb().getCapabilityTable().getNameColumn().firstWhereEq("testing")
351 .delete();
352 fail("Should have bombed");
353 } catch (SQLPoemException e) {
354 assertEquals("Connection bombed", e.innermostException().getMessage());
355 Thrower.stopThrowing(Connection.class, "prepareStatement");
356 }
357 getDb().getCapabilityTable().getNameColumn().firstWhereEq("testing")
358 .delete();
359 }
360
361 public void testSetLogCommits() {
362 // ThrowingConnection.startThrowing("prepareStatement");
363
364 // super.testSetLogCommits();
365 // ThrowingConnection.stopThrowing("prepareStatement");
366 }
367
368 public void testSetLogSQL() {
369 // ThrowingConnection.startThrowing("prepareStatement");
370
371 // super.testSetLogSQL();
372 // ThrowingConnection.stopThrowing("prepareStatement");
373 }
374
375 public void testSetTransactionsMax() {
376 // ThrowingConnection.startThrowing("prepareStatement");
377
378 // super.testSetTransactionsMax();
379 // ThrowingConnection.stopThrowing("prepareStatement");
380 }
381
382 public void testShutdown() {
383 // ThrowingConnection.startThrowing("prepareStatement");
384
385 // super.testShutdown();
386 // ThrowingConnection.stopThrowing("prepareStatement");
387 }
388
389 public void testSqlQuery() {
390 // ThrowingConnection.startThrowing("prepareStatement");
391
392 // super.testSqlQuery();
393 // ThrowingConnection.stopThrowing("prepareStatement");
394 }
395
396 public void testSqlUpdate() {
397 // ThrowingConnection.startThrowing("prepareStatement");
398
399 // super.testSqlUpdate();
400 // ThrowingConnection.stopThrowing("prepareStatement");
401 }
402
403 public void testSqlUpdate1() {
404 // ThrowingConnection.startThrowing("prepareStatement");
405
406 // super.testSqlUpdate1();
407 // ThrowingConnection.stopThrowing("prepareStatement");
408 }
409
410 public void testSqlUpdate2() {
411 // ThrowingConnection.startThrowing("prepareStatement");
412
413 // super.testSqlUpdate2();
414 // ThrowingConnection.stopThrowing("prepareStatement");
415 }
416
417 public void testTables() {
418 // ThrowingConnection.startThrowing("prepareStatement");
419
420 // super.testTables();
421 // ThrowingConnection.stopThrowing("prepareStatement");
422 }
423
424 public void testToString() {
425 // ThrowingConnection.startThrowing("prepareStatement");
426
427 // super.testToString();
428 // ThrowingConnection.stopThrowing("prepareStatement");
429 }
430
431 public void testTransaction() {
432 // ThrowingConnection.startThrowing("prepareStatement");
433
434 // super.testTransaction();
435 // ThrowingConnection.stopThrowing("prepareStatement");
436 }
437
438 public void testTransactionsMax() {
439 // ThrowingConnection.startThrowing("prepareStatement");
440
441 // super.testTransactionsMax();
442 // ThrowingConnection.stopThrowing("prepareStatement");
443 }
444
445 public void testTrimCache() {
446 // ThrowingConnection.startThrowing("prepareStatement");
447
448 // super.testTrimCache();
449 // ThrowingConnection.stopThrowing("prepareStatement");
450 }
451
452 public void testUncacheContents() {
453 // ThrowingConnection.startThrowing("prepareStatement");
454
455 // super.testUncacheContents();
456 // ThrowingConnection.stopThrowing("prepareStatement");
457 }
458
459 }