riak-client 0.9.0.beta2 → 0.9.0
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/Rakefile +11 -90
- data/lib/riak/client.rb +90 -38
- data/lib/riak/client/http_backend.rb +1 -2
- data/lib/riak/client/http_backend/transport_methods.rb +18 -2
- data/lib/riak/client/net_http_backend.rb +0 -3
- data/lib/riak/client/protobuffs_backend.rb +2 -2
- data/lib/riak/link.rb +1 -1
- data/lib/riak/locale/en.yml +4 -1
- data/riak-client.gemspec +4 -4
- data/spec/fixtures/multipart-mapreduce.txt +10 -0
- data/spec/integration/riak/cache_store_spec.rb +9 -9
- data/spec/integration/riak/http_backends_spec.rb +1 -1
- data/spec/integration/riak/protobuffs_backends_spec.rb +1 -1
- data/spec/integration/riak/test_server_spec.rb +1 -1
- data/spec/riak/client_spec.rb +52 -36
- data/spec/riak/curb_backend_spec.rb +1 -1
- data/spec/riak/excon_backend_spec.rb +1 -1
- data/spec/riak/net_http_backend_spec.rb +2 -2
- data/spec/support/http_backend_implementation_examples.rb +1 -1
- metadata +6 -5
data/Rakefile
CHANGED
@@ -18,96 +18,17 @@ gemspec = Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency "builder", "~>2.1.2"
|
19
19
|
gem.add_dependency "beefcake", "~>0.2.0"
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
lib/riak/client/excon_backend.rb
|
33
|
-
lib/riak/client/http_backend/configuration.rb
|
34
|
-
lib/riak/client/http_backend/object_methods.rb
|
35
|
-
lib/riak/client/http_backend/request_headers.rb
|
36
|
-
lib/riak/client/http_backend/transport_methods.rb
|
37
|
-
lib/riak/client/http_backend.rb
|
38
|
-
lib/riak/client/net_http_backend.rb
|
39
|
-
lib/riak/client/protobuffs_backend.rb
|
40
|
-
lib/riak/client/pump.rb
|
41
|
-
lib/riak/client.rb
|
42
|
-
lib/riak/core_ext/blank.rb
|
43
|
-
lib/riak/core_ext/extract_options.rb
|
44
|
-
lib/riak/core_ext/slice.rb
|
45
|
-
lib/riak/core_ext/stringify_keys.rb
|
46
|
-
lib/riak/core_ext/symbolize_keys.rb
|
47
|
-
lib/riak/core_ext/to_param.rb
|
48
|
-
lib/riak/core_ext.rb
|
49
|
-
lib/riak/failed_request.rb
|
50
|
-
lib/riak/i18n.rb
|
51
|
-
lib/riak/invalid_response.rb
|
52
|
-
lib/riak/link.rb
|
53
|
-
lib/riak/locale
|
54
|
-
lib/riak/locale/en.yml
|
55
|
-
lib/riak/map_reduce/filter_builder.rb
|
56
|
-
lib/riak/map_reduce/phase.rb
|
57
|
-
lib/riak/map_reduce.rb
|
58
|
-
lib/riak/map_reduce_error.rb
|
59
|
-
lib/riak/robject.rb
|
60
|
-
lib/riak/search.rb
|
61
|
-
lib/riak/test_server.rb
|
62
|
-
lib/riak/util/escape.rb
|
63
|
-
lib/riak/util/fiber1.8.rb
|
64
|
-
lib/riak/util/headers.rb
|
65
|
-
lib/riak/util/multipart/stream_parser.rb
|
66
|
-
lib/riak/util/multipart.rb
|
67
|
-
lib/riak/util/tcp_socket_extensions.rb
|
68
|
-
lib/riak/util/translation.rb
|
69
|
-
lib/riak/walk_spec.rb
|
70
|
-
lib/riak.rb
|
71
|
-
Rakefile
|
72
|
-
riak-client.gemspec
|
73
|
-
spec/fixtures/cat.jpg
|
74
|
-
spec/fixtures/multipart-blank.txt
|
75
|
-
spec/fixtures/multipart-with-body.txt
|
76
|
-
spec/fixtures/server.cert.crt
|
77
|
-
spec/fixtures/server.cert.key
|
78
|
-
spec/fixtures/test.pem
|
79
|
-
spec/integration/riak/cache_store_spec.rb
|
80
|
-
spec/integration/riak/http_backends_spec.rb
|
81
|
-
spec/integration/riak/protobuffs_backends_spec.rb
|
82
|
-
spec/integration/riak/test_server_spec.rb
|
83
|
-
spec/riak/bucket_spec.rb
|
84
|
-
spec/riak/client_spec.rb
|
85
|
-
spec/riak/curb_backend_spec.rb
|
86
|
-
spec/riak/escape_spec.rb
|
87
|
-
spec/riak/excon_backend_spec.rb
|
88
|
-
spec/riak/headers_spec.rb
|
89
|
-
spec/riak/http_backend/configuration_spec.rb
|
90
|
-
spec/riak/http_backend/object_methods_spec.rb
|
91
|
-
spec/riak/http_backend/transport_methods_spec.rb
|
92
|
-
spec/riak/http_backend_spec.rb
|
93
|
-
spec/riak/link_spec.rb
|
94
|
-
spec/riak/map_reduce/filter_builder_spec.rb
|
95
|
-
spec/riak/map_reduce/phase_spec.rb
|
96
|
-
spec/riak/map_reduce_spec.rb
|
97
|
-
spec/riak/multipart_spec.rb
|
98
|
-
spec/riak/net_http_backend_spec.rb
|
99
|
-
spec/riak/robject_spec.rb
|
100
|
-
spec/riak/search_spec.rb
|
101
|
-
spec/riak/stream_parser_spec.rb
|
102
|
-
spec/riak/walk_spec_spec.rb
|
103
|
-
spec/spec_helper.rb
|
104
|
-
spec/support/drb_mock_server.rb
|
105
|
-
spec/support/http_backend_implementation_examples.rb
|
106
|
-
spec/support/mock_server.rb
|
107
|
-
spec/support/mocks.rb
|
108
|
-
spec/support/test_server.yml.example
|
109
|
-
spec/support/unified_backend_examples.rb
|
110
|
-
}
|
21
|
+
files = FileList["**/*"]
|
22
|
+
# Editor and O/S files
|
23
|
+
files.exclude ".DS_Store", "*~", "\#*", ".\#*", "*.swp", "*.tmproj", "tmtags"
|
24
|
+
# Generated artifacts
|
25
|
+
files.exclude "coverage", "rdoc", "pkg", "doc", ".bundle", "*.rbc", ".rvmrc", ".watchr", ".rspec"
|
26
|
+
# Project-specific
|
27
|
+
files.exclude "Gemfile.lock", %r{spec/support/test_server.yml$}, "bin"
|
28
|
+
# Remove directories
|
29
|
+
files.exclude {|d| File.directory?(d) }
|
30
|
+
|
31
|
+
gem.files = files.to_a
|
111
32
|
|
112
33
|
gem.test_files = gem.files.grep(/_spec\.rb$/)
|
113
34
|
end
|
data/lib/riak/client.rb
CHANGED
@@ -40,25 +40,31 @@ module Riak
|
|
40
40
|
# Regexp for validating hostnames, lifted from uri.rb in Ruby 1.8.6
|
41
41
|
HOST_REGEX = /^(?:(?:(?:[a-zA-Z\d](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\])$/n
|
42
42
|
|
43
|
+
VALID_OPTIONS = [:protocol, :host, :port, :http_port, :pb_port, :prefix, :client_id, :mapred, :luwak, :http_backend, :protobuffs_backend, :ssl, :basic_auth]
|
44
|
+
|
43
45
|
# @return [String] The protocol to use for the Riak endpoint
|
44
46
|
attr_reader :protocol
|
45
47
|
|
46
48
|
# @return [String] The host or IP address for the Riak endpoint
|
47
49
|
attr_reader :host
|
48
50
|
|
49
|
-
# @return [Fixnum] The port
|
50
|
-
attr_reader :
|
51
|
+
# @return [Fixnum] The HTTP(S) port for the Riak endpoint
|
52
|
+
attr_reader :http_port
|
53
|
+
|
54
|
+
# @return [Fixnum] The Protocol Buffers port for the Riak endpoint
|
55
|
+
attr_reader :pb_port
|
51
56
|
|
52
57
|
# @return [String] The user:pass for http basic authentication
|
53
58
|
attr_reader :basic_auth
|
54
59
|
|
55
|
-
# @return [String] The internal client ID used by Riak to route responses
|
56
|
-
attr_reader :client_id
|
57
|
-
|
58
60
|
# @return [Hash|nil] The SSL options that get built when using SSL
|
59
61
|
attr_reader :ssl_options
|
60
62
|
|
61
|
-
# @return [
|
63
|
+
# @return [String] The internal client ID used by Riak to route responses
|
64
|
+
attr_reader :client_id
|
65
|
+
|
66
|
+
# @attr_writer [Hash|nil] The writer that will build valid SSL options
|
67
|
+
# from the provided config
|
62
68
|
attr_writer :ssl
|
63
69
|
|
64
70
|
# @return [String] The URL path prefix to the "raw" HTTP endpoint
|
@@ -87,20 +93,22 @@ module Riak
|
|
87
93
|
# @option options [String, Symbol] :protobuffs_backend (:Beefcake) which Protocol Buffers backend to use
|
88
94
|
# @raise [ArgumentError] raised if any invalid options are given
|
89
95
|
def initialize(options={})
|
90
|
-
unless (options.keys -
|
91
|
-
raise ArgumentError, t("
|
96
|
+
unless (options.keys - VALID_OPTIONS).empty?
|
97
|
+
raise ArgumentError, t("invalid_options")
|
92
98
|
end
|
93
|
-
self.
|
94
|
-
self.
|
95
|
-
self.host
|
96
|
-
self.
|
97
|
-
self.
|
98
|
-
self.
|
99
|
-
self.
|
100
|
-
self.
|
101
|
-
self.
|
99
|
+
self.protocol = options[:protocol] || "http"
|
100
|
+
self.ssl = options[:ssl] if options[:ssl]
|
101
|
+
self.host = options[:host] || "127.0.0.1"
|
102
|
+
self.http_port = options[:http_port] || 8098
|
103
|
+
self.pb_port = options[:pb_port] || 8087
|
104
|
+
self.port = options[:port] if options[:port]
|
105
|
+
self.prefix = options[:prefix] || "/riak/"
|
106
|
+
self.mapred = options[:mapred] || "/mapred"
|
107
|
+
self.luwak = options[:luwak] || "/luwak"
|
108
|
+
self.http_backend = options[:http_backend] || :NetHTTP
|
102
109
|
self.protobuffs_backend = options[:protobuffs_backend] || :Beefcake
|
103
|
-
self.basic_auth
|
110
|
+
self.basic_auth = options[:basic_auth] if options[:basic_auth]
|
111
|
+
self.client_id = options[:client_id] if options[:client_id]
|
104
112
|
end
|
105
113
|
|
106
114
|
# Set the client ID for this client. Must be a string or Fixnum value 0 =< value < MAX_CLIENT_ID.
|
@@ -108,14 +116,18 @@ module Riak
|
|
108
116
|
# @raise [ArgumentError] when an invalid client ID is given
|
109
117
|
# @return [String] the assigned client ID
|
110
118
|
def client_id=(value)
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
+
value = case value
|
120
|
+
when 0...MAX_CLIENT_ID, String
|
121
|
+
value
|
122
|
+
else
|
123
|
+
raise ArgumentError, t("invalid_client_id", :max_id => MAX_CLIENT_ID)
|
124
|
+
end
|
125
|
+
backend.set_client_id value if backend.respond_to?(:set_client_id)
|
126
|
+
@client_id = value
|
127
|
+
end
|
128
|
+
|
129
|
+
def client_id
|
130
|
+
@client_id ||= backend.respond_to?(:get_client_id) ? backend.get_client_id : make_client_id
|
119
131
|
end
|
120
132
|
|
121
133
|
# Set the protocol of the Riak endpoint. Value must be in the
|
@@ -126,7 +138,8 @@ module Riak
|
|
126
138
|
unless PROTOCOLS.include?(value.to_s)
|
127
139
|
raise ArgumentError, t("protocol_invalid", :invalid => value, :valid => PROTOCOLS.join(', '))
|
128
140
|
end
|
129
|
-
@ssl_options ||= {} if value
|
141
|
+
@ssl_options ||= {} if value == 'https'
|
142
|
+
@ssl_options = nil if value == 'http'
|
130
143
|
@backend = nil
|
131
144
|
@protocol = value
|
132
145
|
end
|
@@ -140,15 +153,58 @@ module Riak
|
|
140
153
|
@host = value
|
141
154
|
end
|
142
155
|
|
143
|
-
#
|
156
|
+
# @return [Fixnum] The port of the Riak endpoint
|
157
|
+
# @deprecated Ports for HTTP(S) and Protocol Buffers are
|
158
|
+
# segregated. Use {#http_port} or {#pb_port}.
|
159
|
+
def port
|
160
|
+
warn(t('deprecated.port', :backtrace => caller.join("\n")))
|
161
|
+
case protocol
|
162
|
+
when /http/i
|
163
|
+
http_port
|
164
|
+
when /pbc/i
|
165
|
+
pb_port
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Set the port number of the Riak endpoint. This must be an
|
170
|
+
# integer between 0 and 65535.
|
171
|
+
# @deprecated Ports for HTTP(S) and Protocol Buffers are
|
172
|
+
# segregated. Use {#http_port=} or {#pb_port=}.
|
144
173
|
# @param [Fixnum] value The port number of the Riak endpoint
|
145
174
|
# @raise [ArgumentError] if an invalid port number is given
|
146
175
|
# @return [Fixnum] the assigned port number
|
147
176
|
def port=(value)
|
177
|
+
warn(t('deprecated.port', :backtrace => caller[0..2].join("\n ")))
|
148
178
|
raise ArgumentError, t("port_invalid") unless (0..65535).include?(value)
|
149
|
-
|
179
|
+
case protocol
|
180
|
+
when /http/i
|
181
|
+
self.http_port = value
|
182
|
+
when /pbc/i
|
183
|
+
self.pb_port = value
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# Set the HTTP(S) port for the Riak endpoint
|
188
|
+
# @param [Fixnum] value The HTTP port number of the Riak endpoint
|
189
|
+
# @raise [ArgumentError] if an invalid port number is given
|
190
|
+
# @return [Fixnum] the assigned port number
|
191
|
+
def http_port=(value)
|
192
|
+
raise ArgumentError, t("port_invalid") unless (0..65535).include?(value)
|
193
|
+
@http_port = value
|
194
|
+
end
|
195
|
+
|
196
|
+
# Set the Protocol Buffers port for the Riak endpoint
|
197
|
+
# @param [Fixnum] value The Protocol Buffers port number of the Riak endpoint
|
198
|
+
# @raise [ArgumentError] if an invalid port number is given
|
199
|
+
# @return [Fixnum] the assigned port number
|
200
|
+
def pb_port=(value)
|
201
|
+
raise ArgumentError, t("port_invalid") unless (0..65535).include?(value)
|
202
|
+
@pb_port = value
|
150
203
|
end
|
151
204
|
|
205
|
+
|
206
|
+
# Sets the HTTP Basic Authentication credentials.
|
207
|
+
# @param [String] value an auth string in the form "user:password"
|
152
208
|
def basic_auth=(value)
|
153
209
|
raise ArgumentError, t("invalid_basic_auth") unless value.to_s.split(':').length === 2
|
154
210
|
@basic_auth = value
|
@@ -172,9 +228,9 @@ module Riak
|
|
172
228
|
value ? ssl_enable : ssl_disable
|
173
229
|
end
|
174
230
|
|
175
|
-
# Checks if
|
231
|
+
# Checks if SSL is enabled for HTTP
|
176
232
|
def ssl_enabled?
|
177
|
-
protocol
|
233
|
+
protocol == 'https' || @ssl_options.present?
|
178
234
|
end
|
179
235
|
|
180
236
|
# Automatically detects and returns an appropriate HTTP backend.
|
@@ -324,16 +380,12 @@ module Riak
|
|
324
380
|
|
325
381
|
# @return [String] A representation suitable for IRB and debugging output.
|
326
382
|
def inspect
|
327
|
-
"#<Riak::Client #{protocol}://#{host}:#{
|
383
|
+
"#<Riak::Client #{protocol}://#{host}:#{protocol == 'pbc' ? pb_port : http_port}>"
|
328
384
|
end
|
329
385
|
|
330
386
|
private
|
331
387
|
def make_client_id
|
332
|
-
|
333
|
-
end
|
334
|
-
|
335
|
-
def b64encode(n)
|
336
|
-
Base64.encode64([n].pack("N")).chomp
|
388
|
+
rand(MAX_CLIENT_ID)
|
337
389
|
end
|
338
390
|
|
339
391
|
def ssl_enable
|
@@ -341,7 +393,7 @@ module Riak
|
|
341
393
|
@ssl_options[:pem] = File.read(@ssl_options[:pem_file]) if @ssl_options[:pem_file]
|
342
394
|
@ssl_options[:verify_mode] ||= "peer" if @ssl_options.stringify_keys.any? {|k,v| %w[pem ca_file ca_path].include?(k)}
|
343
395
|
@ssl_options[:verify_mode] ||= "none"
|
344
|
-
raise ArgumentError.new unless %w[none peer].include?(@ssl_options[:verify_mode])
|
396
|
+
raise ArgumentError.new(t('invalid_ssl_verify_mode', :invalid => @ssl_options[:verify_mode])) unless %w[none peer].include?(@ssl_options[:verify_mode])
|
345
397
|
|
346
398
|
@ssl_options
|
347
399
|
end
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
require 'riak'
|
15
15
|
|
16
|
-
|
17
16
|
module Riak
|
18
17
|
class Client
|
19
18
|
# The parent class for all backends that connect to Riak via
|
@@ -67,7 +66,7 @@ module Riak
|
|
67
66
|
load_object(RObject.new(bucket, key), response)
|
68
67
|
end
|
69
68
|
|
70
|
-
# Reloads the data for a given RObject, a special case of {#
|
69
|
+
# Reloads the data for a given RObject, a special case of {#fetch_object}.
|
71
70
|
def reload_object(robject, r = nil)
|
72
71
|
options = r ? {:r => r} : {}
|
73
72
|
response = get([200,300,304], riak_kv_wm_raw, escape(robject.bucket.name), escape(robject.key), options, reload_headers(robject))
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
require 'riak'
|
15
|
+
require 'base64'
|
15
16
|
|
16
17
|
module Riak
|
17
18
|
class Client
|
@@ -137,17 +138,28 @@ module Riak
|
|
137
138
|
def default_headers
|
138
139
|
{
|
139
140
|
"Accept" => "multipart/mixed, application/json;q=0.7, */*;q=0.5",
|
140
|
-
"X-Riak-ClientId" =>
|
141
|
+
"X-Riak-ClientId" => client_id
|
141
142
|
}.merge(basic_auth_header)
|
142
143
|
end
|
143
144
|
|
145
|
+
def client_id
|
146
|
+
value = @client.client_id
|
147
|
+
case value
|
148
|
+
when Integer
|
149
|
+
b64encode(value)
|
150
|
+
when String
|
151
|
+
value
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
144
155
|
def basic_auth_header
|
145
156
|
@client.basic_auth ? {"Authorization" => "Basic #{Base64::encode64(@client.basic_auth)}"} : {}
|
146
157
|
end
|
147
158
|
|
148
159
|
# @return [URI] The calculated root URI for the Riak HTTP endpoint
|
149
160
|
def root_uri
|
150
|
-
|
161
|
+
protocol = client.ssl_enabled? ? "https" : "http"
|
162
|
+
URI.parse("#{protocol}://#{client.host}:#{client.http_port}")
|
151
163
|
end
|
152
164
|
|
153
165
|
# Calculates an absolute URI from a relative path specification
|
@@ -206,6 +218,10 @@ module Riak
|
|
206
218
|
def response_headers
|
207
219
|
Thread.current[:response_headers] ||= Riak::Util::Headers.new
|
208
220
|
end
|
221
|
+
|
222
|
+
def b64encode(n)
|
223
|
+
Base64.encode64([n].pack("N")).chomp
|
224
|
+
end
|
209
225
|
end
|
210
226
|
end
|
211
227
|
end
|
@@ -58,14 +58,11 @@ module Riak
|
|
58
58
|
def configure_ssl(http)
|
59
59
|
http.use_ssl = true
|
60
60
|
http.verify_mode = OpenSSL::SSL.const_get("VERIFY_#{@client.ssl_options[:verify_mode].upcase}")
|
61
|
-
|
62
61
|
if @client.ssl_options[:pem]
|
63
62
|
http.cert = OpenSSL::X510::Certificate.new(@client.ssl_options[:pem])
|
64
63
|
http.key = OpenSSL::PKey::RSA.new(@client.ssl_options[:pem], @client.ssl_options[:pem_password])
|
65
64
|
end
|
66
|
-
|
67
65
|
http.ca_file = @client.ssl_options[:ca_file] if @client.ssl_options[:ca_file]
|
68
|
-
|
69
66
|
http.ca_path = @client.ssl_options[:ca_path] if @client.ssl_options[:ca_path]
|
70
67
|
end
|
71
68
|
end
|
@@ -20,7 +20,7 @@ module Riak
|
|
20
20
|
class Client
|
21
21
|
class ProtobuffsBackend
|
22
22
|
include Util::Translation
|
23
|
-
|
23
|
+
|
24
24
|
# Message Codes Enum
|
25
25
|
MESSAGE_CODES = %W[
|
26
26
|
ErrorResp
|
@@ -74,7 +74,7 @@ module Riak
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def socket
|
77
|
-
Thread.current[:riakpbc_socket] ||= TCPSocket.new(@client.host, @client.
|
77
|
+
Thread.current[:riakpbc_socket] ||= TCPSocket.new(@client.host, @client.pb_port)
|
78
78
|
end
|
79
79
|
|
80
80
|
def reset_socket
|
data/lib/riak/link.rb
CHANGED
@@ -22,7 +22,7 @@ module Riak
|
|
22
22
|
# @return [String] the relationship tag (or "rel") of the other resource to this one
|
23
23
|
attr_accessor :tag
|
24
24
|
alias_method :rel, :tag
|
25
|
-
alias_method :
|
25
|
+
alias_method :rel=, :tag=
|
26
26
|
|
27
27
|
# @return [String] the bucket of the related resource
|
28
28
|
attr_accessor :bucket
|
data/lib/riak/locale/en.yml
CHANGED
@@ -16,6 +16,8 @@ en:
|
|
16
16
|
bucket_link_conversion: "Can't convert a bucket link to a walk spec"
|
17
17
|
client_type: "invalid argument %{client} is not a Riak::Client"
|
18
18
|
content_type_undefined: "content_type is not defined!"
|
19
|
+
deprecated:
|
20
|
+
port: "DEPRECATION: Riak::Client#port has been deprecated, use #http_port or #pb_port for the appropriate protocol.\n%{backtrace}"
|
19
21
|
empty_map_reduce_query: "Specify one or more query phases to your MapReduce."
|
20
22
|
failed_request: "Client request failed."
|
21
23
|
filter_needs_block: "Filter %{filter} expects a block."
|
@@ -28,8 +30,9 @@ en:
|
|
28
30
|
invalid_basic_auth: "basic auth must be set using 'user:pass'"
|
29
31
|
invalid_client_id: "Invalid client ID, must be a string or between 0 and %{max_id}"
|
30
32
|
invalid_function_value: "invalid value for function: %{value}"
|
31
|
-
invalid_phase_type: "type must be :map, :reduce, or :link"
|
32
33
|
invalid_options: "Invalid configuration options given."
|
34
|
+
invalid_phase_type: "type must be :map, :reduce, or :link"
|
35
|
+
invalid_ssl_verify_mode: "%{invalid} is not a valid :verify_mode option for SSL. Valid options are 'peer' and 'none'."
|
33
36
|
loading_bucket: "while loading bucket '%{name}'"
|
34
37
|
missing_block: "A block must be given."
|
35
38
|
missing_host_and_port: "You must specify a host and port, or use the defaults of 127.0.0.1:8098"
|
data/riak-client.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{riak-client}
|
5
|
-
s.version = "0.9.0
|
5
|
+
s.version = "0.9.0"
|
6
6
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sean Cribbs"]
|
9
|
-
s.date = %q{2011-03
|
9
|
+
s.date = %q{2011-04-03}
|
10
10
|
s.description = %q{riak-client is a rich client for Riak, the distributed database by Basho. It supports the full HTTP interface including storage operations, bucket configuration, link-walking and map-reduce.}
|
11
11
|
s.email = %q{sean@basho.com}
|
12
|
-
s.files = ["erl_src/riak_kv_test_backend.beam", "erl_src/riak_kv_test_backend.erl", "Gemfile", "lib/active_support/cache/riak_store.rb", "lib/riak/bucket.rb", "lib/riak/cache_store.rb", "lib/riak/client/beefcake/messages.rb", "lib/riak/client/beefcake/object_methods.rb", "lib/riak/client/beefcake_protobuffs_backend.rb", "lib/riak/client/curb_backend.rb", "lib/riak/client/excon_backend.rb", "lib/riak/client/http_backend/configuration.rb", "lib/riak/client/http_backend/object_methods.rb", "lib/riak/client/http_backend/request_headers.rb", "lib/riak/client/http_backend/transport_methods.rb", "lib/riak/client/http_backend.rb", "lib/riak/client/net_http_backend.rb", "lib/riak/client/protobuffs_backend.rb", "lib/riak/client/pump.rb", "lib/riak/client.rb", "lib/riak/core_ext/blank.rb", "lib/riak/core_ext/extract_options.rb", "lib/riak/core_ext/slice.rb", "lib/riak/core_ext/stringify_keys.rb", "lib/riak/core_ext/symbolize_keys.rb", "lib/riak/core_ext/to_param.rb", "lib/riak/core_ext.rb", "lib/riak/failed_request.rb", "lib/riak/i18n.rb", "lib/riak/invalid_response.rb", "lib/riak/link.rb", "lib/riak/locale/en.yml", "lib/riak/map_reduce/filter_builder.rb", "lib/riak/map_reduce/phase.rb", "lib/riak/map_reduce.rb", "lib/riak/map_reduce_error.rb", "lib/riak/robject.rb", "lib/riak/search.rb", "lib/riak/test_server.rb", "lib/riak/util/escape.rb", "lib/riak/util/fiber1.8.rb", "lib/riak/util/headers.rb", "lib/riak/util/multipart/stream_parser.rb", "lib/riak/util/multipart.rb", "lib/riak/util/tcp_socket_extensions.rb", "lib/riak/util/translation.rb", "lib/riak/walk_spec.rb", "lib/riak.rb", "Rakefile", "riak-client.gemspec", "spec/fixtures/cat.jpg", "spec/fixtures/multipart-blank.txt", "spec/fixtures/multipart-with-body.txt", "spec/fixtures/server.cert.crt", "spec/fixtures/server.cert.key", "spec/fixtures/test.pem", "spec/integration/riak/cache_store_spec.rb", "spec/integration/riak/http_backends_spec.rb", "spec/integration/riak/protobuffs_backends_spec.rb", "spec/integration/riak/test_server_spec.rb", "spec/riak/bucket_spec.rb", "spec/riak/client_spec.rb", "spec/riak/curb_backend_spec.rb", "spec/riak/escape_spec.rb", "spec/riak/excon_backend_spec.rb", "spec/riak/headers_spec.rb", "spec/riak/http_backend/configuration_spec.rb", "spec/riak/http_backend/object_methods_spec.rb", "spec/riak/http_backend/transport_methods_spec.rb", "spec/riak/http_backend_spec.rb", "spec/riak/link_spec.rb", "spec/riak/map_reduce/filter_builder_spec.rb", "spec/riak/map_reduce/phase_spec.rb", "spec/riak/map_reduce_spec.rb", "spec/riak/multipart_spec.rb", "spec/riak/net_http_backend_spec.rb", "spec/riak/robject_spec.rb", "spec/riak/search_spec.rb", "spec/riak/stream_parser_spec.rb", "spec/riak/walk_spec_spec.rb", "spec/spec_helper.rb", "spec/support/drb_mock_server.rb", "spec/support/http_backend_implementation_examples.rb", "spec/support/mock_server.rb", "spec/support/mocks.rb", "spec/support/test_server.yml.example", "spec/support/unified_backend_examples.rb"]
|
12
|
+
s.files = ["erl_src/riak_kv_test_backend.beam", "erl_src/riak_kv_test_backend.erl", "Gemfile", "lib/active_support/cache/riak_store.rb", "lib/riak/bucket.rb", "lib/riak/cache_store.rb", "lib/riak/client/beefcake/messages.rb", "lib/riak/client/beefcake/object_methods.rb", "lib/riak/client/beefcake_protobuffs_backend.rb", "lib/riak/client/curb_backend.rb", "lib/riak/client/excon_backend.rb", "lib/riak/client/http_backend/configuration.rb", "lib/riak/client/http_backend/object_methods.rb", "lib/riak/client/http_backend/request_headers.rb", "lib/riak/client/http_backend/transport_methods.rb", "lib/riak/client/http_backend.rb", "lib/riak/client/net_http_backend.rb", "lib/riak/client/protobuffs_backend.rb", "lib/riak/client/pump.rb", "lib/riak/client.rb", "lib/riak/core_ext/blank.rb", "lib/riak/core_ext/extract_options.rb", "lib/riak/core_ext/slice.rb", "lib/riak/core_ext/stringify_keys.rb", "lib/riak/core_ext/symbolize_keys.rb", "lib/riak/core_ext/to_param.rb", "lib/riak/core_ext.rb", "lib/riak/failed_request.rb", "lib/riak/i18n.rb", "lib/riak/invalid_response.rb", "lib/riak/link.rb", "lib/riak/locale/en.yml", "lib/riak/map_reduce/filter_builder.rb", "lib/riak/map_reduce/phase.rb", "lib/riak/map_reduce.rb", "lib/riak/map_reduce_error.rb", "lib/riak/robject.rb", "lib/riak/search.rb", "lib/riak/test_server.rb", "lib/riak/util/escape.rb", "lib/riak/util/fiber1.8.rb", "lib/riak/util/headers.rb", "lib/riak/util/multipart/stream_parser.rb", "lib/riak/util/multipart.rb", "lib/riak/util/tcp_socket_extensions.rb", "lib/riak/util/translation.rb", "lib/riak/walk_spec.rb", "lib/riak.rb", "Rakefile", "riak-client.gemspec", "spec/fixtures/cat.jpg", "spec/fixtures/multipart-blank.txt", "spec/fixtures/multipart-mapreduce.txt", "spec/fixtures/multipart-with-body.txt", "spec/fixtures/server.cert.crt", "spec/fixtures/server.cert.key", "spec/fixtures/test.pem", "spec/integration/riak/cache_store_spec.rb", "spec/integration/riak/http_backends_spec.rb", "spec/integration/riak/protobuffs_backends_spec.rb", "spec/integration/riak/test_server_spec.rb", "spec/riak/bucket_spec.rb", "spec/riak/client_spec.rb", "spec/riak/curb_backend_spec.rb", "spec/riak/escape_spec.rb", "spec/riak/excon_backend_spec.rb", "spec/riak/headers_spec.rb", "spec/riak/http_backend/configuration_spec.rb", "spec/riak/http_backend/object_methods_spec.rb", "spec/riak/http_backend/transport_methods_spec.rb", "spec/riak/http_backend_spec.rb", "spec/riak/link_spec.rb", "spec/riak/map_reduce/filter_builder_spec.rb", "spec/riak/map_reduce/phase_spec.rb", "spec/riak/map_reduce_spec.rb", "spec/riak/multipart_spec.rb", "spec/riak/net_http_backend_spec.rb", "spec/riak/robject_spec.rb", "spec/riak/search_spec.rb", "spec/riak/stream_parser_spec.rb", "spec/riak/walk_spec_spec.rb", "spec/spec_helper.rb", "spec/support/drb_mock_server.rb", "spec/support/http_backend_implementation_examples.rb", "spec/support/mock_server.rb", "spec/support/mocks.rb", "spec/support/test_server.yml.example", "spec/support/unified_backend_examples.rb"]
|
13
13
|
s.homepage = %q{http://seancribbs.github.com/ripple}
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.rubygems_version = %q{1.6.1}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
--NT6cqYFYCfbYZsocVt15tNWCpG9
|
3
|
+
Content-Type: application/json
|
4
|
+
|
5
|
+
{"phase":0,"data":["source :gemcutter\n\ngem 'i18n'\ngem 'builder'\ngem 'rspec', \"~>2.0.0\"\ngem 'fakeweb', \">=1.2\"\ngem 'rack', '>=1.0'\ngem 'rake'\ngem 'bundler'\ngem 'excon', \"~>0.3.4\"\n\nif defined? JRUBY_VERSION\n gem 'json'\n gem 'jruby-openssl'\nelse\n gem 'curb', '>=0.6'\n gem 'yajl-ruby'\nend\n\ngroup :integration do\n gem 'activesupport', '~>3.0'\nend\n"]}
|
6
|
+
--NT6cqYFYCfbYZsocVt15tNWCpG9
|
7
|
+
Content-Type: application/json
|
8
|
+
|
9
|
+
{"phase":0,"data":["source \"http://rubygems.org\"\n\ngem 'rake'\ngem 'gollum-site'\ngem 'rdiscount'\ngem 'RedCloth'\ngem 'rspec'\n"]}
|
10
|
+
--NT6cqYFYCfbYZsocVt15tNWCpG9--
|
@@ -24,7 +24,7 @@ describe Riak::CacheStore do
|
|
24
24
|
|
25
25
|
before do
|
26
26
|
@web_port ||= 8098
|
27
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :
|
27
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :http_port => @web_port)
|
28
28
|
@cleanup = true
|
29
29
|
end
|
30
30
|
|
@@ -56,12 +56,12 @@ describe Riak::CacheStore do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should configure the client according to the initialized options" do
|
59
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :
|
60
|
-
@cache.client.
|
59
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :http_port => 10000)
|
60
|
+
@cache.client.http_port.should == 10000
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should choose the bucket according to the initializer option" do
|
64
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :bucket => "foobar", :
|
64
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :bucket => "foobar", :http_port => @web_port)
|
65
65
|
@cache.bucket.name.should == "foobar"
|
66
66
|
end
|
67
67
|
|
@@ -70,7 +70,7 @@ describe Riak::CacheStore do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should set the N value to the specified value" do
|
73
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :n_value => 1, :
|
73
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :n_value => 1, :http_port => @web_port)
|
74
74
|
@cache.bucket.n_value.should == 1
|
75
75
|
end
|
76
76
|
|
@@ -79,7 +79,7 @@ describe Riak::CacheStore do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should set the bucket R default to the specified value" do
|
82
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :r => "quorum", :
|
82
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :r => "quorum", :http_port => @web_port)
|
83
83
|
@cache.bucket.r.should == "quorum"
|
84
84
|
end
|
85
85
|
|
@@ -88,7 +88,7 @@ describe Riak::CacheStore do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should set the bucket W default to the specified value" do
|
91
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :w => "all", :
|
91
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :w => "all", :http_port => @web_port)
|
92
92
|
@cache.bucket.w.should == "all"
|
93
93
|
end
|
94
94
|
|
@@ -97,7 +97,7 @@ describe Riak::CacheStore do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should set the bucket DW default to the specified value" do
|
100
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :dw => "quorum", :
|
100
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :dw => "quorum", :http_port => @web_port)
|
101
101
|
@cache.bucket.dw.should == "quorum"
|
102
102
|
end
|
103
103
|
|
@@ -106,7 +106,7 @@ describe Riak::CacheStore do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should set the bucket RW default to the specified value" do
|
109
|
-
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :rw => "all", :
|
109
|
+
@cache = ActiveSupport::Cache.lookup_store(:riak_store, :rw => "all", :http_port => @web_port)
|
110
110
|
@cache.bucket.rw.should == "all"
|
111
111
|
end
|
112
112
|
end
|
@@ -156,7 +156,7 @@ if $test_server
|
|
156
156
|
@server.prepare!
|
157
157
|
@server.start.should be_true
|
158
158
|
|
159
|
-
client = Riak::Client.new(:
|
159
|
+
client = Riak::Client.new(:http_port => 9000)
|
160
160
|
obj = client['test_bucket'].new("test_item")
|
161
161
|
obj.data = {"data" => "testing"}
|
162
162
|
obj.store rescue nil
|
data/spec/riak/client_spec.rb
CHANGED
@@ -15,10 +15,11 @@ require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
|
15
15
|
|
16
16
|
describe Riak::Client do
|
17
17
|
describe "when initializing" do
|
18
|
-
it "should default to the local interface on port 8098" do
|
18
|
+
it "should default to the local interface on port 8098 (8087 for protobuffs)" do
|
19
19
|
client = Riak::Client.new
|
20
20
|
client.host.should == "127.0.0.1"
|
21
|
-
client.
|
21
|
+
client.http_port.should == 8098
|
22
|
+
client.pb_port.should == 8087
|
22
23
|
end
|
23
24
|
|
24
25
|
it "should accept a protocol" do
|
@@ -31,15 +32,23 @@ describe Riak::Client do
|
|
31
32
|
client.host.should == "riak.basho.com"
|
32
33
|
end
|
33
34
|
|
34
|
-
it "should accept
|
35
|
-
client = Riak::Client.new :
|
36
|
-
client.
|
35
|
+
it "should accept an HTTP port" do
|
36
|
+
client = Riak::Client.new :http_port => 9000
|
37
|
+
client.http_port.should == 9000
|
37
38
|
end
|
38
39
|
|
39
|
-
it "should
|
40
|
-
Riak::Client.new
|
40
|
+
it "should accept a Protobuffs port" do
|
41
|
+
client = Riak::Client.new :pb_port => 9000
|
42
|
+
client.pb_port.should == 9000
|
41
43
|
end
|
42
|
-
|
44
|
+
|
45
|
+
it "should warn on setting :port" do
|
46
|
+
# TODO: make a deprecation utility class/module instead
|
47
|
+
client = Riak::Client.allocate
|
48
|
+
client.should_receive(:warn).and_return(true)
|
49
|
+
client.send :initialize, :port => 9000
|
50
|
+
end
|
51
|
+
|
43
52
|
it "should accept basic_auth" do
|
44
53
|
client = Riak::Client.new :basic_auth => "user:pass"
|
45
54
|
client.basic_auth.should eq("user:pass")
|
@@ -50,13 +59,8 @@ describe Riak::Client do
|
|
50
59
|
client.client_id.should == "AAAAAA=="
|
51
60
|
end
|
52
61
|
|
53
|
-
it "should turn an integer client ID into a base64-encoded string" do
|
54
|
-
client = Riak::Client.new :client_id => 1
|
55
|
-
client.client_id.should == "AAAAAQ=="
|
56
|
-
end
|
57
|
-
|
58
62
|
it "should create a client ID if not specified" do
|
59
|
-
Riak::Client.new.client_id.
|
63
|
+
Riak::Client.new.client_id.should_not be_nil
|
60
64
|
end
|
61
65
|
|
62
66
|
it "should accept a path prefix" do
|
@@ -101,7 +105,7 @@ describe Riak::Client do
|
|
101
105
|
|
102
106
|
it "should require a valid protocol to be set" do
|
103
107
|
lambda { @client.protocol = 'invalid-protocol' }.should(
|
104
|
-
|
108
|
+
raise_error(ArgumentError, /^'invalid-protocol' is not a valid protocol/))
|
105
109
|
end
|
106
110
|
|
107
111
|
it "should reset the unified backend when changing the protocol" do
|
@@ -128,20 +132,38 @@ describe Riak::Client do
|
|
128
132
|
end
|
129
133
|
end
|
130
134
|
|
135
|
+
[:http, :pb].each do |protocol|
|
136
|
+
describe "setting the #{protocol} port" do
|
137
|
+
it "should allow setting the #{protocol} port" do
|
138
|
+
@client.should respond_to("#{protocol}_port=")
|
139
|
+
@client.send("#{protocol}_port=", 9000)
|
140
|
+
@client.send("#{protocol}_port").should == 9000
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should require the port to be a valid number" do
|
144
|
+
[-1,65536,"foo"].each do |invalid|
|
145
|
+
lambda { @client.send("#{protocol}_port=",invalid) }.should raise_error(ArgumentError)
|
146
|
+
end
|
147
|
+
[0,1,65535,8098].each do |valid|
|
148
|
+
lambda { @client.send("#{protocol}_port=", valid) }.should_not raise_error
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
131
154
|
describe "setting the port" do
|
132
|
-
|
133
|
-
@client.
|
155
|
+
before do
|
156
|
+
@client.stub!(:warn).and_return(true)
|
157
|
+
end
|
158
|
+
it "should raise a deprecation warning" do
|
159
|
+
@client.should_receive(:warn).and_return(true)
|
134
160
|
@client.port = 9000
|
135
|
-
@client.port.should == 9000
|
136
161
|
end
|
137
162
|
|
138
|
-
it "should
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
[0,1,65535,8098].each do |valid|
|
143
|
-
lambda { @client.port = valid }.should_not raise_error
|
144
|
-
end
|
163
|
+
it "should set the port for the selected protocol" do
|
164
|
+
@client.protocol = "pbc"
|
165
|
+
@client.port = 9000
|
166
|
+
@client.pb_port.should == 9000
|
145
167
|
end
|
146
168
|
end
|
147
169
|
|
@@ -150,7 +172,7 @@ describe Riak::Client do
|
|
150
172
|
@client.should respond_to(:basic_auth=)
|
151
173
|
@client.basic_auth = "user:pass"
|
152
174
|
@client.basic_auth.should eq("user:pass")
|
153
|
-
end
|
175
|
+
end
|
154
176
|
|
155
177
|
it "should require that basic auth splits into two even parts" do
|
156
178
|
lambda { @client.basic_auth ="user" }.should raise_error(ArgumentError, "basic auth must be set using 'user:pass'")
|
@@ -169,11 +191,6 @@ describe Riak::Client do
|
|
169
191
|
@client.client_id.should == "foo"
|
170
192
|
end
|
171
193
|
|
172
|
-
it "should base64-encode an integer" do
|
173
|
-
@client.client_id = 1
|
174
|
-
@client.client_id.should == "AAAAAQ=="
|
175
|
-
end
|
176
|
-
|
177
194
|
it "should reject an integer equal to the maximum client id" do
|
178
195
|
lambda { @client.client_id = Riak::Client::MAX_CLIENT_ID }.should raise_error(ArgumentError)
|
179
196
|
end
|
@@ -202,7 +219,6 @@ describe Riak::Client do
|
|
202
219
|
|
203
220
|
it "should raise an error when the chosen backend is not valid" do
|
204
221
|
Riak::Client::NetHTTPBackend.should_receive(:configured?).and_return(false)
|
205
|
-
# @client = Riak::Client.new(:http_backend => :NetHTTP)
|
206
222
|
lambda { @client.http }.should raise_error
|
207
223
|
end
|
208
224
|
end
|
@@ -214,7 +230,7 @@ describe Riak::Client do
|
|
214
230
|
|
215
231
|
it "should choose the selected backend" do
|
216
232
|
@client.protobuffs_backend = :Beefcake
|
217
|
-
@client.protobuffs.should be_instance_of(Riak::Client::BeefcakeProtobuffsBackend)
|
233
|
+
@client.protobuffs.should be_instance_of(Riak::Client::BeefcakeProtobuffsBackend)
|
218
234
|
end
|
219
235
|
|
220
236
|
it "should raise an error when the chosen backend is not valid" do
|
@@ -234,13 +250,13 @@ describe Riak::Client do
|
|
234
250
|
@client.backend.should be_kind_of(Riak::Client::HTTPBackend)
|
235
251
|
end
|
236
252
|
end
|
237
|
-
|
253
|
+
|
238
254
|
it "should use Protobuffs when the protocol is pbc" do
|
239
255
|
@client.protocol = "pbc"
|
240
256
|
@client.backend.should be_kind_of(Riak::Client::ProtobuffsBackend)
|
241
257
|
end
|
242
258
|
end
|
243
|
-
|
259
|
+
|
244
260
|
describe "retrieving a bucket" do
|
245
261
|
before :each do
|
246
262
|
@client = Riak::Client.new
|
@@ -460,7 +476,7 @@ describe Riak::Client do
|
|
460
476
|
@client.ssl = {:pem => 'i-am-a-pem'}
|
461
477
|
@client.ssl_options[:pem].should eq('i-am-a-pem')
|
462
478
|
end
|
463
|
-
|
479
|
+
|
464
480
|
it "should set them pem from the contents of pem_file" do
|
465
481
|
filepath = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures/test.pem'))
|
466
482
|
@client.ssl = {:pem_file => filepath}
|
@@ -36,7 +36,7 @@ else
|
|
36
36
|
end
|
37
37
|
|
38
38
|
before :each do
|
39
|
-
@client = Riak::Client.new(:
|
39
|
+
@client = Riak::Client.new(:http_port => $mock_server.port, :http_backend => :Curb) # Point to our mock
|
40
40
|
@backend = @client.http
|
41
41
|
@_mock_set = false
|
42
42
|
end
|
@@ -36,7 +36,7 @@ else
|
|
36
36
|
end
|
37
37
|
|
38
38
|
before :each do
|
39
|
-
@client = Riak::Client.new(:
|
39
|
+
@client = Riak::Client.new(:http_port => $mock_server.port, :http_backend => :Excon) # Point to our mock
|
40
40
|
@backend = @client.http
|
41
41
|
@_mock_set = false
|
42
42
|
end
|
@@ -15,8 +15,8 @@ require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
|
15
15
|
|
16
16
|
describe Riak::Client::NetHTTPBackend do
|
17
17
|
before :each do
|
18
|
-
@client = Riak::Client.new
|
19
|
-
@backend =
|
18
|
+
@client = Riak::Client.new(:http_backend => :NetHTTP)
|
19
|
+
@backend = @client.http
|
20
20
|
FakeWeb.allow_net_connect = false
|
21
21
|
end
|
22
22
|
|
@@ -215,7 +215,7 @@ shared_examples_for "HTTP backend" do
|
|
215
215
|
|
216
216
|
describe "SSL" do
|
217
217
|
it "should be supported" do
|
218
|
-
@client.
|
218
|
+
@client.http_port = $mock_server.port + 1 unless @client.http_backend == :NetHTTP
|
219
219
|
@client.ssl = true
|
220
220
|
setup_http_mock(:get, @backend.path("/riak/","ssl").to_s, :body => "Success!")
|
221
221
|
response = @backend.get(200, "/riak/","ssl")
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riak-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.9.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.9.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Cribbs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03
|
13
|
+
date: 2011-04-03 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- riak-client.gemspec
|
163
163
|
- spec/fixtures/cat.jpg
|
164
164
|
- spec/fixtures/multipart-blank.txt
|
165
|
+
- spec/fixtures/multipart-mapreduce.txt
|
165
166
|
- spec/fixtures/multipart-with-body.txt
|
166
167
|
- spec/fixtures/server.cert.crt
|
167
168
|
- spec/fixtures/server.cert.key
|
@@ -215,9 +216,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
216
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
217
|
none: false
|
217
218
|
requirements:
|
218
|
-
- - "
|
219
|
+
- - ">="
|
219
220
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
221
|
+
version: "0"
|
221
222
|
requirements: []
|
222
223
|
|
223
224
|
rubyforge_project:
|