rod 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
- data/README.rdoc +38 -10
- data/Rakefile +20 -9
- data/changelog.txt +25 -0
- data/contributors.txt +1 -0
- data/data/backward/0.7.0/_join_element.dat +0 -0
- data/data/backward/0.7.0/_polymorphic_join_element.dat +0 -0
- data/data/backward/0.7.0/char.dat +0 -0
- data/data/backward/0.7.0/database.yml +58 -0
- data/data/backward/0.7.0/rod_test__automobile.dat +0 -0
- data/data/backward/0.7.0/rod_test__caveman.dat +0 -0
- data/data/backward/0.7.0/rod_test__dog.dat +0 -0
- data/data/backward/0.7.0/rod_test__test_model.dat +0 -0
- data/data/portability/_join_element.dat +0 -0
- data/data/portability/_polymorphic_join_element.dat +0 -0
- data/data/portability/char.dat +0 -0
- data/data/portability/database.yml +49 -0
- data/data/portability/rod_test__automobile.dat +0 -0
- data/data/portability/rod_test__caveman.dat +0 -0
- data/data/portability/rod_test__dog.dat +0 -0
- data/data/portability/rod_test__test_model.dat +0 -0
- data/features/backward.feature +33 -0
- data/features/basic.feature +3 -0
- data/features/collection_proxy.feature +95 -0
- data/features/flat_indexing.feature +44 -2
- data/features/hash_indexing.feature +63 -9
- data/features/portability.feature +72 -0
- data/features/segmented_indexing.feature +45 -2
- data/features/steps/collection_proxy.rb +1 -1
- data/features/steps/model.rb +48 -5
- data/features/steps/rod.rb +15 -16
- data/lib/rod.rb +11 -1
- data/lib/rod/abstract_database.rb +52 -42
- data/lib/rod/berkeley/collection_proxy.rb +96 -0
- data/lib/rod/berkeley/database.rb +337 -0
- data/lib/rod/berkeley/environment.rb +209 -0
- data/lib/rod/berkeley/sequence.rb +222 -0
- data/lib/rod/berkeley/transaction.rb +233 -0
- data/lib/rod/collection_proxy.rb +76 -1
- data/lib/rod/constants.rb +3 -2
- data/lib/rod/database.rb +127 -14
- data/lib/rod/index/base.rb +12 -3
- data/lib/rod/index/hash_index.rb +295 -70
- data/lib/rod/index/segmented_index.rb +3 -0
- data/lib/rod/model.rb +154 -531
- data/lib/rod/property/base.rb +190 -0
- data/lib/rod/property/field.rb +258 -0
- data/lib/rod/property/plural_association.rb +145 -0
- data/lib/rod/property/singular_association.rb +139 -0
- data/rod.gemspec +6 -4
- data/spec/berkeley/database.rb +83 -0
- data/spec/berkeley/environment.rb +58 -0
- data/spec/berkeley/sequence.rb +101 -0
- data/spec/berkeley/transaction.rb +92 -0
- data/spec/collection_proxy.rb +38 -0
- data/spec/database.rb +36 -0
- data/spec/model.rb +26 -0
- data/spec/property/base.rb +73 -0
- data/spec/property/field.rb +244 -0
- data/spec/property/plural_association.rb +67 -0
- data/spec/property/singular_association.rb +65 -0
- data/tests/class_compatibility_create.rb +2 -2
- data/tests/eff1_test.rb +1 -1
- data/tests/eff2_test.rb +1 -1
- data/tests/full_runs.rb +1 -1
- data/tests/generate_classes_create.rb +14 -14
- data/tests/migration_create.rb +47 -47
- data/tests/migration_verify.rb +1 -1
- data/tests/missing_class_create.rb +6 -6
- data/tests/properties_order_create.rb +4 -4
- data/tests/read_on_create.rb +33 -34
- data/tests/save_struct.rb +40 -39
- data/tests/unit/database.rb +1 -1
- data/tests/unit/model_tests.rb +73 -65
- metadata +71 -15
- data/tests/unit/model.rb +0 -36
data/tests/unit/model_tests.rb
CHANGED
@@ -31,86 +31,94 @@ module RodTest
|
|
31
31
|
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
def
|
36
|
-
Database.instance
|
34
|
+
class ModuleTests < Test::Unit::TestCase
|
35
|
+
def create_db
|
36
|
+
@database = Database.instance
|
37
|
+
|
38
|
+
@database.create_database("tmp/test_stored_instances") do
|
39
|
+
yield
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
|
-
def
|
40
|
-
Database.instance
|
43
|
+
def create_db_without_block
|
44
|
+
@database = Database.instance
|
45
|
+
@database.create_database("tmp/test_stored_instances")
|
41
46
|
end
|
42
47
|
|
43
|
-
|
48
|
+
def test_reflection
|
44
49
|
# A
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
50
|
+
create_db do
|
51
|
+
assert AStruct.property(:a1)
|
52
|
+
assert AStruct.property(:a1).type
|
53
|
+
assert AStruct.property(:a1).type == :integer
|
54
|
+
|
55
|
+
assert AStruct.property(:a2)
|
56
|
+
assert AStruct.property(:a2).type
|
57
|
+
assert AStruct.property(:a2).type == :ulong
|
58
|
+
assert AStruct.property(:a2).options[:index]
|
59
|
+
assert AStruct.property(:a2).options[:index] == :flat
|
60
|
+
|
61
|
+
assert AStruct.property(:rod_id)
|
62
|
+
|
63
|
+
assert AStruct.property(:b_structs)
|
64
|
+
assert AStruct.property(:b_structs).options[:class_name]
|
65
|
+
assert AStruct.property(:b_structs).options[:class_name] == "RodTest::BStruct"
|
66
|
+
|
67
|
+
# B
|
68
|
+
assert BStruct.property(:a_struct)
|
69
|
+
assert BStruct.property(:rod_id)
|
70
|
+
end
|
71
|
+
end
|
67
72
|
|
68
73
|
def test_instances
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
74
|
+
create_db do
|
75
|
+
a1 = AStruct.new
|
76
|
+
a2 = AStruct.new
|
77
|
+
a3 = AStruct.new
|
78
|
+
|
79
|
+
b1 = BStruct.new
|
80
|
+
b2 = BStruct.new
|
81
|
+
|
82
|
+
# these are generated, non-trivial accessors, so they need to be tested
|
83
|
+
a1.a1 = 2
|
84
|
+
a1.a2 = 2000000000
|
85
|
+
assert a1.a1 == 2
|
86
|
+
assert a1.a2 == 2000000000
|
87
|
+
|
88
|
+
assert a1.b_structs_count == a1.b_structs.count
|
89
|
+
a1.b_structs = [b1, b2]
|
90
|
+
assert a1.b_structs.to_a == [b1, b2]
|
91
|
+
assert a1.b_structs_count == a1.b_structs.count
|
92
|
+
|
93
|
+
b1.b = "tead-only database"
|
94
|
+
assert b1.b == "tead-only database"
|
95
|
+
end
|
89
96
|
end
|
90
97
|
|
91
98
|
def test_stored_instances
|
99
|
+
create_db do
|
100
|
+
a1 = AStruct.new
|
101
|
+
a2 = AStruct.new
|
102
|
+
a3 = AStruct.new
|
92
103
|
|
93
|
-
|
94
|
-
|
95
|
-
a3 = AStruct.new
|
104
|
+
b1 = BStruct.new
|
105
|
+
b2 = BStruct.new
|
96
106
|
|
97
|
-
|
98
|
-
|
107
|
+
a1.b_structs = [b1, b2]
|
108
|
+
a2.b_structs = [b1]
|
109
|
+
a3.b_structs = []
|
99
110
|
|
100
|
-
|
101
|
-
|
102
|
-
|
111
|
+
a1.store
|
112
|
+
a2.store
|
113
|
+
a3.store
|
103
114
|
|
104
|
-
|
105
|
-
|
106
|
-
a3.store
|
115
|
+
b1.store
|
116
|
+
b2.store
|
107
117
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
assert a1.b_structs_count == a1.b_structs.count
|
112
|
-
#p "AStruct.count: #{AStruct.count}" <- should throw a more relevant exception
|
118
|
+
assert a1.b_structs_count == a1.b_structs.count
|
119
|
+
#p "AStruct.count: #{AStruct.count}" <- should throw a more relevant exception
|
120
|
+
end
|
113
121
|
end
|
114
|
-
|
122
|
+
end
|
115
123
|
end
|
116
124
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Aleksander Pohl
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-07-01 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: RubyInline
|
@@ -46,12 +46,9 @@ dependencies:
|
|
46
46
|
requirement: &id003 !ruby/object:Gem::Requirement
|
47
47
|
none: false
|
48
48
|
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: 3.0.7
|
52
|
-
- - <
|
49
|
+
- - ~>
|
53
50
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
51
|
+
version: 3.2.2
|
55
52
|
type: :runtime
|
56
53
|
version_requirements: *id003
|
57
54
|
- !ruby/object:Gem::Dependency
|
@@ -74,12 +71,9 @@ dependencies:
|
|
74
71
|
requirement: &id005 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
73
|
requirements:
|
77
|
-
- -
|
74
|
+
- - ~>
|
78
75
|
- !ruby/object:Gem::Version
|
79
76
|
version: 0.9.8
|
80
|
-
- - <
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0.0
|
83
77
|
type: :development
|
84
78
|
version_requirements: *id005
|
85
79
|
- !ruby/object:Gem::Dependency
|
@@ -121,7 +115,18 @@ dependencies:
|
|
121
115
|
version: 1.0.0
|
122
116
|
type: :development
|
123
117
|
version_requirements: *id008
|
124
|
-
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: minitest
|
120
|
+
prerelease: false
|
121
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ~>
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.7.0
|
127
|
+
type: :development
|
128
|
+
version_requirements: *id009
|
129
|
+
description: Ruby Object Database is designed for large amounts of data, whose structure rarely changes.
|
125
130
|
email:
|
126
131
|
- apohllo@o2.pl
|
127
132
|
executables: []
|
@@ -138,7 +143,24 @@ files:
|
|
138
143
|
- Rakefile
|
139
144
|
- changelog.txt
|
140
145
|
- contributors.txt
|
146
|
+
- data/backward/0.7.0/_join_element.dat
|
147
|
+
- data/backward/0.7.0/_polymorphic_join_element.dat
|
148
|
+
- data/backward/0.7.0/char.dat
|
149
|
+
- data/backward/0.7.0/database.yml
|
150
|
+
- data/backward/0.7.0/rod_test__automobile.dat
|
151
|
+
- data/backward/0.7.0/rod_test__caveman.dat
|
152
|
+
- data/backward/0.7.0/rod_test__dog.dat
|
153
|
+
- data/backward/0.7.0/rod_test__test_model.dat
|
154
|
+
- data/portability/_join_element.dat
|
155
|
+
- data/portability/_polymorphic_join_element.dat
|
156
|
+
- data/portability/char.dat
|
157
|
+
- data/portability/database.yml
|
158
|
+
- data/portability/rod_test__automobile.dat
|
159
|
+
- data/portability/rod_test__caveman.dat
|
160
|
+
- data/portability/rod_test__dog.dat
|
161
|
+
- data/portability/rod_test__test_model.dat
|
141
162
|
- features/append.feature
|
163
|
+
- features/backward.feature
|
142
164
|
- features/basic.feature
|
143
165
|
- features/collection.feature
|
144
166
|
- features/collection_proxy.feature
|
@@ -147,6 +169,7 @@ files:
|
|
147
169
|
- features/inheritence.feature
|
148
170
|
- features/muliple_db.feature
|
149
171
|
- features/persistence.feature
|
172
|
+
- features/portability.feature
|
150
173
|
- features/relationship_indexing.feature
|
151
174
|
- features/relationships.feature
|
152
175
|
- features/segmented_indexing.feature
|
@@ -159,6 +182,11 @@ files:
|
|
159
182
|
- lib/rod.rb
|
160
183
|
- lib/rod/abstract_database.rb
|
161
184
|
- lib/rod/abstract_model.rb
|
185
|
+
- lib/rod/berkeley/collection_proxy.rb
|
186
|
+
- lib/rod/berkeley/database.rb
|
187
|
+
- lib/rod/berkeley/environment.rb
|
188
|
+
- lib/rod/berkeley/sequence.rb
|
189
|
+
- lib/rod/berkeley/transaction.rb
|
162
190
|
- lib/rod/cache.rb
|
163
191
|
- lib/rod/collection_proxy.rb
|
164
192
|
- lib/rod/constants.rb
|
@@ -170,11 +198,26 @@ files:
|
|
170
198
|
- lib/rod/index/segmented_index.rb
|
171
199
|
- lib/rod/join_element.rb
|
172
200
|
- lib/rod/model.rb
|
201
|
+
- lib/rod/property/base.rb
|
202
|
+
- lib/rod/property/field.rb
|
203
|
+
- lib/rod/property/plural_association.rb
|
204
|
+
- lib/rod/property/singular_association.rb
|
173
205
|
- lib/rod/reference_updater.rb
|
174
206
|
- lib/rod/string_element.rb
|
175
207
|
- lib/rod/string_ex.rb
|
176
208
|
- lib/rod/utils.rb
|
177
209
|
- rod.gemspec
|
210
|
+
- spec/berkeley/database.rb
|
211
|
+
- spec/berkeley/environment.rb
|
212
|
+
- spec/berkeley/sequence.rb
|
213
|
+
- spec/berkeley/transaction.rb
|
214
|
+
- spec/collection_proxy.rb
|
215
|
+
- spec/database.rb
|
216
|
+
- spec/model.rb
|
217
|
+
- spec/property/base.rb
|
218
|
+
- spec/property/field.rb
|
219
|
+
- spec/property/plural_association.rb
|
220
|
+
- spec/property/singular_association.rb
|
178
221
|
- tests/check_strings.rb
|
179
222
|
- tests/class_compatibility_create.rb
|
180
223
|
- tests/class_compatibility_verify.rb
|
@@ -201,7 +244,6 @@ files:
|
|
201
244
|
- tests/structures.rb
|
202
245
|
- tests/unit/abstract_database.rb
|
203
246
|
- tests/unit/database.rb
|
204
|
-
- tests/unit/model.rb
|
205
247
|
- tests/unit/model_tests.rb
|
206
248
|
- tests/validate_read_on_create.rb
|
207
249
|
- utils/convert_index.rb
|
@@ -229,12 +271,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
271
|
requirements: []
|
230
272
|
|
231
273
|
rubyforge_project: rod
|
232
|
-
rubygems_version: 1.8.
|
274
|
+
rubygems_version: 1.8.24
|
233
275
|
signing_key:
|
234
276
|
specification_version: 3
|
235
|
-
summary: Ruby
|
277
|
+
summary: Ruby Object Database
|
236
278
|
test_files:
|
237
279
|
- features/append.feature
|
280
|
+
- features/backward.feature
|
238
281
|
- features/basic.feature
|
239
282
|
- features/collection.feature
|
240
283
|
- features/collection_proxy.feature
|
@@ -243,6 +286,7 @@ test_files:
|
|
243
286
|
- features/inheritence.feature
|
244
287
|
- features/muliple_db.feature
|
245
288
|
- features/persistence.feature
|
289
|
+
- features/portability.feature
|
246
290
|
- features/relationship_indexing.feature
|
247
291
|
- features/relationships.feature
|
248
292
|
- features/segmented_indexing.feature
|
@@ -252,3 +296,15 @@ test_files:
|
|
252
296
|
- features/steps/test_helper.rb
|
253
297
|
- features/support/mocha.rb
|
254
298
|
- features/update.feature
|
299
|
+
- spec/berkeley/database.rb
|
300
|
+
- spec/berkeley/environment.rb
|
301
|
+
- spec/berkeley/sequence.rb
|
302
|
+
- spec/berkeley/transaction.rb
|
303
|
+
- spec/collection_proxy.rb
|
304
|
+
- spec/database.rb
|
305
|
+
- spec/model.rb
|
306
|
+
- spec/property/base.rb
|
307
|
+
- spec/property/field.rb
|
308
|
+
- spec/property/plural_association.rb
|
309
|
+
- spec/property/singular_association.rb
|
310
|
+
has_rdoc:
|
data/tests/unit/model.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
$:.unshift("tests")
|
2
|
-
require 'test/unit'
|
3
|
-
require 'structures'
|
4
|
-
|
5
|
-
class ModelTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
RodTest::Database.instance.open_database("tmp/abc")
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
RodTest::Database.instance.close_database()
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_referential_integrity
|
15
|
-
struct1 = RodTest::MyStruct.find_by_title("title_0")
|
16
|
-
assert(not(struct1.nil?))
|
17
|
-
struct2 = RodTest::MyStruct.find_by_title("title_0")
|
18
|
-
assert(not(struct2.nil?))
|
19
|
-
assert(struct1.object_id == struct2.object_id,
|
20
|
-
"Referential integrity not working for find_by " +
|
21
|
-
"#{struct1.object_id}:#{struct2.object_id}")
|
22
|
-
|
23
|
-
struct3 = RodTest::YourStruct[0]
|
24
|
-
assert(not(struct3.nil?))
|
25
|
-
struct4 = RodTest::HisStruct[0]
|
26
|
-
assert(not(struct4.nil?))
|
27
|
-
assert(struct3.his_structs[0].object_id == struct4.object_id,
|
28
|
-
"Referential integrity not working for has_many " +
|
29
|
-
"#{struct3.his_structs[0].object_id}:#{struct4.object_id}")
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_print_system_error
|
33
|
-
puts "Test system error:"
|
34
|
-
RodTest::Database.instance.print_system_error
|
35
|
-
end
|
36
|
-
end
|