gotime-cassandra_object 0.9.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +70 -25
- data/Rakefile +11 -39
- data/gotime-cassandra_object.gemspec +6 -6
- data/lib/cassandra_object.rb +6 -12
- data/lib/cassandra_object/associations.rb +1 -1
- data/lib/cassandra_object/attributes.rb +53 -43
- data/lib/cassandra_object/base.rb +4 -17
- data/lib/cassandra_object/batches.rb +13 -0
- data/lib/cassandra_object/connection.rb +15 -0
- data/lib/cassandra_object/dirty.rb +19 -14
- data/lib/cassandra_object/finder_methods.rb +64 -0
- data/lib/cassandra_object/identity.rb +0 -1
- data/lib/cassandra_object/migrations.rb +3 -1
- data/lib/cassandra_object/persistence.rb +51 -94
- data/lib/cassandra_object/railtie.rb +11 -0
- data/lib/cassandra_object/tasks/{ks.rb → ks.rake} +0 -2
- data/lib/cassandra_object/validation.rb +11 -15
- data/{test → test-old}/active_model_test.rb +0 -0
- data/test-old/base_test.rb +4 -0
- data/{test → test-old}/basic_scenarios_test.rb +0 -0
- data/{test → test-old}/callbacks_test.rb +0 -0
- data/{test → test-old}/config/cassandra.in.sh +0 -0
- data/{test → test-old}/config/log4j.properties +0 -0
- data/{test → test-old}/config/storage-conf.xml +0 -0
- data/{test → test-old}/connection.rb +0 -0
- data/{test → test-old}/cursor_test.rb +0 -0
- data/{test → test-old}/dirty_test.rb +0 -0
- data/{test → test-old}/fixture_models.rb +0 -0
- data/{test → test-old}/identity/natural_key_factory_test.rb +0 -0
- data/{test → test-old}/index_test.rb +0 -0
- data/{test → test-old}/legacy/test_helper.rb +0 -0
- data/{test → test-old}/migration_test.rb +0 -0
- data/{test → test-old}/one_to_many_associations_test.rb +0 -0
- data/{test → test-old}/test_case.rb +0 -0
- data/test-old/test_helper.rb +16 -0
- data/{test → test-old}/time_test.rb +0 -0
- data/{test → test-old}/types_test.rb +0 -0
- data/{test → test-old}/validation_test.rb +0 -0
- data/{test → test-old}/z_mock_test.rb +0 -0
- data/test/batches_test.rb +15 -0
- data/test/connection_test.rb +17 -0
- data/test/finder_methods_test.rb +28 -0
- data/test/identity_test.rb +15 -0
- data/test/persistence_test.rb +17 -0
- data/test/test_helper.rb +21 -12
- metadata +75 -165
- data/lib/cassandra_object/find_each.rb +0 -28
- data/lib/cassandra_object/find_with_ids.rb +0 -24
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CassandraObject::BatchesTest < CassandraObject::TestCase
|
4
|
+
test 'find_each' do
|
5
|
+
Issue.create
|
6
|
+
Issue.create
|
7
|
+
|
8
|
+
issues = []
|
9
|
+
Issue.find_each do |issue|
|
10
|
+
issues << issue
|
11
|
+
end
|
12
|
+
|
13
|
+
assert_equal Issue.all.to_set, issues.to_set
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CassandraObject::ConnectionTest < CassandraObject::TestCase
|
4
|
+
class TestObject < CassandraObject::Base
|
5
|
+
end
|
6
|
+
|
7
|
+
test 'establish_connection' do
|
8
|
+
TestObject.establish_connection(
|
9
|
+
keyspace: 'place_directory_development',
|
10
|
+
servers: '192.168.0.100:9160'
|
11
|
+
)
|
12
|
+
|
13
|
+
assert_not_equal CassandraObject::Base.connection, TestObject.connection
|
14
|
+
assert_equal 'place_directory_development', TestObject.connection.keyspace
|
15
|
+
assert_equal ["192.168.0.100:9160"], TestObject.connection.servers
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CassandraObject::FinderMethodsTest < CassandraObject::TestCase
|
4
|
+
test 'first' do
|
5
|
+
first_issue = Issue.create
|
6
|
+
second_issue = Issue.create
|
7
|
+
|
8
|
+
assert [first_issue, second_issue].include?(Issue.first)
|
9
|
+
end
|
10
|
+
|
11
|
+
test 'all' do
|
12
|
+
first_issue = Issue.create
|
13
|
+
second_issue = Issue.create
|
14
|
+
|
15
|
+
assert_equal [first_issue, second_issue].to_set, Issue.all.to_set
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'find_with_ids' do
|
19
|
+
first_issue = Issue.create
|
20
|
+
second_issue = Issue.create
|
21
|
+
third_issue = Issue.create
|
22
|
+
|
23
|
+
assert_equal [], Issue.find_with_ids([])
|
24
|
+
assert_equal first_issue, Issue.find_with_ids(first_issue.key)
|
25
|
+
assert_equal [first_issue, second_issue].to_set, Issue.find_with_ids(first_issue.key, second_issue.key).to_set
|
26
|
+
assert_equal [first_issue, second_issue].to_set, Issue.find_with_ids([first_issue.key, second_issue.key]).to_set
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CassandraObject::IdentiyTest < CassandraObject::TestCase
|
4
|
+
test 'equality of new records' do
|
5
|
+
assert_not_equal Issue.new, Issue.new
|
6
|
+
end
|
7
|
+
|
8
|
+
test 'equality' do
|
9
|
+
first_issue = Issue.create
|
10
|
+
second_issue = Issue.create
|
11
|
+
|
12
|
+
assert_equal first_issue, first_issue
|
13
|
+
assert_not_equal first_issue, second_issue
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CassandraObject::PersistenceTest < CassandraObject::TestCase
|
4
|
+
test 'persisted' do
|
5
|
+
issue = Issue.new
|
6
|
+
assert issue.new_record?
|
7
|
+
assert !issue.persisted?
|
8
|
+
|
9
|
+
issue.save
|
10
|
+
assert issue.persisted?
|
11
|
+
assert !issue.new_record?
|
12
|
+
|
13
|
+
issue.destroy
|
14
|
+
assert issue.destroyed?
|
15
|
+
assert !issue.persisted?
|
16
|
+
end
|
17
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
|
4
|
-
Bundler.setup
|
5
|
-
|
6
1
|
require 'cassandra_object'
|
7
|
-
require '
|
2
|
+
require 'rails/test_help'
|
3
|
+
|
4
|
+
class Issue < CassandraObject::Base
|
5
|
+
key :uuid
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
module CassandraObject
|
9
|
+
class TestCase < ActiveSupport::TestCase
|
10
|
+
setup do
|
11
|
+
CassandraObject::Base.establish_connection(
|
12
|
+
keyspace: 'place_directory_development',
|
13
|
+
servers: '192.168.0.100:9160'
|
14
|
+
)
|
15
|
+
end
|
12
16
|
|
13
|
-
|
14
|
-
|
17
|
+
teardown do
|
18
|
+
Issue.delete_all
|
19
|
+
end
|
15
20
|
|
16
|
-
|
21
|
+
def connection
|
22
|
+
CassandraObject::Base.connection
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,131 +1,57 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotime-cassandra_object
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 1
|
9
|
-
version: 0.9.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Michael Koziarski
|
13
9
|
- gotime
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
name: activesupport
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
13
|
+
date: 2011-07-22 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: &2153244980 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
19
|
+
requirements:
|
27
20
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
version: "3.0"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
33
23
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: activemodel
|
37
24
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
requirements:
|
41
|
-
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 3
|
45
|
-
- 0
|
46
|
-
version: "3.0"
|
47
|
-
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: *2153244980
|
26
|
+
- !ruby/object:Gem::Dependency
|
50
27
|
name: cassandra
|
51
|
-
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
28
|
+
requirement: &2153244520 !ruby/object:Gem::Requirement
|
53
29
|
none: false
|
54
|
-
requirements:
|
30
|
+
requirements:
|
55
31
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
- 11
|
60
|
-
- 3
|
32
|
+
- !ruby/object:Gem::Version
|
61
33
|
version: 0.11.3
|
62
34
|
type: :runtime
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: shoulda
|
66
35
|
prerelease: false
|
67
|
-
|
68
|
-
|
69
|
-
requirements:
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
type: :development
|
76
|
-
version_requirements: *id004
|
77
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *2153244520
|
37
|
+
- !ruby/object:Gem::Dependency
|
78
38
|
name: bundler
|
79
|
-
|
80
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
39
|
+
requirement: &2153244060 !ruby/object:Gem::Requirement
|
81
40
|
none: false
|
82
|
-
requirements:
|
41
|
+
requirements:
|
83
42
|
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
segments:
|
86
|
-
- 1
|
87
|
-
- 0
|
88
|
-
- 0
|
43
|
+
- !ruby/object:Gem::Version
|
89
44
|
version: 1.0.0
|
90
45
|
type: :development
|
91
|
-
version_requirements: *id005
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: jeweler
|
94
46
|
prerelease: false
|
95
|
-
|
96
|
-
none: false
|
97
|
-
requirements:
|
98
|
-
- - ~>
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
segments:
|
101
|
-
- 1
|
102
|
-
- 5
|
103
|
-
- 1
|
104
|
-
version: 1.5.1
|
105
|
-
type: :development
|
106
|
-
version_requirements: *id006
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
|
-
name: rcov
|
109
|
-
prerelease: false
|
110
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
|
-
requirements:
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
118
|
-
type: :development
|
119
|
-
version_requirements: *id007
|
47
|
+
version_requirements: *2153244060
|
120
48
|
description: Cassandra ActiveModel
|
121
49
|
email: gems@gotime.com
|
122
50
|
executables: []
|
123
|
-
|
124
51
|
extensions: []
|
125
|
-
|
126
|
-
extra_rdoc_files:
|
52
|
+
extra_rdoc_files:
|
127
53
|
- README.markdown
|
128
|
-
files:
|
54
|
+
files:
|
129
55
|
- .gitignore
|
130
56
|
- CHANGELOG
|
131
57
|
- Gemfile
|
@@ -142,13 +68,14 @@ files:
|
|
142
68
|
- lib/cassandra_object/associations/one_to_one.rb
|
143
69
|
- lib/cassandra_object/attributes.rb
|
144
70
|
- lib/cassandra_object/base.rb
|
71
|
+
- lib/cassandra_object/batches.rb
|
145
72
|
- lib/cassandra_object/callbacks.rb
|
146
73
|
- lib/cassandra_object/collection.rb
|
74
|
+
- lib/cassandra_object/connection.rb
|
147
75
|
- lib/cassandra_object/consistency.rb
|
148
76
|
- lib/cassandra_object/cursor.rb
|
149
77
|
- lib/cassandra_object/dirty.rb
|
150
|
-
- lib/cassandra_object/
|
151
|
-
- lib/cassandra_object/find_with_ids.rb
|
78
|
+
- lib/cassandra_object/finder_methods.rb
|
152
79
|
- lib/cassandra_object/generators/migration_generator.rb
|
153
80
|
- lib/cassandra_object/generators/templates/migration.rb.erb
|
154
81
|
- lib/cassandra_object/identity.rb
|
@@ -164,6 +91,7 @@ files:
|
|
164
91
|
- lib/cassandra_object/migrations/migration.rb
|
165
92
|
- lib/cassandra_object/mocking.rb
|
166
93
|
- lib/cassandra_object/persistence.rb
|
94
|
+
- lib/cassandra_object/railtie.rb
|
167
95
|
- lib/cassandra_object/schema.rb
|
168
96
|
- lib/cassandra_object/schema/migration.rb
|
169
97
|
- lib/cassandra_object/schema/migration_proxy.rb
|
@@ -171,85 +99,67 @@ files:
|
|
171
99
|
- lib/cassandra_object/serialization.rb
|
172
100
|
- lib/cassandra_object/tasks/column_family.rb
|
173
101
|
- lib/cassandra_object/tasks/keyspace.rb
|
174
|
-
- lib/cassandra_object/tasks/ks.
|
102
|
+
- lib/cassandra_object/tasks/ks.rake
|
175
103
|
- lib/cassandra_object/timestamps.rb
|
176
104
|
- lib/cassandra_object/type_registration.rb
|
177
105
|
- lib/cassandra_object/types.rb
|
178
106
|
- lib/cassandra_object/validation.rb
|
179
|
-
- test/active_model_test.rb
|
180
|
-
- test/
|
181
|
-
- test/
|
182
|
-
- test/
|
183
|
-
- test/config/
|
184
|
-
- test/config/
|
185
|
-
- test/
|
186
|
-
- test/
|
187
|
-
- test/
|
188
|
-
- test/
|
189
|
-
- test/
|
190
|
-
- test/
|
191
|
-
- test/
|
192
|
-
- test/
|
193
|
-
- test/
|
194
|
-
- test/
|
107
|
+
- test-old/active_model_test.rb
|
108
|
+
- test-old/base_test.rb
|
109
|
+
- test-old/basic_scenarios_test.rb
|
110
|
+
- test-old/callbacks_test.rb
|
111
|
+
- test-old/config/cassandra.in.sh
|
112
|
+
- test-old/config/log4j.properties
|
113
|
+
- test-old/config/storage-conf.xml
|
114
|
+
- test-old/connection.rb
|
115
|
+
- test-old/cursor_test.rb
|
116
|
+
- test-old/dirty_test.rb
|
117
|
+
- test-old/fixture_models.rb
|
118
|
+
- test-old/identity/natural_key_factory_test.rb
|
119
|
+
- test-old/index_test.rb
|
120
|
+
- test-old/legacy/test_helper.rb
|
121
|
+
- test-old/migration_test.rb
|
122
|
+
- test-old/one_to_many_associations_test.rb
|
123
|
+
- test-old/test_case.rb
|
124
|
+
- test-old/test_helper.rb
|
125
|
+
- test-old/time_test.rb
|
126
|
+
- test-old/types_test.rb
|
127
|
+
- test-old/validation_test.rb
|
128
|
+
- test-old/z_mock_test.rb
|
129
|
+
- test/batches_test.rb
|
130
|
+
- test/connection_test.rb
|
131
|
+
- test/finder_methods_test.rb
|
132
|
+
- test/identity_test.rb
|
133
|
+
- test/persistence_test.rb
|
195
134
|
- test/test_helper.rb
|
196
|
-
- test/time_test.rb
|
197
|
-
- test/types_test.rb
|
198
|
-
- test/validation_test.rb
|
199
|
-
- test/z_mock_test.rb
|
200
|
-
has_rdoc: true
|
201
135
|
homepage: http://github.com/gotime/cassandra_object
|
202
136
|
licenses: []
|
203
|
-
|
204
137
|
post_install_message:
|
205
138
|
rdoc_options: []
|
206
|
-
|
207
|
-
require_paths:
|
139
|
+
require_paths:
|
208
140
|
- lib
|
209
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
142
|
none: false
|
211
|
-
requirements:
|
212
|
-
- -
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
|
215
|
-
|
216
|
-
version: "0"
|
217
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 1.9.2
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
148
|
none: false
|
219
|
-
requirements:
|
220
|
-
- -
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
segments:
|
223
|
-
- 1
|
224
|
-
- 3
|
225
|
-
- 5
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
226
152
|
version: 1.3.5
|
227
153
|
requirements: []
|
228
|
-
|
229
154
|
rubyforge_project:
|
230
|
-
rubygems_version: 1.
|
155
|
+
rubygems_version: 1.8.5
|
231
156
|
signing_key:
|
232
157
|
specification_version: 3
|
233
158
|
summary: Cassandra ActiveModel
|
234
|
-
test_files:
|
235
|
-
- test/
|
236
|
-
- test/
|
237
|
-
- test/
|
238
|
-
- test/
|
239
|
-
- test/
|
240
|
-
- test/config/storage-conf.xml
|
241
|
-
- test/connection.rb
|
242
|
-
- test/cursor_test.rb
|
243
|
-
- test/dirty_test.rb
|
244
|
-
- test/fixture_models.rb
|
245
|
-
- test/identity/natural_key_factory_test.rb
|
246
|
-
- test/index_test.rb
|
247
|
-
- test/legacy/test_helper.rb
|
248
|
-
- test/migration_test.rb
|
249
|
-
- test/one_to_many_associations_test.rb
|
250
|
-
- test/test_case.rb
|
159
|
+
test_files:
|
160
|
+
- test/batches_test.rb
|
161
|
+
- test/connection_test.rb
|
162
|
+
- test/finder_methods_test.rb
|
163
|
+
- test/identity_test.rb
|
164
|
+
- test/persistence_test.rb
|
251
165
|
- test/test_helper.rb
|
252
|
-
- test/time_test.rb
|
253
|
-
- test/types_test.rb
|
254
|
-
- test/validation_test.rb
|
255
|
-
- test/z_mock_test.rb
|