mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 01:25:36 -05:00
Alanren/integration test (#3657)
* add an extension for integration tests * setup ads before running test * test setup * test cases * bash script * shorter temp folder name * code cleanup * add commented out original code * fix test error * test result path * rename results file * change file path * report smoke test results * test stablize * test stablization and configurable test servers * fix smoke test error * connection provider * simplify the integration test script * add comment * fix tslint error * address PR comments * add temp log to check whether the environment variable is already set * remove temp log * move api definition to testapi typing file * exclude integration tests extension * address comments
This commit is contained in:
@@ -47,4 +47,8 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
|
||||
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||
return this._proxy.$getUriForConnection(connectionId);
|
||||
}
|
||||
|
||||
public $connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult> {
|
||||
return this._proxy.$connect(connectionProfile);
|
||||
}
|
||||
}
|
||||
|
||||
23
src/sql/workbench/api/node/extHostExtensionManagement.ts
Normal file
23
src/sql/workbench/api/node/extHostExtensionManagement.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
import { ExtHostExtensionManagementShape, MainThreadExtensionManagementShape, SqlMainContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
|
||||
|
||||
export class ExtHostExtensionManagement implements ExtHostExtensionManagementShape {
|
||||
|
||||
private readonly _proxy: MainThreadExtensionManagementShape;
|
||||
|
||||
constructor(_mainContext: IMainContext) {
|
||||
this._proxy = _mainContext.getProxy(SqlMainContext.MainThreadExtensionManagement);
|
||||
}
|
||||
|
||||
$install(vsixPath: string): Thenable<string> {
|
||||
return this._proxy.$install(vsixPath);
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class ModelViewEditorImpl extends ModelViewPanelImpl implements sqlops.workspace
|
||||
this._proxy.$setDirty(this.handle, value);
|
||||
}
|
||||
|
||||
registerSaveHandler(handler: () => Thenable<boolean>) {
|
||||
registerSaveHandler(handler: () => Thenable<boolean>): void {
|
||||
this._saveHandler = handler;
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
let handle = this.getHandle(dialog);
|
||||
this.updateDialogContent(dialog);
|
||||
dialog.dialogName ? this._proxy.$openDialog(handle, dialog.dialogName) :
|
||||
this._proxy.$openDialog(handle);
|
||||
this._proxy.$openDialog(handle);
|
||||
}
|
||||
|
||||
public closeDialog(dialog: sqlops.window.modelviewdialog.Dialog): void {
|
||||
|
||||
@@ -30,6 +30,10 @@ export class ExtHostObjectExplorer implements ExtHostObjectExplorerShape {
|
||||
public $findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<sqlops.objectexplorer.ObjectExplorerNode[]> {
|
||||
return this._proxy.$findNodes(connectionId, type, schema, name, database, parentObjectNames).then(results => results.map(result => new ExtHostObjectExplorerNode(result, connectionId, this._proxy)));
|
||||
}
|
||||
|
||||
public $getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return this._proxy.$getNodeActions(connectionId, nodePath);
|
||||
}
|
||||
}
|
||||
|
||||
class ExtHostObjectExplorerNode implements sqlops.objectexplorer.ObjectExplorerNode {
|
||||
|
||||
@@ -15,6 +15,9 @@ import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadConnectionManagement)
|
||||
export class MainThreadConnectionManagement implements MainThreadConnectionManagementShape {
|
||||
@@ -28,6 +31,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@IEditorService private _workbenchEditorService: IEditorService,
|
||||
@IConnectionDialogService private _connectionDialogService: IConnectionDialogService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostConnectionManagement);
|
||||
@@ -54,7 +58,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
|
||||
public async $openConnectionDialog(providers: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: sqlops.IConnectionCompletionOptions): Promise<sqlops.connection.Connection> {
|
||||
let connectionProfile = await this._connectionDialogService.openDialogAndWait(this._connectionManagementService, { connectionType: 1, providers: providers }, initialConnectionProfile);
|
||||
const connection = connectionProfile ? {
|
||||
const connection = connectionProfile ? {
|
||||
connectionId: connectionProfile.id,
|
||||
options: connectionProfile.options,
|
||||
providerName: connectionProfile.providerName
|
||||
@@ -101,4 +105,23 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
};
|
||||
return connection;
|
||||
}
|
||||
|
||||
public $connect(connectionProfile: IConnectionProfile): Thenable<sqlops.ConnectionResult> {
|
||||
let profile = new ConnectionProfile(this._capabilitiesService, connectionProfile);
|
||||
profile.id = generateUuid();
|
||||
return this._connectionManagementService.connectAndSaveProfile(profile, undefined, {
|
||||
saveTheConnection: true,
|
||||
showDashboard: true,
|
||||
params: undefined,
|
||||
showConnectionDialogOnError: true,
|
||||
showFirewallRuleOnError: true
|
||||
}).then((result) => {
|
||||
return <sqlops.ConnectionResult>{
|
||||
connected: result.connected,
|
||||
connectionId: result.connected ? profile.id : undefined,
|
||||
errorCode: result.errorCode,
|
||||
errorMessage: result.errorMessage
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
32
src/sql/workbench/api/node/mainThreadExtensionManagement.ts
Normal file
32
src/sql/workbench/api/node/mainThreadExtensionManagement.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { SqlMainContext, MainThreadExtensionManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
|
||||
export class MainThreadExtensionManagement implements MainThreadExtensionManagementShape {
|
||||
|
||||
private _toDispose: IDisposable[];
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IExtensionManagementService private _extensionService: IExtensionManagementService
|
||||
) {
|
||||
this._toDispose = [];
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
}
|
||||
|
||||
public $install(vsixPath: string): Thenable<string> {
|
||||
return this._extensionService.install(vsixPath).then((value: void) => { return undefined; }, (reason: any) => { return reason ? reason.toString() : undefined; });
|
||||
}
|
||||
}
|
||||
@@ -78,4 +78,8 @@ export class MainThreadObjectExplorer implements MainThreadObjectExplorerShape {
|
||||
public $refresh(connectionId: string, nodePath: string): Thenable<sqlops.NodeInfo> {
|
||||
return this._objectExplorerService.refreshNodeInView(connectionId, nodePath).then(node => node.toNodeInfo());
|
||||
}
|
||||
|
||||
public $getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return this._objectExplorerService.getNodeActions(connectionId, nodePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import { ExtHostQueryEditor } from 'sql/workbench/api/node/extHostQueryEditor';
|
||||
import { ExtHostBackgroundTaskManagement } from './extHostBackgroundTaskManagement';
|
||||
import { ExtHostNotebook } from 'sql/workbench/api/node/extHostNotebook';
|
||||
import { ExtHostNotebookDocumentsAndEditors } from 'sql/workbench/api/node/extHostNotebookDocumentsAndEditors';
|
||||
import { ExtHostExtensionManagement } from 'sql/workbench/api/node/extHostExtensionManagement';
|
||||
|
||||
export interface ISqlExtensionApiFactory {
|
||||
vsCodeFactory(extension: IExtensionDescription): typeof vscode;
|
||||
@@ -77,6 +78,7 @@ export function createApiFactory(
|
||||
const extHostQueryEditor = rpcProtocol.set(SqlExtHostContext.ExtHostQueryEditor, new ExtHostQueryEditor(rpcProtocol));
|
||||
const extHostNotebook = rpcProtocol.set(SqlExtHostContext.ExtHostNotebook, new ExtHostNotebook(rpcProtocol));
|
||||
const extHostNotebookDocumentsAndEditors = rpcProtocol.set(SqlExtHostContext.ExtHostNotebookDocumentsAndEditors, new ExtHostNotebookDocumentsAndEditors(rpcProtocol));
|
||||
const extHostExtensionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostExtensionManagement, new ExtHostExtensionManagement(rpcProtocol));
|
||||
|
||||
|
||||
return {
|
||||
@@ -129,6 +131,9 @@ export function createApiFactory(
|
||||
},
|
||||
getUriForConnection(connectionId: string): Thenable<string> {
|
||||
return extHostConnectionManagement.$getUriForConnection(connectionId);
|
||||
},
|
||||
connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult> {
|
||||
return extHostConnectionManagement.$connect(connectionProfile);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -152,6 +157,9 @@ export function createApiFactory(
|
||||
},
|
||||
findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<sqlops.objectexplorer.ObjectExplorerNode[]> {
|
||||
return extHostObjectExplorer.$findNodes(connectionId, type, schema, name, database, parentObjectNames);
|
||||
},
|
||||
getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return extHostObjectExplorer.$getNodeActions(connectionId, nodePath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -421,6 +429,12 @@ export function createApiFactory(
|
||||
}
|
||||
};
|
||||
|
||||
const extensions: typeof sqlops.extensions = {
|
||||
install(vsixPath: string): Thenable<string> {
|
||||
return extHostExtensionManagement.$install(vsixPath);
|
||||
}
|
||||
};
|
||||
|
||||
const nb = {
|
||||
get notebookDocuments() {
|
||||
return extHostNotebookDocumentsAndEditors.getAllDocuments().map(doc => doc.document);
|
||||
@@ -483,7 +497,8 @@ export function createApiFactory(
|
||||
SqlThemeIcon: sqlExtHostTypes.SqlThemeIcon,
|
||||
TreeComponentItem: sqlExtHostTypes.TreeComponentItem,
|
||||
nb: nb,
|
||||
AzureResource: sqlExtHostTypes.AzureResource
|
||||
AzureResource: sqlExtHostTypes.AzureResource,
|
||||
extensions: extensions,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'sql/workbench/api/node/mainThreadModelViewDialog';
|
||||
import 'sql/workbench/api/node/mainThreadNotebook';
|
||||
import 'sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors';
|
||||
import 'sql/workbench/api/node/mainThreadAccountManagement';
|
||||
import 'sql/workbench/api/node/mainThreadExtensionManagement';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
export class SqlExtHostContribution implements IWorkbenchContribution {
|
||||
|
||||
@@ -546,6 +546,7 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
|
||||
$listDatabases(connectionId: string): Thenable<string[]>;
|
||||
$getConnectionString(connectionId: string, includePassword: boolean): Thenable<string>;
|
||||
$getUriForConnection(connectionId: string): Thenable<string>;
|
||||
$connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult>;
|
||||
}
|
||||
|
||||
export interface MainThreadCredentialManagementShape extends IDisposable {
|
||||
@@ -580,8 +581,8 @@ export const SqlMainContext = {
|
||||
MainThreadModelViewDialog: createMainId<MainThreadModelViewDialogShape>('MainThreadModelViewDialog'),
|
||||
MainThreadQueryEditor: createMainId<MainThreadQueryEditorShape>('MainThreadQueryEditor'),
|
||||
MainThreadNotebook: createMainId<MainThreadNotebookShape>('MainThreadNotebook'),
|
||||
MainThreadNotebookDocumentsAndEditors: createMainId<MainThreadNotebookDocumentsAndEditorsShape>('MainThreadNotebookDocumentsAndEditors')
|
||||
|
||||
MainThreadNotebookDocumentsAndEditors: createMainId<MainThreadNotebookDocumentsAndEditorsShape>('MainThreadNotebookDocumentsAndEditors'),
|
||||
MainThreadExtensionManagement: createMainId<MainThreadExtensionManagementShape>('MainThreadExtensionManagement')
|
||||
};
|
||||
|
||||
export const SqlExtHostContext = {
|
||||
@@ -602,7 +603,8 @@ export const SqlExtHostContext = {
|
||||
ExtHostModelViewDialog: createExtId<ExtHostModelViewDialogShape>('ExtHostModelViewDialog'),
|
||||
ExtHostQueryEditor: createExtId<ExtHostQueryEditorShape>('ExtHostQueryEditor'),
|
||||
ExtHostNotebook: createExtId<ExtHostNotebookShape>('ExtHostNotebook'),
|
||||
ExtHostNotebookDocumentsAndEditors: createExtId<ExtHostNotebookDocumentsAndEditorsShape>('ExtHostNotebookDocumentsAndEditors')
|
||||
ExtHostNotebookDocumentsAndEditors: createExtId<ExtHostNotebookDocumentsAndEditorsShape>('ExtHostNotebookDocumentsAndEditors'),
|
||||
ExtHostExtensionManagement: createExtId<ExtHostExtensionManagementShape>('ExtHostExtensionManagement')
|
||||
};
|
||||
|
||||
export interface MainThreadDashboardShape extends IDisposable {
|
||||
@@ -708,6 +710,7 @@ export interface MainThreadObjectExplorerShape extends IDisposable {
|
||||
$isExpanded(connectionId: string, nodePath: string): Thenable<boolean>;
|
||||
$findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<sqlops.NodeInfo[]>;
|
||||
$refresh(connectionId: string, nodePath: string): Thenable<sqlops.NodeInfo>;
|
||||
$getNodeActions(connectionId: string, nodePath: string): Thenable<string[]>;
|
||||
}
|
||||
|
||||
export interface ExtHostModelViewDialogShape {
|
||||
@@ -837,4 +840,12 @@ export interface MainThreadNotebookDocumentsAndEditorsShape extends IDisposable
|
||||
$trySaveDocument(uri: UriComponents): Thenable<boolean>;
|
||||
$tryShowNotebookDocument(resource: UriComponents, options: INotebookShowOptions): TPromise<string>;
|
||||
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleNotebookEditOperation[], opts: IUndoStopOptions): TPromise<boolean>;
|
||||
}
|
||||
|
||||
export interface ExtHostExtensionManagementShape {
|
||||
$install(vsixPath: string): Thenable<string>;
|
||||
}
|
||||
|
||||
export interface MainThreadExtensionManagementShape extends IDisposable {
|
||||
$install(vsixPath: string): Thenable<string>;
|
||||
}
|
||||
Reference in New Issue
Block a user