Rubernate 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,635 @@
1
+ $:.unshift(File.expand_path('../../..', __FILE__)) unless
2
+ $:.include?(File.expand_path('../../..', __FILE__))
3
+
4
+
5
+ require 'config'
6
+ require 'rubernate/fixtures'
7
+ require 'set'
8
+
9
+ module Rubernate
10
+ module DBI::GenericTests
11
+ include Rubernate
12
+ include DBI
13
+ include FixtureClasses
14
+
15
+ def init rt_class, db_url, db_user, db_password
16
+ @factory = RuntimeFactory.new rt_class, db_url, db_user, db_password
17
+ @factory.connect {|dbh|
18
+ dbh.do 'delete from r_params'
19
+ dbh.do 'delete from r_objects'
20
+ dbh.commit
21
+ }
22
+ @runtime = @factory.create
23
+ Thread.current[:on_save] = Thread.current[:on_load] = nil
24
+ end
25
+
26
+ def teardown
27
+ @runtime.dbh.disconnect if @runtime and @runtime.dbh
28
+ end
29
+
30
+ def test_connect
31
+ assert @runtime
32
+ assert @runtime.dbh
33
+ assert_nothing_raised {
34
+ assert_equal 0, @runtime.dbh.select_all('select * from r_objects').size
35
+ }
36
+ assert_nothing_raised {
37
+ assert_equal 0, @runtime.dbh.select_all('select * from r_params').size
38
+ }
39
+ end
40
+
41
+ def test_create
42
+ o = C1.new
43
+ o.peer = Peer.new
44
+ @runtime.create o
45
+ rows = @runtime.dbh.select_all 'select * from r_objects'
46
+ assert_equal 1, rows.size
47
+ assert_equal C1.name, rows[0][1]
48
+ assert o.peer.dirty?
49
+ end
50
+
51
+ def test_save_objects
52
+ objects = [C1.new, C2.new, C3.new]
53
+ objects.each {|object| @runtime.create object}
54
+
55
+ @runtime.save objects
56
+
57
+ for object in objects
58
+ assert !object.peer.dirty?
59
+ end
60
+
61
+ rows = @runtime.dbh.select_all 'select * from r_objects order by object_pk'
62
+ assert_equal 3, rows.size
63
+
64
+ for object in objects
65
+ row = rows.shift
66
+ assert_equal object.primary_key, row[0].to_i
67
+ assert_equal object.class.name, row[1]
68
+ end
69
+ end
70
+
71
+ def test_save_param_string
72
+ o, o.p1 = C1.new, 'test'
73
+ @runtime.create o
74
+ @runtime.save o
75
+ rows = @runtime.dbh.select_all 'select * from r_params'
76
+ assert_equal 1, rows.size
77
+ assert_equal o.primary_key, rows[0]['OBJECT_PK'].to_i
78
+ assert_equal PARAM_FLAG_STRING, rows[0]['FLAGS'].to_i
79
+ assert_nil rows[0]['INT_VALUE']
80
+ assert_equal 'test', rows[0]['STR_VALUE']
81
+ assert_nil rows[0]['DAT_VALUE']
82
+ assert_nil rows[0]['REF_VALUE']
83
+ end
84
+
85
+ def test_save_param_int
86
+ o, o.p1 = C1.new, 777
87
+ @runtime.create o
88
+ @runtime.save o
89
+ rows = @runtime.dbh.select_all 'select * from r_params'
90
+ assert_equal 1, rows.size
91
+ assert_equal o.primary_key, rows[0]['OBJECT_PK'].to_i
92
+ assert_equal PARAM_FLAG_INT, rows[0]['FLAGS'].to_i
93
+ assert_equal 777, rows[0]['INT_VALUE'].to_i
94
+ assert_nil rows[0]['STR_VALUE']
95
+ assert_nil rows[0]['DAT_VALUE']
96
+ assert_nil rows[0]['REF_VALUE']
97
+ end
98
+
99
+ def test_save_param_ref
100
+ o0, o1 = C2.new, C1.new
101
+ o1.p1 = o0
102
+ @runtime.create o0
103
+ @runtime.create o1
104
+ @runtime.save [o0, o1]
105
+
106
+ rows = @runtime.dbh.select_all 'select * from r_params'
107
+ assert_equal 1, rows.size
108
+ assert_equal o1.primary_key, rows[0]['OBJECT_PK'].to_i
109
+ assert_equal PARAM_FLAG_REF, rows[0]['FLAGS'].to_i
110
+ assert_nil rows[0]['INT_VALUE']
111
+ assert_nil rows[0]['STR_VALUE']
112
+ assert_nil rows[0]['DAT_VALUE']
113
+ assert_equal o0.primary_key, rows[0]['REF_VALUE'].to_i
114
+ end
115
+
116
+ def test_save_param_int_hash
117
+ hash = {}
118
+ for i in 1..10
119
+ hash[i] = C2.new
120
+ @runtime.create hash[i]
121
+ end
122
+ o, o.p1 = C1.new, hash
123
+
124
+ @runtime.create o
125
+ @runtime.save o
126
+
127
+ rows = @runtime.dbh.select_all 'select * from r_params order by int_value'
128
+ assert_equal 10, rows.size
129
+ for row in rows
130
+ assert_equal o.primary_key, row['OBJECT_PK'].to_i
131
+ assert_equal PARAM_FLAG_INT | PARAM_FLAG_HASH, row['FLAGS'].to_i
132
+ assert hash.has_key?(row['INT_VALUE'].to_i)
133
+ assert_nil row['STR_VALUE']
134
+ assert_nil row['DAT_VALUE']
135
+ assert_equal hash[row['INT_VALUE'].to_i].primary_key, row['REF_VALUE'].to_i
136
+ end
137
+ end
138
+
139
+ def test_save_param_si_hash
140
+ hash = {777 => C2.new}
141
+
142
+ @runtime.create hash[777]
143
+
144
+ hash['key'] = C2.new
145
+ @runtime.create hash['key']
146
+
147
+ o, o.p1 = C1.new, hash
148
+
149
+ @runtime.create o
150
+ @runtime.save [o]
151
+
152
+ rows = @runtime.dbh.select_all 'select * from r_params order by int_value'
153
+ assert_equal 2, rows.size
154
+
155
+ for row in rows
156
+ if row['FLAGS'].to_i == HASH_INT_REF
157
+ assert_equal o.primary_key, row['OBJECT_PK'].to_i
158
+ assert hash.has_key?(row['INT_VALUE'].to_i)
159
+ assert_nil row['STR_VALUE']
160
+ assert_nil row['DAT_VALUE']
161
+ assert_equal hash[row['INT_VALUE'].to_i].primary_key, row['REF_VALUE'].to_i
162
+ elsif row['FLAGS'].to_i == HASH_STRING_REF
163
+ assert_equal o.primary_key, row['OBJECT_PK'].to_i
164
+ assert_nil row['INT_VALUE']
165
+ assert hash.has_key?(row['STR_VALUE'])
166
+ assert_nil row['DAT_VALUE']
167
+ assert_equal hash[row['STR_VALUE']].primary_key, row['REF_VALUE'].to_i
168
+ else
169
+ flunk 'Invalid flags ' + row['FLAGS'].to_i
170
+ end
171
+ end
172
+ end
173
+
174
+ def test_save_param_array
175
+ array = []
176
+ for i in 0..9
177
+ o = C2.new
178
+ @runtime.create o
179
+ array[i] = o
180
+ end
181
+ o, o.p1 = C1.new, array
182
+
183
+ @runtime.create o
184
+ @runtime.save o
185
+
186
+ rows = @runtime.dbh.select_all 'select * from r_params order by int_value'
187
+ assert_equal 10, rows.size
188
+ for i in 0..9
189
+ row = rows[i]
190
+ assert_equal o.primary_key, row['OBJECT_PK'].to_i
191
+ assert_equal 'p1', row['NAME']
192
+ assert_equal ARRAY_INT_REF, row['FLAGS'].to_i
193
+ assert_equal i, row['INT_VALUE'].to_i
194
+ assert_nil row['STR_VALUE']
195
+ assert_nil row['DAT_VALUE']
196
+ assert_equal array[row['INT_VALUE'].to_i].primary_key, row['REF_VALUE'].to_i
197
+ end
198
+ end
199
+
200
+ def test_delete
201
+ o1, o2 = C1.new, C2.new
202
+
203
+ @runtime.create o1
204
+ @runtime.create o2
205
+
206
+ o1.p1 = o2
207
+ @runtime.save o1
208
+ @runtime.save o2
209
+
210
+ assert 1, @runtime.dbh.select_all(
211
+ 'select * from r_objects where object_pk = ?', o1.primary_key).size
212
+ assert 1, @runtime.dbh.select_all(
213
+ 'select * from r_objects where object_pk = ?', o2.primary_key).size
214
+ assert 1, @runtime.dbh.select_all(
215
+ 'select * from r_params where object_pk = ?', o1.primary_key).size
216
+ @runtime.delete o1
217
+
218
+ assert 0, @runtime.dbh.select_all(
219
+ 'select * from r_objects where object_pk = ?', o1.primary_key).size
220
+ assert 1, @runtime.dbh.select_all(
221
+ 'select * from r_objects where object_pk = ?', o2.primary_key).size
222
+ assert 0, @runtime.dbh.select_all(
223
+ 'select * from r_params where object_pk = ?', o1.primary_key).size
224
+ end
225
+
226
+ def test_find_by_query_empty
227
+ peers = @runtime.find_by_query "select * from r_objects"
228
+ assert peers
229
+ assert_equal 0, peers.size
230
+ end
231
+
232
+ def test_find_by_query_order_by_int
233
+ for i in 1..10
234
+ o = C1.new
235
+ @runtime.create o
236
+ o.p1 = i
237
+ @runtime.save [o]
238
+ end
239
+ objects = @runtime.find_by_query %{select o.* from r_objects o, r_params p
240
+ where o.object_pk = p.object_pk order by p.int_value}
241
+ assert_equal 10, objects.size
242
+ for i in 1..10
243
+ object = objects[i - 1]
244
+ assert_equal C1, object.class
245
+ assert_equal i, object.p1
246
+ assert !object.peer.dirty?
247
+ end
248
+ end
249
+
250
+ def test_load_by_pk
251
+ assert_nil @runtime.load_by_pk(0)
252
+ o0, o1 = C2.new, C1.new
253
+ @runtime.create o0
254
+ @runtime.create o1
255
+ o0.p1 = 'o0.p1'
256
+ o0.p2 = o1
257
+ @runtime.save [o0, o1]
258
+
259
+ o0 = @runtime.load_by_pk o0.primary_key
260
+ assert o0
261
+ assert_equal 2, o0.peer.size
262
+ assert_equal 'o0.p1', o0.p1
263
+ assert_equal o0.p2, o1
264
+ end
265
+
266
+ def test_param_type_time
267
+ pk, time = nil, Time.new
268
+ Rubernate.session {o = C1.new.attach; o.p1 = time; pk = o.primary_key}
269
+ Rubernate.session {
270
+ o = find_by_pk pk
271
+ assert_equal time.to_a[0..5], o.p1.to_a[0..5] # Ignore time-zone
272
+ }
273
+ end
274
+
275
+ def test_param_type_date
276
+ pk, date = nil, Date.today
277
+ Rubernate.session {o = C1.new.attach; o.p1 = date; pk = o.primary_key}
278
+ Rubernate.session {
279
+ o = find_by_pk pk
280
+ assert_equal date, o.p1
281
+ }
282
+ end
283
+
284
+ def test_param_hash_time
285
+ pk, time = nil, Time.now
286
+ Rubernate.session {o = C1.new.attach; o.p1 = {time => o}; pk = o.primary_key}
287
+ Rubernate.session {
288
+ o = find_by_pk pk
289
+ assert_equal 1, o.p1.size
290
+ _time, _obj = o.p1.shift
291
+ assert_equal time.to_a[0..5], _time.to_a[0..5] # Ignore time-zone
292
+ assert_equal o, _obj
293
+ }
294
+ end
295
+
296
+ def test_param_hash_date
297
+ pk, date = nil, Date.today
298
+ Rubernate.session {o = C1.new.attach; o.p1 = {date => o}; pk = o.primary_key}
299
+ Rubernate.session {
300
+ o = find_by_pk pk
301
+ assert_equal 1, o.p1.size
302
+ _date, _obj = o.p1.shift
303
+ assert_equal date, _date
304
+ assert_equal o, _obj
305
+ }
306
+ end
307
+
308
+ def test_param_hash_nil
309
+ pk = nil
310
+ Rubernate.session {o = C1.new.attach; o.p1 = {nil => o}; pk = o.primary_key}
311
+ Rubernate.session {
312
+ o = find_by_pk pk
313
+ assert_equal 1, o.p1.size
314
+ assert_equal o, o.p1[nil]
315
+ }
316
+ end
317
+
318
+ def test_param_nil
319
+ pk = nil
320
+ Rubernate.session {o = C1.new.attach; o.p1 = 'not nil'; pk = o.primary_key}
321
+ Rubernate.session {
322
+ o = find_by_pk pk
323
+ assert_equal 'not nil', o.p1
324
+ o.p1 = nil
325
+ }
326
+ Rubernate.session {
327
+ o = find_by_pk pk
328
+ assert_nil o.p1
329
+ }
330
+ end
331
+
332
+ def test_empty_array
333
+ pk = nil
334
+ Rubernate.session {o = C1.new.attach; o.p1 = []; pk = o.primary_key}
335
+ Rubernate.session do
336
+ o = find_by_pk pk
337
+ assert_equal [], o.p1
338
+ end
339
+ end
340
+
341
+ def test_empty_hash
342
+ pk = nil
343
+ Rubernate.session {o = C1.new.attach; o.p1 = {}; pk = o.primary_key}
344
+ Rubernate.session do
345
+ o = find_by_pk pk
346
+ assert_equal ({}), o.p1
347
+ end
348
+ end
349
+ end
350
+
351
+ module GenericRuntimeTests
352
+ include Rubernate
353
+ include DBI
354
+ include Queries
355
+ include FixtureClasses
356
+
357
+ def init rt_class, db_url, db_user, db_password
358
+ @factory = RuntimeFactory.new rt_class, db_url, db_user, db_password
359
+ @factory.connect {|dbh|
360
+ dbh.do 'delete from r_params'
361
+ dbh.do 'delete from r_objects'
362
+ dbh.commit
363
+ }
364
+ Rubernate.runtime_factory = @factory
365
+ Thread.current[:on_save] = Thread.current[:on_load] = nil
366
+ end
367
+
368
+ def test_session
369
+ Rubernate.session {|runtime|
370
+ assert runtime
371
+ assert runtime.dbh
372
+ assert_equal 0, runtime.dbh.select_all('select * from r_objects').size
373
+ }
374
+ end
375
+
376
+ def test_session_commit
377
+ Rubernate.session{|runtime|
378
+ runtime.dbh.do "insert into r_objects values (3, 'C1')"
379
+ }
380
+ rows = @factory.connect.select_all('select * from r_objects')
381
+
382
+ assert_equal 1, rows.size
383
+ assert_equal 3, rows[0][0].to_i
384
+ assert_equal 'C1', rows[0][1].to_s
385
+ end
386
+
387
+ def test_session_rollback
388
+ assert_raise(RuntimeError) {
389
+ Rubernate.session{|runtime|
390
+ runtime.dbh.do "insert into r_objects values (4, 'C1')"
391
+ raise 'error'
392
+ }
393
+ }
394
+ assert_equal 0, @factory.connect.select_all('select * from r_objects').size
395
+ end
396
+
397
+ def test_find_and_load_lazy
398
+ k1, k2 = nil
399
+ Rubernate.session{|runtime|
400
+ o1, o2 = C1.new.attach, C2.new.attach
401
+ o1.p1, o2.p1, o2.p2 = 'o1.p1', 'o2.p1', o1
402
+ k1, k2 = o1.primary_key, o2.primary_key
403
+ }
404
+ Rubernate.session{|runtime|
405
+ o2 = runtime.find_by_pk k2
406
+ assert 'o2.p1', o2.p1
407
+ assert 'o1.p1', o2.p2.p1 # o1 should be loaded lazy
408
+ }
409
+ end
410
+
411
+ def test_find_flushed
412
+ k1, k2 = nil
413
+ Rubernate.session{|runtime|
414
+ o1, o2 = C1.new.attach, C2.new.attach
415
+ o1.p1, o2.p1, o2.p2 = 'o1.p1', 'o2.p1', o1
416
+ result = runtime.find_by_query %{select o.*
417
+ from r_objects o, r_params p
418
+ where o.object_pk = p.object_pk and p.ref_value = ?}, o1
419
+ assert_equal 1, result.size
420
+ assert o2.equal?(result[0])
421
+ assert o1.equal?(o2.p2)
422
+ assert 'o1.p1', o1.p1
423
+ assert 'o2.p1', o2.p1
424
+ }
425
+ end
426
+
427
+ def test_query_building
428
+ Rubernate.session do |runtime|
429
+ for i in 1..10
430
+ o, o.p1 = C2.new.attach, i
431
+ end
432
+ for i in 1..10
433
+ res = runtime.find_by_query 'Select :o; Where(o.p1.int <= :value)', {:value => i}
434
+ assert_equal i, res.size
435
+ end
436
+ end
437
+ end
438
+
439
+ # Test find_by_pk for object with no params
440
+ def test_find_by_pk
441
+ pk = nil
442
+ Rubernate.session { |runtime| pk = C3.new.attach.primary_key }
443
+ Thread.current[:on_load], Thread.current[:on_save] = nil
444
+ assert pk
445
+ Rubernate.session { |runtime|
446
+ o = runtime.find_by_pk pk
447
+ assert !o.peer.dirty?
448
+ assert_not_nil Thread.current[:on_load]
449
+ o.p0 = 'o.p0'
450
+ }
451
+ assert_not_nil Thread.current[:on_save]
452
+ Rubernate.session { |runtime|
453
+ o = runtime.find_by_pk pk
454
+ assert !o.peer.dirty?
455
+ assert_equal 'o.p0', o.p0
456
+ }
457
+ end
458
+
459
+ def test_remove
460
+ pk = nil
461
+ Rubernate.session { |runtime| pk = C3.new.attach.primary_key }
462
+ Rubernate.session { |runtime|
463
+ o = runtime.find_by_pk pk
464
+ assert o
465
+ o.remove!
466
+ assert o.removed?
467
+ assert_raise(RuntimeError) { o.primary_key }
468
+ }
469
+ Rubernate.session{ |runtime|
470
+ assert_raise(Rubernate::ObjectNotFoundException) {runtime.find_by_pk pk}
471
+ }
472
+ end
473
+
474
+ def test_find_by_class
475
+ Rubernate.session do |runtime|
476
+ for i in 1..10
477
+ o, o.p1 = C2.new.attach, i
478
+ end
479
+ res = runtime.find_by_query 'Select :o; Where(o.klass == :c)', {:c => C2}
480
+ for o in res
481
+ o.p2 = o.p1 * o.p1
482
+ end
483
+ res = runtime.find_by_query 'Select :o; Where o.klass == :c; OrderBy o.p2.int', {:c => C2}
484
+ for i in 1..10
485
+ o = res[i - 1]
486
+ assert_equal i, o.p1
487
+ assert_equal i * i, o.p2
488
+ end
489
+ end
490
+ end
491
+
492
+ def test_ref_store
493
+ o1pk, o2pk = nil
494
+ Rubernate.session do
495
+ o1 = C2.new.attach
496
+ o2 = C1.new.attach
497
+ o1.p1 = o1
498
+ o1.p2 = o2
499
+ o1pk = o1.primary_key
500
+ o2pk = o2.primary_key
501
+ end
502
+ Rubernate.session do
503
+ o1 = find_by_pk o1pk
504
+ o2 = find_by_pk o2pk
505
+ assert_equal o1, o1.p1
506
+ assert_equal o2, o1.p2
507
+ end
508
+ end
509
+
510
+ def test_array_store
511
+ o1pk, o2pk = nil
512
+ Rubernate.session do
513
+ o1 = C1.new.attach
514
+ o2 = C2.new.attach
515
+ o1.p1 = [o2, o1]
516
+ o1pk, o2pk = o1.primary_key, o2.primary_key
517
+ end
518
+
519
+ Rubernate.session do
520
+ o1 = find_by_pk o1pk
521
+ o2 = find_by_pk o2pk
522
+ assert_equal [o1, o2].to_set, o1.p1.to_set
523
+ end
524
+ end
525
+
526
+ def test_array_change
527
+ o1pk, o2pk = nil
528
+ Rubernate.session do
529
+ o1 = C1.new.attach
530
+ o1pk = o1.primary_key
531
+ o1.p1 = [o1]
532
+ end
533
+ Rubernate.session do
534
+ o1 = find_by_pk o1pk
535
+ assert_equal [o1], o1.p1
536
+ o2 = C2.new.attach
537
+ o2pk = o2.primary_key
538
+ o1.p1 << o2
539
+ end
540
+ Rubernate.session do
541
+ o1 = find_by_pk o1pk
542
+ o2 = find_by_pk o2pk
543
+ assert_equal [o1, o2].to_set, o1.p1.to_set
544
+ end
545
+ end
546
+
547
+ def test_remove_referred
548
+ pk1, pk2 = nil
549
+ Rubernate.session do
550
+ o1, o2 = C1.new.attach, C1.new.attach
551
+ pk1, pk2 = o1.primary_key, o2.primary_key
552
+ o1.p1 = o2
553
+ end
554
+ Rubernate.session do
555
+ o1 = find_by_pk pk1
556
+ o2 = find_by_pk pk2
557
+ assert_equal o2, o1.p1
558
+ o2.remove!
559
+ assert o1.p1.removed?
560
+ end
561
+ Rubernate.session do
562
+ o1 = find_by_pk pk1
563
+ assert_nil o1.p1
564
+ end
565
+ end
566
+
567
+ def test_remove_referred_object_array
568
+ pk1, pk2 = nil
569
+ Rubernate.session do
570
+ o1, o2 = C1.new.attach, C1.new.attach
571
+ pk1, pk2 = o1.primary_key, o2.primary_key
572
+ o1.p1 = [o2]
573
+ end
574
+ Rubernate.session do
575
+ o1 = find_by_pk pk1
576
+ o2 = find_by_pk pk2
577
+ assert_equal [o2], o1.p1
578
+ o2.remove!
579
+ o1.p1 << o1
580
+ end
581
+ Rubernate.session do
582
+ o1 = find_by_pk pk1
583
+ assert_equal [o1], o1.p1
584
+ end
585
+ end
586
+
587
+ def test_remove_referred_object_hash
588
+ pk1, pk2 = nil
589
+ Rubernate.session do
590
+ o1, o2 = C1.new.attach, C1.new.attach
591
+ pk1, pk2 = o1.primary_key, o2.primary_key
592
+ o1.p1 = {1 => o2}
593
+ end
594
+ Rubernate.session do
595
+ o1 = find_by_pk pk1
596
+ o2 = find_by_pk pk2
597
+ assert_equal ({1 => o2}), o1.p1
598
+ o2.remove!
599
+ o1.p1[2] = o1
600
+ end
601
+ Rubernate.session do
602
+ o1 = find_by_pk pk1
603
+ assert_equal ({2 => o1}), o1.p1
604
+ end
605
+ end
606
+
607
+ def test_remove_referred_externally
608
+ pk1, pk2 = nil
609
+ Rubernate.session do
610
+ o1, o2 = C1.new.attach, C1.new.attach
611
+ pk1, pk2 = o1.primary_key, o2.primary_key
612
+ o1.p1 = o2, o1
613
+ end
614
+ Rubernate.session do
615
+ dbh.do 'delete from r_params where object_pk = ? and ref_value = ?', pk1, pk2
616
+ o1 = find_by_pk pk1
617
+ assert_equal [o1], o1.p1
618
+ end
619
+ end
620
+
621
+ def test_attach_initialized
622
+ o1, o1.p1, pk1 = C1.new, 'obj1'
623
+ o2, o2.p1, pk2 = C2.new, o1
624
+ o2.p2 = [o2]
625
+ Rubernate.session {o1.attach; pk1 = o1.primary_key; o2.attach; pk2 = o2.primary_key}
626
+ Rubernate.session do
627
+ o1 = find_by_pk pk1
628
+ o2 = find_by_pk pk2
629
+ assert_equal 'obj1', o1.p1
630
+ assert_equal o1, o2.p1
631
+ assert_equal [o2], o2.p2
632
+ end
633
+ end
634
+ end
635
+ end
@@ -0,0 +1,19 @@
1
+ $:.unshift(File.expand_path('../../..', __FILE__)) unless
2
+ $:.include?(File.expand_path('../../..', __FILE__))
3
+
4
+ require 'rubernate/fixtures'
5
+ require 'rubernate/impl/dbigeneric_stub'
6
+
7
+ class Rubernate::DBI::MysqlTest < Test::Unit::TestCase
8
+ include Rubernate::DBI::GenericTests
9
+ def setup
10
+ init MYSQL_RUNTIME_CLASS, MYSQL_DB_URL, MYSQL_DB_USER, MYSQL_DB_PWD
11
+ end
12
+ end
13
+
14
+ class Rubernate::DBI::MysqlRuntimeTest < Test::Unit::TestCase
15
+ include Rubernate::GenericRuntimeTests
16
+ def setup
17
+ init MYSQL_RUNTIME_CLASS, MYSQL_DB_URL, MYSQL_DB_USER, MYSQL_DB_PWD
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ $:.unshift(File.expand_path('../../..', __FILE__)) unless
2
+ $:.include?(File.expand_path('../../..', __FILE__))
3
+
4
+ require 'rubernate/fixtures'
5
+ require 'rubernate/impl/dbigeneric_stub'
6
+
7
+ class Rubernate::DBI::OracleTest < Test::Unit::TestCase
8
+ include Rubernate::DBI::GenericTests
9
+ def setup
10
+ init ORA_RUNTIME_CLASS, ORA_DB_URL, ORA_DB_USER, ORA_DB_PWD
11
+ end
12
+ end
13
+
14
+ class Rubernate::DBI::OracleRuntimeTest < Test::Unit::TestCase
15
+ include Rubernate::GenericRuntimeTests
16
+ def setup
17
+ init ORA_RUNTIME_CLASS, ORA_DB_URL, ORA_DB_USER, ORA_DB_PWD
18
+ end
19
+ end