Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finished renaming Service to Client (including files, tests, etc).

  • Loading branch information...
commit 4fa2d20b51656d5711abe4b1b72821ccd9d564b5 1 parent 0975672
@trevorrowe trevorrowe authored
Showing with 125 additions and 117 deletions.
  1. +1 −1  features/s3/step_definitions/hooks.js
  2. +4 −4 lib/client.js
  3. +4 −4 lib/http.js
  4. 0  lib/{json_service.js → json_client.js}
  5. +8 −8 lib/promise.js
  6. 0  lib/{query_service.js → query_client.js}
  7. 0  lib/{rest_service.js → rest_client.js}
  8. +1 −1  lib/{rest_xml_service.js → rest_xml_client.js}
  9. +2 −2 lib/services/dynamodb.api.js
  10. +6 −4 lib/services/dynamodb.js
  11. +2 −2 lib/services/ec2.api.js
  12. +6 −4 lib/services/ec2.js
  13. +2 −2 lib/services/s3.api.js
  14. +6 −4 lib/services/s3.js
  15. +1 −1  lib/services/simpleworkflow.api.js
  16. +6 −4 lib/services/simpleworkflow.js
  17. +3 −3 test/integration/dynamodb.spec.coffee
  18. +3 −3 test/integration/ec2.spec.coffee
  19. +4 −4 test/integration/s3.spec.coffee
  20. +3 −3 test/integration/simpleworkflow.spec.coffee
  21. +5 −5 test/unit/aws_request.spec.coffee
  22. +24 −24 test/unit/client.spec.coffee
  23. +1 −1  test/unit/{json_service.spec.coffee → json_client.spec.coffee}
  24. +1 −1  test/unit/{query_service.spec.coffee → query_client.spec.coffee}
  25. +1 −1  test/unit/query_param_serializer.spec.coffee
  26. +9 −9 test/unit/request_handler.spec.coffee
  27. +1 −1  test/unit/{rest_service.spec.coffee → rest_client.spec.coffee}
  28. +1 −1  test/unit/{rest_xml_service.spec.coffee → rest_xml_client.spec.coffee}
  29. +3 −3 test/unit/services/dynamodb.spec.coffee
  30. +3 −3 test/unit/services/ec2.spec.coffee
  31. +12 −12 test/unit/services/s3.spec.coffee
  32. +1 −1  test/unit/sigv2.spec.coffee
  33. +1 −1  test/unit/sigv4.spec.coffee
View
2  features/s3/step_definitions/hooks.js
@@ -16,7 +16,7 @@
module.exports = function () {
this.Before("@s3", function (callback) {
- this.s3 = new this.AWS.S3();
+ this.s3 = new this.AWS.S3.Client();
callback();
});
View
8 lib/client.js
@@ -36,11 +36,11 @@ AWS.Client = inherit({
makeRequest: function makeRequest(method, params, options) {
- var service = options === undefined ? this :
+ var client = options === undefined ? this :
new this.constructor(AWS.util.merge(this.config, options));
var awsResponse = new AWS.AWSResponse({
- service: service,
+ client: client,
method: method,
params: params
});
@@ -106,7 +106,7 @@ AWS.Client = inherit({
},
// How many times a failed request should be retried before giving up.
- // the defaultRetryCount can be overriden by service classes.
+ // the defaultRetryCount can be overriden by client classes.
numRetries: function numRetries() {
if (this.config.maxRetries !== undefined) {
return this.config.maxRetries;
@@ -130,7 +130,7 @@ AWS.Client = inherit({
},
throttledError: function throttledError(error) {
- // this logic varies between services
+ // this logic varies between clients
return (error.code == 'ProvisionedThroughputExceededException');
},
View
8 lib/http.js
@@ -72,13 +72,13 @@ AWS.RequestHandler = inherit({
constructor: function RequestHandler(awsRequest) {
this.awsRequest = awsRequest;
this.awsResponse = awsRequest.awsResponse;
- this.service = this.awsResponse.service;
+ this.client = this.awsResponse.client;
this.method = this.awsResponse.method;
this.params = this.awsResponse.params;
},
makeRequest: function makeRequest() {
- var httpRequest = this.service.buildRequest(this.method, this.params);
+ var httpRequest = this.client.buildRequest(this.method, this.params);
httpRequest.sign();
this.sendRequest(httpRequest);
},
@@ -145,7 +145,7 @@ AWS.RequestHandler = inherit({
handleHttpResponse: function handleHttpResponse(httpResponse) {
var self = this;
- this.service.parseResponse(httpResponse, this.method, function (error, data) {
+ this.client.parseResponse(httpResponse, this.method, function (error, data) {
if (error)
self.handleError(error);
else
@@ -163,7 +163,7 @@ AWS.RequestHandler = inherit({
retryRequest: function retryRequest(error) {
- var delays = this.service.retryDelays();
+ var delays = this.client.retryDelays();
var delay = delays[this.awsResponse.retryCount];
this.awsResponse.retryCount += 1;
View
0  lib/json_service.js → lib/json_client.js
File renamed without changes
View
16 lib/promise.js
@@ -28,7 +28,7 @@ AWS.AWSRequest = inherit({
},
/**
- * @param callback [Function] this function is called when the service
+ * @param callback [Function] this function is called when the client
* returns any data
* @option options bind [Object] (response object) an object to bind
* the callback function to. Defaults to the response object.
@@ -43,7 +43,7 @@ AWS.AWSRequest = inherit({
},
/**
- * @param callback [Function] this function is called when the service
+ * @param callback [Function] this function is called when the client
* returns a successful response.
* @option options bind [Object] (response object) an object to bind
* the callback function to. Defaults to the response object.
@@ -59,12 +59,12 @@ AWS.AWSRequest = inherit({
},
/**
- * @param callback [Function] this function is called when the service
+ * @param callback [Function] this function is called when the client
* responds with an error or if a request could not be made.
* @option options bind [Object] (response object) an object to bind
* the callback function to. Defaults to the response object.
* @return [this]
- * @param {Function} callback This function is called when the service
+ * @param {Function} callback This function is called when the client
*/
fail: function fail(callback, options) {
if (this.state === 'fail') {
@@ -77,7 +77,7 @@ AWS.AWSRequest = inherit({
/**
* @param callback [Function] this function is called after after
- * the service returns with a successful response or an error.
+ * the client returns with a successful response or an error.
* It is also called when the request could not be completed.
* @option options bind [Object] (response object) an object to bind
* the callback function to. Defaults to the response object.
@@ -141,13 +141,13 @@ AWS.AWSRequest = inherit({
* @api private
*/
addConfigCallback: function addConfigCallback(cbMethod, configName) {
- if (!this.awsResponse.service) return;
+ if (!this.awsResponse.client) return;
if (configName === undefined) {
configName = 'on' + cbMethod.charAt(0).toUpperCase() + cbMethod.slice(1);
}
- var callbacks = this.awsResponse.service.config[configName];
+ var callbacks = this.awsResponse.client.config[configName];
if (!(callbacks instanceof Array) && callbacks !== undefined) {
callbacks = [callbacks];
}
@@ -166,7 +166,7 @@ AWS.AWSResponse = inherit({
constructor: function AWSResponse(options) {
// the request "context"
- this.service = options.service;
+ this.client = options.client;
this.method = options.method;
this.params = options.params;
View
0  lib/query_service.js → lib/query_client.js
File renamed without changes
View
0  lib/rest_service.js → lib/rest_client.js
File renamed without changes
View
2  lib/rest_xml_service.js → lib/rest_xml_client.js
@@ -14,7 +14,7 @@
*/
var AWS = require('./core');
-require('./rest_service');
+require('./rest_client');
require('./xml/builder');
require('./xml/parser');
var inherit = AWS.util.inherit;
View
4 lib/services/dynamodb.api.js
@@ -15,7 +15,7 @@
var AWS = require('../core');
-AWS.DynamoDB.prototype.api = {
+AWS.DynamoDB.Client.prototype.api = {
format: 'json',
targetPrefix: 'DynamoDB_20111205.',
timestampFormat: 'iso8601',
@@ -957,4 +957,4 @@ AWS.DynamoDB.prototype.api = {
}
}
}
-};
+};
View
10 lib/services/dynamodb.js
@@ -16,12 +16,14 @@
var AWS = require('../core');
var inherit = AWS.util.inherit;
-require('../json_service');
+require('../json_client');
require('../sigv4');
-AWS.DynamoDB = inherit(AWS.JSONClient, {
+AWS.DynamoDB = {};
- constructor: function DynamoDB(config) {
+AWS.DynamoDB.Client = inherit(AWS.JSONClient, {
+
+ constructor: function DynamoDBClient(config) {
this.serviceName = 'dynamodb';
AWS.JSONClient.call(this, config);
},
@@ -47,4 +49,4 @@ AWS.DynamoDB = inherit(AWS.JSONClient, {
require('./dynamodb.api');
-AWS.Client.defineMethods(AWS.DynamoDB);
+AWS.Client.defineMethods(AWS.DynamoDB.Client);
View
4 lib/services/ec2.api.js
@@ -15,7 +15,7 @@
var AWS = require('../core');
-AWS.EC2.prototype.api = {
+AWS.EC2.Client.prototype.api = {
format: 'query',
apiVersion: '2012-07-20',
timestampFormat: 'iso8601',
@@ -8899,4 +8899,4 @@ AWS.EC2.prototype.api = {
}
}
}
-};
+};
View
10 lib/services/ec2.js
@@ -16,12 +16,14 @@
var AWS = require('../core');
var inherit = AWS.util.inherit;
-require('../query_service');
+require('../query_client');
require('../sigv2');
-AWS.EC2 = inherit(AWS.QueryClient, {
+AWS.EC2 = {};
- constructor: function EC2(config) {
+AWS.EC2.Client = inherit(AWS.QueryClient, {
+
+ constructor: function EC2Client(config) {
this.serviceName = 'ec2';
AWS.QueryClient.call(this, config);
},
@@ -47,4 +49,4 @@ AWS.EC2 = inherit(AWS.QueryClient, {
require('./ec2.api');
-AWS.Client.defineMethods(AWS.EC2);
+AWS.Client.defineMethods(AWS.EC2.Client);
View
4 lib/services/s3.api.js
@@ -15,7 +15,7 @@
var AWS = require('../core');
-AWS.S3.prototype.api = {
+AWS.S3.Client.prototype.api = {
format: 'rest-xml',
xmlNamespace: 'http://s3.amazonaws.com/doc/2006-03-01/',
timestampFormat: 'rfc822',
@@ -2190,4 +2190,4 @@ AWS.S3.prototype.api = {
}
}
}
-};
+};
View
10 lib/services/s3.js
@@ -16,12 +16,14 @@
var AWS = require('../core');
var inherit = AWS.util.inherit;
-require('../rest_xml_service');
+require('../rest_xml_client');
require('../sigvs3');
-AWS.S3 = inherit(AWS.RESTXMLClient, {
+AWS.S3 = {};
- constructor: function S3(config) {
+AWS.S3.Client = inherit(AWS.RESTXMLClient, {
+
+ constructor: function S3Client(config) {
this.serviceName = 's3';
AWS.RESTXMLClient.call(this, config);
this.setEndpoint((config || {}).endpoint, config);
@@ -172,4 +174,4 @@ AWS.S3 = inherit(AWS.RESTXMLClient, {
require('./s3.api');
-AWS.Client.defineMethods(AWS.S3);
+AWS.Client.defineMethods(AWS.S3.Client);
View
2  lib/services/simpleworkflow.api.js
@@ -15,7 +15,7 @@
var AWS = require('../core');
-AWS.SimpleWorkflow.prototype.api = {
+AWS.SimpleWorkflow.Client.prototype.api = {
format: 'json',
targetPrefix: 'SimpleWorkflowService.',
timestampFormat: 'unixTimestamp',
View
10 lib/services/simpleworkflow.js
@@ -16,12 +16,14 @@
var AWS = require('../core');
var inherit = AWS.util.inherit;
-require('../json_service');
+require('../json_client');
require('../sigv3');
-AWS.SimpleWorkflow = inherit(AWS.JSONClient, {
+AWS.SimpleWorkflow = {};
- constructor: function SimpleWorkflow(config) {
+AWS.SimpleWorkflow.Client = inherit(AWS.JSONClient, {
+
+ constructor: function SimpleWorkflowClient(config) {
this.serviceName = 'swf';
AWS.JSONClient.call(this, config);
},
@@ -32,4 +34,4 @@ AWS.SimpleWorkflow = inherit(AWS.JSONClient, {
require('./simpleworkflow.api');
-AWS.Client.defineMethods(AWS.SimpleWorkflow);
+AWS.Client.defineMethods(AWS.SimpleWorkflow.Client);
View
6 test/integration/dynamodb.spec.coffee
@@ -14,18 +14,18 @@
helpers = require('./helpers'); AWS = helpers.AWS
describe 'AWS.DynamoDB', ->
- service = new AWS.DynamoDB()
+ client = new AWS.DynamoDB.Client()
describe 'listTables', ->
it 'should send a request with parameters', ->
- helpers.integration (-> service.listTables(Limit: 3)), (resp) ->
+ helpers.integration (-> client.listTables(Limit: 3)), (resp) ->
expect(resp.error).toEqual(null)
expect(JSON.stringify(resp.data)).toMatch(/\{.*"TableNames":.*\}/)
expect(resp.httpRequest.body).toEqual('{"Limit":3}')
describe 'deleteItem', ->
it 'should fail if TableName not provided', ->
- helpers.integration (-> service.deleteItem()), (resp) ->
+ helpers.integration (-> client.deleteItem()), (resp) ->
errObj =
code: 'ValidationException',
message: 'The paramater \'tableName\' is required but was not present in the request'
View
6 test/integration/ec2.spec.coffee
@@ -15,14 +15,14 @@ helpers = require('./helpers'); AWS = helpers.AWS
describe 'AWS.EC2', ->
- service = new AWS.EC2()
+ client = new AWS.EC2.Client()
it 'should send a request with parameters', ->
# limit the list of regions returned with this filter
params = { RegionNames: ['us-east-1', 'us-west-1'] }
- helpers.integration (-> service.describeRegions(params)), (resp) ->
+ helpers.integration (-> client.describeRegions(params)), (resp) ->
expect(resp.error).toEqual(null)
expect(resp.data.Regions).toEqual([
{ RegionName: 'us-east-1', Endpoint: 'ec2.us-east-1.amazonaws.com' },
@@ -33,7 +33,7 @@ describe 'AWS.EC2', ->
params = { InstanceIds : ['i-12345678'] }
- helpers.integration (-> service.describeInstances(params)), (resp) ->
+ helpers.integration (-> client.describeInstances(params)), (resp) ->
expect(resp.data).toEqual(null)
expect(resp.error).toEqual(
code : 'InvalidInstanceID.NotFound',
View
8 test/integration/s3.spec.coffee
@@ -16,24 +16,24 @@ helpers = require('./helpers'); AWS = helpers.AWS
describe 'AWS.S3', ->
beforeEach ->
- service = new AWS.S3()
+ client = new AWS.S3.Client()
describe 'CRUD buckets', ->
it 'should be able to create and delete buckets in a different region', ->
- service = new AWS.S3(region:'eu-west-1')
+ client = new AWS.S3.Client(region:'eu-west-1')
bucketName = 'aws-sdk-js-integration-' + AWS.util.date.unixTimestamp()
params = { Bucket: bucketName, LocationConstraint: 'EU' }
# create a bucket in the EU
- helpers.integration (-> service.createBucket(params)), (resp) ->
+ helpers.integration (-> client.createBucket(params)), (resp) ->
expect(resp.error).toEqual(null)
expect(resp.data.Location).toEqual("http://#{bucketName}.s3.amazonaws.com/")
# delete the bucket
- helpers.integration (-> service.deleteBucket({Bucket:bucketName})), (resp2) ->
+ helpers.integration (-> client.deleteBucket({Bucket:bucketName})), (resp2) ->
expect(resp2.error).toEqual(null)
expect(resp2.data.RequestId).toBeDefined()
View
6 test/integration/simpleworkflow.spec.coffee
@@ -14,18 +14,18 @@
helpers = require('./helpers'); AWS = helpers.AWS
describe 'AWS.SimpleWorkflow', ->
- service = new AWS.SimpleWorkflow()
+ client = new AWS.SimpleWorkflow.Client()
describe 'listDomains', ->
it 'should send a request with parameters', ->
- helpers.integration (-> service.listDomains(registrationStatus: "REGISTERED")), (resp) ->
+ helpers.integration (-> client.listDomains(registrationStatus: "REGISTERED")), (resp) ->
expect(resp.error).toEqual(null)
expect(JSON.stringify(resp.data)).toMatch(/\{"domainInfos":.*\}/)
expect(resp.httpRequest.body).toEqual('{"registrationStatus":"REGISTERED"}')
describe 'getWorkflowExecutionHistory', ->
it 'should fail if TableName not provided', ->
- helpers.integration (-> service.getWorkflowExecutionHistory()), (resp) ->
+ helpers.integration (-> client.getWorkflowExecutionHistory()), (resp) ->
expect(resp.error.code).toEqual('ValidationException')
expect(resp.error.message).toMatch(/Value null at 'domain' failed to satisfy constraint: Member must not be null/)
expect(resp.data).toEqual(null)
View
10 test/unit/aws_request.spec.coffee
@@ -18,7 +18,7 @@ describe 'AWS.AWSRequest', ->
request = null
response = null
beforeEach ->
- response = new AWS.AWSResponse(service: null, method: 'POST', params: {})
+ response = new AWS.AWSResponse(client: null, method: 'POST', params: {})
request = new AWS.AWSRequest(response)
sharedBehaviour = (cbMethod, notifyMethod, data) ->
@@ -67,9 +67,9 @@ describe 'AWS.AWSRequest', ->
describe 'constructor', ->
- it 'should add data callback passed in via service config (onData)', ->
+ it 'should add data callback passed in via client config (onData)', ->
result = null
- response.service =
+ response.client =
config:
onData: (resp) -> result = resp.data
request = new AWS.AWSRequest(response)
@@ -79,7 +79,7 @@ describe 'AWS.AWSRequest', ->
it 'should allow callbacks to be passed in as an array', ->
result1 = null
result2 = null
- response.service =
+ response.client =
config:
onData: [
(resp) -> result1 = resp.data + '1',
@@ -92,7 +92,7 @@ describe 'AWS.AWSRequest', ->
it 'should work for other callbacks', ->
result = []
- response.service =
+ response.client =
config:
onData: -> result.push('data')
onAlways: -> result.push('always')
View
48 test/unit/client.spec.coffee
@@ -17,43 +17,43 @@ MockClient = helpers.MockClient
describe 'AWS.Client', ->
- config = null; service = null
+ config = null; client = null
retryableError = (error, result) ->
- expect(service.retryableError(error)).toEqual(result)
+ expect(client.retryableError(error)).toEqual(result)
beforeEach ->
config = new AWS.Config()
- service = new AWS.Client(config)
+ client = new AWS.Client(config)
describe 'constructor', ->
it 'should use AWS.config copy if no config is provided', ->
- service = new AWS.Client()
- expect(service.config).not.toBe(AWS.config)
- expect(service.config.sslEnabled).toEqual(true)
+ client = new AWS.Client()
+ expect(client.config).not.toBe(AWS.config)
+ expect(client.config.sslEnabled).toEqual(true)
it 'should merge custom options on top of global defaults if config provided', ->
- service = new AWS.Client(maxRetries: 5)
- expect(service.config.sslEnabled).toEqual(true)
- expect(service.config.maxRetries).toEqual(5)
+ client = new AWS.Client(maxRetries: 5)
+ expect(client.config.sslEnabled).toEqual(true)
+ expect(client.config.maxRetries).toEqual(5)
it 'should allow AWS.config to be object literal', ->
cfg = AWS.config
AWS.config = maxRetries: 20
- service = new AWS.Client({})
- expect(service.config.maxRetries).toEqual(20)
- expect(service.config.sslEnabled).toEqual(true)
+ client = new AWS.Client({})
+ expect(client.config.maxRetries).toEqual(20)
+ expect(client.config.sslEnabled).toEqual(true)
AWS.config = cfg
describe 'makeRequest', ->
it 'should allow extra config applied per request', ->
- service = new MockClient(maxRetries: 10, sslEnabled: false)
- request = service.makeRequest('foo', {}, {sslEnabled: true, maxRetries: 0})
+ client = new MockClient(maxRetries: 10, sslEnabled: false)
+ request = client.makeRequest('foo', {}, {sslEnabled: true, maxRetries: 0})
- expect(request.awsResponse.service.config.sslEnabled).toEqual(true)
- expect(request.awsResponse.service.config.maxRetries).toEqual(0)
- expect(request.awsResponse.service).not.toBe(service)
- expect(service.config.sslEnabled).toEqual(false)
- expect(service.config.maxRetries).toEqual(10)
+ expect(request.awsResponse.client.config.sslEnabled).toEqual(true)
+ expect(request.awsResponse.client.config.maxRetries).toEqual(0)
+ expect(request.awsResponse.client).not.toBe(client)
+ expect(client.config.sslEnabled).toEqual(false)
+ expect(client.config.maxRetries).toEqual(10)
describe 'retryableError', ->
@@ -74,10 +74,10 @@ describe 'AWS.Client', ->
describe 'numRetries', ->
it 'should use config max retry value if defined', ->
- service.config.maxRetries = 30
- expect(service.numRetries()).toEqual(30)
+ client.config.maxRetries = 30
+ expect(client.numRetries()).toEqual(30)
it 'should use defaultRetries defined on object if undefined on config', ->
- service.defaultRetryCount = 13
- service.config.maxRetries = undefined;
- expect(service.numRetries()).toEqual(13)
+ client.defaultRetryCount = 13
+ client.config.maxRetries = undefined;
+ expect(client.numRetries()).toEqual(13)
View
2  test/unit/json_service.spec.coffee → test/unit/json_client.spec.coffee
@@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
AWS = require('../../lib/core')
-require('../../lib/json_service')
+require('../../lib/json_client')
describe 'AWS.JSONClient', ->
View
2  test/unit/query_service.spec.coffee → test/unit/query_client.spec.coffee
@@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
AWS = require('../../lib/core')
-require('../../lib/query_service')
+require('../../lib/query_client')
describe 'AWS.QueryClient', ->
View
2  test/unit/query_param_serializer.spec.coffee
@@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
AWS = require('../../lib/core')
-require('../../lib/query_service')
+require('../../lib/query_client')
describe 'AWS.QueryParamSerializer', ->
View
18 test/unit/request_handler.spec.coffee
@@ -18,7 +18,7 @@ MockClient = helpers.MockClient
describe 'AWS.RequestHandler', ->
oldSetTimeout = setTimeout
- config = null; service = null; totalWaited = null; delays = []
+ config = null; client = null; totalWaited = null; delays = []
context = null; request = null; handler = null
beforeEach ->
@@ -31,8 +31,8 @@ describe 'AWS.RequestHandler', ->
totalWaited = 0
delays = []
- service = new MockClient(maxRetries: 3)
- context = new AWS.AWSResponse(service: service,
+ client = new MockClient(maxRetries: 3)
+ context = new AWS.AWSResponse(client: client,
method: 'mockMethod', params: {foo: 'bar'})
request = new AWS.AWSRequest(context)
handler = new AWS.RequestHandler(request)
@@ -78,7 +78,7 @@ describe 'AWS.RequestHandler', ->
it 'should retry a request with a set maximum retries', ->
- service.config.maxRetries = 10
+ client.config.maxRetries = 10
# fail every request with a fake networking error
AWS.HttpClient.getInstance.andReturn handleRequest: (req, cb) ->
@@ -86,7 +86,7 @@ describe 'AWS.RequestHandler', ->
handler.makeRequest()
- expect(context.retryCount).toEqual(service.config.maxRetries + 1);
+ expect(context.retryCount).toEqual(client.config.maxRetries + 1);
expect(request.notifyFail).toHaveBeenCalled()
expect(request.notifyDone).not.toHaveBeenCalled()
@@ -113,7 +113,7 @@ describe 'AWS.RequestHandler', ->
retryable: true)
expect(request.notifyDone).not.toHaveBeenCalled()
- expect(context.retryCount).toEqual(service.config.maxRetries + 1);
+ expect(context.retryCount).toEqual(client.config.maxRetries + 1);
it 'should not call notifyFail if retried fewer than maxRetries', ->
@@ -128,7 +128,7 @@ describe 'AWS.RequestHandler', ->
handler.makeRequest()
expect(totalWaited).toEqual(90)
- expect(context.retryCount).toBeLessThan(service.config.maxRetries);
+ expect(context.retryCount).toBeLessThan(client.config.maxRetries);
it 'notifies done on a successful response', ->
@@ -158,7 +158,7 @@ describe 'AWS.RequestHandler', ->
it 'notifies fail if an error is thrown', ->
- # throw by the service while parsing a response
+ # throw by the client while parsing a response
error = { error: 'ParseError', message: 'error message' }
AWS.HttpClient.getInstance.andReturn handleRequest: (req, cb) ->
@@ -166,7 +166,7 @@ describe 'AWS.RequestHandler', ->
cb.onData("Success!")
cb.onEnd()
- spyOn(service, 'parseResponse').andThrow(error)
+ spyOn(client, 'parseResponse').andThrow(error)
spyOn(handler, 'retryRequest')
try
View
2  test/unit/rest_service.spec.coffee → test/unit/rest_client.spec.coffee
@@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
AWS = require('../../lib/core')
-require('../../lib/rest_xml_service')
+require('../../lib/rest_xml_client')
describe 'AWS.RESTClient', ->
View
2  test/unit/rest_xml_service.spec.coffee → test/unit/rest_xml_client.spec.coffee
@@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
helpers = require('../helpers'); AWS = helpers.AWS
-require('../../lib/rest_xml_service')
+require('../../lib/rest_xml_client')
describe 'AWS.RESTXMLClient', ->
View
6 test/unit/services/dynamodb.spec.coffee
@@ -14,19 +14,19 @@
AWS = require('../../../lib/core')
require('../../../lib/services/dynamodb')
-describe 'AWS.DynamoDB', ->
+describe 'AWS.DynamoDB.Client', ->
configure = (options) ->
new AWS.Config(options)
ddb = (options) ->
- new AWS.DynamoDB(configure(options))
+ new AWS.DynamoDB.Client(configure(options))
describe 'config', ->
it 'returns the configuration object it was constructed with', ->
config = configure()
- dynamo = new AWS.DynamoDB(config)
+ dynamo = new AWS.DynamoDB.Client(config)
expect(dynamo.config).toEqual(config)
describe 'numRetries', ->
View
6 test/unit/services/ec2.spec.coffee
@@ -12,11 +12,11 @@
# language governing permissions and limitations under the License.
AWS = require('../../../lib/core')
-require('../../../lib/services/s3')
+require('../../../lib/services/ec2')
-describe 'AWS.EC2', ->
+describe 'AWS.EC2.Client', ->
- ec2 = new AWS.EC2()
+ ec2 = new AWS.EC2.Client()
describe 'parseResponse', ->
View
24 test/unit/services/s3.spec.coffee
@@ -14,12 +14,12 @@
AWS = require('../../../lib/core')
require('../../../lib/services/s3')
-describe 'AWS.S3', ->
+describe 'AWS.S3.Client', ->
s3 = null
beforeEach ->
- s3 = new AWS.S3()
+ s3 = new AWS.S3.Client()
describe 'dnsCompatibleBucketName', ->
@@ -55,19 +55,19 @@ describe 'AWS.S3', ->
describe 'endpoint', ->
it 'sets hostname to s3.amazonaws.com when region is un-specified', ->
- s3 = new AWS.S3()
+ s3 = new AWS.S3.Client()
expect(s3.endpoint.hostname).toEqual('s3.amazonaws.com')
it 'sets hostname to s3.amazonaws.com when region is us-east-1', ->
- s3 = new AWS.S3({ region: 'us-east-1' })
+ s3 = new AWS.S3.Client({ region: 'us-east-1' })
expect(s3.endpoint.hostname).toEqual('s3.amazonaws.com')
it 'sets region to us-east-1 when unspecified', ->
- s3 = new AWS.S3({ region: 'us-east-1' })
+ s3 = new AWS.S3.Client({ region: 'us-east-1' })
expect(s3.config.region).toEqual('us-east-1')
it 'combines the region with s3 in the endpoint using a - instead of .', ->
- s3 = new AWS.S3({ region: 'us-west-1' })
+ s3 = new AWS.S3.Client({ region: 'us-west-1' })
expect(s3.endpoint.hostname).toEqual('s3-us-west-1.amazonaws.com')
describe 'buildRequest', ->
@@ -78,7 +78,7 @@ describe 'AWS.S3', ->
it 'obeys the configuration for s3ForcePathStyle', ->
config = new AWS.Config({s3ForcePathStyle: true })
- s3 = new AWS.S3(config)
+ s3 = new AWS.S3.Client(config)
expect(s3.config.s3ForcePathStyle).toEqual(true)
req = s3.buildRequest('headObject', {Bucket:'bucket', Key:'key'})
expect(req.endpoint.hostname).toEqual('s3.amazonaws.com')
@@ -112,7 +112,7 @@ describe 'AWS.S3', ->
describe 'HTTPS', ->
beforeEach ->
- s3 = new AWS.S3({ sslEnabled: true, region: 'us-east-1' })
+ s3 = new AWS.S3.Client({ sslEnabled: true, region: 'us-east-1' })
it 'puts dns-compat bucket names in the hostname', ->
req = s3.buildRequest('headObject', {Bucket:'bucket-name',Key:'abc'})
@@ -131,7 +131,7 @@ describe 'AWS.S3', ->
expect(req.path).toEqual('/bucket.name')
it 'puts dns-compat bucket names in path if configured to do so', ->
- s3 = new AWS.S3({ sslEnabled: true, s3ForcePathStyle: true })
+ s3 = new AWS.S3.Client({ sslEnabled: true, s3ForcePathStyle: true })
req = s3.buildRequest('listObjects', {Bucket:'bucket-name'})
expect(req.endpoint.hostname).toEqual('s3.amazonaws.com')
expect(req.path).toEqual('/bucket-name')
@@ -144,7 +144,7 @@ describe 'AWS.S3', ->
describe 'HTTP', ->
beforeEach ->
- s3 = new AWS.S3({ sslEnabled: false, region: 'us-east-1' })
+ s3 = new AWS.S3.Client({ sslEnabled: false, region: 'us-east-1' })
it 'puts dns-compat bucket names in the hostname', ->
req = s3.buildRequest('listObjects', {Bucket:'bucket-name'})
@@ -161,8 +161,8 @@ describe 'AWS.S3', ->
expect(req.endpoint.hostname).toEqual('s3.amazonaws.com')
expect(req.path).toEqual('/bucket_name')
- # S3 returns a handful of errors without xml bodies (to match the http spec)
- # these tests ensure we give meaningful codes/messages for these.
+ # S3.Client returns a handful of errors without xml bodies (to match the
+ # http spec) these tests ensure we give meaningful codes/messages for these.
describe 'errors with no XML body', ->
extractError = (resp) ->
View
2  test/unit/sigv2.spec.coffee
@@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.
AWS = require('../../lib/core')
-require('../../lib/query_service')
+require('../../lib/query_client')
require('../../lib/sigv2')
describe 'AWS.SigV2', ->
View
2  test/unit/sigv4.spec.coffee
@@ -15,7 +15,7 @@ AWS = require('../../lib/core')
require('../../lib/services/dynamodb')
buildRequest = ->
- ddb = new AWS.DynamoDB({ region:'region' })
+ ddb = new AWS.DynamoDB.Client({ region:'region' })
req = ddb.buildRequest('listTables', { foo: 'bar' })
req.endpoint.hostname = 'localhost'
return req
Please sign in to comment.
Something went wrong with that request. Please try again.