waz-storage 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,98 @@
1
+ # enabling the load of files from root (on RSpec)
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../')
3
+ require 'tests/configuration'
4
+ require 'lib/waz-tables'
5
+
6
+ describe "Table object behavior" do
7
+ it "should initialize a new table" do
8
+ table = WAZ::Tables::Table.new({:name => 'tablename', :url => 'http://localhost' })
9
+ table.name.should == 'tablename'
10
+ table.url.should == 'http://localhost'
11
+ end
12
+
13
+ it "should list tables" do
14
+ WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my-account", :access_key => "key"})
15
+ result = [ {:name => 'table1', :url => 'url1'}, {:name => 'table2', :url => 'url2'} ], nil
16
+ WAZ::Tables::Service.any_instance.expects(:list_tables).returns(result)
17
+ tables = WAZ::Tables::Table.list
18
+ tables.size.should == 2
19
+ tables.first().name.should == "table1"
20
+ tables.first().url.should == "url1"
21
+ tables.last().name.should == "table2"
22
+ tables.last().url.should == "url2"
23
+ end
24
+
25
+ it "should find a table by its name and return a WAZ::Tables::Table instance" do
26
+ WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my-account", :access_key => "key"})
27
+ WAZ::Tables::Service.any_instance.expects(:get_table).with('table1').returns({:name => 'table1', :url => 'url1'})
28
+ table = WAZ::Tables::Table.find('table1')
29
+ table.name.should == "table1"
30
+ table.url.should == "url1"
31
+ end
32
+
33
+ it "should return nil when looking for an unexisting table" do
34
+ WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my-account", :access_key => "key"})
35
+ WAZ::Tables::Service.any_instance.expects(:get_table).with('unexistingtable').raises(WAZ::Tables::TableDoesNotExist.new('unexistingtable'))
36
+ table = WAZ::Tables::Table.find('unexistingtable')
37
+ table.nil?.should == true
38
+ end
39
+
40
+ it "should create table" do
41
+ WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my-account", :access_key => "key"})
42
+ WAZ::Tables::Service.any_instance.expects(:create_table).returns({:name => 'table1', :url => 'http://foo'})
43
+ table = WAZ::Tables::Table.create('table1')
44
+ table.name.should == "table1"
45
+ end
46
+
47
+ it "should destroy a table" do
48
+ WAZ::Storage::Base.stubs(:default_connection).returns({:account_name => "my_account", :access_key => "key"})
49
+ WAZ::Tables::Service.any_instance.expects(:delete_table).with("tabletodelete")
50
+ WAZ::Tables::Service.any_instance.expects(:get_table).returns({:name => 'tabletodelete', :url => 'http://localhost'})
51
+ table = WAZ::Tables::Table.find('tabletodelete')
52
+ table.destroy!
53
+ end
54
+
55
+ it "should throw when not name provided for the table" do
56
+ lambda { WAZ::Tables::Table.new({:foo => "bar"}) }.should raise_error(WAZ::Storage::InvalidOption)
57
+ end
58
+
59
+ it "should raise an exception when table name starts with no lower/upper char" do
60
+ lambda { WAZ::Tables::Table.create('9table') }.should raise_error(WAZ::Storage::InvalidParameterValue)
61
+ end
62
+
63
+ it "should raise an exception when table contains any other char than letters or digits" do
64
+ lambda { WAZ::Tables::Table.create('table-name') }.should raise_error(WAZ::Storage::InvalidParameterValue)
65
+ end
66
+
67
+ it "should raise an exception when table name is less than 3" do
68
+ lambda { WAZ::Tables::Table.create('t') }.should raise_error(WAZ::Storage::InvalidParameterValue)
69
+ end
70
+
71
+ it "should raise an exception when table name is longer than 63" do
72
+ lambda { WAZ::Tables::Table.create('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') }.should raise_error(WAZ::Storage::InvalidParameterValue)
73
+ end
74
+
75
+ it "should raise an exception when :url option is not provided" do
76
+ lambda { WAZ::Tables::Table.new({:name => 'name'}) }.should raise_error(WAZ::Storage::InvalidOption)
77
+ end
78
+
79
+ it "should raise an exception when :name option is not provided" do
80
+ lambda { WAZ::Tables::Table.new({:url => 'url'}) }.should raise_error(WAZ::Storage::InvalidOption)
81
+ end
82
+
83
+ it "should raise an exception when :name is empty" do
84
+ lambda { WAZ::Tables::Table.new({:name => '', :url => 'url'}) }.should raise_error(WAZ::Storage::InvalidOption)
85
+ end
86
+
87
+ it "should raise an exception when :url is empty" do
88
+ lambda { WAZ::Tables::Table.new({:name => 'name', :url => ''}) }.should raise_error(WAZ::Storage::InvalidOption)
89
+ end
90
+
91
+ it "should raise an exception when invalid table name is provided" do
92
+ 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"
93
+ options = {:name => '1invalidname', :url => 'url'}
94
+ options.stubs(:keys).returns([:name, :url])
95
+ WAZ::Tables::Table.any_instance.stubs(:new).with(options).raises(WAZ::Storage::InvalidParameterValue)
96
+ lambda { WAZ::Tables::Table.new(options) }.should raise_error(WAZ::Storage::InvalidParameterValue)
97
+ end
98
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |gem|
3
+ gem.authors = ['Johnny G. Halife']
4
+ gem.email = ['johnny.halife@me.com']
5
+ gem.description = %q{A simple implementation of Windows Azure Storage API for Ruby, inspired by the S3 gems and self experience of dealing with queues. The major goal of the whole gem is to enable ruby developers [like me =)] to leverage Windows Azure Storage features and have another option for cloud storage.}
6
+ gem.summary = %q{Client library for Windows Azure's Storage Service REST API}
7
+ gem.homepage = 'http://waz-storage.heroku.com'
8
+
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
+ gem.name = "waz-storage"
13
+ gem.require_paths = ["lib"]
14
+ gem.version = "1.1.2"
15
+
16
+ gem.test_files = Dir['tests/**/*']
17
+
18
+ gem.has_rdoc = true
19
+ gem.rdoc_options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
20
+
21
+ gem.add_dependency 'rest-client'
22
+ gem.add_dependency 'ruby-hmac'
23
+
24
+ gem.add_development_dependency 'rspec'
25
+ gem.add_development_dependency 'rcov'
26
+ gem.add_development_dependency 'mocha'
27
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waz-storage
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 23
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 1
9
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Johnny G. Halife
@@ -14,16 +15,17 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-09-27 00:00:00 -03:00
18
- default_executable:
18
+ date: 2012-05-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rest-client
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
28
+ hash: 3
27
29
  segments:
28
30
  - 0
29
31
  version: "0"
@@ -33,16 +35,61 @@ dependencies:
33
35
  name: ruby-hmac
34
36
  prerelease: false
35
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
36
39
  requirements:
37
40
  - - ">="
38
41
  - !ruby/object:Gem::Version
42
+ hash: 3
39
43
  segments:
40
44
  - 0
41
45
  version: "0"
42
46
  type: :runtime
43
47
  version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ type: :development
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: rcov
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ type: :development
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: mocha
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ type: :development
89
+ version_requirements: *id005
44
90
  description: A simple implementation of Windows Azure Storage API for Ruby, inspired by the S3 gems and self experience of dealing with queues. The major goal of the whole gem is to enable ruby developers [like me =)] to leverage Windows Azure Storage features and have another option for cloud storage.
45
- email: johnny.halife@me.com
91
+ email:
92
+ - johnny.halife@me.com
46
93
  executables: []
47
94
 
48
95
  extensions: []
@@ -50,7 +97,16 @@ extensions: []
50
97
  extra_rdoc_files: []
51
98
 
52
99
  files:
53
- - rakefile
100
+ - .gitignore
101
+ - CHANGELOG.rdoc
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - LICENSE
105
+ - README.rdoc
106
+ - lib/waz-blobs.rb
107
+ - lib/waz-queues.rb
108
+ - lib/waz-storage.rb
109
+ - lib/waz-tables.rb
54
110
  - lib/waz/blobs/blob_object.rb
55
111
  - lib/waz/blobs/container.rb
56
112
  - lib/waz/blobs/exceptions.rb
@@ -63,17 +119,24 @@ files:
63
119
  - lib/waz/storage/core_service.rb
64
120
  - lib/waz/storage/exceptions.rb
65
121
  - lib/waz/storage/validation_rules.rb
66
- - lib/waz/storage/version.rb
67
122
  - lib/waz/tables/edm_type_helper.rb
68
123
  - lib/waz/tables/exceptions.rb
69
124
  - lib/waz/tables/service.rb
70
125
  - lib/waz/tables/table.rb
71
126
  - lib/waz/tables/table_array.rb
72
- - lib/waz-blobs.rb
73
- - lib/waz-queues.rb
74
- - lib/waz-storage.rb
75
- - lib/waz-tables.rb
76
- has_rdoc: true
127
+ - rakefile
128
+ - tests/configuration.rb
129
+ - tests/waz/blobs/blob_object_test.rb
130
+ - tests/waz/blobs/container_test.rb
131
+ - tests/waz/blobs/service_test.rb
132
+ - tests/waz/queues/message_test.rb
133
+ - tests/waz/queues/queue_test.rb
134
+ - tests/waz/queues/service_test.rb
135
+ - tests/waz/storage/base_tests.rb
136
+ - tests/waz/storage/shared_key_core_service_test.rb
137
+ - tests/waz/tables/service_test.rb
138
+ - tests/waz/tables/table_test.rb
139
+ - waz-storage.gemspec
77
140
  homepage: http://waz-storage.heroku.com
78
141
  licenses: []
79
142
 
@@ -85,25 +148,39 @@ rdoc_options:
85
148
  require_paths:
86
149
  - lib
87
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
88
152
  requirements:
89
153
  - - ">="
90
154
  - !ruby/object:Gem::Version
155
+ hash: 3
91
156
  segments:
92
157
  - 0
93
158
  version: "0"
94
159
  required_rubygems_version: !ruby/object:Gem::Requirement
160
+ none: false
95
161
  requirements:
96
162
  - - ">="
97
163
  - !ruby/object:Gem::Version
164
+ hash: 3
98
165
  segments:
99
166
  - 0
100
167
  version: "0"
101
168
  requirements: []
102
169
 
103
170
  rubyforge_project:
104
- rubygems_version: 1.3.6
171
+ rubygems_version: 1.8.24
105
172
  signing_key:
106
173
  specification_version: 3
107
174
  summary: Client library for Windows Azure's Storage Service REST API
108
- test_files: []
109
-
175
+ test_files:
176
+ - tests/configuration.rb
177
+ - tests/waz/blobs/blob_object_test.rb
178
+ - tests/waz/blobs/container_test.rb
179
+ - tests/waz/blobs/service_test.rb
180
+ - tests/waz/queues/message_test.rb
181
+ - tests/waz/queues/queue_test.rb
182
+ - tests/waz/queues/service_test.rb
183
+ - tests/waz/storage/base_tests.rb
184
+ - tests/waz/storage/shared_key_core_service_test.rb
185
+ - tests/waz/tables/service_test.rb
186
+ - tests/waz/tables/table_test.rb
@@ -1,11 +0,0 @@
1
- module WAZ
2
- module Storage
3
- module VERSION #:nodoc:
4
- MAJOR = '1'
5
- MINOR = '1'
6
- TINY = '1'
7
- end
8
-
9
- Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY].compact * '.'
10
- end
11
- end