Permalink
Browse files

Merge branch 'dev' into bumping

  • Loading branch information...
2 parents e93dcfd + f62f063 commit 89d9e5c923f27199efca00f80980570ffcb87140 Andre Rodrigues committed Oct 15, 2012
@@ -53,7 +53,7 @@ function ServiceBusSettings(serviceBusEndpointUri, wrapEndpointUri, namespace, w
if (wrapEndpointUri) {
this._wrapEndpointUri = wrapEndpointUri;
} else {
- this._wrapEndpointUri = 'https://' + namespace + '-sb.accesscontrol.windows.net/WRAPv0.9';
+ this._wrapEndpointUri = 'https://' + namespace + '-sb.accesscontrol.windows.net:443/WRAPv0.9';
}
this._wrapName = wrapName;
@@ -108,7 +108,15 @@ function ServiceClient(host, authenticationProvider) {
if (host) {
var parsedHost = ServiceClient._parseHost(host);
this.host = parsedHost.hostname;
- this.port = parsedHost.port;
+
+ if (parsedHost.port) {
+ this.port = parsedHost.port;
+ } else if (parsedHost.protocol === 'https:') {
+ this.port = 443;
+ } else {
+ this.port = 80;
+ }
+
if (!this.protocol) {
this.protocol = parsedHost.protocol + '//';
}
@@ -385,12 +393,7 @@ ServiceClient._parseHost = function (host) {
fullHost = ServiceClient.DEFAULT_PROTOCOL + fullHost;
}
- var parsedUrl = url.parse(fullHost);
- if (!parsedUrl.port) {
- parsedUrl.port = ServiceClient.DEFAULT_PORT;
- }
-
- return parsedUrl;
+ return url.parse(fullHost);
};
/*
@@ -111,23 +111,22 @@ StorageServiceClient._getStorageSettingsExplicitOrEnvironment = function (storag
}
// Default endpoints
- var blobendpoint = url.format({ protocol: 'http:', hostname: storageAccount + '.' + ServiceClient.CLOUD_BLOB_HOST });
- var tableendpoint = url.format({ protocol: 'http:', hostname: storageAccount + '.' + ServiceClient.CLOUD_TABLE_HOST });
- var queueendpoint = url.format({ protocol: 'http:', hostname: storageAccount + '.' + ServiceClient.CLOUD_QUEUE_HOST });
+ var blobendpoint = url.format({ protocol: 'http:', port: 80, hostname: storageAccount + '.' + ServiceClient.CLOUD_BLOB_HOST });
+ var tableendpoint = url.format({ protocol: 'http:', port: 80, hostname: storageAccount + '.' + ServiceClient.CLOUD_TABLE_HOST });
+ var queueendpoint = url.format({ protocol: 'http:', port: 80, hostname: storageAccount + '.' + ServiceClient.CLOUD_QUEUE_HOST });
if (host) {
var parsedHost = ServiceClient._parseHost(host);
-
var parsedHostUrl = url.format(parsedHost);
if (parsedHostUrl === url.format(ServiceClient._parseHost(ServiceClient.DEVSTORE_BLOB_HOST)) ||
parsedHostUrl === url.format(ServiceClient._parseHost(ServiceClient.DEVSTORE_TABLE_HOST)) ||
parsedHostUrl === url.format(ServiceClient._parseHost(ServiceClient.DEVSTORE_QUEUE_HOST))) {
usePathStyleUri = true;
}
- blobendpoint = url.format(parsedHostUrl);
- tableendpoint = url.format(parsedHostUrl);
- queueendpoint = url.format(parsedHostUrl);
+ blobendpoint = parsedHostUrl;
+ tableendpoint = parsedHostUrl;
+ queueendpoint = parsedHostUrl;
}
var settings = {
@@ -71,6 +71,7 @@ var validKeys = [
function StorageServiceSettings(name, key, blobEndpointUri, queueEndpointUri, tableEndpointUri, usePathStyleUri) {
this._name = name;
this._key = key;
+
this._blobEndpointUri = blobEndpointUri;
this._queueEndpointUri = queueEndpointUri;
this._tableEndpointUri = tableEndpointUri;
@@ -144,12 +145,7 @@ StorageServiceSettings._getDefaultServiceEndpoint = function (settings, dns) {
settings
);
- var port = '80';
- if (scheme.toLowerCase() === 'https') {
- port = '443';
- }
-
- return url.format({ protocol: scheme, hostname: accountName + '.' + dns, port: port });
+ return url.format({ protocol: scheme, hostname: accountName + '.' + dns });
};
@@ -29,7 +29,7 @@ suite('servicebussettings-tests', function () {
var expectedServiceBusEndpoint = 'https://' + expectedNamespace + '.servicebus.windows.net';
var expectedWrapName = 'myname';
var expectedWrapPassword = 'mypassword';
- var expectedWrapEndpointUri = 'https://' + expectedNamespace + '-sb.accesscontrol.windows.net/WRAPv0.9';
+ var expectedWrapEndpointUri = 'https://' + expectedNamespace + '-sb.accesscontrol.windows.net:443/WRAPv0.9';
var connectionString = 'Endpoint=' + expectedServiceBusEndpoint + ';SharedSecretIssuer=' + expectedWrapName + ';SharedSecretValue=' + expectedWrapPassword;
// Test
@@ -70,7 +70,7 @@ suite('servicebussettings-tests', function () {
var expectedServiceBusEndpoint = 'https://' + expectedNamespace + '.servicebus.windows.net';
var expectedWrapName = 'myname';
var expectedWrapPassword = 'mypassword';
- var expectedWrapEndpointUri = 'https://' + expectedNamespace + '-sb.accesscontrol.windows.net/WRAPv0.9';
+ var expectedWrapEndpointUri = 'https://' + expectedNamespace + '-sb.accesscontrol.windows.net:443/WRAPv0.9';
var connectionString = 'eNdPoinT=' + expectedServiceBusEndpoint + ';sHarEdsecRetiSsuer=' + expectedWrapName + ';shArEdsecrEtvAluE=' + expectedWrapPassword;
// Test
@@ -105,9 +105,9 @@ suite('storageservicesettings-tests', function () {
// Assert
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
- actual._blobEndpointUri.should.equal(expectedBlobEndpoint + ':443');
- actual._queueEndpointUri.should.equal(expectedQueueEndpoint + ':443');
- actual._tableEndpointUri.should.equal(expectedTableEndpoint + ':443');
+ actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
+ actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
+ actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('testCreateFromConnectionStringWithTableEndpointSpecified', function () {
@@ -126,8 +126,8 @@ suite('storageservicesettings-tests', function () {
// Assert
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
- actual._blobEndpointUri.should.equal(expectedBlobEndpoint + ':443');
- actual._queueEndpointUri.should.equal(expectedQueueEndpoint + ':443');
+ actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
+ actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
@@ -148,8 +148,8 @@ suite('storageservicesettings-tests', function () {
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
- actual._queueEndpointUri.should.equal(expectedQueueEndpoint + ':443');
- actual._tableEndpointUri.should.equal(expectedTableEndpoint + ':443');
+ actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
+ actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('testCreateFromConnectionStringWithQueueEndpointSpecified', function () {
@@ -168,9 +168,9 @@ suite('storageservicesettings-tests', function () {
// Assert
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
- actual._blobEndpointUri.should.equal(expectedBlobEndpoint + ':443');
+ actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
- actual._tableEndpointUri.should.equal(expectedTableEndpoint + ':443');
+ actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('testCreateFromConnectionStringWithQueueAndBlobEndpointSpecified', function () {
@@ -191,7 +191,7 @@ suite('storageservicesettings-tests', function () {
actual._key.should.equal(expectedKey);
actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
- actual._tableEndpointUri.should.equal(expectedTableEndpoint + ':443');
+ actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('testCreateFromConnectionStringWithAutomaticMissingProtocolFail', function () {
@@ -292,9 +292,9 @@ suite('storageservicesettings-tests', function () {
// Assert
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
- actual._blobEndpointUri.should.equal(expectedBlobEndpoint + ':443');
- actual._queueEndpointUri.should.equal(expectedQueueEndpoint + ':443');
- actual._tableEndpointUri.should.equal(expectedTableEndpoint + ':443');
+ actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
+ actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
+ actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('getDevelopmentStorageAccount', function () {
@@ -1620,7 +1620,7 @@ suite('servicebusservice-tests', function () {
done();
});
- test('storageConnectionStringsEndpointHttpsExplicit', function (done) {
+ test('storageConnectionStringsEndpointHttpExplicit', function (done) {
var topicName = testutil.generateId(topicNamesPrefix, topicNames);
var expectedNamespace = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE];
var expectedKey = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY];
@@ -1630,6 +1630,26 @@ suite('servicebusservice-tests', function () {
assert.equal(err, null);
assert.equal(serviceBusService.host, process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + '.servicebus.windows.net');
+ assert.equal(serviceBusService.port, 80);
+ assert.equal(serviceBusService.authenticationProvider.issuer, 'owner');
+ assert.equal(serviceBusService.authenticationProvider.accessKey, expectedKey);
+ assert.equal(serviceBusService.authenticationProvider.acsHost, 'https://' + process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + '-sb.accesscontrol.windows.net:443');
+
+ done();
+ });
+ });
+
+ test('storageConnectionStringsEndpointHttpsExplicit', function (done) {
+ var topicName = testutil.generateId(topicNamesPrefix, topicNames);
+ var expectedNamespace = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE];
+ var expectedKey = process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY];
+ var expectedHost = 'https://' + process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + '.servicebus.windows.net';
+ var serviceBusService = azure.createServiceBusService(expectedNamespace, expectedKey, undefined, undefined, expectedHost);
+ serviceBusService.createTopic(topicName, function (err) {
+ assert.equal(err, null);
+
+ assert.equal(serviceBusService.host, process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + '.servicebus.windows.net');
+ assert.equal(serviceBusService.port, 443);
assert.equal(serviceBusService.authenticationProvider.issuer, 'owner');
assert.equal(serviceBusService.authenticationProvider.accessKey, expectedKey);
assert.equal(serviceBusService.authenticationProvider.acsHost, 'https://' + process.env[ServiceClient.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] + '-sb.accesscontrol.windows.net:443');

0 comments on commit 89d9e5c

Please sign in to comment.