Tests for Schema Compare utils file (#10822)

* Introduced ApiWrapper for testability

* Added tests for coverage of utils.ts

* Addressed comments
This commit is contained in:
Sakshi Sharma
2020-06-11 10:16:22 -07:00
committed by GitHub
parent bb244e4b91
commit f862d77f34
9 changed files with 261 additions and 40 deletions

View File

@@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as azdata from 'azdata';
/**
* Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into
* this API from our code
*/
export class ApiWrapper {
public openConnectionDialog(providers?: string[],
initialConnectionProfile?: azdata.IConnectionProfile,
connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Thenable<azdata.connection.Connection> {
return azdata.connection.openConnectionDialog(providers, initialConnectionProfile, connectionCompletionOptions);
}
public registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): vscode.Disposable {
return vscode.commands.registerCommand(command, callback, thisArg);
}
public getUriForConnection(connectionId: string): Thenable<string> {
return azdata.connection.getUriForConnection(connectionId);
}
public getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]> {
return azdata.connection.getConnections(activeConnectionsOnly);
}
public connect(connectionProfile: azdata.IConnectionProfile, saveConnection?: boolean, showDashboard?: boolean): Thenable<azdata.ConnectionResult> {
return azdata.connection.connect(connectionProfile, saveConnection, showDashboard);
}
public showErrorMessage(message: string, ...items: string[]): Thenable<string | undefined> {
return vscode.window.showErrorMessage(message, ...items);
}
public showWarningMessage(message: string, options?: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined> {
if (options) {
return vscode.window.showWarningMessage(message, options, ...items);
}
else {
return vscode.window.showWarningMessage(message, ...items);
}
}
}

View File

@@ -3,22 +3,22 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { Disposable, ExtensionContext } from 'vscode';
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
import { ApiWrapper } from '../common/apiWrapper';
/**
* The main controller class that initializes the extension
*/
export default class MainController implements vscode.Disposable {
protected _context: vscode.ExtensionContext;
export default class MainController implements Disposable {
protected schemaCompareMainWindow: SchemaCompareMainWindow;
public constructor(context: vscode.ExtensionContext) {
this._context = context;
public constructor(private context: ExtensionContext, private apiWrapper: ApiWrapper) {
this.schemaCompareMainWindow = new SchemaCompareMainWindow(this.apiWrapper, null, this.extensionContext);
}
public get extensionContext(): vscode.ExtensionContext {
return this._context;
public get extensionContext(): ExtensionContext {
return this.context;
}
public deactivate(): void {
@@ -30,7 +30,7 @@ export default class MainController implements vscode.Disposable {
}
private initializeSchemaCompareDialog(): void {
vscode.commands.registerCommand('schemaCompare.start', (context: any) => new SchemaCompareMainWindow(null, this.extensionContext).start(context));
this.apiWrapper.registerCommand('schemaCompare.start', (context: any) => this.schemaCompareMainWindow.start(context));
}
public dispose(): void {

View File

@@ -5,12 +5,13 @@
import * as vscode from 'vscode';
import MainController from './controllers/mainController';
import { ApiWrapper } from './common/apiWrapper';
let controllers: MainController[] = [];
export async function activate(context: vscode.ExtensionContext): Promise<void> {
// Start the main controller
let mainController = new MainController(context);
let mainController = new MainController(context, new ApiWrapper());
controllers.push(mainController);
context.subscriptions.push(mainController);

View File

@@ -14,6 +14,7 @@ import { TelemetryReporter, TelemetryViews } from './telemetry';
import { getTelemetryErrorType, getEndpointName, verifyConnectionAndGetOwnerUri, getRootPath } from './utils';
import { SchemaCompareDialog } from './dialogs/schemaCompareDialog';
import { isNullOrUndefined } from 'util';
import { ApiWrapper } from './common/apiWrapper';
// Do not localize this, this is used to decide the icon for the editor.
// TODO : In future icon should be decided based on language id (scmp) and not resource name
@@ -68,7 +69,7 @@ export class SchemaCompareMainWindow {
public sourceEndpointInfo: mssql.SchemaCompareEndpointInfo;
public targetEndpointInfo: mssql.SchemaCompareEndpointInfo;
constructor(private schemaCompareService?: mssql.ISchemaCompareService, private extensionContext?: vscode.ExtensionContext) {
constructor(private apiWrapper: ApiWrapper, private schemaCompareService?: mssql.ISchemaCompareService, private extensionContext?: vscode.ExtensionContext) {
this.SchemaCompareActionMap = new Map<Number, string>();
this.SchemaCompareActionMap[mssql.SchemaUpdateAction.Delete] = loc.deleteAction;
this.SchemaCompareActionMap[mssql.SchemaUpdateAction.Change] = loc.changeAction;
@@ -949,8 +950,8 @@ export class SchemaCompareMainWindow {
return;
}
this.sourceEndpointInfo = await this.constructEndpointInfo(result.sourceEndpointInfo, loc.sourceTitle);
this.targetEndpointInfo = await this.constructEndpointInfo(result.targetEndpointInfo, loc.targetTitle);
this.sourceEndpointInfo = await this.constructEndpointInfo(result.sourceEndpointInfo, loc.sourceTitle, this.apiWrapper);
this.targetEndpointInfo = await this.constructEndpointInfo(result.targetEndpointInfo, loc.targetTitle, this.apiWrapper);
this.updateSourceAndTarget();
this.setDeploymentOptions(result.deploymentOptions);
@@ -968,12 +969,12 @@ export class SchemaCompareMainWindow {
});
}
private async constructEndpointInfo(endpoint: mssql.SchemaCompareEndpointInfo, caller: string): Promise<mssql.SchemaCompareEndpointInfo> {
private async constructEndpointInfo(endpoint: mssql.SchemaCompareEndpointInfo, caller: string, apiWrapper: ApiWrapper): Promise<mssql.SchemaCompareEndpointInfo> {
let ownerUri;
let endpointInfo;
if (endpoint && endpoint.endpointType === mssql.SchemaCompareEndpointType.Database) {
// only set endpoint info if able to connect to the database
ownerUri = await verifyConnectionAndGetOwnerUri(endpoint, caller);
ownerUri = await verifyConnectionAndGetOwnerUri(endpoint, caller, apiWrapper);
}
if (ownerUri) {
endpointInfo = endpoint;

View File

@@ -12,14 +12,19 @@ import 'mocha';
import { SchemaCompareDialog } from './../dialogs/schemaCompareDialog';
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
import { SchemaCompareTestService } from './testSchemaCompareService';
import { mockConnectionProfile, mockDacpacEndpoint } from './testUtils';
import { createContext, TestContext } from './testContext';
import { mockIConnectionProfile, mockDacpacEndpoint, mockFilePath } from './testUtils';
// Mock test data
const mocksource: string = 'source.dacpac';
const mocktarget: string = 'target.dacpac';
let mockExtensionContext: TypeMoq.IMock<vscode.ExtensionContext>;
let testContext: TestContext;
before(async function (): Promise<void> {
testContext = createContext();
});
describe('SchemaCompareDialog.openDialog', function (): void {
beforeEach(() => {
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
@@ -27,7 +32,7 @@ describe('SchemaCompareDialog.openDialog', function (): void {
});
it('Should be correct when created.', async function (): Promise<void> {
let schemaCompareResult = new SchemaCompareMainWindow(undefined, mockExtensionContext.object);
let schemaCompareResult = new SchemaCompareMainWindow(testContext.apiWrapper.object, undefined, mockExtensionContext.object);
let dialog = new SchemaCompareDialog(schemaCompareResult);
await dialog.openDialog();
@@ -45,7 +50,7 @@ describe('SchemaCompareResult.start', function (): void {
it('Should be correct when created.', async function (): Promise<void> {
let sc = new SchemaCompareTestService();
let result = new SchemaCompareMainWindow(sc, mockExtensionContext.object);
let result = new SchemaCompareMainWindow(testContext.apiWrapper.object, sc, mockExtensionContext.object);
await result.start(null);
let promise = new Promise(resolve => setTimeout(resolve, 5000)); // to ensure comparison result view is initialized
await promise;
@@ -67,7 +72,7 @@ describe('SchemaCompareResult.start', function (): void {
it('Should start with the source as undefined', async function (): Promise<void> {
let sc = new SchemaCompareTestService();
let result = new SchemaCompareMainWindow(sc, mockExtensionContext.object);
let result = new SchemaCompareMainWindow(testContext.apiWrapper.object, sc, mockExtensionContext.object);
await result.start(undefined);
let promise = new Promise(resolve => setTimeout(resolve, 5000)); // to ensure comparison result view is initialized
await promise;
@@ -79,23 +84,23 @@ describe('SchemaCompareResult.start', function (): void {
it('Should start with the source as database', async function (): Promise<void> {
let sc = new SchemaCompareTestService();
let result = new SchemaCompareMainWindow(sc, mockExtensionContext.object);
await result.start({connectionProfile: mockConnectionProfile});
let result = new SchemaCompareMainWindow(testContext.apiWrapper.object, sc, mockExtensionContext.object);
await result.start({connectionProfile: mockIConnectionProfile});
let promise = new Promise(resolve => setTimeout(resolve, 5000)); // to ensure comparison result view is initialized
await promise;
should.notEqual(result.sourceEndpointInfo, undefined);
should.equal(result.sourceEndpointInfo.endpointType, mssql.SchemaCompareEndpointType.Database);
should.equal(result.sourceEndpointInfo.serverName, mockConnectionProfile.serverName);
should.equal(result.sourceEndpointInfo.databaseName, mockConnectionProfile.databaseName);
should.equal(result.sourceEndpointInfo.serverName, mockIConnectionProfile.serverName);
should.equal(result.sourceEndpointInfo.databaseName, mockIConnectionProfile.databaseName);
should.equal(result.targetEndpointInfo, undefined);
});
it('Should start with the source as dacpac.', async function (): Promise<void> {
let sc = new SchemaCompareTestService();
let result = new SchemaCompareMainWindow(sc, mockExtensionContext.object);
const dacpacPath = 'C:\\users\\test\\test.dacpac';
let result = new SchemaCompareMainWindow(testContext.apiWrapper.object, sc, mockExtensionContext.object);
const dacpacPath = mockFilePath;
await result.start(dacpacPath);
let promise = new Promise(resolve => setTimeout(resolve, 5000)); // to ensure comparison result view is initialized
await promise;

View File

@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as path from 'path';
import * as TypeMoq from 'typemoq';
import { ApiWrapper } from '../common/apiWrapper';
export interface TestContext {
apiWrapper: TypeMoq.IMock<ApiWrapper>;
context: vscode.ExtensionContext;
}
export function createContext(): TestContext {
let extensionPath = path.join(__dirname, '..', '..');
return {
apiWrapper: TypeMoq.Mock.ofType(ApiWrapper),
context: {
subscriptions: [],
workspaceState: {
get: () => { return undefined; },
update: () => { return Promise.resolve(); }
},
globalState: {
get: () => { return Promise.resolve(); },
update: () => { return Promise.resolve(); }
},
extensionPath: extensionPath,
asAbsolutePath: () => { return ''; },
storagePath: '',
globalStoragePath: '',
logPath: '',
extensionUri: vscode.Uri.parse(''),
environmentVariableCollection: undefined as any
},
};
}

View File

@@ -5,9 +5,11 @@
import * as azdata from 'azdata';
import * as mssql from '../../../mssql';
import should = require('should');
import { AssertionError } from 'assert';
// Mock test data
export const mockConnectionProfile: azdata.IConnectionProfile = {
export const mockIConnectionProfile: azdata.IConnectionProfile = {
connectionName: 'My Connection',
serverName: 'My Server',
databaseName: 'My Database',
@@ -23,6 +25,35 @@ export const mockConnectionProfile: azdata.IConnectionProfile = {
options: null
};
export const mockConnectionProfile: azdata.connection.ConnectionProfile = {
providerId: 'My Provider',
connectionId: 'My Id',
connectionName: 'My Connection',
serverName: 'My Server',
databaseName: 'My Database',
userName: 'My User',
password: 'My Pwd',
authenticationType: 'SqlLogin',
savePassword: false,
groupFullName: 'My groupName',
groupId: 'My GroupId',
saveProfile: true,
options: {
server: 'My Server',
database: 'My Database',
user: 'My User',
password: 'My Pwd',
authenticationType: 'SqlLogin'
}
};
export const mockConnectionResult: azdata.ConnectionResult = {
connected: false,
connectionId: undefined,
errorMessage: 'Login failed for user \'sa\'',
errorCode: 18456
};
export const mockConnectionInfo = {
options: {},
serverName: 'My Server',
@@ -53,3 +84,18 @@ export const mockDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {
packageFilePath: '',
connectionDetails: undefined
};
export async function shouldThrowSpecificError(block: Function, expectedMessage: string, details?: string) {
let succeeded = false;
try {
await block();
succeeded = true;
}
catch (err) {
should(err.message).equal(expectedMessage);
}
if (succeeded) {
throw new AssertionError({ message: `Operation succeeded, but expected failure with exception: "${expectedMessage}".${details ? ' ' + details : ''}` });
}
}

View File

@@ -4,9 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import * as should from 'should';
import * as azdata from 'azdata';
import * as mssql from '../../../mssql';
import * as loc from '../localizedConstants';
import * as TypeMoq from 'typemoq';
import {getEndpointName, verifyConnectionAndGetOwnerUri } from '../utils';
import {mockDacpacEndpoint, mockDatabaseEndpoint, mockFilePath, mockConnectionInfo} from './testUtils';
import {mockDacpacEndpoint, mockDatabaseEndpoint, mockFilePath, mockConnectionInfo, shouldThrowSpecificError, mockConnectionResult, mockConnectionProfile} from './testUtils';
import { createContext, TestContext } from './testContext';
let testContext: TestContext;
describe('utils: Tests to verify getEndpointName', function (): void {
it('Should generate correct endpoint information', async () => {
@@ -18,8 +24,8 @@ describe('utils: Tests to verify getEndpointName', function (): void {
});
it('Should get endpoint information from ConnectionInfo', async () => {
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = mockDatabaseEndpoint;
testDatabaseEndpoint.connectionDetails = mockConnectionInfo;
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
testDatabaseEndpoint.connectionDetails = {...mockConnectionInfo};
should(getEndpointName(testDatabaseEndpoint)).equal('My Server.My Database');
});
@@ -35,10 +41,14 @@ describe('utils: Tests to verify getEndpointName', function (): void {
});
});
describe('utils: Tests to verify verifyConnectionAndGetOwnerUri', function (): void {
describe('utils: Basic tests to verify verifyConnectionAndGetOwnerUri', function (): void {
before(async function (): Promise<void> {
testContext = createContext();
});
it('Should return undefined for endpoint as dacpac', async function (): Promise<void> {
let ownerUri = undefined;
ownerUri = await verifyConnectionAndGetOwnerUri(mockDacpacEndpoint, 'test');
ownerUri = await verifyConnectionAndGetOwnerUri(mockDacpacEndpoint, 'test', testContext.apiWrapper.object);
should(ownerUri).equal(undefined);
});
@@ -48,8 +58,73 @@ describe('utils: Tests to verify verifyConnectionAndGetOwnerUri', function (): v
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
testDatabaseEndpoint.connectionDetails = undefined;
ownerUri = await verifyConnectionAndGetOwnerUri(testDatabaseEndpoint, 'test');
ownerUri = await verifyConnectionAndGetOwnerUri(testDatabaseEndpoint, 'test', testContext.apiWrapper.object);
should(ownerUri).equal(undefined);
});
});
describe('utils: In-depth tests to verify verifyConnectionAndGetOwnerUri', function (): void {
before(async function (): Promise<void> {
testContext = createContext();
});
it('Should throw an error asking to make a connection', async function (): Promise<void> {
let getConnectionsResults: azdata.connection.ConnectionProfile[] = [];
let connection = {...mockConnectionResult};
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
testDatabaseEndpoint.connectionDetails = {...mockConnectionInfo};
const getConnectionString = loc.getConnectionString('test');
testContext.apiWrapper.setup(x => x.connect(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => { return Promise.resolve(connection); });
testContext.apiWrapper.setup(x => x.getUriForConnection(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(undefined); });
testContext.apiWrapper.setup(x => x.getConnections(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(getConnectionsResults); });
testContext.apiWrapper.setup(x => x.showWarningMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((s) => { throw new Error(s); });
await shouldThrowSpecificError(async () => await verifyConnectionAndGetOwnerUri(testDatabaseEndpoint, 'test', testContext.apiWrapper.object), getConnectionString);
});
it('Should throw an error for login failure', async function (): Promise<void> {
let getConnectionsResults: azdata.connection.ConnectionProfile[] = [{...mockConnectionProfile}];
let connection = {...mockConnectionResult};
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
testDatabaseEndpoint.connectionDetails = {...mockConnectionInfo};
testContext.apiWrapper.setup(x => x.connect(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => { return Promise.resolve(connection); });
testContext.apiWrapper.setup(x => x.getUriForConnection(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(undefined); });
testContext.apiWrapper.setup(x => x.getConnections(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(getConnectionsResults); });
testContext.apiWrapper.setup(x => x.showErrorMessage(TypeMoq.It.isAny())).returns((s) => { throw new Error(s); });
await shouldThrowSpecificError(async () => await verifyConnectionAndGetOwnerUri(testDatabaseEndpoint, 'test', testContext.apiWrapper.object), connection.errorMessage);
});
it('Should throw an error for login failure with openConnectionDialog but no ownerUri', async function (): Promise<void> {
let getConnectionsResults: azdata.connection.ConnectionProfile[] = [];
let connection = {...mockConnectionResult};
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
testDatabaseEndpoint.connectionDetails = {...mockConnectionInfo};
testContext.apiWrapper.setup(x => x.connect(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => { return Promise.resolve(connection); });
testContext.apiWrapper.setup(x => x.getUriForConnection(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(undefined); });
testContext.apiWrapper.setup(x => x.getConnections(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(getConnectionsResults); });
testContext.apiWrapper.setup(x => x.showWarningMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => { return Promise.resolve(loc.YesButtonText); });
testContext.apiWrapper.setup(x => x.openConnectionDialog(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => { return Promise.resolve(undefined); });
await shouldThrowSpecificError(async () => await verifyConnectionAndGetOwnerUri(testDatabaseEndpoint, 'test', testContext.apiWrapper.object), connection.errorMessage);
});
it('Should not throw an error and set ownerUri appropriately', async function (): Promise<void> {
let ownerUri = undefined;
let connection = {...mockConnectionResult};
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
let expectedOwnerUri: string = 'providerName:MSSQL|authenticationType:SqlLogin|database:My Database|server:My Server|user:My User|databaseDisplayName:My Database';
testDatabaseEndpoint.connectionDetails = {...mockConnectionInfo};
testContext.apiWrapper.setup(x => x.connect(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => { return Promise.resolve(connection); });
testContext.apiWrapper.setup(x => x.getUriForConnection(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(expectedOwnerUri); });
ownerUri = await verifyConnectionAndGetOwnerUri(testDatabaseEndpoint, 'test', testContext.apiWrapper.object);
should(ownerUri).equal(expectedOwnerUri);
});
});

View File

@@ -8,6 +8,7 @@ import * as vscode from 'vscode';
import * as mssql from '../../mssql';
import * as os from 'os';
import * as loc from './localizedConstants';
import { ApiWrapper } from './common/apiWrapper';
export interface IPackageInfo {
name: string;
@@ -83,15 +84,19 @@ function connectionInfoToConnectionProfile(details: azdata.ConnectionInfo): azda
};
}
export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompareEndpointInfo, caller: string): Promise<string | undefined> {
export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompareEndpointInfo, caller: string, apiWrapper: ApiWrapper): Promise<string> {
let ownerUri = undefined;
if (endpoint.endpointType === mssql.SchemaCompareEndpointType.Database && endpoint.connectionDetails) {
let connectionProfile = await connectionInfoToConnectionProfile(endpoint.connectionDetails);
let connection = await azdata.connection.connect(connectionProfile, false, false);
let connection = await apiWrapper.connect(connectionProfile, false, false);
if (connection) {
ownerUri = await azdata.connection.getUriForConnection(connection.connectionId);
ownerUri = await apiWrapper.getUriForConnection(connection.connectionId);
if (!ownerUri) {
let connectionList = await azdata.connection.getConnections(true);
let connectionList = await apiWrapper.getConnections(true);
let userConnection;
userConnection = connectionList.find(connection =>
(endpoint.connectionDetails['authenticationType'] === 'SqlLogin'
@@ -103,18 +108,18 @@ export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompa
if (userConnection === undefined) {
const getConnectionString = loc.getConnectionString(caller);
// need only yes button - since the modal dialog has a default cancel
let result = await vscode.window.showWarningMessage(getConnectionString, { modal: true }, loc.YesButtonText);
let result = await apiWrapper.showWarningMessage(getConnectionString, { modal: true }, loc.YesButtonText);
if (result === loc.YesButtonText) {
userConnection = await azdata.connection.openConnectionDialog(undefined, connectionProfile);
userConnection = await apiWrapper.openConnectionDialog(undefined, connectionProfile);
}
}
if (userConnection !== undefined) {
ownerUri = await azdata.connection.getUriForConnection(userConnection.connectionId);
ownerUri = await apiWrapper.getUriForConnection(userConnection.connectionId);
}
}
if (!ownerUri && connection.errorMessage) {
vscode.window.showErrorMessage(connection.errorMessage);
apiWrapper.showErrorMessage(connection.errorMessage);
}
}
}