cql-rb 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Ruby CQL3 driver
2
2
 
3
- [![Build Status](https://travis-ci.org/iconara/cql-rb.png?branch=master)](https://travis-ci.org/iconara/cql-rb)
4
-
5
3
  # Requirements
6
4
 
7
5
  Cassandra 1.2 with the native transport protocol turned on and a modern Ruby. Tested with Ruby 1.9.3 and JRuby and 1.7.x.
@@ -31,6 +29,8 @@ when you're done you can call `#close` to disconnect from Cassandra. You can con
31
29
 
32
30
  # Usage
33
31
 
32
+ The full [API documentation](http://rubydoc.info/gems/cql-rb/frames) is available from [rubydoc.info](http://rubydoc.info/).
33
+
34
34
  ## Changing keyspaces
35
35
 
36
36
  ```ruby
@@ -204,6 +204,8 @@ Open an issue and I'll do my best to help you. Please include the gem version, C
204
204
 
205
205
  # Known bugs & limitations
206
206
 
207
+ [![Build Status](https://travis-ci.org/iconara/cql-rb.png?branch=master)](https://travis-ci.org/iconara/cql-rb)
208
+
207
209
  * No automatic peer discovery.
208
210
  * No automatic reconnection on connection failures.
209
211
  * JRuby 1.6.8 and earlier is not supported, although it probably works fine. The only known issue is that connection failures aren't handled gracefully.
@@ -51,7 +51,7 @@ module Cql
51
51
  when_not_connecting do
52
52
  f = @io_reactor.stop
53
53
  f.on_complete { @closed_future.complete!(self) }
54
- f.on_failure { @closed_future.fail!(e) }
54
+ f.on_failure { |e| @closed_future.fail!(e) }
55
55
  end
56
56
  @closed_future.on_complete do
57
57
  @lock.synchronize do
data/lib/cql/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Cql
4
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.0.1'.freeze
5
5
  end
@@ -158,6 +158,11 @@ module Cql
158
158
  it 'returns itself' do
159
159
  client.connect.get.close.get.should equal(client)
160
160
  end
161
+
162
+ it 'fails when the IO reactor stop fails' do
163
+ io_reactor.stub(:stop).and_return(Future.failed(StandardError.new('Bork!')))
164
+ expect { client.close.get }.to raise_error('Bork!')
165
+ end
161
166
  end
162
167
 
163
168
  describe '#use' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.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-06-13 00:00:00.000000000 Z
12
+ date: 2013-06-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A pure Ruby CQL3 driver for Cassandra
15
15
  email:
@@ -86,7 +86,6 @@ files:
86
86
  - spec/cql/uuid_spec.rb
87
87
  - spec/integration/client_spec.rb
88
88
  - spec/integration/protocol_spec.rb
89
- - spec/integration/regression_spec.rb
90
89
  - spec/spec_helper.rb
91
90
  - spec/support/await_helper.rb
92
91
  - spec/support/bytes_helper.rb
@@ -113,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
112
  version: '0'
114
113
  segments:
115
114
  - 0
116
- hash: -3274197899140325066
115
+ hash: 2653215981660413619
117
116
  requirements: []
118
117
  rubyforge_project:
119
118
  rubygems_version: 1.8.23
@@ -142,7 +141,6 @@ test_files:
142
141
  - spec/cql/uuid_spec.rb
143
142
  - spec/integration/client_spec.rb
144
143
  - spec/integration/protocol_spec.rb
145
- - spec/integration/regression_spec.rb
146
144
  - spec/spec_helper.rb
147
145
  - spec/support/await_helper.rb
148
146
  - spec/support/bytes_helper.rb
@@ -1,133 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
-
6
- describe 'Regressions' do
7
- let :connection_options do
8
- {:host => ENV['CASSANDRA_HOST']}
9
- end
10
-
11
- let :client do
12
- Cql::Client.connect(connection_options)
13
- end
14
-
15
- before do
16
- client.connect
17
- client.execute('DROP KEYSPACE cql_rb_client_spec') rescue nil
18
- client.execute(%(CREATE KEYSPACE cql_rb_client_spec WITH REPLICATION = {'CLASS': 'SimpleStrategy', 'replication_factor': 1}))
19
- client.use('cql_rb_client_spec')
20
- end
21
-
22
- after do
23
- client.execute('DROP KEYSPACE cql_rb_client_spec') rescue nil
24
- client.close
25
- end
26
-
27
- it 'executes queries with multibyte characters' do
28
- client.execute(%(CREATE TABLE users (user_id VARCHAR PRIMARY KEY, first VARCHAR, last VARCHAR, age INT)))
29
- client.execute(%(INSERT INTO users (user_id, first, last, age) VALUES ('test', 'ümlaut', 'test', 1)))
30
- end
31
-
32
- context 'with prepared statements' do
33
- it 'handles multibyte characters in prepared statements' do
34
- client.execute(%(CREATE TABLE users (user_id VARCHAR PRIMARY KEY, first VARCHAR, last VARCHAR, age INT)))
35
- client.execute("INSERT INTO users (user_id, first, last, age) VALUES ('test', 'ümlaut', 'test', 1)")
36
- statement = client.prepare('INSERT INTO users (user_id, first, last, age) VALUES (?, ?, ?, ?)')
37
- statement.execute('test2', 'test2', 'test2', 2)
38
- statement.execute('test3', 'ümlaut', 'test3', 3)
39
- end
40
-
41
- it 'prepares and executes a statement with an append to a set' do
42
- client.execute(%(CREATE TABLE users (name VARCHAR PRIMARY KEY, emails SET<VARCHAR>)))
43
- statement = client.prepare(%(UPDATE users SET emails = emails + ? WHERE name = 'eve'))
44
- statement.execute(['eve@gmail.com'])
45
- end
46
-
47
- it 'prepares and executes a statement with an append to a list' do
48
- client.execute(%(CREATE TABLE users (name VARCHAR PRIMARY KEY, emails LIST<VARCHAR>)))
49
- statement = client.prepare(%(UPDATE users SET emails = emails + ? WHERE name = 'eve'))
50
- statement.execute(['eve@gmail.com', 'eve@yahoo.com'])
51
- end
52
-
53
- it 'prepares and executes a statement with an append to a map' do
54
- client.execute(%(CREATE TABLE users (name VARCHAR PRIMARY KEY, emails MAP<VARCHAR, VARCHAR>)))
55
- statement = client.prepare(%(UPDATE users SET emails = emails + ? WHERE name = 'eve'))
56
- statement.execute({'home' => 'eve@yahoo.com'})
57
- end
58
-
59
- it 'prepares and executes a statement with a map assignment' do
60
- client.execute(%(CREATE TABLE users (name VARCHAR PRIMARY KEY, emails MAP<VARCHAR, VARCHAR>)))
61
- statement = client.prepare(%(UPDATE users SET emails['home'] = ? WHERE name = 'eve'))
62
- statement.execute('eve@gmail.com')
63
- end
64
- end
65
-
66
- context 'frame decoding' do
67
- it 'decodes null counters' do
68
- client.execute(%<CREATE TABLE counters (id ASCII, counter1 COUNTER, counter2 COUNTER, PRIMARY KEY (id))>)
69
- client.execute(%<UPDATE counters SET counter1 = counter1 + 1 WHERE id = 'foo'>)
70
- result = client.execute(%<SELECT counter1, counter2 FROM counters WHERE id = 'foo'>)
71
- result.first['counter1'].should == 1
72
- result.first['counter2'].should be_nil
73
- end
74
-
75
- it 'decodes null values' do
76
- client.execute(<<-CQL)
77
- CREATE TABLE lots_of_types (
78
- id INT,
79
- ascii_column ASCII,
80
- bigint_column BIGINT,
81
- blob_column BLOB,
82
- boolean_column BOOLEAN,
83
- decimal_column DECIMAL,
84
- double_column DOUBLE,
85
- float_column FLOAT,
86
- int_column INT,
87
- text_column TEXT,
88
- timestamp_column TIMESTAMP,
89
- uuid_column UUID,
90
- varchar_column VARCHAR,
91
- varint_column VARINT,
92
- timeuuid_column TIMEUUID,
93
- inet_column INET,
94
- list_column LIST<ASCII>,
95
- map_column MAP<TEXT, BOOLEAN>,
96
- set_column SET<BLOB>,
97
- PRIMARY KEY (id)
98
- )
99
- CQL
100
- client.execute(%<INSERT INTO lots_of_types (id) VALUES (3)>)
101
- result = client.execute(%<SELECT * FROM lots_of_types WHERE id = 3>)
102
- row = result.first
103
- row['ascii_column'].should be_nil
104
- row['bigint_column'].should be_nil
105
- row['blob_column'].should be_nil
106
- row['boolean_column'].should be_nil
107
- row['decimal_column'].should be_nil
108
- row['double_column'].should be_nil
109
- row['float_column'].should be_nil
110
- row['int_column'].should be_nil
111
- row['text_column'].should be_nil
112
- row['timestamp_column'].should be_nil
113
- row['uuid_column'].should be_nil
114
- row['varchar_column'].should be_nil
115
- row['varint_column'].should be_nil
116
- row['timeuuid_column'].should be_nil
117
- row['inet_column'].should be_nil
118
- row['list_column'].should be_nil
119
- row['map_column'].should be_nil
120
- row['set_column'].should be_nil
121
- end
122
- end
123
-
124
- context 'wat' do
125
- it 'null values' do
126
- client.execute('CREATE TABLE null_value (a BIGINT, b BOOLEAN, c INT, PRIMARY KEY ((a, b), c))')
127
- client.execute('INSERT INTO null_value (a, b, c) VALUES (123123123123, true, 3234)')
128
- client.execute('INSERT INTO null_value (a, b, c) VALUES (123123123123, true, 234243)')
129
- client.execute('INSERT INTO null_value (a, b, c) VALUES (456456, false, 465645)')
130
- p client.execute('SELECT * FROM null_value').to_a
131
- end
132
- end
133
- end