This commit is contained in:
yugangw-msft 2015-06-22 12:28:10 -07:00
Родитель eaf1630788
Коммит 370821a74d
4 изменённых файлов: 15 добавлений и 8 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -108,6 +108,7 @@ tools/*.dll
# Azure Tooling #
node_modules
.ntvs_analysis.dat
# Eclipse #
*.pydevproject

Просмотреть файл

@ -17,9 +17,16 @@ var WebResource = msrest.WebResource;
* TokenCredentials object used for authentication.
*
* @param {object} options - The parameter options used by ServiceClient
*
* @param {Array} [options.longRunningOperationRetryTimeoutInSeconds] - Retry timeout
*
*/
function AzureServiceClient(credentials, options) {
AzureServiceClient['super_'].call(this, credentials, options);
if (options) {
this.longRunningOperationRetryTimeoutInSeconds =
options.longRunningOperationRetryTimeoutInSeconds;
}
}
util.inherits(AzureServiceClient, msrest.ServiceClient);
@ -50,7 +57,7 @@ AzureServiceClient.prototype.getPutOperationResult = function (resultOfInitialRe
resultOfInitialRequest.response.statusCode)));
}
var pollingState = new PollingState(resultOfInitialRequest, this.longRunningOperationRetryTimeout);
var pollingState = new PollingState(resultOfInitialRequest, this.longRunningOperationRetryTimeoutInSeconds);
async.whilst(
//while condition
@ -113,14 +120,14 @@ AzureServiceClient.prototype.getPostOrDeleteOperationResult = function (resultOf
return callback(new Error('Missing resultOfInitialRequest.response'));
}
if (resultOfInitialRequest.response.statusCode != 200 &&
resultOfInitialRequest.response.statusCode != 202 &&
resultOfInitialRequest.response.statusCode != 204) {
if (resultOfInitialRequest.response.statusCode !== 200 &&
resultOfInitialRequest.response.statusCode !== 202 &&
resultOfInitialRequest.response.statusCode !== 204) {
return callback(new Error(util.format('Unexpected polling status code from long running operation \'%s\'',
resultOfInitialRequest.response.statusCode)));
}
var pollingState = new PollingState(resultOfInitialRequest, this.longRunningOperationRetryTimeout);
var pollingState = new PollingState(resultOfInitialRequest, this.longRunningOperationRetryTimeoutInSeconds);
async.whilst(
function () {

Просмотреть файл

@ -79,9 +79,8 @@ describe('AzureServiceClient', function () {
}
};
var client = new AzureServiceClient();
var client = new AzureServiceClient(null, { longRunningOperationRetryTimeoutInSeconds : 0});
client._getStatus = mockedGetStatus;
client.longRunningOperationRetryTimeout = 0;
describe('Put', function () {
resultOfInitialRequest.response.statusCode = 201;

Просмотреть файл

@ -5,7 +5,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{ffccb0e4-74ae-413a-b685-c67cdfb34a11}</ProjectGuid>
<ProjectHome />
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
<StartupFile />
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>