cassanity 0.5.0 → 0.5.1
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/lib/cassanity/keyspace.rb +14 -3
- data/lib/cassanity/version.rb +1 -1
- data/spec/unit/cassanity/keyspace_spec.rb +38 -0
- metadata +4 -4
data/lib/cassanity/keyspace.rb
CHANGED
@@ -66,11 +66,22 @@ module Cassanity
|
|
66
66
|
#
|
67
67
|
# Returns whatever is returned by executor.
|
68
68
|
def create(args = {})
|
69
|
+
create_arguments = {}.merge(args)
|
70
|
+
|
71
|
+
if @strategy_class
|
72
|
+
create_arguments[:strategy_class] = @strategy_class
|
73
|
+
end
|
74
|
+
|
75
|
+
if @strategy_options
|
76
|
+
strategy_options = args[:strategy_options] || {}
|
77
|
+
create_arguments[:strategy_options] = strategy_options.merge(@strategy_options)
|
78
|
+
end
|
79
|
+
|
80
|
+
create_arguments[:keyspace_name] = @name
|
81
|
+
|
69
82
|
@executor.call({
|
70
83
|
command: :keyspace_create,
|
71
|
-
arguments:
|
72
|
-
keyspace_name: @name,
|
73
|
-
})
|
84
|
+
arguments: create_arguments,
|
74
85
|
})
|
75
86
|
end
|
76
87
|
|
data/lib/cassanity/version.rb
CHANGED
@@ -240,6 +240,44 @@ describe Cassanity::Keyspace do
|
|
240
240
|
})
|
241
241
|
subject.create(args)
|
242
242
|
end
|
243
|
+
|
244
|
+
it "includes strategy class and options if present" do
|
245
|
+
args = {something: 'else'}
|
246
|
+
|
247
|
+
executor.should_receive(:call).with({
|
248
|
+
command: :keyspace_create,
|
249
|
+
arguments: args.merge({
|
250
|
+
keyspace_name: keyspace_name,
|
251
|
+
strategy_class: 'NetworkTopologyStrategy',
|
252
|
+
strategy_options: {replication_factory: 3},
|
253
|
+
}),
|
254
|
+
})
|
255
|
+
|
256
|
+
instance = described_class.new(required_arguments.merge({
|
257
|
+
strategy_class: 'NetworkTopologyStrategy',
|
258
|
+
strategy_options: {replication_factory: 3},
|
259
|
+
}))
|
260
|
+
|
261
|
+
instance.create(args)
|
262
|
+
end
|
263
|
+
|
264
|
+
it "merges strategy options in args with initialized strategy options" do
|
265
|
+
args = {strategy_options: {dc1: 1}}
|
266
|
+
|
267
|
+
executor.should_receive(:call).with({
|
268
|
+
command: :keyspace_create,
|
269
|
+
arguments: {
|
270
|
+
keyspace_name: keyspace_name,
|
271
|
+
strategy_options: {dc1: 1, dc2: 2},
|
272
|
+
},
|
273
|
+
})
|
274
|
+
|
275
|
+
instance = described_class.new(required_arguments.merge({
|
276
|
+
strategy_options: {dc2: 2},
|
277
|
+
}))
|
278
|
+
|
279
|
+
instance.create(args)
|
280
|
+
end
|
243
281
|
end
|
244
282
|
|
245
283
|
describe "#recreate" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cassandra-cql
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
segments:
|
194
194
|
- 0
|
195
|
-
hash:
|
195
|
+
hash: -90461320440382772
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
none: false
|
198
198
|
requirements:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash:
|
204
|
+
hash: -90461320440382772
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
207
|
rubygems_version: 1.8.23
|