waz-storage 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -9
- data/CHANGELOG.rdoc +72 -72
- data/Gemfile +4 -4
- data/Gemfile.lock +46 -40
- data/LICENSE +18 -18
- data/README.rdoc +310 -310
- data/lib/waz-blobs.rb +4 -4
- data/lib/waz-queues.rb +6 -6
- data/lib/waz-storage.rb +39 -39
- data/lib/waz-tables.rb +4 -4
- data/lib/waz/blobs/blob_object.rb +122 -122
- data/lib/waz/blobs/container.rb +172 -161
- data/lib/waz/blobs/exceptions.rb +10 -10
- data/lib/waz/blobs/service.rb +181 -156
- data/lib/waz/queues/exceptions.rb +28 -28
- data/lib/waz/queues/message.rb +64 -64
- data/lib/waz/queues/queue.rb +164 -164
- data/lib/waz/queues/service.rb +105 -105
- data/lib/waz/storage/base.rb +70 -70
- data/lib/waz/storage/exceptions.rb +33 -33
- data/lib/waz/storage/validation_rules.rb +25 -25
- data/lib/waz/tables/edm_type_helper.rb +44 -44
- data/lib/waz/tables/exceptions.rb +44 -44
- data/lib/waz/tables/service.rb +178 -178
- data/lib/waz/tables/table.rb +74 -74
- data/lib/waz/tables/table_array.rb +10 -10
- data/rakefile +8 -21
- data/{tests → spec}/configuration.rb +22 -22
- data/{tests/waz/blobs/blob_object_test.rb → spec/waz/blobs/blob_object_spec.rb} +80 -80
- data/{tests/waz/blobs/container_test.rb → spec/waz/blobs/container_spec.rb} +175 -162
- data/{tests/waz/blobs/service_test.rb → spec/waz/blobs/service_spec.rb} +336 -282
- data/{tests/waz/queues/message_test.rb → spec/waz/queues/message_spec.rb} +32 -32
- data/{tests/waz/queues/queue_test.rb → spec/waz/queues/queue_spec.rb} +205 -205
- data/{tests/waz/queues/service_test.rb → spec/waz/queues/service_spec.rb} +298 -298
- data/{tests → spec}/waz/storage/base_tests.rb +81 -81
- data/{tests/waz/storage/shared_key_core_service_test.rb → spec/waz/storage/shared_key_core_service_spec.rb} +141 -141
- data/{tests/waz/tables/service_test.rb → spec/waz/tables/service_spec.rb} +613 -613
- data/{tests/waz/tables/table_test.rb → spec/waz/tables/table_spec.rb} +97 -97
- data/waz-storage.gemspec +29 -27
- metadata +47 -26
data/lib/waz/tables/table.rb
CHANGED
@@ -1,75 +1,75 @@
|
|
1
|
-
module WAZ
|
2
|
-
module Tables
|
3
|
-
# This class represents a Table on Windows Azure Tables API. These are the methods implemented from Microsoft's API description
|
4
|
-
# available on MSDN at http://msdn.microsoft.com/en-us/library/dd179423.aspx
|
5
|
-
#
|
6
|
-
# # list available tables
|
7
|
-
# tables = WAZ::Tables::Table.list
|
8
|
-
#
|
9
|
-
# # list more tables
|
10
|
-
# WAZ::Tables::Table.list(tables.continuation_token)
|
11
|
-
#
|
12
|
-
# # get a specific table
|
13
|
-
# my_table = WAZ::Tables::Table.find('my-table')
|
14
|
-
#
|
15
|
-
# # delete table
|
16
|
-
# my_table.destroy!
|
17
|
-
#
|
18
|
-
# # create a new table
|
19
|
-
# WAZ::Tables::Table.create('new-table')
|
20
|
-
#
|
21
|
-
class Table
|
22
|
-
class << self
|
23
|
-
INVALID_TABLE_ERROR_MESSAGE = "must start with at least one lower/upper characted, can have character or any digit starting from the second position, must be from 3 through 63 characters long"
|
24
|
-
|
25
|
-
# Finds a table by name. It will return nil if no table was found.
|
26
|
-
def find(table_name)
|
27
|
-
raise WAZ::Storage::InvalidParameterValue, {:name => table_name, :values => [INVALID_TABLE_ERROR_MESSAGE]} unless WAZ::Storage::ValidationRules.valid_table_name?(table_name)
|
28
|
-
begin
|
29
|
-
WAZ::Tables::Table.new(service_instance.get_table(table_name))
|
30
|
-
rescue WAZ::Tables::TableDoesNotExist
|
31
|
-
return nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Returns an array of the existing tables (WAZ::Tables::Table) on the current
|
36
|
-
# Windows Azure Storage account.
|
37
|
-
def list(continuation_token = {})
|
38
|
-
table_list, next_table_name = service_instance.list_tables(continuation_token['NextTableName'])
|
39
|
-
tables = TableArray.new(table_list.map { |table| WAZ::Tables::Table.new({ :name => table[:name], :url => table[:url] }) })
|
40
|
-
tables.continuation_token = {'NextTableName' => next_table_name} unless next_table_name.nil?
|
41
|
-
return tables
|
42
|
-
end
|
43
|
-
|
44
|
-
# Creates a table on the current account.
|
45
|
-
def create(table_name)
|
46
|
-
raise WAZ::Storage::InvalidParameterValue, {:name => table_name, :values => [INVALID_TABLE_ERROR_MESSAGE]} unless WAZ::Storage::ValidationRules.valid_table_name?(table_name)
|
47
|
-
WAZ::Tables::Table.new(service_instance.create_table(table_name))
|
48
|
-
end
|
49
|
-
|
50
|
-
# This method is internally used by this class. It's the way we keep a single instance of the
|
51
|
-
# service that wraps the calls the Windows Azure Tables API. It's initialized with the values
|
52
|
-
# from the default_connection on WAZ::Storage::Base initialized thru establish_connection!
|
53
|
-
def service_instance
|
54
|
-
options = WAZ::Storage::Base.default_connection.merge(:type_of_service => "table")
|
55
|
-
(@service_instances ||= {})[options[:account_name]] ||= Service.new(options)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
attr_accessor :name, :url
|
60
|
-
|
61
|
-
def initialize(options = {})
|
62
|
-
raise WAZ::Storage::InvalidOption, :name unless options.keys.include?(:name) and !options[:name].empty?
|
63
|
-
raise WAZ::Storage::InvalidOption, :url unless options.keys.include?(:url) and !options[:url].empty?
|
64
|
-
raise WAZ::Storage::InvalidParameterValue, {:name => options[:name], :values => [INVALID_TABLE_ERROR_MESSAGE]} unless WAZ::Storage::ValidationRules.valid_table_name?(options[:name])
|
65
|
-
self.name = options[:name]
|
66
|
-
self.url = options[:url]
|
67
|
-
end
|
68
|
-
|
69
|
-
# Removes the table from the current account.
|
70
|
-
def destroy!
|
71
|
-
self.class.service_instance.delete_table(self.name)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
1
|
+
module WAZ
|
2
|
+
module Tables
|
3
|
+
# This class represents a Table on Windows Azure Tables API. These are the methods implemented from Microsoft's API description
|
4
|
+
# available on MSDN at http://msdn.microsoft.com/en-us/library/dd179423.aspx
|
5
|
+
#
|
6
|
+
# # list available tables
|
7
|
+
# tables = WAZ::Tables::Table.list
|
8
|
+
#
|
9
|
+
# # list more tables
|
10
|
+
# WAZ::Tables::Table.list(tables.continuation_token)
|
11
|
+
#
|
12
|
+
# # get a specific table
|
13
|
+
# my_table = WAZ::Tables::Table.find('my-table')
|
14
|
+
#
|
15
|
+
# # delete table
|
16
|
+
# my_table.destroy!
|
17
|
+
#
|
18
|
+
# # create a new table
|
19
|
+
# WAZ::Tables::Table.create('new-table')
|
20
|
+
#
|
21
|
+
class Table
|
22
|
+
class << self
|
23
|
+
INVALID_TABLE_ERROR_MESSAGE = "must start with at least one lower/upper characted, can have character or any digit starting from the second position, must be from 3 through 63 characters long"
|
24
|
+
|
25
|
+
# Finds a table by name. It will return nil if no table was found.
|
26
|
+
def find(table_name)
|
27
|
+
raise WAZ::Storage::InvalidParameterValue, {:name => table_name, :values => [INVALID_TABLE_ERROR_MESSAGE]} unless WAZ::Storage::ValidationRules.valid_table_name?(table_name)
|
28
|
+
begin
|
29
|
+
WAZ::Tables::Table.new(service_instance.get_table(table_name))
|
30
|
+
rescue WAZ::Tables::TableDoesNotExist
|
31
|
+
return nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns an array of the existing tables (WAZ::Tables::Table) on the current
|
36
|
+
# Windows Azure Storage account.
|
37
|
+
def list(continuation_token = {})
|
38
|
+
table_list, next_table_name = service_instance.list_tables(continuation_token['NextTableName'])
|
39
|
+
tables = TableArray.new(table_list.map { |table| WAZ::Tables::Table.new({ :name => table[:name], :url => table[:url] }) })
|
40
|
+
tables.continuation_token = {'NextTableName' => next_table_name} unless next_table_name.nil?
|
41
|
+
return tables
|
42
|
+
end
|
43
|
+
|
44
|
+
# Creates a table on the current account.
|
45
|
+
def create(table_name)
|
46
|
+
raise WAZ::Storage::InvalidParameterValue, {:name => table_name, :values => [INVALID_TABLE_ERROR_MESSAGE]} unless WAZ::Storage::ValidationRules.valid_table_name?(table_name)
|
47
|
+
WAZ::Tables::Table.new(service_instance.create_table(table_name))
|
48
|
+
end
|
49
|
+
|
50
|
+
# This method is internally used by this class. It's the way we keep a single instance of the
|
51
|
+
# service that wraps the calls the Windows Azure Tables API. It's initialized with the values
|
52
|
+
# from the default_connection on WAZ::Storage::Base initialized thru establish_connection!
|
53
|
+
def service_instance
|
54
|
+
options = WAZ::Storage::Base.default_connection.merge(:type_of_service => "table")
|
55
|
+
(@service_instances ||= {})[options[:account_name]] ||= Service.new(options)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
attr_accessor :name, :url
|
60
|
+
|
61
|
+
def initialize(options = {})
|
62
|
+
raise WAZ::Storage::InvalidOption, :name unless options.keys.include?(:name) and !options[:name].empty?
|
63
|
+
raise WAZ::Storage::InvalidOption, :url unless options.keys.include?(:url) and !options[:url].empty?
|
64
|
+
raise WAZ::Storage::InvalidParameterValue, {:name => options[:name], :values => [INVALID_TABLE_ERROR_MESSAGE]} unless WAZ::Storage::ValidationRules.valid_table_name?(options[:name])
|
65
|
+
self.name = options[:name]
|
66
|
+
self.url = options[:url]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Removes the table from the current account.
|
70
|
+
def destroy!
|
71
|
+
self.class.service_instance.delete_table(self.name)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
75
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module WAZ
|
2
|
-
module Tables
|
3
|
-
class TableArray < Array
|
4
|
-
attr_accessor :continuation_token
|
5
|
-
|
6
|
-
def initialize(array)
|
7
|
-
super(array)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
1
|
+
module WAZ
|
2
|
+
module Tables
|
3
|
+
class TableArray < Array
|
4
|
+
attr_accessor :continuation_token
|
5
|
+
|
6
|
+
def initialize(array)
|
7
|
+
super(array)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
11
|
end
|
data/rakefile
CHANGED
@@ -1,21 +1,8 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
t.
|
8
|
-
|
9
|
-
t.rspec_opts = ['-cfn']
|
10
|
-
end
|
11
|
-
|
12
|
-
namespace :docs do
|
13
|
-
Rake::RDocTask.new do |t|
|
14
|
-
t.rdoc_dir = 'rdoc'
|
15
|
-
t.title = "Windows Azure Storage library - simple gem for accessing WAZ's Storage REST API"
|
16
|
-
t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
17
|
-
t.options << '--charset' << 'utf-8'
|
18
|
-
t.rdoc_files.include('README.rdoc')
|
19
|
-
t.rdoc_files.include('lib/**/*.rb')
|
20
|
-
end
|
21
|
-
end
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
6
|
+
t.pattern = "spec/**/*_spec.rb"
|
7
|
+
t.rspec_opts = ['-cfn']
|
8
|
+
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start do
|
3
|
-
add_group "Gem files" do |src_file|
|
4
|
-
lib_path = File.expand_path("../lib", File.dirname(__FILE__))
|
5
|
-
src_file.filename.start_with?(lib_path)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'rubygems'
|
10
|
-
require 'rspec'
|
11
|
-
require 'rspec/autorun'
|
12
|
-
require 'mocha'
|
13
|
-
require 'restclient'
|
14
|
-
require 'time'
|
15
|
-
require 'hmac-sha2'
|
16
|
-
require 'base64'
|
17
|
-
require 'rexml/document'
|
18
|
-
require 'rexml/xpath'
|
19
|
-
|
20
|
-
RSpec.configure do |config|
|
21
|
-
config.mock_with :mocha
|
22
|
-
end
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_group "Gem files" do |src_file|
|
4
|
+
lib_path = File.expand_path("../lib", File.dirname(__FILE__))
|
5
|
+
src_file.filename.start_with?(lib_path)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
require 'rspec'
|
11
|
+
require 'rspec/autorun'
|
12
|
+
require 'mocha'
|
13
|
+
require 'restclient'
|
14
|
+
require 'time'
|
15
|
+
require 'hmac-sha2'
|
16
|
+
require 'base64'
|
17
|
+
require 'rexml/document'
|
18
|
+
require 'rexml/xpath'
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.mock_with :mocha
|
22
|
+
end
|
@@ -1,80 +1,80 @@
|
|
1
|
-
# enabling the load of files from root (on RSpec)
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../../')
|
3
|
-
require '
|
4
|
-
require 'lib/waz-blobs'
|
5
|
-
|
6
|
-
describe "Windows Azure Blobs interface API" do
|
7
|
-
it "should return blob path from url" do
|
8
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
9
|
-
blob.path.should == "container/blob"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should return blob metdata" do
|
13
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
14
|
-
WAZ::Blobs::Service.any_instance.expects(:get_blob_properties).with("container/blob").returns({:x_ms_meta_name => "blob_name"})
|
15
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
16
|
-
blob.metadata.should == { :x_ms_meta_name => "blob_name" }
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should put blob metadataa" do
|
20
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
21
|
-
WAZ::Blobs::Service.any_instance.expects(:set_blob_properties).with("container/blob", {:x_ms_meta_name => "blob_name"})
|
22
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
23
|
-
blob.put_properties!({ :x_ms_meta_name => "blob_name" })
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should get blob contents" do
|
27
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
28
|
-
WAZ::Blobs::Service.any_instance.expects(:get_blob).with("container/blob").returns("this is the blob content")
|
29
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
30
|
-
blob.value.should == "this is the blob content"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should put blob contents" do
|
34
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
35
|
-
WAZ::Blobs::Service.any_instance.expects(:get_blob_properties).with("container/blob").returns({})
|
36
|
-
WAZ::Blobs::Service.any_instance.expects(:put_blob).with("container/blob", "my new blob value", "application/xml", {}).returns("this is the blob content")
|
37
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
38
|
-
blob.value = "my new blob value"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should destroy blob" do
|
42
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
43
|
-
WAZ::Blobs::Service.any_instance.expects(:delete_blob).with("container/blob")
|
44
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
45
|
-
blob.destroy!
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should copy blob" do
|
49
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
50
|
-
WAZ::Blobs::BlobObject.service_instance.expects(:copy_blob).with('container/blob', 'container/blob-copy')
|
51
|
-
WAZ::Blobs::BlobObject.service_instance.expects(:get_blob_properties).with('container/blob-copy').returns(:content_type => "plain/text")
|
52
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "plain/text")
|
53
|
-
copy = blob.copy('container/blob-copy')
|
54
|
-
copy.path.should == "container/blob-copy"
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should take a snapshot of a blob" do
|
58
|
-
mock_time = Time.new
|
59
|
-
Time.stubs(:new).returns(mock_time)
|
60
|
-
|
61
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
62
|
-
WAZ::Blobs::BlobObject.service_instance.expects(:get_blob_properties).with('container/blob').returns(:content_type => "plain/text")
|
63
|
-
WAZ::Blobs::BlobObject.service_instance.expects(:snapshot_blob).with('container/blob').returns(mock_time.httpdate)
|
64
|
-
|
65
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "plain/text")
|
66
|
-
blob_snapshot = blob.snapshot
|
67
|
-
blob_snapshot.snapshot_date.should === mock_time.httpdate
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should not allow snapshoted blobs to perform write operations" do
|
71
|
-
snapshot = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "plain/text", :snapshot_date => Time.new.httpdate)
|
72
|
-
lambda { snapshot.value = "new-value" }.should raise_error(WAZ::Blobs::InvalidOperation)
|
73
|
-
lambda { snapshot.put_properties!({:x_ms_meta_name => "foo"}) }.should raise_error(WAZ::Blobs::InvalidOperation)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "blob path should include snapshot parameter" do
|
77
|
-
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob?snapshot=foo", :content_type => "application/xml")
|
78
|
-
blob.path.should == "container/blob?snapshot=foo"
|
79
|
-
end
|
80
|
-
end
|
1
|
+
# enabling the load of files from root (on RSpec)
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../../')
|
3
|
+
require 'spec/configuration'
|
4
|
+
require 'lib/waz-blobs'
|
5
|
+
|
6
|
+
describe "Windows Azure Blobs interface API" do
|
7
|
+
it "should return blob path from url" do
|
8
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
9
|
+
blob.path.should == "container/blob"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return blob metdata" do
|
13
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
14
|
+
WAZ::Blobs::Service.any_instance.expects(:get_blob_properties).with("container/blob").returns({:x_ms_meta_name => "blob_name"})
|
15
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
16
|
+
blob.metadata.should == { :x_ms_meta_name => "blob_name" }
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should put blob metadataa" do
|
20
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
21
|
+
WAZ::Blobs::Service.any_instance.expects(:set_blob_properties).with("container/blob", {:x_ms_meta_name => "blob_name"})
|
22
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
23
|
+
blob.put_properties!({ :x_ms_meta_name => "blob_name" })
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should get blob contents" do
|
27
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
28
|
+
WAZ::Blobs::Service.any_instance.expects(:get_blob).with("container/blob").returns("this is the blob content")
|
29
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
30
|
+
blob.value.should == "this is the blob content"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should put blob contents" do
|
34
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
35
|
+
WAZ::Blobs::Service.any_instance.expects(:get_blob_properties).with("container/blob").returns({})
|
36
|
+
WAZ::Blobs::Service.any_instance.expects(:put_blob).with("container/blob", "my new blob value", "application/xml", {}).returns("this is the blob content")
|
37
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
38
|
+
blob.value = "my new blob value"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should destroy blob" do
|
42
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
43
|
+
WAZ::Blobs::Service.any_instance.expects(:delete_blob).with("container/blob")
|
44
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "application/xml")
|
45
|
+
blob.destroy!
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should copy blob" do
|
49
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
50
|
+
WAZ::Blobs::BlobObject.service_instance.expects(:copy_blob).with('container/blob', 'container/blob-copy')
|
51
|
+
WAZ::Blobs::BlobObject.service_instance.expects(:get_blob_properties).with('container/blob-copy').returns(:content_type => "plain/text")
|
52
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "plain/text")
|
53
|
+
copy = blob.copy('container/blob-copy')
|
54
|
+
copy.path.should == "container/blob-copy"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should take a snapshot of a blob" do
|
58
|
+
mock_time = Time.new
|
59
|
+
Time.stubs(:new).returns(mock_time)
|
60
|
+
|
61
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
62
|
+
WAZ::Blobs::BlobObject.service_instance.expects(:get_blob_properties).with('container/blob').returns(:content_type => "plain/text")
|
63
|
+
WAZ::Blobs::BlobObject.service_instance.expects(:snapshot_blob).with('container/blob').returns(mock_time.httpdate)
|
64
|
+
|
65
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "plain/text")
|
66
|
+
blob_snapshot = blob.snapshot
|
67
|
+
blob_snapshot.snapshot_date.should === mock_time.httpdate
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should not allow snapshoted blobs to perform write operations" do
|
71
|
+
snapshot = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob", :content_type => "plain/text", :snapshot_date => Time.new.httpdate)
|
72
|
+
lambda { snapshot.value = "new-value" }.should raise_error(WAZ::Blobs::InvalidOperation)
|
73
|
+
lambda { snapshot.put_properties!({:x_ms_meta_name => "foo"}) }.should raise_error(WAZ::Blobs::InvalidOperation)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "blob path should include snapshot parameter" do
|
77
|
+
blob = WAZ::Blobs::BlobObject.new(:name => "blob_name", :url => "http://localhost/container/blob?snapshot=foo", :content_type => "application/xml")
|
78
|
+
blob.path.should == "container/blob?snapshot=foo"
|
79
|
+
end
|
80
|
+
end
|
@@ -1,162 +1,175 @@
|
|
1
|
-
# enabling the load of files from root (on RSpec)
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../')
|
3
|
-
require '
|
4
|
-
require 'lib/waz-blobs'
|
5
|
-
|
6
|
-
describe "Windows Azure Containers interface API" do
|
7
|
-
|
8
|
-
it "should should throw when no container name is provided" do
|
9
|
-
lambda {WAZ::Blobs::Container.new}.should raise_error(WAZ::Storage::InvalidOption)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should list containers" do
|
13
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
14
|
-
WAZ::Blobs::Service.any_instance.expects(:list_containers).returns([{:name => 'my-container'}, {:name => 'other container'}])
|
15
|
-
containers = WAZ::Blobs::Container.list
|
16
|
-
containers.size.should == 2
|
17
|
-
containers.first().name.should == "my-container"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should be able to create a container" do
|
21
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
22
|
-
WAZ::Blobs::Service.any_instance.expects(:create_container).with("my-container")
|
23
|
-
container = WAZ::Blobs::Container.create('my-container')
|
24
|
-
container.name.should == 'my-container'
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should be able to return a container by name" do
|
28
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
29
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:name => "container-name", :x_ms_meta_name => "container-name"}).twice
|
30
|
-
container = WAZ::Blobs::Container.find('container-name')
|
31
|
-
container.metadata[:x_ms_meta_name].should == 'container-name'
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should be able to return container metadata" do
|
35
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
36
|
-
WAZ::Blobs::Service.any_instance.expects(:create_container).with("container-name")
|
37
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
38
|
-
container = WAZ::Blobs::Container.create('container-name')
|
39
|
-
container.metadata[:x_ms_meta_name].should == 'container-name'
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should be able to say whether the container is public or not" do
|
43
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
44
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
45
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_acl).with("container-name").returns(false)
|
46
|
-
container = WAZ::Blobs::Container.find("container-name")
|
47
|
-
container.public_access?.should == false
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should be able to set whether the container is public or not" do
|
51
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
52
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
53
|
-
WAZ::Blobs::Service.any_instance.expects(:set_container_acl).with('container-name', false)
|
54
|
-
container = WAZ::Blobs::Container.find("container-name")
|
55
|
-
container.public_access = false
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should be able to set container properties" do
|
59
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
60
|
-
WAZ::Blobs::Service.any_instance.expects(:set_container_properties).with("container-name", {:x_ms_meta_meta1 => "meta1"}).returns(false)
|
61
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
62
|
-
container = WAZ::Blobs::Container.find("container-name")
|
63
|
-
container.put_properties!(:x_ms_meta_meta1 => "meta1")
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should be able to return a list files within the container" do
|
67
|
-
expected_blobs = [ {:name => 'blob1', :url => 'url', :content_type => 'app/xml'}, {:name => 'blob2', :url => 'url', :content_type => 'app/xml'} ]
|
68
|
-
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
69
|
-
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
70
|
-
WAZ::Blobs::Service.any_instance.expects(:list_blobs).with("container-name").returns(expected_blobs)
|
71
|
-
container = WAZ::Blobs::Container.find("container-name")
|
72
|
-
container_blobs = container.blobs
|
73
|
-
container_blobs.first().name = expected_blobs[0][:name]
|
74
|
-
container_blobs[1].name = expected_blobs[1][:name]
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should
|
78
|
-
|
79
|
-
|
80
|
-
WAZ::
|
81
|
-
|
82
|
-
container.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
WAZ::
|
94
|
-
WAZ::Blobs::
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
WAZ::
|
107
|
-
WAZ::Blobs::Service.any_instance.expects(:
|
108
|
-
|
109
|
-
|
110
|
-
blob
|
111
|
-
blob.
|
112
|
-
blob.
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
WAZ::
|
118
|
-
WAZ::Blobs::Service.any_instance.expects(:
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
blob.
|
123
|
-
blob.
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
WAZ::
|
130
|
-
|
131
|
-
blob =
|
132
|
-
|
133
|
-
blob.
|
134
|
-
blob.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
WAZ::
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
end
|
149
|
-
|
150
|
-
it "should
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
1
|
+
# enabling the load of files from root (on RSpec)
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../')
|
3
|
+
require 'spec/configuration'
|
4
|
+
require 'lib/waz-blobs'
|
5
|
+
|
6
|
+
describe "Windows Azure Containers interface API" do
|
7
|
+
|
8
|
+
it "should should throw when no container name is provided" do
|
9
|
+
lambda {WAZ::Blobs::Container.new}.should raise_error(WAZ::Storage::InvalidOption)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should list containers" do
|
13
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
14
|
+
WAZ::Blobs::Service.any_instance.expects(:list_containers).returns([{:name => 'my-container'}, {:name => 'other container'}])
|
15
|
+
containers = WAZ::Blobs::Container.list
|
16
|
+
containers.size.should == 2
|
17
|
+
containers.first().name.should == "my-container"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be able to create a container" do
|
21
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
22
|
+
WAZ::Blobs::Service.any_instance.expects(:create_container).with("my-container")
|
23
|
+
container = WAZ::Blobs::Container.create('my-container')
|
24
|
+
container.name.should == 'my-container'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be able to return a container by name" do
|
28
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
29
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:name => "container-name", :x_ms_meta_name => "container-name"}).twice
|
30
|
+
container = WAZ::Blobs::Container.find('container-name')
|
31
|
+
container.metadata[:x_ms_meta_name].should == 'container-name'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to return container metadata" do
|
35
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
36
|
+
WAZ::Blobs::Service.any_instance.expects(:create_container).with("container-name")
|
37
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
38
|
+
container = WAZ::Blobs::Container.create('container-name')
|
39
|
+
container.metadata[:x_ms_meta_name].should == 'container-name'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to say whether the container is public or not" do
|
43
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
44
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
45
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_acl).with("container-name").returns(false)
|
46
|
+
container = WAZ::Blobs::Container.find("container-name")
|
47
|
+
container.public_access?.should == false
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should be able to set whether the container is public or not" do
|
51
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
52
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
53
|
+
WAZ::Blobs::Service.any_instance.expects(:set_container_acl).with('container-name', false)
|
54
|
+
container = WAZ::Blobs::Container.find("container-name")
|
55
|
+
container.public_access = false
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to set container properties" do
|
59
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
60
|
+
WAZ::Blobs::Service.any_instance.expects(:set_container_properties).with("container-name", {:x_ms_meta_meta1 => "meta1"}).returns(false)
|
61
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
62
|
+
container = WAZ::Blobs::Container.find("container-name")
|
63
|
+
container.put_properties!(:x_ms_meta_meta1 => "meta1")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should be able to return a list files within the container" do
|
67
|
+
expected_blobs = [ {:name => 'blob1', :url => 'url', :content_type => 'app/xml'}, {:name => 'blob2', :url => 'url', :content_type => 'app/xml'} ]
|
68
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
69
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
70
|
+
WAZ::Blobs::Service.any_instance.expects(:list_blobs).with("container-name").returns(expected_blobs)
|
71
|
+
container = WAZ::Blobs::Container.find("container-name")
|
72
|
+
container_blobs = container.blobs
|
73
|
+
container_blobs.first().name = expected_blobs[0][:name]
|
74
|
+
container_blobs[1].name = expected_blobs[1][:name]
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should be able to return statistics of the container" do
|
78
|
+
options = {:maxresults => 100, :marker => "marker"}
|
79
|
+
expected_values = {:size => 200, :files => 100, :next_marker => "next-marker"}
|
80
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
81
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
82
|
+
WAZ::Blobs::Service.any_instance.expects(:statistics).with("container-name", options).returns(expected_values)
|
83
|
+
container = WAZ::Blobs::Container.find("container-name")
|
84
|
+
statistics = container.statistics(options)
|
85
|
+
statistics[:size].should == 200
|
86
|
+
statistics[:files].should == 100
|
87
|
+
statistics[:next_marker].should == "next-marker"
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should destroy container" do
|
91
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
92
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
93
|
+
WAZ::Blobs::Service.any_instance.expects(:delete_container).with("container-name")
|
94
|
+
container = WAZ::Blobs::Container.find("container-name")
|
95
|
+
container.destroy!
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should be able to return null when container not found by name" do
|
99
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
100
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").raises(RestClient::ResourceNotFound)
|
101
|
+
container = WAZ::Blobs::Container.find('container-name')
|
102
|
+
container.nil?.should == true
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should be able to put blob inside given container" do
|
106
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
107
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
108
|
+
WAZ::Blobs::Service.any_instance.expects(:put_blob).with("container-name/my_blob", "this is the blob content", "text/plain; charset=UTF-8", {:x_ms_meta_custom_property => "customValue"})
|
109
|
+
container = WAZ::Blobs::Container.find("container-name")
|
110
|
+
blob = container.store("my_blob", "this is the blob content", "text/plain; charset=UTF-8", {:x_ms_meta_custom_property => "customValue"})
|
111
|
+
blob.name.should == "my_blob"
|
112
|
+
blob.url.should == "http://my_account.blob.core.windows.net/container-name/my_blob"
|
113
|
+
blob.content_type.should == "text/plain; charset=UTF-8"
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should be able to upload a stream to a blob inside a given container" do
|
117
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
118
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
119
|
+
WAZ::Blobs::Service.any_instance.expects(:put_block).with("container-name/my_blob", Base64.encode64('%064d' % 0), "this is the blob content")
|
120
|
+
WAZ::Blobs::Service.any_instance.expects(:put_block_list).with("container-name/my_blob", [Base64.encode64('%064d' % 0)], "text/plain; charset=UTF-8", {:x_ms_meta_custom_property => "customValue"})
|
121
|
+
container = WAZ::Blobs::Container.find("container-name")
|
122
|
+
blob = container.upload("my_blob", StringIO.new("this is the blob content"), "text/plain; charset=UTF-8", {:x_ms_meta_custom_property => "customValue"})
|
123
|
+
blob.name.should == "my_blob"
|
124
|
+
blob.url.should == "http://my_account.blob.core.windows.net/container-name/my_blob"
|
125
|
+
blob.content_type.should == "text/plain; charset=UTF-8"
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should be able to put blob inside given container (when simulating fake containers)" do
|
129
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
130
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
131
|
+
WAZ::Blobs::Service.any_instance.expects(:put_blob).with("container-name/fake-container/blob", "this is the blob content", "text/plain; charset=UTF-8", {:x_ms_meta_custom_property => "customValue"})
|
132
|
+
container = WAZ::Blobs::Container.find("container-name")
|
133
|
+
blob = container.store("/fake-container/blob", "this is the blob content", "text/plain; charset=UTF-8", {:x_ms_meta_custom_property => "customValue"})
|
134
|
+
blob.name.should == "fake-container/blob"
|
135
|
+
blob.url.should == "http://my_account.blob.core.windows.net/container-name/fake-container/blob"
|
136
|
+
blob.content_type.should == "text/plain; charset=UTF-8"
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should return a specific blob for the given container" do
|
140
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
141
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
142
|
+
WAZ::Blobs::Service.any_instance.expects(:get_blob_properties).with("container-name/my_blob").returns({ :content_type => "application/xml" })
|
143
|
+
container = WAZ::Blobs::Container.find("container-name")
|
144
|
+
blob = container['my_blob']
|
145
|
+
blob.name.should == 'my_blob'
|
146
|
+
blob.content_type.should == 'application/xml'
|
147
|
+
blob.url.should == 'http://my_account.blob.core.windows.net/container-name/my_blob'
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should return nil when the file does not exist" do
|
151
|
+
WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
|
152
|
+
WAZ::Blobs::Service.any_instance.expects(:get_container_properties).with("container-name").returns({:x_ms_meta_name => "container-name"})
|
153
|
+
WAZ::Blobs::Service.any_instance.expects(:get_blob_properties).with("container-name/my_blob").raises(RestClient::ResourceNotFound)
|
154
|
+
container = WAZ::Blobs::Container.find('container-name')
|
155
|
+
blob = container['my_blob']
|
156
|
+
blob.nil?.should == true
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should raise an exception when container name starts with - (hypen)" do
|
160
|
+
lambda { WAZ::Blobs::Container.create('-container') }.should raise_error(WAZ::Storage::InvalidParameterValue)
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should raise an exception when container name ends with - (hypen)" do
|
164
|
+
lambda { WAZ::Blobs::Container.create('container-') }.should raise_error(WAZ::Storage::InvalidParameterValue)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should raise an exception when container name is less than 3" do
|
168
|
+
lambda { WAZ::Blobs::Container.create('co') }.should raise_error(WAZ::Storage::InvalidParameterValue)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should raise an exception when container name is longer than 63" do
|
172
|
+
lambda { WAZ::Blobs::Container.create('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') }.should raise_error(WAZ::Storage::InvalidParameterValue)
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|