Fix getUriForConnection API returning wrong URIs (#2202)

* Fix connection URI api to return working URI

* run tsfmt

* Keep using hand-built connection string for now in import

* Use connection ID instead of URI to get connection string
This commit is contained in:
Matt Irvine
2018-08-20 12:41:06 -07:00
committed by Karl Burtram
parent efa3658ced
commit 3001640eec
7 changed files with 26 additions and 21 deletions

View File

@@ -797,7 +797,7 @@ suite('SQL ConnectionManagementService tests', () => {
test('getActiveConnectionCredentials returns the credentials dictionary for a connection profile', () => {
let profile = Object.assign({}, connectionProfile);
profile.options = {password: profile.password};
profile.options = { password: profile.password };
profile.id = 'test_id';
connectionStatusManager.addConnection(profile, 'test_uri');
(connectionManagementService as any)._connectionStatusManager = connectionStatusManager;
@@ -807,7 +807,7 @@ suite('SQL ConnectionManagementService tests', () => {
test('getConnectionUriFromId returns a URI of an active connection with the given id', () => {
let profile = Object.assign({}, connectionProfile);
profile.options = {password: profile.password};
profile.options = { password: profile.password };
profile.id = 'test_id';
let uri = 'test_initial_uri';
connectionStatusManager.addConnection(profile, uri);
@@ -816,13 +816,13 @@ suite('SQL ConnectionManagementService tests', () => {
// If I call getConnectionUriFromId on the given connection
let foundUri = connectionManagementService.getConnectionUriFromId(profile.id);
// Then the returned URI matches the connection's
assert.equal(foundUri, Utils.generateUri(new ConnectionProfile(capabilitiesService, profile)));
// Then the returned URI matches the connection's original URI
assert.equal(foundUri, uri);
});
test('getConectionUriFromId returns undefined if the given connection is not active', () => {
let profile = Object.assign({}, connectionProfile);
profile.options = {password: profile.password};
profile.options = { password: profile.password };
profile.id = 'test_id';
connectionStatusManager.addConnection(profile, Utils.generateUri(profile));
(connectionManagementService as any)._connectionStatusManager = connectionStatusManager;

View File

@@ -254,7 +254,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
return undefined;
}
getConnectionString(ownerUri: string): Thenable<string> {
getConnectionString(connectionId: string): Thenable<string> {
return undefined;
}