riak-client 0.9.8 → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/.gitignore +32 -0
  2. data/Gemfile +17 -11
  3. data/Guardfile +14 -0
  4. data/Rakefile +18 -44
  5. data/erl_src/riak_kv_test_backend.beam +0 -0
  6. data/erl_src/riak_kv_test_backend.erl +461 -128
  7. data/erl_src/riak_search_test_backend.beam +0 -0
  8. data/erl_src/riak_search_test_backend.erl +175 -0
  9. data/lib/active_support/cache/riak_store.rb +0 -13
  10. data/lib/riak.rb +11 -16
  11. data/lib/riak/bucket.rb +59 -41
  12. data/lib/riak/cache_store.rb +1 -14
  13. data/lib/riak/client.rb +145 -73
  14. data/lib/riak/client/beefcake/messages.rb +36 -31
  15. data/lib/riak/client/beefcake/object_methods.rb +27 -19
  16. data/lib/riak/client/beefcake_protobuffs_backend.rb +27 -33
  17. data/lib/riak/client/excon_backend.rb +0 -13
  18. data/lib/riak/client/http_backend.rb +95 -60
  19. data/lib/riak/client/http_backend/configuration.rb +144 -19
  20. data/lib/riak/client/http_backend/key_streamer.rb +1 -14
  21. data/lib/riak/client/http_backend/object_methods.rb +16 -16
  22. data/lib/riak/client/http_backend/request_headers.rb +0 -13
  23. data/lib/riak/client/http_backend/transport_methods.rb +26 -56
  24. data/lib/riak/client/net_http_backend.rb +11 -13
  25. data/lib/riak/client/protobuffs_backend.rb +21 -19
  26. data/lib/riak/client/pump.rb +1 -15
  27. data/lib/riak/client/search.rb +85 -0
  28. data/lib/riak/cluster.rb +151 -0
  29. data/lib/riak/core_ext.rb +1 -0
  30. data/lib/riak/core_ext/deep_dup.rb +13 -0
  31. data/lib/riak/core_ext/json.rb +15 -0
  32. data/lib/riak/core_ext/stringify_keys.rb +1 -1
  33. data/lib/riak/core_ext/symbolize_keys.rb +1 -1
  34. data/lib/riak/encoding.rb +6 -0
  35. data/lib/riak/failed_request.rb +2 -15
  36. data/lib/riak/i18n.rb +0 -13
  37. data/lib/riak/json.rb +19 -8
  38. data/lib/riak/link.rb +18 -20
  39. data/lib/riak/locale/en.yml +13 -16
  40. data/lib/riak/map_reduce.rb +40 -20
  41. data/lib/riak/map_reduce/filter_builder.rb +14 -18
  42. data/lib/riak/map_reduce/phase.rb +0 -13
  43. data/lib/riak/map_reduce_error.rb +0 -13
  44. data/lib/riak/node.rb +38 -0
  45. data/lib/riak/node/configuration.rb +286 -0
  46. data/lib/riak/node/console.rb +139 -0
  47. data/lib/riak/node/control.rb +207 -0
  48. data/lib/riak/node/defaults.rb +70 -0
  49. data/lib/riak/node/generation.rb +99 -0
  50. data/lib/riak/node/log.rb +34 -0
  51. data/lib/riak/node/version.rb +37 -0
  52. data/lib/riak/robject.rb +45 -41
  53. data/lib/riak/search.rb +2 -161
  54. data/lib/riak/serializers.rb +74 -0
  55. data/lib/riak/stamp.rb +77 -0
  56. data/lib/riak/test_server.rb +56 -220
  57. data/lib/riak/util/escape.rb +58 -17
  58. data/lib/riak/util/headers.rb +2 -15
  59. data/lib/riak/util/multipart.rb +0 -13
  60. data/lib/riak/util/multipart/stream_parser.rb +0 -13
  61. data/lib/riak/util/tcp_socket_extensions.rb +1 -14
  62. data/lib/riak/util/translation.rb +0 -13
  63. data/lib/riak/version.rb +3 -0
  64. data/lib/riak/walk_spec.rb +0 -13
  65. data/riak-client.gemspec +27 -47
  66. data/spec/fixtures/multipart-with-marked-tombstones.txt +17 -0
  67. data/spec/fixtures/multipart-with-unmarked-tombstone.txt +16 -0
  68. data/spec/integration/riak/cache_store_spec.rb +2 -40
  69. data/spec/integration/riak/cluster_spec.rb +88 -0
  70. data/spec/integration/riak/http_backends_spec.rb +6 -30
  71. data/spec/integration/riak/node_spec.rb +184 -0
  72. data/spec/integration/riak/protobuffs_backends_spec.rb +2 -26
  73. data/spec/integration/riak/test_server_spec.rb +31 -167
  74. data/spec/riak/beefcake_protobuffs_backend_spec.rb +5 -4
  75. data/spec/riak/bucket_spec.rb +26 -36
  76. data/spec/riak/client_spec.rb +44 -38
  77. data/spec/riak/escape_spec.rb +56 -30
  78. data/spec/riak/excon_backend_spec.rb +4 -17
  79. data/spec/riak/headers_spec.rb +1 -14
  80. data/spec/riak/http_backend/configuration_spec.rb +211 -34
  81. data/spec/riak/http_backend/object_methods_spec.rb +52 -18
  82. data/spec/riak/http_backend/transport_methods_spec.rb +5 -38
  83. data/spec/riak/http_backend_spec.rb +84 -78
  84. data/spec/riak/link_spec.rb +19 -18
  85. data/spec/riak/map_reduce/filter_builder_spec.rb +1 -14
  86. data/spec/riak/map_reduce/phase_spec.rb +1 -14
  87. data/spec/riak/map_reduce_spec.rb +141 -43
  88. data/spec/riak/multipart_spec.rb +1 -14
  89. data/spec/riak/net_http_backend_spec.rb +2 -15
  90. data/spec/riak/robject_spec.rb +129 -97
  91. data/spec/riak/search_spec.rb +45 -62
  92. data/spec/riak/serializers_spec.rb +93 -0
  93. data/spec/riak/stamp_spec.rb +54 -0
  94. data/spec/riak/stream_parser_spec.rb +3 -16
  95. data/spec/riak/walk_spec_spec.rb +1 -14
  96. data/spec/spec_helper.rb +22 -27
  97. data/spec/support/http_backend_implementation_examples.rb +49 -79
  98. data/spec/support/integration_setup.rb +10 -0
  99. data/spec/support/mock_server.rb +0 -14
  100. data/spec/support/mocks.rb +0 -13
  101. data/spec/support/test_server.rb +30 -0
  102. data/spec/support/test_server.yml.example +14 -2
  103. data/spec/support/unified_backend_examples.rb +36 -27
  104. metadata +100 -31
  105. data/lib/riak/client/curb_backend.rb +0 -89
  106. data/spec/riak/curb_backend_spec.rb +0 -76
@@ -1,16 +1,3 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
1
  require 'net/http'
15
2
 
16
3
  # Splits headers into < 8KB chunks
@@ -44,7 +31,7 @@ module Riak
44
31
  def initialize
45
32
  initialize_http_header({})
46
33
  end
47
-
34
+
48
35
  # Parse a single header line into its key and value
49
36
  # @param [String] chunk a single header line
50
37
  def self.parse(chunk)
@@ -54,7 +41,7 @@ module Riak
54
41
  m = /\A([^:]+):\s*/.match(line)
55
42
  [m[1], m.post_match] rescue [nil, nil]
56
43
  end
57
-
44
+
58
45
  # Parses a header line and adds it to the header collection
59
46
  # @param [String] chunk a single header line
60
47
  def parse(chunk)
@@ -1,16 +1,3 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
1
  require 'riak/util/headers'
15
2
 
16
3
  module Riak
@@ -1,16 +1,3 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License
14
1
  require 'riak/util/translation'
15
2
  require 'riak/util/multipart'
16
3
 
@@ -1,16 +1,3 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
1
  require 'time'
15
2
  require 'timeout'
16
3
  require 'socket'
@@ -18,7 +5,7 @@ require 'socket'
18
5
  # Borrowed from Webrat and Selenium client, watches for TCP port
19
6
  # liveness of the spawned server.
20
7
  # @private
21
- class TCPSocket
8
+ class TCPSocket
22
9
  def self.wait_for_service(options)
23
10
  verbose_wait until listening_service?(options)
24
11
  end
@@ -1,16 +1,3 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
1
  require 'riak/i18n'
15
2
 
16
3
  module Riak
@@ -0,0 +1,3 @@
1
+ module Riak
2
+ VERSION = "1.0.0.beta"
3
+ end
@@ -1,16 +1,3 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
1
  require 'riak/util/translation'
15
2
  require 'riak/util/escape'
16
3
  require 'riak/link'
@@ -1,51 +1,31 @@
1
- # -*- encoding: utf-8 -*-
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require 'riak/version'
2
3
 
3
- Gem::Specification.new do |s|
4
- s.name = %q{riak-client}
5
- s.version = "0.9.7"
4
+ Gem::Specification.new do |gem|
5
+ # Meta
6
+ gem.name = "riak-client"
7
+ gem.version = Riak::VERSION
8
+ gem.summary = %Q{riak-client is a rich client for Riak, the distributed database by Basho.}
9
+ gem.description = %Q{riak-client is a rich client for Riak, the distributed database by Basho. It supports the full HTTP and Protocol Buffers interfaces including storage operations, bucket configuration, link-walking, secondary indexes and map-reduce.}
10
+ gem.email = ["sean@basho.com"]
11
+ gem.homepage = "http://seancribbs.github.com/ripple"
12
+ gem.authors = ["Sean Cribbs"]
6
13
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Sean Cribbs}]
9
- s.date = %q{2011-07-26}
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
- s.email = %q{sean@basho.com}
12
- s.files = [%q{erl_src/riak_kv_test_backend.beam}, %q{erl_src/riak_kv_test_backend.erl}, %q{Gemfile}, %q{lib/active_support/cache/riak_store.rb}, %q{lib/riak/bucket.rb}, %q{lib/riak/cache_store.rb}, %q{lib/riak/client/beefcake/messages.rb}, %q{lib/riak/client/beefcake/object_methods.rb}, %q{lib/riak/client/beefcake_protobuffs_backend.rb}, %q{lib/riak/client/curb_backend.rb}, %q{lib/riak/client/excon_backend.rb}, %q{lib/riak/client/http_backend/configuration.rb}, %q{lib/riak/client/http_backend/key_streamer.rb}, %q{lib/riak/client/http_backend/object_methods.rb}, %q{lib/riak/client/http_backend/request_headers.rb}, %q{lib/riak/client/http_backend/transport_methods.rb}, %q{lib/riak/client/http_backend.rb}, %q{lib/riak/client/net_http_backend.rb}, %q{lib/riak/client/protobuffs_backend.rb}, %q{lib/riak/client/pump.rb}, %q{lib/riak/client.rb}, %q{lib/riak/core_ext/blank.rb}, %q{lib/riak/core_ext/extract_options.rb}, %q{lib/riak/core_ext/slice.rb}, %q{lib/riak/core_ext/stringify_keys.rb}, %q{lib/riak/core_ext/symbolize_keys.rb}, %q{lib/riak/core_ext/to_param.rb}, %q{lib/riak/core_ext.rb}, %q{lib/riak/failed_request.rb}, %q{lib/riak/i18n.rb}, %q{lib/riak/json.rb}, %q{lib/riak/link.rb}, %q{lib/riak/locale/en.yml}, %q{lib/riak/map_reduce/filter_builder.rb}, %q{lib/riak/map_reduce/phase.rb}, %q{lib/riak/map_reduce.rb}, %q{lib/riak/map_reduce_error.rb}, %q{lib/riak/robject.rb}, %q{lib/riak/search.rb}, %q{lib/riak/test_server.rb}, %q{lib/riak/util/escape.rb}, %q{lib/riak/util/fiber1.8.rb}, %q{lib/riak/util/headers.rb}, %q{lib/riak/util/multipart/stream_parser.rb}, %q{lib/riak/util/multipart.rb}, %q{lib/riak/util/tcp_socket_extensions.rb}, %q{lib/riak/util/translation.rb}, %q{lib/riak/walk_spec.rb}, %q{lib/riak.rb}, %q{Rakefile}, %q{riak-client.gemspec}, %q{spec/fixtures/cat.jpg}, %q{spec/fixtures/multipart-blank.txt}, %q{spec/fixtures/multipart-mapreduce.txt}, %q{spec/fixtures/multipart-with-body.txt}, %q{spec/fixtures/server.cert.crt}, %q{spec/fixtures/server.cert.key}, %q{spec/fixtures/test.pem}, %q{spec/integration/riak/cache_store_spec.rb}, %q{spec/integration/riak/http_backends_spec.rb}, %q{spec/integration/riak/protobuffs_backends_spec.rb}, %q{spec/integration/riak/test_server_spec.rb}, %q{spec/riak/beefcake_protobuffs_backend_spec.rb}, %q{spec/riak/bucket_spec.rb}, %q{spec/riak/client_spec.rb}, %q{spec/riak/core_ext/to_param_spec.rb}, %q{spec/riak/curb_backend_spec.rb}, %q{spec/riak/escape_spec.rb}, %q{spec/riak/excon_backend_spec.rb}, %q{spec/riak/headers_spec.rb}, %q{spec/riak/http_backend/configuration_spec.rb}, %q{spec/riak/http_backend/object_methods_spec.rb}, %q{spec/riak/http_backend/transport_methods_spec.rb}, %q{spec/riak/http_backend_spec.rb}, %q{spec/riak/link_spec.rb}, %q{spec/riak/map_reduce/filter_builder_spec.rb}, %q{spec/riak/map_reduce/phase_spec.rb}, %q{spec/riak/map_reduce_spec.rb}, %q{spec/riak/multipart_spec.rb}, %q{spec/riak/net_http_backend_spec.rb}, %q{spec/riak/robject_spec.rb}, %q{spec/riak/search_spec.rb}, %q{spec/riak/stream_parser_spec.rb}, %q{spec/riak/walk_spec_spec.rb}, %q{spec/spec_helper.rb}, %q{spec/support/drb_mock_server.rb}, %q{spec/support/http_backend_implementation_examples.rb}, %q{spec/support/mock_server.rb}, %q{spec/support/mocks.rb}, %q{spec/support/test_server.yml.example}, %q{spec/support/unified_backend_examples.rb}]
13
- s.homepage = %q{http://seancribbs.github.com/ripple}
14
- s.require_paths = [%q{lib}]
15
- s.rubygems_version = %q{1.8.5}
16
- s.summary = %q{riak-client is a rich client for Riak, the distributed database by Basho.}
17
- s.test_files = [%q{spec/integration/riak/cache_store_spec.rb}, %q{spec/integration/riak/http_backends_spec.rb}, %q{spec/integration/riak/protobuffs_backends_spec.rb}, %q{spec/integration/riak/test_server_spec.rb}, %q{spec/riak/beefcake_protobuffs_backend_spec.rb}, %q{spec/riak/bucket_spec.rb}, %q{spec/riak/client_spec.rb}, %q{spec/riak/core_ext/to_param_spec.rb}, %q{spec/riak/curb_backend_spec.rb}, %q{spec/riak/escape_spec.rb}, %q{spec/riak/excon_backend_spec.rb}, %q{spec/riak/headers_spec.rb}, %q{spec/riak/http_backend/configuration_spec.rb}, %q{spec/riak/http_backend/object_methods_spec.rb}, %q{spec/riak/http_backend/transport_methods_spec.rb}, %q{spec/riak/http_backend_spec.rb}, %q{spec/riak/link_spec.rb}, %q{spec/riak/map_reduce/filter_builder_spec.rb}, %q{spec/riak/map_reduce/phase_spec.rb}, %q{spec/riak/map_reduce_spec.rb}, %q{spec/riak/multipart_spec.rb}, %q{spec/riak/net_http_backend_spec.rb}, %q{spec/riak/robject_spec.rb}, %q{spec/riak/search_spec.rb}, %q{spec/riak/stream_parser_spec.rb}, %q{spec/riak/walk_spec_spec.rb}]
14
+ # Deps
15
+ gem.add_development_dependency "rspec", "~>2.6.0"
16
+ gem.add_development_dependency "fakeweb", ">=1.2"
17
+ gem.add_development_dependency "rack", ">=1.0"
18
+ gem.add_development_dependency "excon", "~>0.6.1"
19
+ gem.add_development_dependency 'rake', '~> 0.8.7'
20
+ gem.add_runtime_dependency "i18n", ">=0.4.0"
21
+ gem.add_runtime_dependency "builder", ">= 2.1.2"
22
+ gem.add_runtime_dependency "beefcake", "~>0.3.7"
23
+ gem.add_runtime_dependency "multi_json", "~>1.0.0"
18
24
 
19
- if s.respond_to? :specification_version then
20
- s.specification_version = 3
21
-
22
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
23
- s.add_development_dependency(%q<rspec>, ["~> 2.4.0"])
24
- s.add_development_dependency(%q<fakeweb>, [">= 1.2"])
25
- s.add_development_dependency(%q<rack>, [">= 1.0"])
26
- s.add_development_dependency(%q<curb>, [">= 0.6"])
27
- s.add_development_dependency(%q<excon>, ["~> 0.5.7"])
28
- s.add_runtime_dependency(%q<i18n>, [">= 0.4.0"])
29
- s.add_runtime_dependency(%q<builder>, ["~> 2.1.2"])
30
- s.add_runtime_dependency(%q<beefcake>, ["= 0.3.2"])
31
- else
32
- s.add_dependency(%q<rspec>, ["~> 2.4.0"])
33
- s.add_dependency(%q<fakeweb>, [">= 1.2"])
34
- s.add_dependency(%q<rack>, [">= 1.0"])
35
- s.add_dependency(%q<curb>, [">= 0.6"])
36
- s.add_dependency(%q<excon>, ["~> 0.5.7"])
37
- s.add_dependency(%q<i18n>, [">= 0.4.0"])
38
- s.add_dependency(%q<builder>, ["~> 2.1.2"])
39
- s.add_dependency(%q<beefcake>, ["= 0.3.2"])
40
- end
41
- else
42
- s.add_dependency(%q<rspec>, ["~> 2.4.0"])
43
- s.add_dependency(%q<fakeweb>, [">= 1.2"])
44
- s.add_dependency(%q<rack>, [">= 1.0"])
45
- s.add_dependency(%q<curb>, [">= 0.6"])
46
- s.add_dependency(%q<excon>, ["~> 0.5.7"])
47
- s.add_dependency(%q<i18n>, [">= 0.4.0"])
48
- s.add_dependency(%q<builder>, ["~> 2.1.2"])
49
- s.add_dependency(%q<beefcake>, ["= 0.3.2"])
50
- end
25
+ # Files
26
+ ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten
27
+ gem.files = (Dir['**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
28
+ gem.test_files = (Dir['spec/**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
29
+ # gem.executables = Dir['bin/*'].map { |f| File.basename(f) }
30
+ gem.require_paths = ['lib']
51
31
  end
@@ -0,0 +1,17 @@
1
+
2
+ --ADqgQtdmA5iQgyR5UGzX6V3HZtI
3
+ Content-Type: multipart/mixed; boundary=Ljz1mP3hZzqPu6DH1Y4L8k7hfxy
4
+
5
+ --Ljz1mP3hZzqPu6DH1Y4L8k7hfxy
6
+ X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvrNPcuWwZTIlMfKIOotdIIvCwA=
7
+ Location: /buckets/links/keys/target
8
+ Content-Type: application/octet-stream
9
+ Link: </buckets/links>; rel="up"
10
+ Etag: 5bUNdzHJhZDdCr7KlWxXq
11
+ Last-Modified: Tue, 18 Oct 2011 19:10:13 GMT
12
+ X-Riak-Deleted: true
13
+
14
+
15
+ --Ljz1mP3hZzqPu6DH1Y4L8k7hfxy--
16
+
17
+ --ADqgQtdmA5iQgyR5UGzX6V3HZtI--
@@ -0,0 +1,16 @@
1
+
2
+ --CvfrSTCWwIiwezy0Zt1B2zwKgS7
3
+ Content-Type: multipart/mixed; boundary=E9n2ZOKHIazIoPHzXj9XsWYWJjJ
4
+
5
+ --E9n2ZOKHIazIoPHzXj9XsWYWJjJ
6
+ X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvpN53+WwZTIlMfKcNVJ6ARfFgA=
7
+ Location: /buckets/links/keys/target
8
+ Content-Type: application/octet-stream
9
+ Link: </buckets/links>; rel="up"
10
+ Etag: 50FOyLo7juvEVUO33MRJwP
11
+ Last-Modified: Tue, 18 Oct 2011 18:35:01 GMT
12
+
13
+
14
+ --E9n2ZOKHIazIoPHzXj9XsWYWJjJ--
15
+
16
+ --CvfrSTCWwIiwezy0Zt1B2zwKgS7--
@@ -1,51 +1,13 @@
1
- # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- require File.expand_path("../../spec_helper", File.dirname(__FILE__))
1
+ require 'spec_helper'
15
2
  require 'riak/cache_store'
16
3
 
17
4
  describe Riak::CacheStore do
18
- before :all do
19
- if $test_server
20
- @web_port = 9000
21
- $test_server.start
22
- end
23
- end
24
-
25
5
  before do
26
- @web_port ||= 8098
6
+ @web_port = $test_server.http_port
27
7
  @cache = ActiveSupport::Cache.lookup_store(:riak_store, :http_port => @web_port)
28
- @cleanup = true
29
- end
30
-
31
- after do
32
- if @cleanup
33
- if $test_server
34
- $test_server.recycle
35
- Thread.current[:curl_easy_handle] = nil
36
- else
37
- @cache.bucket.keys(:force => true).each do |k|
38
- @cache.bucket.delete(k, :rw => 1) unless k.blank?
39
- end
40
- end
41
- end
42
8
  end
43
9
 
44
10
  describe "Riak integration" do
45
- before do
46
- @cleanup = false
47
- end
48
-
49
11
  it "should have a client" do
50
12
  @cache.should respond_to(:client)
51
13
  @cache.client.should be_kind_of(Riak::Client)
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+ require 'riak/cluster'
3
+
4
+ describe Riak::Cluster, :test_server => false, :slow => true do
5
+ let(:config) { YAML.load_file("spec/support/test_server.yml").symbolize_keys }
6
+ subject { described_class.new(config) }
7
+
8
+ it "should have a list of nodes" do
9
+ should respond_to(:nodes)
10
+ subject.nodes.should be_kind_of(Array)
11
+ subject.nodes.should have(4).items
12
+ subject.nodes.should be_all {|n| n.kind_of?(Riak::Node) }
13
+ end
14
+
15
+ it "should have a configuration" do
16
+ should respond_to(:configuration)
17
+ subject.configuration.should be_kind_of(Hash)
18
+ end
19
+
20
+ it "should require a :source and :root configuration keys" do
21
+ expect {
22
+ described_class.new({})
23
+ }.to raise_error(ArgumentError)
24
+ end
25
+
26
+ it "should not be created initially" do
27
+ should_not be_exist
28
+ end
29
+
30
+ context "creating the cluster" do
31
+ before { subject.create }
32
+ after { subject.destroy }
33
+
34
+ it "should generate all nodes inside its root" do
35
+ subject.root.should be_exist
36
+ subject.nodes.should be_all {|n| n.exist? }
37
+ end
38
+ end
39
+
40
+ context "destroying the cluster" do
41
+ before { subject.create; subject.should be_exist; subject.destroy }
42
+
43
+ it "should remove all nodes and its root directory" do
44
+ subject.should_not be_exist
45
+ end
46
+ end
47
+
48
+ context "dropping data from the cluster" do
49
+ it "should make all nodes drop their data" do
50
+ subject.nodes.each {|n| n.should_receive(:drop) }
51
+ subject.drop
52
+ end
53
+ end
54
+
55
+ context "starting the cluster", :slow => true do
56
+ before { subject.create }
57
+ after { subject.destroy }
58
+
59
+ it "should start all nodes in the cluster" do
60
+ subject.start
61
+ subject.nodes.should be_all {|n| n.started? }
62
+ end
63
+ end
64
+
65
+ context "stopping the cluster", :slow => true do
66
+ before { subject.create; subject.start; subject.should be_started }
67
+ after { subject.destroy }
68
+
69
+ it "should stop all nodes in the cluster" do
70
+ subject.stop
71
+ subject.nodes.should be_all {|n| n.stopped? }
72
+ end
73
+ end
74
+
75
+ context "joining the cluster together", :slow => true do
76
+ before { subject.create; subject.start; subject.should be_started }
77
+ after { subject.destroy }
78
+
79
+ it "should join nodes into a cluster" do
80
+ subject.join
81
+ node_names = subject.nodes.map {|n| n.name }.sort
82
+ subject.nodes.should be_all do |n|
83
+ n.peers.should have(3).items
84
+ n.peers.sort == (node_names - [n.name])
85
+ end
86
+ end
87
+ end
88
+ end
@@ -1,36 +1,12 @@
1
- # Copyright 2010 Sean Cribbs and Basho Technologies, Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- require File.expand_path("../../spec_helper", File.dirname(__FILE__))
1
+ require 'spec_helper'
15
2
 
16
3
  describe "HTTP" do
17
- before :all do
18
- if $test_server
19
- @web_port = 9000
20
- $test_server.start
21
- end
22
- end
23
-
24
4
  before do
25
- @web_port ||= 8098
5
+ @web_port = $test_server.http_port
26
6
  @client = Riak::Client.new(:http_port => @web_port)
27
7
  end
28
8
 
29
- after do
30
- $test_server.recycle if $test_server.started?
31
- end
32
-
33
- [:CurbBackend, :ExconBackend, :NetHTTPBackend].each do |klass|
9
+ [:ExconBackend, :NetHTTPBackend].each do |klass|
34
10
  bklass = Riak::Client.const_get(klass)
35
11
  if bklass.configured?
36
12
  describe klass.to_s do
@@ -63,9 +39,9 @@ describe "HTTP" do
63
39
  let(:sized) { Reader.new(["foo", "bar", "baz"]) }
64
40
  let(:sizeless) { SizelessReader.new(["foo", "bar", "baz"]) }
65
41
  it "should set the content-length or transfer-encoding properly on IO uploads" do
66
- lambda { subject.put(204, "/riak/nethttp", "test-file", file, {"Content-Type" => "text/plain"}) }.should_not raise_error
67
- lambda { subject.put(204, "/riak/nethttp", "test-sized", sized, {"Content-Type" => "text/plain"}) }.should_not raise_error
68
- lambda { subject.put(204, "/riak/nethttp", "test-file", sizeless, {"Content-Type" => "text/plain"}) }.should_not raise_error
42
+ lambda { subject.put(204, subject.object_path('nethttp', 'test-file'), file, {"Content-Type" => "text/plain"}) }.should_not raise_error
43
+ lambda { subject.put(204, subject.object_path('nethttp', 'test-sized'), sized, {"Content-Type" => "text/plain"}) }.should_not raise_error
44
+ lambda { subject.put(204, subject.object_path('nethttp', 'test-sizeless'), sizeless, {"Content-Type" => "text/plain"}) }.should_not raise_error
69
45
  end
70
46
  end
71
47
  end