This commit is contained in:
Andre Rodrigues 2012-10-10 19:00:43 +01:00
Родитель aa3923a6bd 32cf01fd20
Коммит cc967820fd
2 изменённых файлов: 8 добавлений и 2 удалений

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

@ -59,7 +59,7 @@ function ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNa
}
var namespace = namespaceOrConnectionString;
if (namespaceOrConnectionString && accessKey === undefined) {
if (namespaceOrConnectionString && !accessKey) {
// If namespaceOrConnectionString was passed and no accessKey was passed, assume connection string
var connectionString = ConnectionStringParser.parse(namespaceOrConnectionString);
if (connectionString['endpoint']) {
@ -75,6 +75,11 @@ function ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNa
if (connectionString['sharedsecretvalue']) {
accessKey = connectionString['sharedsecretvalue'];
}
if (connectionString['stsendpoint']) {
var endpoint = url.parse(connectionString['stsendpoint']);
acsNamespace = endpoint.host.split('.')[0];
}
}
ServiceBusService.super_.call(this, host, namespace, accessKey, issuer, acsNamespace, authenticationProvider);

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

@ -1608,13 +1608,14 @@ suite('servicebusservice-tests', function () {
});
test('connectionStrings', function (done) {
var connectionString = 'Endpoint=sb://ablal-martvue.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=value';
var connectionString = 'Endpoint=sb://ablal-martvue.servicebus.windows.net/;StsEndpoint=https://ablal-martvue-sb.accesscontrol.windows.net;SharedSecretIssuer=owner;SharedSecretValue=value';
var serviceBusService = azure.createServiceBusService(connectionString);
assert.equal(serviceBusService.host, 'servicebus.windows.net');
assert.equal(serviceBusService.namespace, 'ablal-martvue');
assert.equal(serviceBusService.issuer, 'owner');
assert.equal(serviceBusService.accessKey, 'value');
assert.equal(serviceBusService.acsNamespace, 'ablal-martvue-sb');
done();
});