azure 0.1.1 → 0.5.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.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/ChangeLog.txt +5 -0
- data/Gemfile +16 -3
- data/README.md +344 -2
- data/Rakefile +66 -37
- data/azure.gemspec +30 -11
- data/lib/azure.rb +35 -4
- data/lib/azure/blob/blob.rb +32 -0
- data/lib/azure/blob/blob_service.rb +1423 -0
- data/lib/azure/blob/block.rb +31 -0
- data/lib/azure/blob/container.rb +32 -0
- data/lib/azure/blob/serialization.rb +285 -0
- data/lib/azure/core.rb +32 -0
- data/lib/azure/core/auth/authorizer.rb +36 -0
- data/lib/azure/core/auth/shared_key.rb +21 -6
- data/lib/azure/core/auth/shared_key_lite.rb +17 -3
- data/lib/azure/core/auth/signer.rb +48 -0
- data/lib/azure/core/configuration.rb +152 -0
- data/lib/azure/core/error.rb +22 -0
- data/lib/azure/core/filtered_service.rb +44 -0
- data/lib/azure/core/http/debug_filter.rb +36 -0
- data/lib/azure/core/http/http_error.rb +84 -0
- data/lib/azure/core/http/http_filter.rb +53 -0
- data/lib/azure/core/http/http_request.rb +157 -0
- data/lib/azure/core/http/http_response.rb +133 -0
- data/lib/azure/core/http/retry_policy.rb +68 -0
- data/lib/azure/core/http/signer_filter.rb +34 -0
- data/lib/azure/core/service.rb +38 -32
- data/lib/azure/core/signed_service.rb +43 -0
- data/lib/azure/queue/message.rb +30 -0
- data/lib/azure/queue/queue.rb +29 -0
- data/lib/azure/queue/queue_service.rb +568 -0
- data/lib/azure/queue/serialization.rb +103 -0
- data/lib/azure/service/access_policy.rb +26 -0
- data/lib/azure/service/enumeration_results.rb +21 -0
- data/lib/azure/service/logging.rb +32 -0
- data/lib/azure/service/metrics.rb +31 -0
- data/lib/azure/service/retention_policy.rb +25 -0
- data/lib/azure/service/serialization.rb +240 -0
- data/lib/azure/service/signed_identifier.rb +30 -0
- data/lib/azure/service/storage_service.rb +79 -0
- data/lib/azure/service/storage_service_properties.rb +32 -0
- data/lib/azure/service_bus/action.rb +21 -0
- data/lib/azure/service_bus/auth/wrap_service.rb +59 -46
- data/lib/azure/service_bus/auth/wrap_signer.rb +69 -0
- data/lib/azure/service_bus/brokered_message.rb +36 -51
- data/lib/azure/service_bus/brokered_message_serializer.rb +48 -34
- data/lib/azure/service_bus/correlation_filter.rb +45 -0
- data/lib/azure/service_bus/empty_rule_action.rb +30 -0
- data/lib/azure/service_bus/false_filter.rb +38 -0
- data/lib/azure/service_bus/filter.rb +21 -0
- data/lib/azure/{core/utils → service_bus}/interval.rb +29 -22
- data/lib/azure/service_bus/queue.rb +230 -0
- data/lib/azure/service_bus/resource.rb +109 -0
- data/lib/azure/service_bus/rule.rb +98 -0
- data/lib/azure/service_bus/rule_aspect.rb +34 -0
- data/lib/azure/service_bus/serialization.rb +160 -0
- data/lib/azure/service_bus/service_bus_service.rb +819 -12
- data/lib/azure/service_bus/sql_filter.rb +50 -0
- data/lib/azure/service_bus/sql_rule_action.rb +50 -0
- data/lib/azure/service_bus/subscription.rb +184 -0
- data/lib/azure/service_bus/topic.rb +187 -0
- data/lib/azure/service_bus/true_filter.rb +38 -0
- data/lib/azure/{tables → table}/auth/shared_key.rb +33 -12
- data/lib/azure/table/auth/shared_key_lite.rb +44 -0
- data/lib/azure/table/batch.rb +330 -0
- data/lib/azure/table/batch_response.rb +117 -0
- data/lib/azure/table/edmtype.rb +127 -0
- data/lib/azure/table/entity.rb +31 -0
- data/lib/azure/table/guid.rb +24 -0
- data/lib/azure/table/query.rb +112 -0
- data/lib/azure/table/serialization.rb +105 -0
- data/lib/azure/table/table_service.rb +557 -0
- data/lib/azure/version.rb +31 -0
- data/test/fixtures/container_acl.xml +11 -0
- data/test/fixtures/{error.xml → http_error.xml} +0 -0
- data/test/fixtures/list_blobs.xml +121 -0
- data/test/fixtures/list_block_all_with_none_committed.xml +22 -0
- data/test/fixtures/list_blocks_all.xml +23 -0
- data/test/fixtures/list_blocks_committed.xml +13 -0
- data/test/fixtures/list_containers.xml +38 -0
- data/test/fixtures/list_page_ranges.xml +11 -0
- data/test/fixtures/logging.xml +11 -0
- data/test/fixtures/metrics.xml +10 -0
- data/test/fixtures/queues.xml +1 -1
- data/test/fixtures/retention_policy.xml +5 -0
- data/test/fixtures/storage_service_properties.xml +23 -0
- data/test/integration/blob/blob_metadata_test.rb +75 -0
- data/test/integration/blob/blob_pages_test.rb +119 -0
- data/test/integration/blob/blob_properties_test.rb +77 -0
- data/test/integration/blob/block_blob_test.rb +254 -0
- data/test/integration/blob/container/container_acl_test.rb +69 -0
- data/test/integration/blob/container/container_metadata_test.rb +50 -0
- data/test/integration/blob/container/create_container_test.rb +60 -0
- data/test/integration/blob/container/delete_container_test.rb +39 -0
- data/test/integration/blob/container/get_container_properties_test.rb +48 -0
- data/test/integration/blob/container/list_containers_test.rb +79 -0
- data/test/integration/blob/container/root_container_test.rb +50 -0
- data/test/integration/blob/copy_blob_test.rb +113 -0
- data/test/integration/blob/create_blob_snapshot_test.rb +80 -0
- data/test/integration/blob/create_page_blob_test.rb +83 -0
- data/test/integration/blob/delete_blob_test.rb +159 -0
- data/test/integration/blob/get_blob_test.rb +65 -0
- data/test/integration/blob/informative_errors_test.rb +39 -0
- data/test/integration/blob/lease/acquire_lease_test.rb +36 -0
- data/test/integration/blob/lease/break_lease_test.rb +40 -0
- data/test/integration/blob/lease/release_lease_test.rb +40 -0
- data/test/integration/blob/lease/renew_lease_test.rb +42 -0
- data/test/integration/blob/list_blobs_test.rb +113 -0
- data/test/integration/queue/clear_messages_test.rb +42 -0
- data/test/integration/queue/create_message_test.rb +75 -0
- data/test/integration/queue/create_queue_test.rb +50 -0
- data/test/integration/queue/delete_message_test.rb +67 -0
- data/test/integration/queue/delete_queue_test.rb +45 -0
- data/test/integration/queue/informative_errors_test.rb +42 -0
- data/test/integration/queue/list_messages_encoded_test.rb +79 -0
- data/test/integration/queue/list_messages_test.rb +79 -0
- data/test/integration/queue/list_queues_test.rb +44 -0
- data/test/integration/queue/peek_messages_test.rb +59 -0
- data/test/integration/queue/queue_metadata_test.rb +40 -0
- data/test/integration/queue/update_message_test.rb +74 -0
- data/test/integration/service_bus/informative_errors_test.rb +37 -0
- data/test/integration/service_bus/queues_scenario_test.rb +200 -0
- data/test/integration/service_bus/queues_test.rb +266 -0
- data/test/integration/service_bus/rules_test.rb +145 -0
- data/test/integration/service_bus/scenario_test.rb +102 -0
- data/test/integration/service_bus/subscriptions_test.rb +211 -0
- data/test/integration/service_bus/topics_scenario_test.rb +406 -0
- data/test/integration/service_bus/topics_test.rb +129 -0
- data/test/integration/table/create_table_test.rb +36 -0
- data/test/integration/table/delete_entity_batch_test.rb +107 -0
- data/test/integration/table/delete_entity_test.rb +94 -0
- data/test/integration/table/delete_table_test.rb +40 -0
- data/test/integration/table/get_table_test.rb +37 -0
- data/test/integration/table/informative_errors_test.rb +39 -0
- data/test/integration/table/insert_entity_batch_test.rb +100 -0
- data/test/integration/table/insert_entity_test.rb +88 -0
- data/test/integration/table/insert_or_merge_entity_batch_test.rb +159 -0
- data/test/integration/table/insert_or_merge_entity_test.rb +143 -0
- data/test/integration/table/insert_or_replace_entity_batch_test.rb +152 -0
- data/test/integration/table/insert_or_replace_entity_test.rb +137 -0
- data/test/integration/table/merge_entity_batch_test.rb +128 -0
- data/test/integration/table/merge_entity_test.rb +113 -0
- data/test/integration/table/query_entities_test.rb +195 -0
- data/test/integration/table/query_tables_test.rb +43 -0
- data/test/integration/table/query_test.rb +251 -0
- data/test/integration/table/table_acl_test.rb +52 -0
- data/test/integration/table/update_entity_batch_test.rb +149 -0
- data/test/integration/table/update_entity_test.rb +131 -0
- data/test/integration/test_helper.rb +23 -9
- data/test/support/env.rb +15 -1
- data/test/support/fixtures.rb +14 -0
- data/test/support/name_generator.rb +74 -0
- data/test/support/stubs.rb +14 -0
- data/test/test_helper.rb +43 -3
- data/test/unit/blob/blob_service_test.rb +1947 -0
- data/test/unit/core/auth/shared_key_lite_test.rb +51 -0
- data/test/unit/core/auth/shared_key_test.rb +58 -0
- data/test/unit/core/auth/signer_test.rb +30 -0
- data/test/unit/core/http/http_error_test.rb +57 -0
- data/test/unit/core/http/http_request_test.rb +66 -0
- data/test/unit/core/http/http_response_test.rb +45 -0
- data/test/unit/service/serialization_test.rb +502 -0
- data/test/unit/service/storage_service_test.rb +291 -0
- data/test/unit/table/edmtype_test.rb +108 -0
- metadata +231 -230
- data/Gemfile.lock +0 -36
- data/lib/azure/atom.rb +0 -170
- data/lib/azure/auth.rb +0 -29
- data/lib/azure/blobs.rb +0 -620
- data/lib/azure/blobs/blob.rb +0 -360
- data/lib/azure/blobs/container.rb +0 -209
- data/lib/azure/blobs/service.rb +0 -396
- data/lib/azure/blobs/shared_access_signature.rb +0 -84
- data/lib/azure/blobs/uri.rb +0 -60
- data/lib/azure/configuration.rb +0 -121
- data/lib/azure/core/collection.rb +0 -118
- data/lib/azure/core/signer.rb +0 -32
- data/lib/azure/core/utils/queryable.rb +0 -74
- data/lib/azure/core/utils/storage_service_properties.rb +0 -83
- data/lib/azure/core/utils/string.rb +0 -59
- data/lib/azure/error.rb +0 -72
- data/lib/azure/queues.rb +0 -272
- data/lib/azure/queues/message.rb +0 -174
- data/lib/azure/queues/queue.rb +0 -187
- data/lib/azure/queues/service.rb +0 -263
- data/lib/azure/queues/service_properties.rb +0 -152
- data/lib/azure/queues/uri.rb +0 -78
- data/lib/azure/request.rb +0 -102
- data/lib/azure/response.rb +0 -93
- data/lib/azure/service_bus.rb +0 -4
- data/lib/azure/service_bus/auth/authorizer.rb +0 -22
- data/lib/azure/service_bus/auth/uri.rb +0 -52
- data/lib/azure/service_bus/auth/wrap.rb +0 -37
- data/lib/azure/service_bus/auth/wrap_token.rb +0 -45
- data/lib/azure/service_bus/auth/wrap_token_manager.rb +0 -46
- data/lib/azure/service_bus/queues.rb +0 -194
- data/lib/azure/service_bus/queues/queue.rb +0 -100
- data/lib/azure/service_bus/queues/queue_serializer.rb +0 -51
- data/lib/azure/service_bus/queues/service.rb +0 -154
- data/lib/azure/service_bus/queues/uri.rb +0 -80
- data/lib/azure/service_bus/rules.rb +0 -110
- data/lib/azure/service_bus/rules/rule.rb +0 -97
- data/lib/azure/service_bus/rules/service.rb +0 -122
- data/lib/azure/service_bus/rules/uri.rb +0 -39
- data/lib/azure/service_bus/subscriptions.rb +0 -170
- data/lib/azure/service_bus/subscriptions/service.rb +0 -133
- data/lib/azure/service_bus/subscriptions/subscription.rb +0 -164
- data/lib/azure/service_bus/subscriptions/subscription_serializer.rb +0 -74
- data/lib/azure/service_bus/subscriptions/uri.rb +0 -71
- data/lib/azure/service_bus/topics.rb +0 -120
- data/lib/azure/service_bus/topics/service.rb +0 -98
- data/lib/azure/service_bus/topics/topic.rb +0 -122
- data/lib/azure/service_bus/topics/topic_serializer.rb +0 -44
- data/lib/azure/service_bus/topics/uri.rb +0 -58
- data/lib/azure/service_runtime/client/goal_state_pipe_monitor.rb +0 -21
- data/lib/azure/service_runtime/client/goal_state_protocol.rb +0 -18
- data/lib/azure/service_runtime/client/runtime_client.rb +0 -135
- data/lib/azure/service_runtime/deployment.rb +0 -24
- data/lib/azure/service_runtime/local_resource.rb +0 -15
- data/lib/azure/service_runtime/role.rb +0 -17
- data/lib/azure/service_runtime/role_environment.rb +0 -206
- data/lib/azure/service_runtime/role_environment_change.rb +0 -32
- data/lib/azure/service_runtime/role_instance.rb +0 -35
- data/lib/azure/service_runtime/role_instance_endpoint.rb +0 -14
- data/lib/azure/tables.rb +0 -215
- data/lib/azure/tables/auth/shared_key_lite.rb +0 -30
- data/lib/azure/tables/entities_collection.rb +0 -66
- data/lib/azure/tables/entity.rb +0 -127
- data/lib/azure/tables/service.rb +0 -211
- data/lib/azure/tables/table.rb +0 -129
- data/lib/azure/tables/tables_collection.rb +0 -62
- data/lib/azure/tables/types.rb +0 -65
- data/lib/azure/tables/uri.rb +0 -62
- data/test/integration/blobs/auth_test.rb +0 -19
- data/test/integration/blobs/blob_test.rb +0 -61
- data/test/integration/blobs/clear_page_range_test.rb +0 -19
- data/test/integration/blobs/copy_test.rb +0 -33
- data/test/integration/blobs/create_blobs_test.rb +0 -51
- data/test/integration/blobs/create_container_test.rb +0 -13
- data/test/integration/blobs/create_snapshot_test.rb +0 -17
- data/test/integration/blobs/delete_blob_snapshots_test.rb +0 -19
- data/test/integration/blobs/delete_blobs_test.rb +0 -25
- data/test/integration/blobs/delete_container_test.rb +0 -24
- data/test/integration/blobs/delete_snapshot_test.rb +0 -17
- data/test/integration/blobs/get_blob_snapshot_test.rb +0 -18
- data/test/integration/blobs/get_blobs_test.rb +0 -31
- data/test/integration/blobs/get_page_range_test.rb +0 -19
- data/test/integration/blobs/list_blobs_test.rb +0 -39
- data/test/integration/blobs/list_containers_test.rb +0 -28
- data/test/integration/blobs/manage_blob_leases_test.rb +0 -45
- data/test/integration/blobs/manage_blob_metadata_test.rb +0 -51
- data/test/integration/blobs/manage_blob_properties_test.rb +0 -25
- data/test/integration/blobs/manage_blob_service_properties_test.rb +0 -38
- data/test/integration/blobs/manage_container_metadata_test.rb +0 -46
- data/test/integration/blobs/manage_container_permissions_test.rb +0 -17
- data/test/integration/blobs/update_page_range_test.rb +0 -20
- data/test/integration/queues/clear_messages_test.rb +0 -22
- data/test/integration/queues/create_queue_test.rb +0 -13
- data/test/integration/queues/delete_message_test.rb +0 -42
- data/test/integration/queues/delete_queue_test.rb +0 -24
- data/test/integration/queues/get_messages_test.rb +0 -39
- data/test/integration/queues/list_queues_test.rb +0 -43
- data/test/integration/queues/manage_queue_metadata_test.rb +0 -45
- data/test/integration/queues/manage_queue_service_properties_test.rb +0 -27
- data/test/integration/queues/peek_messages_test.rb +0 -55
- data/test/integration/queues/put_message_test.rb +0 -31
- data/test/integration/queues/update_message_test.rb +0 -46
- data/test/integration/service_bus/auth_test.rb +0 -18
- data/test/integration/service_bus/queues/create_queue_test.rb +0 -25
- data/test/integration/service_bus/queues/delete_message_from_queue_test.rb +0 -29
- data/test/integration/service_bus/queues/delete_queue_test.rb +0 -25
- data/test/integration/service_bus/queues/get_queue_test.rb +0 -23
- data/test/integration/service_bus/queues/list_queues_test.rb +0 -39
- data/test/integration/service_bus/queues/peek_message_from_queue_test.rb +0 -34
- data/test/integration/service_bus/queues/read_and_delete_message_from_queue_test.rb +0 -31
- data/test/integration/service_bus/queues/send_message_to_queue_test.rb +0 -22
- data/test/integration/service_bus/queues/unlock_message_from_queue_test.rb +0 -36
- data/test/integration/service_bus/rules/create_rule_test.rb +0 -19
- data/test/integration/service_bus/rules/delete_rule_test.rb +0 -17
- data/test/integration/service_bus/rules/get_rule_test.rb +0 -21
- data/test/integration/service_bus/rules/list_rules_test.rb +0 -24
- data/test/integration/service_bus/rules/rule_test.rb +0 -16
- data/test/integration/service_bus/subscriptions/create_subscription_test.rb +0 -25
- data/test/integration/service_bus/subscriptions/delete_message_from_subscription_test.rb +0 -31
- data/test/integration/service_bus/subscriptions/delete_subscription_test.rb +0 -30
- data/test/integration/service_bus/subscriptions/fetch_subscription_test.rb +0 -28
- data/test/integration/service_bus/subscriptions/list_subscriptions_test.rb +0 -23
- data/test/integration/service_bus/subscriptions/peek_lock_message_from_subscription_test.rb +0 -42
- data/test/integration/service_bus/subscriptions/read_delete_message_from_subscription_test.rb +0 -36
- data/test/integration/service_bus/subscriptions/subscription_test.rb +0 -31
- data/test/integration/service_bus/subscriptions/unlock_message_from_subscription_test.rb +0 -43
- data/test/integration/service_bus/topics/create_topic_test.rb +0 -25
- data/test/integration/service_bus/topics/delete_topic_test.rb +0 -25
- data/test/integration/service_bus/topics/get_topic_test.rb +0 -23
- data/test/integration/service_bus/topics/list_topics_test.rb +0 -39
- data/test/integration/service_bus/topics/send_message_to_topic_test.rb +0 -23
- data/test/integration/tables/auth_test.rb +0 -29
- data/test/integration/tables/creating_tables_test.rb +0 -16
- data/test/integration/tables/delete_entity_test.rb +0 -39
- data/test/integration/tables/deleting_table_test.rb +0 -22
- data/test/integration/tables/insert_entity_test.rb +0 -23
- data/test/integration/tables/merge_entity_test.rb +0 -28
- data/test/integration/tables/query_entities_test.rb +0 -131
- data/test/integration/tables/query_tables_test.rb +0 -63
- data/test/integration/tables/update_entity_test.rb +0 -54
- data/test/support/blobs.rb +0 -12
- data/test/support/table_names.rb +0 -44
- data/test/unit/atom_test.rb +0 -58
- data/test/unit/auth_test.rb +0 -24
- data/test/unit/blobs/blob_test.rb +0 -5
- data/test/unit/blobs/container_test.rb +0 -67
- data/test/unit/blobs/service_test.rb +0 -17
- data/test/unit/blobs/shared_access_signature_test.rb +0 -66
- data/test/unit/blobs_test.rb +0 -156
- data/test/unit/core/service_test.rb +0 -57
- data/test/unit/core/utils/interval_test.rb +0 -70
- data/test/unit/core/utils/queryable_test.rb +0 -69
- data/test/unit/core/utils/storage_service_properties_test.rb +0 -66
- data/test/unit/error_test.rb +0 -39
- data/test/unit/queues/message_test.rb +0 -40
- data/test/unit/queues/queue_test.rb +0 -64
- data/test/unit/queues/service_properties.rb +0 -35
- data/test/unit/request_test.rb +0 -38
- data/test/unit/response_test.rb +0 -43
- data/test/unit/service_bus/auth/authorizer_test.rb +0 -27
- data/test/unit/service_bus/auth/wrap_token_test.rb +0 -28
- data/test/unit/service_bus/queues/queue_test.rb +0 -38
- data/test/unit/service_bus/topics/topic_test.rb +0 -33
- data/test/unit/service_runtime/data/goalstate.xml +0 -9
- data/test/unit/service_runtime/data/roleenvironmentdata.xml +0 -29
- data/test/unit/service_runtime/data/runtime.xml +0 -6
- data/test/unit/service_runtime/role_environment_test.rb +0 -144
- data/test/unit/tables/auth/shared_key_lite_test.rb +0 -39
- data/test/unit/tables/auth/shared_key_test.rb +0 -45
- data/test/unit/tables/entities_collection_test.rb +0 -39
- data/test/unit/tables/entity_test.rb +0 -72
- data/test/unit/tables/table_test.rb +0 -57
- data/test/unit/tables_test.rb +0 -302
- data/test/unit/types_test.rb +0 -67
data/test/unit/request_test.rb
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "azure/request"
|
|
3
|
-
|
|
4
|
-
describe Azure::Request do
|
|
5
|
-
describe "#calculate_headers" do
|
|
6
|
-
let :clock do
|
|
7
|
-
clock = MiniTest::Mock.new
|
|
8
|
-
clock.stub(:now, "Sun, 03 May 2012 21:21:52 GMT")
|
|
9
|
-
clock
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "sets the Date and x-ms-date headers" do
|
|
13
|
-
request = Azure::Request.new(:get, URI("/"), nil, clock)
|
|
14
|
-
|
|
15
|
-
request.headers["x-ms-date"].must_equal clock.now
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "sets the Content-Type" do
|
|
19
|
-
request = Azure::Request.new(:get, URI("/"), "<body/>")
|
|
20
|
-
|
|
21
|
-
request.headers["Content-Type"].must_equal "application/atom+xml; charset=utf-8"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "sets the Content-Type, Length, and MD5 if passed a body" do
|
|
25
|
-
request = Azure::Request.new(:get, URI("/"), "<body/>")
|
|
26
|
-
|
|
27
|
-
request.headers["Content-Length"].must_equal "7"
|
|
28
|
-
request.headers["Content-MD5"].must_equal Base64.strict_encode64(Digest::MD5.digest("<body/>"))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "leaves the Content-Type, Length, and MD5 blank if the body is nil" do
|
|
32
|
-
request = Azure::Request.new(:get, URI("/"))
|
|
33
|
-
|
|
34
|
-
request.headers["Content-Length"].must_equal "0"
|
|
35
|
-
request.headers["Content-MD5"].must_be_nil
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
data/test/unit/response_test.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
require "azure/response"
|
|
3
|
-
|
|
4
|
-
describe Azure::Response do
|
|
5
|
-
it "can act as an error" do
|
|
6
|
-
http_response = MiniTest::Mock.new
|
|
7
|
-
http_response.stub(:body, Fixtures[:error])
|
|
8
|
-
http_response.stub(:code, "409")
|
|
9
|
-
|
|
10
|
-
response = Azure::Response.new(http_response)
|
|
11
|
-
|
|
12
|
-
assert_raises(Azure::HTTPError) do
|
|
13
|
-
raise response
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "converts net/http headers into strings" do
|
|
18
|
-
http_response = MiniTest::Mock.new
|
|
19
|
-
http_response.stub(:to_hash, { "Content-Type" => ["text/xml"] })
|
|
20
|
-
|
|
21
|
-
response = Azure::Response.new(http_response)
|
|
22
|
-
response.headers["Content-Type"].must_equal "text/xml"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe Azure::Response::HeaderHash do
|
|
26
|
-
subject do
|
|
27
|
-
Azure::Response::HeaderHash.new(
|
|
28
|
-
"FooBar" => ["1"], "bazqux" => ["2"], "QUXFOO" => ["3"]
|
|
29
|
-
)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "returns the header values as strings, not arrays" do
|
|
33
|
-
subject["FooBar"].must_equal "1"
|
|
34
|
-
subject["bazqux"].must_equal "2"
|
|
35
|
-
subject["QUXFOO"].must_equal "3"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "obtains keys in a case-insensitive fashion" do
|
|
39
|
-
subject["foobar"].must_equal "1"
|
|
40
|
-
subject["BaZqUx"].must_equal "2"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "azure/service_bus/auth/authorizer"
|
|
3
|
-
require "azure/service_bus/auth/wrap"
|
|
4
|
-
|
|
5
|
-
describe Azure::ServiceBus::Auth::Authorizer do
|
|
6
|
-
before do
|
|
7
|
-
uri = double(path: "/path")
|
|
8
|
-
|
|
9
|
-
@access_token = "THEACCESSTOKEN"
|
|
10
|
-
|
|
11
|
-
@token_manager = MiniTest::Mock.new
|
|
12
|
-
@token_manager.stub(:get_access_token, @access_token)
|
|
13
|
-
|
|
14
|
-
@signer = Azure::ServiceBus::Auth::Wrap.new('issuer', 'access_key', @token_manager)
|
|
15
|
-
|
|
16
|
-
@request = MiniTest::Mock.new
|
|
17
|
-
@request.stub(:uri, uri)
|
|
18
|
-
@request.stub(:headers, {})
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "generates a proper Authorization header" do
|
|
22
|
-
auth = Azure::ServiceBus::Auth::Authorizer.new
|
|
23
|
-
auth.sign(@request, @signer)
|
|
24
|
-
|
|
25
|
-
@request.headers["Authorization"].must_equal "WRAP access_token=\"#{@access_token}\""
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "azure/service_bus/auth/wrap_token"
|
|
3
|
-
|
|
4
|
-
describe Azure::ServiceBus::Auth::WrapToken do
|
|
5
|
-
|
|
6
|
-
describe ".parse" do
|
|
7
|
-
let :response do
|
|
8
|
-
Fixtures["sb_get_access_token_response.txt"].read
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
let :expected_token do
|
|
12
|
-
"net.windows.servicebus.action=Listen%2cManage%2cSend&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fgmonfort-sb.accesscontrol.windows.net%2f&Audience=http%3a%2f%2fgmonfort.servicebus.windows.net%2f%24Resources%2fQueues&ExpiresOn=1338862002&Issuer=https%3a%2f%2fgmonfort-sb.accesscontrol.windows.net%2f&HMACSHA256=CFydD48JENdtcaha7TAcH8X4jXRKgFW6X7sRfbbrWBE%3d"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
let :expected_expire_time do
|
|
16
|
-
"1199"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
subject do
|
|
20
|
-
Azure::ServiceBus::Auth::WrapToken.parse(response)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "parses the response and gets the correct values for each attribute" do
|
|
24
|
-
subject.access_token.must_equal expected_token
|
|
25
|
-
subject.expire_time.must_equal expected_expire_time
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "azure/service_bus/queues/queue"
|
|
3
|
-
require "time"
|
|
4
|
-
require "uri"
|
|
5
|
-
|
|
6
|
-
describe Azure::ServiceBus::Queues::Queue do
|
|
7
|
-
describe ".from_node" do
|
|
8
|
-
let :node do
|
|
9
|
-
Nokogiri::XML(Fixtures[:sb_default_create_queue_response]).remove_namespaces!
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
subject do
|
|
13
|
-
Azure::ServiceBus::Queues::Queue.from_node(node)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "parses the node and gets the correct values for each attribute" do
|
|
17
|
-
subject.id.must_equal URI("https://gmonfort.servicebus.windows.net/gfyhfiwdqg")
|
|
18
|
-
subject.title.must_equal "gfyhfiwdqg"
|
|
19
|
-
subject.published.must_equal Time.parse("2012-06-06T05:00:06Z")
|
|
20
|
-
subject.updated.must_equal Time.parse("2012-06-06T05:00:06Z")
|
|
21
|
-
subject.author_name.must_equal "gmonfort"
|
|
22
|
-
subject.description.must_be :kind_of?, Hash
|
|
23
|
-
subject.description.size.must_equal 11
|
|
24
|
-
|
|
25
|
-
subject.description["LockDuration"].must_equal "PT1M"
|
|
26
|
-
subject.description["MaxSizeInMegabytes"].must_equal "1024"
|
|
27
|
-
subject.description["RequiresDuplicateDetection"].must_equal "false"
|
|
28
|
-
subject.description["RequiresSession"].must_equal "false"
|
|
29
|
-
subject.description["DefaultMessageTimeToLive"].must_equal "P10675199DT2H48M5.4775807S"
|
|
30
|
-
subject.description["DeadLetteringOnMessageExpiration"].must_equal "false"
|
|
31
|
-
subject.description["DuplicateDetectionHistoryTimeWindow"].must_equal "PT10M"
|
|
32
|
-
subject.description["MaxDeliveryCount"].must_equal "10"
|
|
33
|
-
subject.description["EnableBatchedOperations"].must_equal "true"
|
|
34
|
-
subject.description["SizeInBytes"].must_equal "0"
|
|
35
|
-
subject.description["MessageCount"].must_equal "0"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "azure/service_bus/topics/topic"
|
|
3
|
-
require "time"
|
|
4
|
-
require "uri"
|
|
5
|
-
|
|
6
|
-
describe Azure::ServiceBus::Topics::Topic do
|
|
7
|
-
describe ".from_node" do
|
|
8
|
-
let :node do
|
|
9
|
-
Nokogiri::XML(Fixtures[:sb_default_create_topic_response]).remove_namespaces!
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
subject do
|
|
13
|
-
Azure::ServiceBus::Topics::Topic.from_node(node)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "parses the node and gets the correct values for each attribute" do
|
|
17
|
-
subject.id.must_equal URI("https://gmonfort.servicebus.windows.net/htsjvyukon")
|
|
18
|
-
subject.title.must_equal "htsjvyukon"
|
|
19
|
-
subject.published.must_equal Time.parse("2012-06-07T19:49:00Z")
|
|
20
|
-
subject.updated.must_equal Time.parse("2012-06-07T19:49:01Z")
|
|
21
|
-
subject.author_name.must_equal "gmonfort"
|
|
22
|
-
subject.description.must_be :kind_of?, Hash
|
|
23
|
-
subject.description.size.must_equal 6
|
|
24
|
-
|
|
25
|
-
subject.description["DefaultMessageTimeToLive"].must_equal "P10675199DT2H48M5.4775807S"
|
|
26
|
-
subject.description["MaxSizeInMegabytes"].must_equal "1024"
|
|
27
|
-
subject.description["RequiresDuplicateDetection"].must_equal "false"
|
|
28
|
-
subject.description["DuplicateDetectionHistoryTimeWindow"].must_equal "PT10M"
|
|
29
|
-
subject.description["EnableBatchedOperations"].must_equal "true"
|
|
30
|
-
subject.description["SizeInBytes"].must_equal "0"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
21c
|
|
2
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
3
|
-
<GoalState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
4
|
-
<Incarnation>1</Incarnation>
|
|
5
|
-
<ExpectedState>Started</ExpectedState>
|
|
6
|
-
<RoleEnvironmentPath>test/unit/service_runtime/data/roleenvironmentdata.xml</RoleEnvironmentPath>
|
|
7
|
-
<CurrentStateEndpoint>test/unit/service_runtime/data/output.xml</CurrentStateEndpoint>
|
|
8
|
-
<Deadline>9999-12-31T23:59:59.9999999</Deadline>
|
|
9
|
-
</GoalState>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<?xml version="0.0" encoding="utf-8"?>
|
|
2
|
-
<RoleEnvironment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
3
|
-
<Deployment id="deployment16(130)" emulated="true" />
|
|
4
|
-
<CurrentInstance id="deployment16(130).RubyRole.WorkerRole2_IN_0" roleName="WorkerRole2" faultDomain="0" updateDomain="0">
|
|
5
|
-
<ConfigurationSettings>
|
|
6
|
-
<ConfigurationSetting name="test" value="8" />
|
|
7
|
-
<ConfigurationSetting name="test2" value="string" />
|
|
8
|
-
</ConfigurationSettings>
|
|
9
|
-
<LocalResources>
|
|
10
|
-
<LocalResource name="DiagnosticStore" path="C:\Users\Administrator\AppData\Local\dftmp\Resources\7dbcfc02-ad16-40d3-a943-f407d20bd898\directory\DiagnosticStore\" sizeInMB="4096" />
|
|
11
|
-
<LocalResource name="ruby" path="C:\Users\Administrator\AppData\Local\dftmp\Resources\7dbcfc02-ad16-40d3-a943-f407d20bd898\directory\ruby\" sizeInMB="1000" />
|
|
12
|
-
</LocalResources>
|
|
13
|
-
<Endpoints>
|
|
14
|
-
<Endpoint name="HttpIn" address="127.255.0.1" port="9002" protocol="tcp" />
|
|
15
|
-
<Endpoint name="Internal2" address="127.255.0.1" port="9101" protocol="http" />
|
|
16
|
-
</Endpoints>
|
|
17
|
-
</CurrentInstance>
|
|
18
|
-
<Roles>
|
|
19
|
-
<Role name="WorkerRole">
|
|
20
|
-
<Instances>
|
|
21
|
-
<Instance id="deployment16(130).RubyRole.WorkerRole_IN_0" faultDomain="0" updateDomain="0">
|
|
22
|
-
<Endpoints>
|
|
23
|
-
<Endpoint name="Internal" address="127.255.0.0" port="9100" protocol="http" />
|
|
24
|
-
</Endpoints>
|
|
25
|
-
</Instance>
|
|
26
|
-
</Instances>
|
|
27
|
-
</Role>
|
|
28
|
-
</Roles>
|
|
29
|
-
</RoleEnvironment>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<RuntimeServerDiscovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
3
|
-
<RuntimeServerEndpoints>
|
|
4
|
-
<RuntimeServerEndpoint version="2011-03-08" path="test/unit/service_runtime/data/goalstate.xml" />
|
|
5
|
-
</RuntimeServerEndpoints>
|
|
6
|
-
</RuntimeServerDiscovery>
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
require 'azure/service_runtime/role_environment'
|
|
2
|
-
require 'eventmachine'
|
|
3
|
-
require 'minitest/autorun'
|
|
4
|
-
require 'em/minitest/spec'
|
|
5
|
-
|
|
6
|
-
describe Azure::ServiceRuntime::RoleEnvironment do
|
|
7
|
-
include EM::MiniTest::Spec
|
|
8
|
-
|
|
9
|
-
before do
|
|
10
|
-
@data_path = "test/unit/service_runtime/data/"
|
|
11
|
-
@runtime_endpoint = "#{@data_path}runtime.xml"
|
|
12
|
-
@output_pipe = "#{@data_path}output.xml"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
subject do
|
|
16
|
-
Azure::ServiceRuntime::RoleEnvironment.endpoint = @runtime_endpoint
|
|
17
|
-
Azure::ServiceRuntime::RoleEnvironment
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "is available" do
|
|
21
|
-
assert subject.is_available?, "must be available"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe ".deployment" do
|
|
25
|
-
it "should retrieve the deployment data correctly" do
|
|
26
|
-
deployment = subject.deployment
|
|
27
|
-
|
|
28
|
-
assert_equal 130, deployment.id
|
|
29
|
-
assert_equal "deployment16(130)", deployment.name
|
|
30
|
-
assert_equal true, deployment.is_emulated?
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe ".current_role_instance" do
|
|
35
|
-
it "should retrieve the current role instance properties correctly" do
|
|
36
|
-
role_instance = subject.current_role_instance
|
|
37
|
-
|
|
38
|
-
assert_equal "deployment16(130).RubyRole.WorkerRole2_IN_0", role_instance.id
|
|
39
|
-
assert_equal "WorkerRole2", role_instance.role_name
|
|
40
|
-
assert_equal 0, role_instance.fault_domain
|
|
41
|
-
assert_equal 0, role_instance.update_domain
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "should retrieve the endpoints correctly" do
|
|
45
|
-
endpoints = subject.current_role_instance.endpoints
|
|
46
|
-
|
|
47
|
-
assert_equal "HttpIn", endpoints["HttpIn"].name
|
|
48
|
-
assert_equal "127.255.0.1", endpoints["HttpIn"].address
|
|
49
|
-
assert_equal 9002, endpoints["HttpIn"].port
|
|
50
|
-
assert_equal "tcp", endpoints["HttpIn"].protocol
|
|
51
|
-
|
|
52
|
-
assert_equal "Internal2", endpoints["Internal2"].name
|
|
53
|
-
assert_equal "127.255.0.1", endpoints["Internal2"].address
|
|
54
|
-
assert_equal 9101, endpoints["Internal2"].port
|
|
55
|
-
assert_equal "http", endpoints["Internal2"].protocol
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "should retrieve the local resources correctly" do
|
|
59
|
-
local_resources = subject.current_role_instance.local_resources
|
|
60
|
-
|
|
61
|
-
assert_equal "DiagnosticStore", local_resources["DiagnosticStore"].name
|
|
62
|
-
assert_equal "C:\\Users\\Administrator\\AppData\\Local\\dftmp\\Resources\\7dbcfc02-ad16-40d3-a943-f407d20bd898\\directory\\DiagnosticStore\\", local_resources["DiagnosticStore"].path
|
|
63
|
-
assert_equal 4096, local_resources["DiagnosticStore"].size
|
|
64
|
-
|
|
65
|
-
assert_equal "ruby", local_resources["ruby"].name
|
|
66
|
-
assert_equal "C:\\Users\\Administrator\\AppData\\Local\\dftmp\\Resources\\7dbcfc02-ad16-40d3-a943-f407d20bd898\\directory\\ruby\\", local_resources["ruby"].path
|
|
67
|
-
assert_equal 1000, local_resources["ruby"].size
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "should retrieve the configuration settings correctly" do
|
|
71
|
-
configuration_settings = subject.current_role_instance.configuration_settings
|
|
72
|
-
|
|
73
|
-
assert_equal "8", configuration_settings["test"]
|
|
74
|
-
assert_equal "string", configuration_settings["test2"]
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
describe ".roles" do
|
|
79
|
-
it "should retrieve information about the other roles correctly" do
|
|
80
|
-
roles = subject.roles
|
|
81
|
-
|
|
82
|
-
assert_equal "WorkerRole", roles["WorkerRole"].name
|
|
83
|
-
assert_equal 1, roles["WorkerRole"].instances.size
|
|
84
|
-
|
|
85
|
-
role_instance = roles["WorkerRole"].instances["deployment16(130).RubyRole.WorkerRole_IN_0"]
|
|
86
|
-
|
|
87
|
-
assert_equal "deployment16(130).RubyRole.WorkerRole_IN_0", role_instance.id
|
|
88
|
-
assert_equal 0, role_instance.fault_domain
|
|
89
|
-
assert_equal 0, role_instance.update_domain
|
|
90
|
-
assert_equal "WorkerRole", role_instance.role_name
|
|
91
|
-
|
|
92
|
-
assert_equal({}, role_instance.configuration_settings)
|
|
93
|
-
assert_equal({}, role_instance.local_resources)
|
|
94
|
-
assert_equal 1, role_instance.endpoints.size
|
|
95
|
-
|
|
96
|
-
endpoint = role_instance.endpoints["Internal"]
|
|
97
|
-
|
|
98
|
-
assert_equal "Internal", endpoint.name
|
|
99
|
-
assert_equal "127.255.0.0", endpoint.address
|
|
100
|
-
assert_equal 9100, endpoint.port
|
|
101
|
-
assert_equal "http", endpoint.protocol
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def assert_status(filename, status)
|
|
106
|
-
request = Nokogiri::XML(File.read(filename))
|
|
107
|
-
assert_equal 1, request.css('CurrentState').size
|
|
108
|
-
assert_equal 1, request.css('CurrentState > StatusLease').size
|
|
109
|
-
assert_equal subject.send(:client_id), request.css('CurrentState > StatusLease')[0]["ClientId"]
|
|
110
|
-
acquire_node = request.css('CurrentState > StatusLease > Acquire')[0]
|
|
111
|
-
|
|
112
|
-
assert_equal "1", acquire_node.css('Incarnation')[0].content
|
|
113
|
-
assert_equal status, acquire_node.css('Status')[0].content
|
|
114
|
-
assert_equal status, acquire_node.css('StatusDetail')[0].content
|
|
115
|
-
assert_equal "9999-12-31T23:59:59.999Z", acquire_node.css('Expiration')[0].content
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
describe ".request_recycle" do
|
|
119
|
-
after do
|
|
120
|
-
File.delete @output_pipe
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
it "should perform a valid recycle request" do
|
|
124
|
-
subject.request_recycle
|
|
125
|
-
assert_status(@output_pipe, "Recycle")
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
describe ".set_status" do
|
|
130
|
-
after do
|
|
131
|
-
File.delete @output_pipe
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
it "should perform a valid status change request to busy status" do
|
|
135
|
-
subject.set_status :busy
|
|
136
|
-
assert_status(@output_pipe, "Busy")
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
it "should perform a valid status change request to ready status" do
|
|
140
|
-
subject.set_status :ready
|
|
141
|
-
assert_status(@output_pipe, "Started")
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "azure/tables/auth/shared_key_lite"
|
|
3
|
-
|
|
4
|
-
describe Azure::Tables::Auth::SharedKeyLite do
|
|
5
|
-
subject do
|
|
6
|
-
Azure::Tables::Auth::SharedKeyLite.new(
|
|
7
|
-
"account-name",
|
|
8
|
-
Base64.strict_encode64("access-key")
|
|
9
|
-
)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "#signable_string includes the relevant bits" do
|
|
13
|
-
string = subject.signable_string(:get, double(path: "/path"), {
|
|
14
|
-
"Date" => "Time"
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
string.must_equal "Time\n/account-name/path"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "#signable_string requires a Date or x-ms-date header" do
|
|
21
|
-
proc {
|
|
22
|
-
subject.signable_string(:get, double(path: "/path"), {})
|
|
23
|
-
}.must_raise KeyError, "Headers must include Date"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "#sign will return a Base64-encoded, HMAC/SHA256-encrypted version of the signable string" do
|
|
27
|
-
def subject.signable_string(*)
|
|
28
|
-
"TestString"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
expected = Base64.strict_encode64(
|
|
32
|
-
OpenSSL::HMAC.digest("sha256", "access-key", "TestString")
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
actual = subject.sign(MiniTest::Mock.new, MiniTest::Mock.new, MiniTest::Mock.new)
|
|
36
|
-
|
|
37
|
-
actual.must_equal expected
|
|
38
|
-
end
|
|
39
|
-
end
|