eurydice 1.1.0.b4-java → 1.1.1.b1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -3
- data/Gemfile.lock +12 -13
- data/eurydice.gemspec +1 -1
- data/examples/01_connect.rb +1 -1
- data/lib/eurydice/pelops/column_family.rb +62 -24
- data/lib/eurydice/version.rb +1 -1
- data/spec/eurydice/pelops/cluster_spec.rb +2 -27
- data/spec/eurydice/pelops/column_family_spec.rb +3 -560
- data/spec/eurydice/pelops/keyspace_spec.rb +4 -76
- data/spec/eurydice/support/cluster.rb +35 -0
- data/spec/eurydice/support/column_family.rb +593 -0
- data/spec/eurydice/support/keyspace.rb +80 -0
- data/spec/spec_helper.rb +5 -1
- metadata +6 -3
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Eurydice
|
4
|
+
shared_examples 'Keyspace' do
|
5
|
+
after do
|
6
|
+
@keyspace.drop! rescue nil
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#create!' do
|
10
|
+
it 'creates a keyspace with a specific strategy class' do
|
11
|
+
@keyspace = @cluster.keyspace(@keyspace_name, :create => false)
|
12
|
+
@keyspace.create!(:strategy_class => 'org.apache.cassandra.locator.NetworkTopologyStrategy')
|
13
|
+
@keyspace.definition(true)[:strategy_class].should == 'org.apache.cassandra.locator.NetworkTopologyStrategy'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'creates a keyspace with specific strategy options' do
|
17
|
+
@keyspace = @cluster.keyspace(@keyspace_name, :create => false)
|
18
|
+
@keyspace.create!(:strategy_options => {:replication_factor => 2})
|
19
|
+
@keyspace.definition(true)[:strategy_options][:replication_factor].should == 2
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'creates a whole schema' do
|
23
|
+
@keyspace = @cluster.keyspace(@keyspace_name, :create => false)
|
24
|
+
@keyspace.create!(
|
25
|
+
:strategy_class => 'org.apache.cassandra.locator.NetworkTopologyStrategy',
|
26
|
+
:strategy_options => {:dc1 => 1, :dc2 => 2},
|
27
|
+
:column_families => {
|
28
|
+
'some_family' => {
|
29
|
+
:comparator_type => :ascii,
|
30
|
+
:comment => 'This is some family'
|
31
|
+
},
|
32
|
+
'another_family' => {
|
33
|
+
:comparator_type => :utf8,
|
34
|
+
:comment => 'This is another family',
|
35
|
+
:column_metadata => {
|
36
|
+
'first_col' => {
|
37
|
+
:validation_class => :ascii,
|
38
|
+
:index_name => 'first_index',
|
39
|
+
:index_type => :keys
|
40
|
+
},
|
41
|
+
'second_col' => {
|
42
|
+
:validation_class => :time_uuid
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
)
|
48
|
+
definition = @keyspace.definition(true)
|
49
|
+
definition[:strategy_class].should == 'org.apache.cassandra.locator.NetworkTopologyStrategy'
|
50
|
+
definition[:strategy_options].should == {:dc1 => 1, :dc2 => 2}
|
51
|
+
definition[:column_families]['some_family'][:comparator_type].should == 'org.apache.cassandra.db.marshal.AsciiType'
|
52
|
+
definition[:column_families]['some_family'][:comment].should == 'This is some family'
|
53
|
+
definition[:column_families]['another_family'][:comment].should == 'This is another family'
|
54
|
+
definition[:column_families]['another_family'][:column_metadata]['first_col'][:validation_class].should == 'org.apache.cassandra.db.marshal.AsciiType'
|
55
|
+
definition[:column_families]['another_family'][:column_metadata]['first_col'][:index_name].should == 'first_index'
|
56
|
+
definition[:column_families]['another_family'][:column_metadata]['second_col'][:validation_class].should == 'org.apache.cassandra.db.marshal.TimeUUIDType'
|
57
|
+
@keyspace.column_family('some_family', :create => false).should exist
|
58
|
+
@keyspace.column_family('another_family', :create => false).should exist
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#drop!' do
|
63
|
+
it 'drops a keyspace' do
|
64
|
+
@keyspace = @cluster.keyspace(@keyspace_name)
|
65
|
+
@keyspace.drop!
|
66
|
+
@keyspace.exists?.should be_false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#definition' do
|
71
|
+
it 'returns keyspace metadata' do
|
72
|
+
@keyspace = @cluster.keyspace(@keyspace_name)
|
73
|
+
definition = @keyspace.definition
|
74
|
+
definition[:name].should == @keyspace_name
|
75
|
+
definition[:strategy_class].should == 'org.apache.cassandra.locator.SimpleStrategy'
|
76
|
+
definition[:strategy_options].should == {:replication_factor => 1}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
$: << File.expand_path('../../lib', __FILE__)
|
2
2
|
|
3
3
|
require 'bundler/setup'
|
4
|
-
require 'eurydice/pelops'
|
4
|
+
require 'eurydice/pelops'
|
5
|
+
|
6
|
+
require_relative 'eurydice/support/cluster'
|
7
|
+
require_relative 'eurydice/support/column_family'
|
8
|
+
require_relative 'eurydice/support/keyspace'
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: eurydice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.1.b1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Theo Hultberg
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-02 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pelops-jars
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.3.0
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
description: ""
|
@@ -58,6 +58,9 @@ files:
|
|
58
58
|
- spec/eurydice/pelops/cluster_spec.rb
|
59
59
|
- spec/eurydice/pelops/column_family_spec.rb
|
60
60
|
- spec/eurydice/pelops/keyspace_spec.rb
|
61
|
+
- spec/eurydice/support/cluster.rb
|
62
|
+
- spec/eurydice/support/column_family.rb
|
63
|
+
- spec/eurydice/support/keyspace.rb
|
61
64
|
- spec/spec_helper.rb
|
62
65
|
homepage: http://github.com/iconara/eurydice
|
63
66
|
licenses: []
|