couchbase-jruby-client 0.2.2-java → 1.0.4-java

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +103 -0
  3. data/.ruby-version +1 -1
  4. data/Rakefile +13 -2
  5. data/couchbase-jruby-client.gemspec +7 -6
  6. data/lib/couchbase/bucket.rb +11 -338
  7. data/lib/couchbase/cluster.rb +10 -88
  8. data/lib/couchbase/configuration.rb +39 -0
  9. data/lib/couchbase/design_doc.rb +18 -73
  10. data/lib/couchbase/document.rb +34 -0
  11. data/lib/couchbase/error.rb +0 -35
  12. data/lib/couchbase/operations.rb +60 -40
  13. data/lib/couchbase/version.rb +1 -1
  14. data/lib/couchbase/view.rb +55 -345
  15. data/lib/couchbase.rb +37 -141
  16. data/lib/jars/couchbase-core-io-1.1.4.jar +0 -0
  17. data/lib/jars/couchbase-java-client-2.1.4.jar +0 -0
  18. data/lib/jars/rxjava-1.0.8.jar +0 -0
  19. data/lib/jars/rxjruby-0.0.1.jar +0 -0
  20. data/test/{test_cas.rb → helper.rb} +15 -10
  21. data/test/test_bucket.rb +14 -228
  22. data/test/test_cluster.rb +1 -29
  23. data/test/test_configuration.rb +51 -0
  24. data/test/test_couchbase.rb +28 -28
  25. data/test/test_design_doc.rb +29 -0
  26. data/test/test_document.rb +51 -0
  27. data/test/test_operations.rb +49 -0
  28. data/test/test_view.rb +62 -116
  29. metadata +43 -125
  30. data/lib/couchbase/async/callback.rb +0 -38
  31. data/lib/couchbase/async/queue.rb +0 -26
  32. data/lib/couchbase/async.rb +0 -32
  33. data/lib/couchbase/constants.rb +0 -29
  34. data/lib/couchbase/operations/arithmetic.rb +0 -290
  35. data/lib/couchbase/operations/delete.rb +0 -115
  36. data/lib/couchbase/operations/design_docs.rb +0 -99
  37. data/lib/couchbase/operations/fetch.rb +0 -33
  38. data/lib/couchbase/operations/get.rb +0 -303
  39. data/lib/couchbase/operations/stats.rb +0 -42
  40. data/lib/couchbase/operations/store.rb +0 -463
  41. data/lib/couchbase/operations/touch.rb +0 -140
  42. data/lib/couchbase/operations/unlock.rb +0 -209
  43. data/lib/couchbase/operations/utils.rb +0 -68
  44. data/lib/couchbase/query.rb +0 -76
  45. data/lib/couchbase/result.rb +0 -60
  46. data/lib/couchbase/transcoder.rb +0 -81
  47. data/lib/couchbase/utils.rb +0 -62
  48. data/lib/couchbase/view_row.rb +0 -227
  49. data/lib/jars/commons-codec-1.5.jar +0 -0
  50. data/lib/jars/couchbase-client-1.3.2-javadoc.jar +0 -0
  51. data/lib/jars/couchbase-client-1.3.2-sources.jar +0 -0
  52. data/lib/jars/couchbase-client-1.3.2.jar +0 -0
  53. data/lib/jars/httpcore-4.3.1.jar +0 -0
  54. data/lib/jars/httpcore-nio-4.3.1.jar +0 -0
  55. data/lib/jars/jettison-1.1.jar +0 -0
  56. data/lib/jars/netty-3.5.5.Final.jar +0 -0
  57. data/lib/jars/spymemcached-2.10.5-javadoc.jar +0 -0
  58. data/lib/jars/spymemcached-2.10.5-sources.jar +0 -0
  59. data/lib/jars/spymemcached-2.10.5.jar +0 -0
  60. data/tasks/benchmark.rake +0 -6
  61. data/tasks/test.rake +0 -36
  62. data/tasks/util.rake +0 -21
  63. data/test/mock.rb +0 -85
  64. data/test/profile/.gitignore +0 -1
  65. data/test/profile/.jrubyrc +0 -722
  66. data/test/profile/Gemfile +0 -7
  67. data/test/profile/benchmark.rb +0 -177
  68. data/test/profile/profile.rb +0 -59
  69. data/test/setup.rb +0 -74
  70. data/test/test_arithmetic.rb +0 -155
  71. data/test/test_async.rb +0 -24
  72. data/test/test_couchbase_rails_cache_store.rb +0 -341
  73. data/test/test_delete.rb +0 -139
  74. data/test/test_design_docs.rb +0 -67
  75. data/test/test_errors.rb +0 -74
  76. data/test/test_fetch.rb +0 -71
  77. data/test/test_format.rb +0 -142
  78. data/test/test_get.rb +0 -363
  79. data/test/test_query.rb +0 -23
  80. data/test/test_result.rb +0 -15
  81. data/test/test_stats.rb +0 -44
  82. data/test/test_store.rb +0 -203
  83. data/test/test_touch.rb +0 -90
  84. data/test/test_unlock.rb +0 -89
  85. data/test/test_utils.rb +0 -67
  86. data/test/test_version.rb +0 -28
  87. data/test/test_view_row.rb +0 -74
data/test/test_format.rb DELETED
@@ -1,142 +0,0 @@
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
-
20
- class TestFormat < Minitest::Test
21
-
22
- ArbitraryClass = Struct.new(:name, :role)
23
- class SkinyClass < Struct.new(:name, :role)
24
- undef to_s rescue nil
25
- undef to_json rescue nil
26
- end
27
-
28
- def test_default_document_format
29
- orig_doc = {'name' => 'Twoflower', 'role' => 'The tourist'}
30
- assert_equal :document, cb.default_format
31
- cb.set(uniq_id, orig_doc)
32
- doc, flags, cas = cb.get(uniq_id, :extended => true)
33
- assert doc.is_a?(Hash)
34
- assert_equal 'Twoflower', doc['name']
35
- assert_equal 'The tourist', doc['role']
36
- end
37
-
38
- def test_it_raises_error_for_document_format_when_neither_to_json_nor_to_s_defined
39
- if (MultiJson.respond_to?(:engine) ? MultiJson.engine : MultiJson.adapter).name =~ /Yajl$/
40
- orig_doc = SkinyClass.new("Twoflower", "The tourist")
41
- refute orig_doc.respond_to?(:to_s)
42
- refute orig_doc.respond_to?(:to_json)
43
-
44
- assert_raises(Couchbase::Error::ValueFormat) do
45
- cb.set(uniq_id, orig_doc)
46
- end
47
-
48
- class << orig_doc
49
- def to_json
50
- MultiJson.dump(:name => name, :role => role)
51
- end
52
- end
53
- cb.set(uniq_id, orig_doc) # OK
54
-
55
- class << orig_doc
56
- undef to_json
57
- def to_s
58
- MultiJson.dump(:name => name, :role => role)
59
- end
60
- end
61
- cb.set(uniq_id, orig_doc) # OK
62
- end
63
- end
64
-
65
- def test_it_could_dump_arbitrary_class_using_marshal_format
66
- orig_doc = ArbitraryClass.new("Twoflower", "The tourist")
67
- cb.set(uniq_id, orig_doc, :format => :marshal)
68
- doc, flags, cas = cb.get(uniq_id, :extended => true)
69
- assert doc.is_a?(ArbitraryClass)
70
- assert_equal 'Twoflower', doc.name
71
- assert_equal 'The tourist', doc.role
72
- end
73
-
74
- def test_it_accepts_only_string_in_plain_mode
75
- cb.default_format = :plain
76
- cb.set(uniq_id, "1")
77
-
78
- assert_raises(Couchbase::Error::ValueFormat) do
79
- cb.set(uniq_id, 1)
80
- end
81
-
82
- assert_raises(Couchbase::Error::ValueFormat) do
83
- cb.set(uniq_id, {:foo => "bar"})
84
- end
85
- ensure
86
- cb.default_format = :document
87
- end
88
-
89
- def test_bignum_conversion
90
- cb.default_format = :plain
91
- cas = 0xffff_ffff_ffff_ffff
92
- assert cas.is_a?(Bignum)
93
- assert_raises(Couchbase::Error::NotFound) do
94
- cb.delete(uniq_id => cas)
95
- end
96
- ensure
97
- cb.default_format = :document
98
- end
99
-
100
- require 'zlib'
101
- # This class wraps any other transcoder and performs compression
102
- # using zlib
103
- class ZlibTranscoder
104
- FMT_ZLIB = 0x04
105
-
106
- def initialize(base)
107
- @base = base
108
- end
109
-
110
- def dump(obj, flags, options = {})
111
- obj, flags = @base.dump(obj, flags, options)
112
- z = Zlib::Deflate.new(Zlib::BEST_SPEED)
113
- buffer = z.deflate(obj, Zlib::FINISH)
114
- z.close
115
- [buffer, flags|FMT_ZLIB]
116
- end
117
-
118
- def load(blob, flags, options = {})
119
- # decompress value only if Zlib flag set
120
- if (flags & FMT_ZLIB) == FMT_ZLIB
121
- z = Zlib::Inflate.new
122
- blob = z.inflate(blob)
123
- z.finish
124
- z.close
125
- end
126
- @base.load(blob, flags, options)
127
- end
128
- end
129
-
130
- def test_it_can_use_custom_transcoder
131
- skip
132
- cb.transcoder = ZlibTranscoder.new(Couchbase::Transcoder::Document)
133
- cb.set(uniq_id, {"foo" => "bar"})
134
- doc, flags, _ = cb.get(uniq_id, :extended => true)
135
- assert_equal({"foo" => "bar"}, doc)
136
- assert_equal(ZlibTranscoder::FMT_ZLIB|Couchbase::Bucket::FMT_DOCUMENT, flags)
137
- cb.transcoder = nil
138
- doc = cb.get(uniq_id)
139
- assert_equal "x\x01\xABVJ\xCB\xCFW\xB2RJJ,R\xAA\x05\0\x1Dz\x044", doc
140
- end
141
-
142
- end
data/test/test_get.rb DELETED
@@ -1,363 +0,0 @@
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
-
20
- class TestGet < Minitest::Test
21
-
22
- def test_trivial_get
23
- cb.set(uniq_id, "bar")
24
- val = cb.get(uniq_id)
25
- assert_equal "bar", val
26
- end
27
-
28
- def test_extended_get
29
- orig_cas = cb.set(uniq_id, "bar")
30
- val, flags, cas = cb.get(uniq_id, :extended => true)
31
- assert_equal "bar", val
32
- #assert_equal 0x0, flags
33
- assert_equal orig_cas, cas
34
-
35
- orig_cas = cb.set(uniq_id, "bar", :flags => 0x1000)
36
- val, flags, cas = cb.get(uniq_id, :extended => true)
37
- assert_equal "bar", val
38
- #assert_equal 0x1000, flags
39
- assert_equal orig_cas, cas
40
- end
41
-
42
- def test_multi_get
43
- cb.set(uniq_id(1), "foo1")
44
- cb.set(uniq_id(2), "foo2")
45
-
46
- val1, val2 = cb.get(uniq_id(1), uniq_id(2))
47
- assert_equal "foo1", val1
48
- assert_equal "foo2", val2
49
- end
50
-
51
- def test_multi_get_extended
52
- cas1 = cb.set(uniq_id(1), "foo1")
53
- cas2 = cb.set(uniq_id(2), "foo2")
54
-
55
- results = cb.get(uniq_id(1), uniq_id(2), :extended => true)
56
- assert_equal ["foo1", nil, cas1], results[uniq_id(1)]
57
- assert_equal ["foo2", nil, cas2], results[uniq_id(2)]
58
- end
59
-
60
- def test_multi_get_and_touch
61
- cb.set(uniq_id(1), "foo1")
62
- cb.set(uniq_id(2), "foo2")
63
-
64
- results = cb.get(uniq_id(1) => 1, uniq_id(2) => 1)
65
- assert results.is_a?(Hash)
66
- assert_equal "foo1", results[uniq_id(1)]
67
- assert_equal "foo2", results[uniq_id(2)]
68
- sleep(2)
69
- assert_raises(Couchbase::Error::NotFound) do
70
- cb.get(uniq_id(1), uniq_id(2))
71
- end
72
- assert cb.get(uniq_id(1), uniq_id(2), :quiet => true).compact.empty?
73
- end
74
-
75
- def test_multi_get_and_touch_extended
76
- cas1 = cb.set(uniq_id(1), "foo1")
77
- cas2 = cb.set(uniq_id(2), "foo2")
78
-
79
- results = cb.get({uniq_id(1) => 1, uniq_id(2) => 1}, :extended => true)
80
- assert_equal ["foo1", nil, cas1], results[uniq_id(1)]
81
- assert_equal ["foo2", nil, cas2], results[uniq_id(2)]
82
- end
83
-
84
- def test_multi_get_and_touch_with_single_key
85
- cb.set(uniq_id, "foo1")
86
-
87
- results = cb.get(uniq_id => 1)
88
- assert results.is_a?(Hash)
89
- assert_equal "foo1", results[uniq_id]
90
- sleep(2)
91
- assert_raises(Couchbase::Error::NotFound) do
92
- cb.get(uniq_id)
93
- end
94
- end
95
-
96
- def test_missing_in_quiet_mode
97
- cb.quiet = true
98
- cas1 = cb.set(uniq_id(1), "foo1")
99
- cas2 = cb.set(uniq_id(2), "foo2")
100
-
101
- val = cb.get(uniq_id(:missing))
102
- refute(val)
103
- val = cb.get(uniq_id(:missing), :extended => true)
104
- refute(val)
105
-
106
- val1, missing, val2 = cb.get(uniq_id(1), uniq_id(:missing), uniq_id(2))
107
- assert_equal "foo1", val1
108
- refute missing
109
- assert_equal "foo2", val2
110
-
111
- # TODO: multi get with cas
112
- # results = cb.get(uniq_id(1), uniq_id(:missing), uniq_id(2), :extended => true)
113
- # assert_equal ["foo1", nil, cas1], results[uniq_id(1)]
114
- # refute results[uniq_id(:missing)]
115
- # assert_equal ["foo2", nil, cas2], results[uniq_id(2)]
116
- ensure
117
- cb.quiet = false
118
- end
119
-
120
- def test_it_allows_temporary_quiet_flag
121
- assert_raises(Couchbase::Error::NotFound) do
122
- cb.get(uniq_id(:missing))
123
- end
124
- refute cb.get(uniq_id(:missing), :quiet => true)
125
- end
126
-
127
- def test_it_allows_temporary_quiet_flag_with_bulk_extended
128
- results = cb.get([uniq_id(:missing1), uniq_id(:missing2)], :extended => true, :quiet => true)
129
- assert_empty results
130
- end
131
-
132
- def test_missing_in_verbose_mode
133
- cb.set(uniq_id(1), "foo1")
134
- cb.set(uniq_id(2), "foo2")
135
-
136
- assert_raises(Couchbase::Error::NotFound) do
137
- cb.get(uniq_id(:missing))
138
- end
139
-
140
- assert_raises(Couchbase::Error::NotFound) do
141
- cb.get(uniq_id(:missing), :extended => true)
142
- end
143
-
144
- assert_raises(Couchbase::Error::NotFound) do
145
- cb.get(uniq_id(1), uniq_id(:missing), uniq_id(2))
146
- end
147
-
148
- assert_raises(Couchbase::Error::NotFound) do
149
- cb.get(uniq_id(1), uniq_id(:missing), uniq_id(2), :extended => true)
150
- end
151
- end
152
-
153
- def test_asynchronous_get
154
- cas = cb.set(uniq_id, "foo")
155
- ret = nil
156
-
157
- future = cb.async_get(uniq_id) { |res| ret = res }
158
- future.get
159
- sleep 0.1
160
-
161
- assert ret.is_a?(Couchbase::Result)
162
- assert ret.success?
163
- assert_equal uniq_id, ret.key
164
- assert_equal :get, ret.operation
165
- assert_equal "foo", ret.value
166
- end
167
-
168
- def test_asynchronous_get_without_block
169
- assert_raises ArgumentError do
170
- cb.async_get(uniq_id)
171
- end
172
- end
173
-
174
- def test_asynchronous_multi_get
175
- skip
176
- cb.set(uniq_id(1), "foo")
177
- cb.set(uniq_id(2), "bar")
178
-
179
- res = {}
180
- cb.run do |conn|
181
- conn.get(uniq_id(1), uniq_id(2)) {|ret| res[ret.key] = ret.value}
182
- end
183
-
184
- assert res[uniq_id(1)]
185
- assert_equal "foo", res[uniq_id(1)]
186
- assert res[uniq_id(2)]
187
- assert_equal "bar", res[uniq_id(2)]
188
- end
189
-
190
- def test_asynchronous_get_missing
191
- skip
192
- cb.set(uniq_id, "foo")
193
- res = {}
194
- missing = []
195
-
196
- get_handler = lambda do |ret|
197
- assert_equal :get, ret.operation
198
- if ret.success?
199
- res[ret.key] = ret.value
200
- else
201
- if ret.error.is_a?(Couchbase::Error::NotFound)
202
- missing << ret.key
203
- else
204
- raise ret.error
205
- end
206
- end
207
- end
208
-
209
- suite = lambda do |conn|
210
- res.clear
211
- missing.clear
212
- conn.get(uniq_id(:missing1), &get_handler)
213
- conn.get(uniq_id, uniq_id(:missing2), &get_handler)
214
- end
215
-
216
- cb.run(&suite)
217
- refute res.has_key?(uniq_id(:missing1))
218
- refute res.has_key?(uniq_id(:missing2))
219
- assert_equal [uniq_id(:missing1), uniq_id(:missing2)], missing.sort
220
- assert_equal "foo", res[uniq_id]
221
-
222
- cb.quiet = true
223
- cb.run(&suite)
224
- assert_equal "foo", res[uniq_id]
225
- assert res.has_key?(uniq_id(:missing1)) # handler was called with nil
226
- refute res[uniq_id(:missing1)]
227
- assert res.has_key?(uniq_id(:missing2))
228
- refute res[uniq_id(:missing2)]
229
- assert_empty missing
230
- end
231
-
232
- def test_get_using_brackets
233
- orig_cas = cb.set(uniq_id, "foo", :flags => 0x1100)
234
-
235
- val = cb[uniq_id]
236
- assert_equal "foo", val
237
-
238
- if RUBY_VERSION =~ /^1\.9/
239
- eval <<-EOC
240
- val, flags, cas = cb[uniq_id, :extended => true]
241
- assert_equal "foo", val
242
- #assert_equal 0x1100, flags
243
- assert_equal orig_cas, cas
244
- EOC
245
- end
246
- end
247
-
248
- def test_it_allows_to_store_nil
249
- skip
250
- orig_cas = cb.set(uniq_id, nil)
251
- assert orig_cas.is_a?(Numeric)
252
-
253
- refute cb.get(uniq_id)
254
- # doesn't raise NotFound exception
255
- refute cb.get(uniq_id, :quiet => false)
256
- # returns CAS
257
- value, flags, cas = cb.get(uniq_id, :extended => true)
258
- refute value
259
- #assert_equal 0x00, flags
260
- assert_equal orig_cas, cas
261
- end
262
-
263
- def test_zero_length_string_is_not_nil
264
- skip
265
- cb.set(uniq_id, "", :format => :document)
266
- assert_equal "", cb.get(uniq_id)
267
-
268
- cb.set(uniq_id, "", :format => :plain)
269
- assert_equal "", cb.get(uniq_id)
270
-
271
- cb.set(uniq_id, "", :format => :marshal)
272
- assert_equal "", cb.get(uniq_id)
273
-
274
- cb.set(uniq_id, nil, :format => :document)
275
- assert_equal nil, cb.get(uniq_id, :quiet => false)
276
-
277
- assert_raises Couchbase::Error::ValueFormat do
278
- cb.set(uniq_id, nil, :format => :plain)
279
- end
280
-
281
- cb.set(uniq_id, nil, :format => :marshal)
282
- assert_equal nil, cb.get(uniq_id, :quiet => false)
283
- end
284
-
285
- def test_format_forcing
286
- skip("format forcing")
287
-
288
- cb.set(uniq_id, '{"foo":"bar"}', :format => :plain)
289
- value, flags, _ = cb.get(uniq_id, :extended => true)
290
- assert_equal '{"foo":"bar"}', value
291
-
292
- value, flags, _ = cb.get(uniq_id, :extended => true, :format => :document)
293
- expected = {"foo" => "bar"}
294
- assert_equal expected, value
295
-
296
- cb.prepend(uniq_id, "NOT-A-JSON")
297
- assert_raises Couchbase::Error::ValueFormat do
298
- cb.get(uniq_id, :format => :document)
299
- end
300
- end
301
-
302
- # http://www.couchbase.com/issues/browse/RCBC-31
303
- def test_consistent_behaviour_for_arrays
304
- cas = cb.set(uniq_id("foo"), "foo")
305
- cb.set(uniq_id("bar"), "bar")
306
-
307
- assert_equal "foo", cb.get(uniq_id("foo"))
308
- assert_equal ["foo"], cb.get([uniq_id("foo")])
309
- assert_equal ["foo", "bar"], cb.get([uniq_id("foo"), uniq_id("bar")])
310
- assert_equal ["foo", "bar"], cb.get(uniq_id("foo"), uniq_id("bar"))
311
- # expected = {uniq_id("foo") => ["foo", nil, cas]}
312
- # assert_equal expected, cb.get([uniq_id("foo")], :extended => true)
313
- assert_raises TypeError do
314
- cb.get([uniq_id("foo"), uniq_id("bar")], [uniq_id("foo")])
315
- end
316
- end
317
-
318
- def test_get_with_lock_trivial
319
- cb.set(uniq_id, "foo")
320
-
321
- assert_equal "foo", cb.get(uniq_id, :lock => 1)
322
- assert_raises Couchbase::Error::KeyExists do
323
- cb.set(uniq_id, "bar")
324
- end
325
- sleep(2)
326
- cb.set(uniq_id, "bar")
327
- end
328
-
329
- def test_multi_get_with_lock
330
- skip("multi_get_with_lock")
331
- cb.set(uniq_id(1), "foo1")
332
- cb.set(uniq_id(2), "foo2")
333
- assert_equal ["foo1", "foo2"], cb.get([uniq_id(1), uniq_id(2)], :lock => 1)
334
- assert_raises Couchbase::Error::KeyExists do
335
- cb.set(uniq_id(1), "bar")
336
- end
337
- assert_raises Couchbase::Error::KeyExists do
338
- cb.set(uniq_id(2), "bar")
339
- end
340
- end
341
-
342
- def test_multi_get_with_custom_locks
343
- skip("multi_get_with_custom_locks")
344
- cb.set(uniq_id(1), "foo1")
345
- cb.set(uniq_id(2), "foo2")
346
- expected = {uniq_id(1) => "foo1", uniq_id(2) => "foo2"}
347
- assert_equal expected, cb.get({uniq_id(1) => 1, uniq_id(2) => 2}, :lock => true)
348
- assert_raises Couchbase::Error::KeyExists do
349
- cb.set(uniq_id(1), "foo")
350
- end
351
- assert_raises Couchbase::Error::KeyExists do
352
- cb.set(uniq_id(2), "foo")
353
- end
354
- end
355
-
356
- def test_multi_get_result_hash_assembling
357
- cb.set(uniq_id(1), "foo")
358
- cb.set(uniq_id(2), "bar")
359
-
360
- expected = {uniq_id(1) => "foo", uniq_id(2) => "bar"}
361
- assert_equal expected, cb.get(uniq_id(1), uniq_id(2), :assemble_hash => true)
362
- end
363
- end
data/test/test_query.rb DELETED
@@ -1,23 +0,0 @@
1
- # Author:: Mike Evans <mike@urlgonomics.com>
2
- # Copyright:: 2013 Urlgonomics LLC.
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
-
20
- class TestQuery < Minitest::Test
21
-
22
-
23
- end
data/test/test_result.rb DELETED
@@ -1,15 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'setup')
2
-
3
- class TestResult < Minitest::Test
4
-
5
- def test_result_object_provides_enough_info
6
- obj = Couchbase::Result.new
7
- assert obj.respond_to?(:success?)
8
- assert obj.respond_to?(:error)
9
- assert obj.respond_to?(:key)
10
- assert obj.respond_to?(:value)
11
- assert obj.respond_to?(:node)
12
- assert obj.respond_to?(:cas)
13
- end
14
-
15
- end
data/test/test_stats.rb DELETED
@@ -1,44 +0,0 @@
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
-
20
- class TestStats < Minitest::Test
21
-
22
- def test_trivial_stats_without_argument
23
- stats = cb.stats
24
- assert stats.is_a?(Hash)
25
- assert stats.has_key?("pid")
26
- key, info = stats.first
27
- assert key.is_a?(String)
28
- assert info.is_a?(Hash)
29
- assert_equal 1, info.size
30
- end
31
-
32
- def test_stats_with_argument
33
- skip unless $mock.real?
34
-
35
- stats = cb.stats("memory")
36
- assert stats.is_a?(Hash)
37
- assert stats.has_key?("mem_used")
38
- key, info = stats.first
39
- assert key.is_a?(String)
40
- assert info.is_a?(Hash)
41
- assert_equal 1, info.size
42
- end
43
-
44
- end