Skip to content

Commit

Permalink
Merge pull request #13 from veena-udayabhanu/master
Browse files Browse the repository at this point in the history
Storage Client Library - 0.3.1
  • Loading branch information
vinaysh-msft committed Jul 23, 2014
2 parents 019c38a + 672e390 commit 8a624c1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 8 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Note: This is an Azure Storage only package. The all up Azure node sdk still has the old storage bits in there. In a future release, those storage bits will be removed and an npm dependency to this storage node sdk will
be taken. This is a CTP v1 release and the changes described below indicate the changes from the Azure node SDK 0.9.8 available here - https://github.com/Azure/azure-sdk-for-node.

2014.07.22 Version 0.3.1

ALL
* Fixed a bug which failed to validate special names for containers and tables.
* Exposed the Validation utility methods so users can use it to validate resource names.

BLOB
* Fixed an issue which caused failures when an error was encountered while uploading big blobs.

2014.07.07 Version 0.3.0

BLOB
Expand Down
1 change: 1 addition & 0 deletions lib/azure-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ exports.SR = azureCommon.SR;
exports.StorageServiceClient = azureCommon.StorageServiceClient;
exports.Logger = azureCommon.Logger;
exports.WebResource = azureCommon.WebResource;
exports.Validate = azureCommon.validate;
exports.date = azureCommon.date;

// Other filters
Expand Down
2 changes: 1 addition & 1 deletion lib/common/streams/batchoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ BatchOperation.prototype.getBatchOperationCallback = function (operation) {
if (error) {
operation.status = OperationState.ERROR;
self.logger.debug(util.format('Operation %d failed. Error %s', operation.operationId, error));
this._error = error;
self._error = error;
} else {
operation.status = OperationState.CALLBACK;
self.logger.debug(util.format('Operation %d succeed', operation.operationId));
Expand Down
2 changes: 1 addition & 1 deletion lib/common/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Constants = {
/*
* Specifies the value to use for UserAgent header.
*/
USER_AGENT_PRODUCT_VERSION: '0.3',
USER_AGENT_PRODUCT_VERSION: '0.3.1',

/**
* The number of default concurrent requests for parallel operation.
Expand Down
8 changes: 4 additions & 4 deletions lib/common/util/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports.isValidUuid = function(uuid, callback) {
* @return {function}
*/
exports.isBase64Encoded = function (key) {
var isValidBase64String = key.match('^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$');
var isValidBase64String = key.match(/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/);

if (isValidBase64String) {
return true;
Expand Down Expand Up @@ -137,7 +137,7 @@ var getNameError = function(name) {
}

// check if name follows naming rules
if (name.match('^([a-z0-9]+(-[a-z0-9]+)*)$') === null) {
if (name.match(/^([a-z0-9]+(-[a-z0-9]+)*)$/) === null) {
return '%s name format is incorrect.';
}

Expand All @@ -159,7 +159,7 @@ exports.containerNameIsValid = function (containerName, callback) {

var nameErrorString = getNameError(containerName);

if (!nameErrorString || containerName.match('^(\$root|\$logs)')) {
if (!nameErrorString || containerName.match(/^(\$root|\$logs)$/)) {
callback();
return true;
} else {
Expand Down Expand Up @@ -240,7 +240,7 @@ exports.tableNameIsValid = function (table, callback) {
return fail('Table name cannot be \'Tables\'.');
}

if (table.match('^([A-Za-z][A-Za-z0-9]{2,62})$') !== null || table === '$MetricsCapacityBlob' || table.match('^(\$Metrics(Transactions|HourPrimary|MinutePrimary|HourSecondary|MinuteSecondary)(Blob|Queue|Table))$') !== null)
if (table.match(/^([A-Za-z][A-Za-z0-9]{2,62})$/) !== null || table === '$MetricsCapacityBlob' || table.match(/^(\$Metrics(HourPrimary|MinutePrimary|HourSecondary|MinuteSecondary)?(Transactions)(Blob|Queue|Table))$/) !== null)
{
callback();
return true;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "azure-storage",
"author": "Microsoft Corporation",
"version": "0.3.0",
"version": "0.3.1",
"description": "Microsoft Azure Storage Client Library for Node.js",
"tags": [
"azure",
Expand Down
10 changes: 10 additions & 0 deletions test/services/blob/blobservice-container-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ describe('BlobContainer', function () {
it('should work', function (done) {
containerName = getName(containerNamesPrefix);

assert.doesNotThrow(function () { blobService.doesContainerExist('$root', function () { }); });

assert.doesNotThrow(function () { blobService.doesContainerExist('$logs', function () { }); });

blobService.doesContainerExist(containerName, function (existsError, exists) {
assert.equal(existsError, null);
assert.strictEqual(exists, false);
Expand All @@ -84,6 +88,12 @@ describe('BlobContainer', function () {
it('should detect incorrect container names', function (done) {
assert.throws(function () { blobService.createContainer(null, function () { }); },
/Required argument container for function createContainer is not defined/);

assert.throws(function () { blobService.createContainer('$root1', function () { }); },
/Container name format is incorrect./);

assert.throws(function () { blobService.createContainer('$root$logs', function () { }); },
/Container name format is incorrect./);

assert.throws(function () { blobService.createContainer('', function () { }); },
/Required argument container for function createContainer is not defined/);
Expand Down
11 changes: 10 additions & 1 deletion test/services/table/tableservice-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ describe('tableservice-tests', function () {
done();
});

describe('doesTableExist', function () {
it('should work', function (done) {
assert.doesNotThrow(function () { tableService.doesTableExist('$MetricsMinutePrimaryTransactionsBlob', function () { }); });
assert.doesNotThrow(function () { tableService.doesTableExist('$MetricsTransactionsTable', function () { }); });

done();
});
});

describe('CreateTable', function () {
it('should detect incorrect table names', function (done) {
assert.throws(function () { tableService.createTable(null, function () { }); },
Expand All @@ -147,7 +156,7 @@ describe('tableservice-tests', function () {

assert.throws(function () { tableService.createTable('$Metrics', function () { }); },
/Table name format is incorrect./);

done();
});

Expand Down

0 comments on commit 8a624c1

Please sign in to comment.