couchbase 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,7 +84,7 @@ namespace :ports do
84
84
  directory "ports"
85
85
 
86
86
  task :libcouchbase => ["ports"] do
87
- recipe = MiniPortile.new "libcouchbase", "2.0.1"
87
+ recipe = MiniPortile.new "libcouchbase", "2.0.3"
88
88
  recipe.files << "http://packages.couchbase.com/clients/c/libcouchbase-#{recipe.version}.tar.gz"
89
89
  recipe.configure_options.push("--disable-debug",
90
90
  "--disable-dependency-tracking",
@@ -250,4 +250,67 @@ class TestAsync < MiniTest::Unit::TestCase
250
250
  end
251
251
  end
252
252
 
253
+ def test_asynchronous_connection
254
+ connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port, :async => true)
255
+ refute connection.connected?, "new asynchronous connection must be disconnected"
256
+ connection.on_connect do |res|
257
+ assert res.success?, "on_connect called with error #{res.error.inspect}"
258
+ assert_same connection, res.bucket
259
+ end
260
+ connection.run {}
261
+ assert connection.connected?, "it should be connected after first run"
262
+ end
263
+
264
+ def test_it_calls_callback_immediately_if_connected_sync
265
+ connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
266
+ assert connection.connected?, "connection wasn't established in sync mode"
267
+ called = false
268
+ connection.on_connect do |res|
269
+ assert res.success?, "on_connect called with error #{res.error.inspect}"
270
+ called = true
271
+ end
272
+ assert called, "the callback hasn't been called on set"
273
+ called = false
274
+ connection.on_connect do |res|
275
+ assert res.success?, "on_connect called with error #{res.error.inspect}"
276
+ called = true
277
+ end
278
+ refute called, "the callback must not be called on subsequent sets"
279
+ end
280
+
281
+ def test_it_calls_callback_immediately_if_connected_async
282
+ connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port, :async => true)
283
+ refute connection.connected?, "new asynchronous connection must be disconnected"
284
+ called = false
285
+ connection.run {}
286
+ assert connection.connected?, "the connection must be established"
287
+ connection.run do
288
+ connection.on_connect do |res|
289
+ assert res.success?, "on_connect called with error #{res.error.inspect}"
290
+ called = true
291
+ end
292
+ end
293
+ assert called, "the callback hasn't been called on set"
294
+ called = false
295
+ connection.run do
296
+ connection.on_connect do |res|
297
+ assert res.success?, "on_connect called with error #{res.error.inspect}"
298
+ called = true
299
+ end
300
+ end
301
+ refute called, "the callback must not be called on subsequent sets"
302
+ end
303
+
304
+ def test_it_returns_error_if_user_start_work_on_disconnected_instance_outside_on_connect_callback
305
+ connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port, :async => true)
306
+ refute connection.connected?, "new asynchronous connection must be disconnected"
307
+ error = nil
308
+ connection.on_error do |ex|
309
+ error = ex
310
+ end
311
+ connection.run do |c|
312
+ c.set("foo", "bar")
313
+ end
314
+ assert_instance_of(Couchbase::Error::Connect, error)
315
+ end
253
316
  end
@@ -0,0 +1,70 @@
1
+ # Author:: Couchbase <info@couchbase.com>
2
+ # Copyright:: 2011, 2012 Couchbase, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require File.join(File.dirname(__FILE__), 'setup')
19
+ require 'eventmachine'
20
+
21
+ class TestEventmachine < MiniTest::Unit::TestCase
22
+
23
+ def setup
24
+ @mock = start_mock
25
+ end
26
+
27
+ def teardown
28
+ stop_mock(@mock)
29
+ end
30
+
31
+ if RUBY_VERSION.to_f >= 1.9
32
+
33
+ def test_trivial_set
34
+ EM.run do
35
+ conn = Couchbase.new(:hostname => @mock.host, :port => @mock.port,
36
+ :engine => :eventmachine, :async => true)
37
+ conn.on_connect do |res|
38
+ assert res.success?, "connection must be successful"
39
+ conn.set(uniq_id, "bar") do |res|
40
+ assert res.success?, "the operation must be successful"
41
+ assert res.cas > 0, "the CAS value must be non-zero"
42
+ EM.stop
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ def test_trivial_get
49
+ EM.run do
50
+ conn = Couchbase.new(:hostname => @mock.host, :port => @mock.port,
51
+ :engine => :eventmachine, :async => true)
52
+ conn.on_connect do |res|
53
+ assert res.success?, "connection must be successful"
54
+ conn.set(uniq_id, "bar") do |res|
55
+ assert res.success?, "the set operation must be successful"
56
+ cas = res.cas
57
+ conn.get(uniq_id) do |res|
58
+ assert res.success?, "the get operation must be successful"
59
+ assert_equal "bar", res.value
60
+ assert_equal cas, res.cas
61
+ EM.stop
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ end
metadata CHANGED
@@ -1,195 +1,167 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: couchbase
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.2
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 1
10
- version: 1.2.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Couchbase
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-28 00:00:00 +03:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- type: :runtime
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: yaji
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 23
29
- segments:
30
- - 0
31
- - 3
32
- - 2
20
+ - !ruby/object:Gem::Version
33
21
  version: 0.3.2
34
- name: yaji
35
- version_requirements: *id001
36
- prerelease: false
37
- - !ruby/object:Gem::Dependency
38
22
  type: :runtime
39
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
40
25
  none: false
41
- requirements:
26
+ requirements:
42
27
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 15
45
- segments:
46
- - 1
47
- - 0
48
- version: "1.0"
28
+ - !ruby/object:Gem::Version
29
+ version: 0.3.2
30
+ - !ruby/object:Gem::Dependency
49
31
  name: multi_json
50
- version_requirements: *id002
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.0'
38
+ type: :runtime
51
39
  prerelease: false
52
- - !ruby/object:Gem::Dependency
53
- type: :development
54
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
55
41
  none: false
56
- requirements:
42
+ requirements:
57
43
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 49
60
- segments:
61
- - 0
62
- - 8
63
- - 7
64
- version: 0.8.7
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
46
+ - !ruby/object:Gem::Dependency
65
47
  name: rake
66
- version_requirements: *id003
67
- prerelease: false
68
- - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
69
54
  type: :development
70
- requirement: &id004 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
71
57
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
79
63
  name: minitest
80
- version_requirements: *id004
81
- prerelease: false
82
- - !ruby/object:Gem::Dependency
83
- type: :development
84
- requirement: &id005 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
85
65
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 9
90
- segments:
91
- - 0
92
- - 7
93
- - 5
94
- version: 0.7.5
95
- name: rake-compiler
96
- version_requirements: *id005
97
- prerelease: false
98
- - !ruby/object:Gem::Dependency
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
99
70
  type: :development
100
- requirement: &id006 !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
109
- name: rdiscount
110
- version_requirements: *id006
111
71
  prerelease: false
112
- - !ruby/object:Gem::Dependency
113
- type: :development
114
- requirement: &id007 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
115
73
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
123
- name: yard
124
- version_requirements: *id007
125
- prerelease: false
126
- - !ruby/object:Gem::Dependency
127
- type: :development
128
- requirement: &id008 !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake-compiler
80
+ requirement: !ruby/object:Gem::Requirement
129
81
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 3
134
- segments:
135
- - 0
136
- version: "0"
137
- name: yard-xml
138
- version_requirements: *id008
139
- prerelease: false
140
- - !ruby/object:Gem::Dependency
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 0.7.5
141
86
  type: :development
142
- requirement: &id009 !ruby/object:Gem::Requirement
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
143
89
  none: false
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- hash: 3
148
- segments:
149
- - 0
150
- version: "0"
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.7.5
94
+ - !ruby/object:Gem::Dependency
151
95
  name: mini_portile
152
- version_requirements: *id009
153
- prerelease: false
154
- - !ruby/object:Gem::Dependency
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
155
102
  type: :development
156
- requirement: &id010 !ruby/object:Gem::Requirement
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
157
105
  none: false
158
- requirements:
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: yajl-ruby
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
159
115
  - - ~>
160
- - !ruby/object:Gem::Version
161
- hash: 19
162
- segments:
163
- - 1
164
- - 1
165
- - 0
116
+ - !ruby/object:Gem::Version
166
117
  version: 1.1.0
167
- name: yajl-ruby
168
- version_requirements: *id010
169
- prerelease: false
170
- - !ruby/object:Gem::Dependency
171
118
  type: :development
172
- requirement: &id011 !ruby/object:Gem::Requirement
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
173
121
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 3
178
- segments:
179
- - 0
180
- version: "0"
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.1.0
126
+ - !ruby/object:Gem::Dependency
181
127
  name: active_support
182
- version_requirements: *id011
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
183
135
  prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: eventmachine
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
184
158
  description: The official client library for use with Couchbase Server.
185
159
  email: support@couchbase.com
186
160
  executables: []
187
-
188
- extensions:
161
+ extensions:
189
162
  - ext/couchbase_ext/extconf.rb
190
163
  extra_rdoc_files: []
191
-
192
- files:
164
+ files:
193
165
  - .gitignore
194
166
  - .travis.yml
195
167
  - .yardopts
@@ -200,19 +172,25 @@ files:
200
172
  - RELEASE_NOTES.markdown
201
173
  - Rakefile
202
174
  - couchbase.gemspec
175
+ - examples/chat-em/Gemfile
176
+ - examples/chat-em/README.markdown
177
+ - examples/chat-em/server.rb
203
178
  - ext/couchbase_ext/.gitignore
204
179
  - ext/couchbase_ext/arguments.c
205
180
  - ext/couchbase_ext/arithmetic.c
206
181
  - ext/couchbase_ext/bucket.c
182
+ - ext/couchbase_ext/context.c
207
183
  - ext/couchbase_ext/couchbase_ext.c
208
184
  - ext/couchbase_ext/couchbase_ext.h
209
185
  - ext/couchbase_ext/delete.c
186
+ - ext/couchbase_ext/eventmachine_plugin.c
210
187
  - ext/couchbase_ext/extconf.rb
211
188
  - ext/couchbase_ext/get.c
212
189
  - ext/couchbase_ext/gethrtime.c
213
190
  - ext/couchbase_ext/http.c
214
191
  - ext/couchbase_ext/multithread_plugin.c
215
192
  - ext/couchbase_ext/observe.c
193
+ - ext/couchbase_ext/plugin_common.c
216
194
  - ext/couchbase_ext/result.c
217
195
  - ext/couchbase_ext/stats.c
218
196
  - ext/couchbase_ext/store.c
@@ -226,6 +204,7 @@ files:
226
204
  - lib/couchbase.rb
227
205
  - lib/couchbase/bucket.rb
228
206
  - lib/couchbase/cluster.rb
207
+ - lib/couchbase/constants.rb
229
208
  - lib/couchbase/result.rb
230
209
  - lib/couchbase/utils.rb
231
210
  - lib/couchbase/version.rb
@@ -235,7 +214,6 @@ files:
235
214
  - lib/rack/session/couchbase.rb
236
215
  - tasks/benchmark.rake
237
216
  - tasks/compile.rake
238
- - tasks/doc.rake
239
217
  - tasks/test.rake
240
218
  - tasks/util.rake
241
219
  - test/profile/.gitignore
@@ -250,6 +228,7 @@ files:
250
228
  - test/test_couchbase_rails_cache_store.rb
251
229
  - test/test_delete.rb
252
230
  - test/test_errors.rb
231
+ - test/test_eventmachine.rb
253
232
  - test/test_format.rb
254
233
  - test/test_get.rb
255
234
  - test/test_stats.rb
@@ -259,39 +238,29 @@ files:
259
238
  - test/test_unlock.rb
260
239
  - test/test_utils.rb
261
240
  - test/test_version.rb
262
- has_rdoc: true
263
241
  homepage: http://couchbase.org
264
- licenses:
242
+ licenses:
265
243
  - ASL-2
266
244
  post_install_message:
267
245
  rdoc_options: []
268
-
269
- require_paths:
246
+ require_paths:
270
247
  - lib
271
- required_ruby_version: !ruby/object:Gem::Requirement
248
+ required_ruby_version: !ruby/object:Gem::Requirement
272
249
  none: false
273
- requirements:
274
- - - ">="
275
- - !ruby/object:Gem::Version
276
- hash: 3
277
- segments:
278
- - 0
279
- version: "0"
280
- required_rubygems_version: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ required_rubygems_version: !ruby/object:Gem::Requirement
281
255
  none: false
282
- requirements:
283
- - - ">="
284
- - !ruby/object:Gem::Version
285
- hash: 3
286
- segments:
287
- - 0
288
- version: "0"
256
+ requirements:
257
+ - - ! '>='
258
+ - !ruby/object:Gem::Version
259
+ version: '0'
289
260
  requirements: []
290
-
291
261
  rubyforge_project:
292
- rubygems_version: 1.6.2
262
+ rubygems_version: 1.8.23
293
263
  signing_key:
294
264
  specification_version: 3
295
265
  summary: Couchbase ruby driver
296
266
  test_files: []
297
-