Merge branch 'connectionStrings' of https://github.com/andrerod/azure-sdk-for-node into connectionStrings
This commit is contained in:
Коммит
cc967820fd
|
@ -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();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче