Change shutdown listeners (#4282)

* change shutdown to use proper notification

* change to use storage service

* remove unused imports

* fix test

* change shutdown methods to private

* remove unusde imports

* fix tests

* formatting
This commit is contained in:
Anthony Dresser
2019-03-13 15:15:51 -07:00
committed by GitHub
parent 08d4cc9690
commit b6584c9ddf
16 changed files with 51 additions and 43 deletions

View File

@@ -35,7 +35,6 @@ export interface IAccountManagementService {
// SERVICE MANAGEMENT METHODS /////////////////////////////////////////
registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): void;
shutdown(): void;
unregisterProvider(providerMetadata: azdata.AccountProviderMetadata): void;
// EVENTING ////////////////////////////////////////////////////////////

View File

@@ -131,6 +131,8 @@ export class CapabilitiesService extends Disposable implements ICapabilitiesServ
this.cleanupProviders();
});
_storageService.onWillSaveState(() => this.shutdown());
this._register(extentionManagementService.onDidUninstallExtension(({ identifier }) => {
const connectionProvider = 'connectionProvider';
let extensionid = getIdFromLocalExtensionId(identifier.id);
@@ -239,7 +241,7 @@ export class CapabilitiesService extends Disposable implements ICapabilitiesServ
}
}
public shutdown(): void {
private shutdown(): void {
this._momento.saveMemento();
}
}

View File

@@ -141,6 +141,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
this.onConnectionChanged(() => this.refreshEditorTitles());
this.onConnect(() => this.refreshEditorTitles());
this.onDisconnect(() => this.refreshEditorTitles());
_storageService.onWillSaveState(() => this.shutdown());
}
public providerRegistered(providerId: string): boolean {
@@ -936,7 +937,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
public onIntelliSenseCacheComplete(handle: number, connectionUri: string): void {
}
public shutdown(): void {
private shutdown(): void {
this._connectionStore.clearActiveConnections();
this._connectionMemento.saveMemento();
}

View File

@@ -51,7 +51,7 @@ export class AccountManagementService implements IAccountManagementService {
private _mementoObj: object,
@IInstantiationService private _instantiationService: IInstantiationService,
@IStorageService private _storageService: IStorageService,
@IClipboardService private _clipboardService: IClipboardService,
@IClipboardService private _clipboardService: IClipboardService
) {
// Create the account store
if (!this._mementoObj) {
@@ -65,6 +65,8 @@ export class AccountManagementService implements IAccountManagementService {
this._removeAccountProviderEmitter = new Emitter<azdata.AccountProviderMetadata>();
this._updateAccountListEmitter = new Emitter<UpdateAccountListEventParams>();
_storageService.onWillSaveState(() => this.shutdown());
// Register status bar item
let statusbarDescriptor = new statusbar.StatusbarItemDescriptor(
AccountListStatusbarItem,
@@ -367,7 +369,7 @@ export class AccountManagementService implements IAccountManagementService {
/**
* Handler for when shutdown of the application occurs. Writes out the memento.
*/
public shutdown(): void {
private shutdown(): void {
if (this._mementoContext) {
this._mementoContext.saveMemento();
}

View File

@@ -67,8 +67,6 @@ export interface INotebookService {
listNotebookEditors(): INotebookEditor[];
shutdown(): void;
getMimeRegistry(): RenderMimeRegistry;
renameNotebookEditor(oldUri: URI, newUri: URI, currentEditor: INotebookEditor): void;
@@ -108,4 +106,4 @@ export interface INotebookEditor {
isVisible(): boolean;
executeEdits(edits: ISingleNotebookEditOperation[]): boolean;
runCell(cell: ICellModel): Promise<boolean>;
}
}

View File

@@ -32,10 +32,10 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { NotebookEditor } from 'sql/parts/notebook/notebookEditor';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { registerNotebookThemes } from 'sql/parts/notebook/notebookStyles';
import { IQueryManagementService } from 'sql/platform/query/common/queryManagement';
import { ILanguageMagic, notebookConstants } from 'sql/parts/notebook/models/modelInterfaces';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { SqlNotebookProvider } from 'sql/workbench/services/notebook/sql/sqlNotebookProvider';
export interface NotebookProviderProperties {
@@ -95,6 +95,7 @@ export class NotebookService extends Disposable implements INotebookService {
private _overrideEditorThemeSetting: boolean;
constructor(
@ILifecycleService lifecycleService: ILifecycleService,
@IStorageService private _storageService: IStorageService,
@IExtensionService extensionService: IExtensionService,
@IExtensionManagementService extensionManagementService: IExtensionManagementService,
@@ -103,7 +104,6 @@ export class NotebookService extends Disposable implements INotebookService {
@IEditorService private readonly _editorService: IEditorService,
@IEditorGroupsService private readonly _editorGroupsService: IEditorGroupsService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IThemeService private readonly _themeService: IThemeService,
@IQueryManagementService private readonly _queryManagementService
) {
super();
@@ -128,6 +128,8 @@ export class NotebookService extends Disposable implements INotebookService {
if (extensionManagementService) {
this._register(extensionManagementService.onDidUninstallExtension(({ identifier }) => this.removeContributedProvidersFromCache(identifier, extensionService)));
}
lifecycleService.onWillShutdown(() => this.shutdown());
this.hookContextKeyListeners();
this.hookNotebookThemesAndConfigListener();
}
@@ -284,7 +286,7 @@ export class NotebookService extends Disposable implements INotebookService {
return this._providerToStandardKernels.get(provider.toUpperCase());
}
public shutdown(): void {
private shutdown(): void {
this._managersMap.forEach(manager => {
manager.forEach(m => {
if (m.serverManager) {
@@ -469,4 +471,4 @@ export class NotebookService extends Disposable implements INotebookService {
}
});
}
}
}

View File

@@ -13,6 +13,7 @@ import { ContextKeyServiceStub } from 'sqltest/stubs/contextKeyServiceStub';
import { ErrorMessageServiceStub } from 'sqltest/stubs/errorMessageServiceStub';
import * as TypeMoq from 'typemoq';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
suite('ConnectionDialogService tests', () => {
@@ -24,7 +25,7 @@ suite('ConnectionDialogService tests', () => {
let errorMessageService = getMockErrorMessageService();
connectionDialogService = new ConnectionDialogService(undefined, undefined, undefined, errorMessageService.object,
undefined, undefined, undefined);
mockConnectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Strict, {}, {});
mockConnectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Strict, {}, {}, new TestStorageService());
(connectionDialogService as any)._connectionManagementService = mockConnectionManagementService.object;
mockConnectionDialog = TypeMoq.Mock.ofType(ConnectionDialogWidget, TypeMoq.MockBehavior.Strict,
undefined,
@@ -87,4 +88,4 @@ suite('ConnectionDialogService tests', () => {
done(err);
});
});
});
});

View File

@@ -35,6 +35,7 @@ import * as TypeMoq from 'typemoq';
import { IConnectionProfileGroup, ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { AccountManagementTestService } from 'sqltest/stubs/accountManagementStubs';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
suite('SQL ConnectionManagementService tests', () => {
@@ -149,7 +150,7 @@ suite('SQL ConnectionManagementService tests', () => {
let connectionManagementService = new ConnectionManagementService(
undefined,
connectionStore.object,
undefined,
new TestStorageService(),
connectionDialogService.object,
undefined,
undefined,
@@ -919,4 +920,4 @@ suite('SQL ConnectionManagementService tests', () => {
assert.equal(profileWithCredentials.userName, username);
assert.equal(profileWithCredentials.options['azureAccountToken'], testToken);
});
});
});

View File

@@ -16,6 +16,7 @@ import { IDbColumn, BatchSummary, QueryExecuteSubsetResult, ResultSetSubset } fr
import { EventEmitter } from 'sql/base/common/eventEmitter';
import { equal } from 'assert';
import { Mock, MockBehavior, It } from 'typemoq';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
const testData: string[][] = [
['1', '2', '3', '4'],
@@ -38,7 +39,7 @@ suite('Insights Dialog Controller Tests', () => {
instMoq.setup(x => x.createInstance(It.isValue(QueryRunner), It.isAny()))
.returns(() => runner);
let connMoq = Mock.ofType(ConnectionManagementService, MockBehavior.Strict, {}, {});
let connMoq = Mock.ofType(ConnectionManagementService, MockBehavior.Strict, {}, {}, new TestStorageService());
connMoq.setup(x => x.connect(It.isAny(), It.isAny()))
.returns(() => Promise.resolve(undefined));

View File

@@ -27,6 +27,7 @@ import { Memento } from 'vs/workbench/common/memento';
import { Emitter } from 'vs/base/common/event';
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
let expectedNotebookContent: nb.INotebookContents = {
cells: [{
@@ -86,7 +87,7 @@ suite('notebook model', function (): void {
capabilitiesService = TypeMoq.Mock.ofType(CapabilitiesTestService);
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
memento.setup(x => x.getMemento(TypeMoq.It.isAny())).returns(() => void 0);
queryConnectionService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined);
queryConnectionService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined, new TestStorageService());
queryConnectionService.callBase = true;
defaultModelOptions = {
notebookUri: defaultUri,

View File

@@ -84,7 +84,7 @@ suite('SQL QueryAction Tests', () => {
let isConnectedReturnValue: boolean = false;
// ... Mock "isConnected in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnectedReturnValue);
// ... Create an editor
@@ -125,7 +125,7 @@ suite('SQL QueryAction Tests', () => {
.returns(() => TPromise.as(none));
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, undefined, connectionDialogService.object);
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService(), connectionDialogService.object);
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
@@ -176,14 +176,14 @@ suite('SQL QueryAction Tests', () => {
countCalledRunQuery++;
});
let queryEditor: TypeMoq.Mock<QueryEditor> = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(), undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService());
undefined, undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService());
queryEditor.setup(x => x.currentQueryInput).returns(() => queryInput.object);
queryEditor.setup(x => x.getSelection()).returns(() => undefined);
queryEditor.setup(x => x.getSelection(false)).returns(() => undefined);
queryEditor.setup(x => x.isSelectionEmpty()).returns(() => isSelectionEmpty);
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => true);
@@ -243,14 +243,14 @@ suite('SQL QueryAction Tests', () => {
// ... Mock "getSelection" in QueryEditor
let queryEditor: TypeMoq.Mock<QueryEditor> = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(), undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService());
undefined, undefined, undefined, undefined, undefined, undefined, undefined, new TestStorageService());
queryEditor.setup(x => x.currentQueryInput).returns(() => queryInput.object);
queryEditor.setup(x => x.getSelection()).returns(() => {
return selectionToReturnInGetSelection;
});
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, undefined, connectionDialogService.object);
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService(), connectionDialogService.object);
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
@@ -316,7 +316,7 @@ suite('SQL QueryAction Tests', () => {
let calledCancelQuery: boolean = false;
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
// ... Mock QueryModelService
@@ -349,7 +349,7 @@ suite('SQL QueryAction Tests', () => {
let countCalledDisconnectEditor: number = 0;
// ... Mock "isConnected" and "disconnectEditor" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
connectionManagementService.setup(x => x.disconnectEditor(TypeMoq.It.isAny())).callback(() => {
countCalledDisconnectEditor++;
@@ -388,7 +388,7 @@ suite('SQL QueryAction Tests', () => {
.returns(() => TPromise.as(none));
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, undefined, connectionDialogService.object);
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService(), connectionDialogService.object);
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
@@ -434,7 +434,7 @@ suite('SQL QueryAction Tests', () => {
.returns(() => TPromise.as(none));
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, undefined, connectionDialogService.object);
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService(), connectionDialogService.object);
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
@@ -469,7 +469,7 @@ suite('SQL QueryAction Tests', () => {
let databaseName: string = undefined;
// ... Mock "isConnected" in ConnectionManagementService
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAnyString())).returns(() => isConnected);
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{
@@ -506,7 +506,7 @@ suite('SQL QueryAction Tests', () => {
// ... Create mock connection management service
let databaseName = 'foobar';
let cms = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let cms = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
cms.callBase = true;
cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
@@ -530,7 +530,7 @@ suite('SQL QueryAction Tests', () => {
// ... Create mock connection management service that will not claim it's connected
let databaseName = 'foobar';
let cms = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let cms = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
cms.callBase = true;
cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
cms.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
@@ -558,7 +558,7 @@ suite('SQL QueryAction Tests', () => {
let dbChangedEmitter = new Emitter<IConnectionParams>();
// ... Create mock connection management service
let cms = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {});
let cms = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, {}, {}, new TestStorageService());
cms.callBase = true;
cms.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);

View File

@@ -140,7 +140,7 @@ suite('SQL QueryEditor Tests', () => {
// Mock ConnectionManagementService
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
memento.setup(x => x.getMemento(TypeMoq.It.isAny())).returns(() => void 0);
connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined);
connectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined, new TestStorageService());
connectionManagementService.callBase = true;
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false);
connectionManagementService.setup(x => x.disconnectEditor(TypeMoq.It.isAny())).returns(() => void 0);
@@ -329,7 +329,7 @@ suite('SQL QueryEditor Tests', () => {
// Mock ConnectionManagementService but don't set connected state
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
memento.setup(x => x.getMemento(TypeMoq.It.isAny())).returns(() => void 0);
queryConnectionService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined);
queryConnectionService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined, new TestStorageService());
queryConnectionService.callBase = true;
queryConnectionService.setup(x => x.disconnectEditor(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => void 0);
@@ -408,4 +408,4 @@ suite('SQL QueryEditor Tests', () => {
done();
});
});
});
});

View File

@@ -11,6 +11,7 @@ import { ConnectionManagementService } from 'sql/platform/connection/common/conn
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
import * as TypeMoq from 'typemoq';
@@ -22,7 +23,7 @@ suite('ServerTreeView onAddConnectionProfile handler tests', () => {
setup(() => {
let instantiationService = new TestInstantiationService();
let mockConnectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Strict, {}, {});
let mockConnectionManagementService = TypeMoq.Mock.ofType(ConnectionManagementService, TypeMoq.MockBehavior.Strict, {}, {}, new TestStorageService());
mockConnectionManagementService.setup(x => x.getConnectionGroups()).returns(x => []);
serverTreeView = new ServerTreeView(mockConnectionManagementService.object, instantiationService, undefined, undefined, undefined, undefined);
let tree = <Tree>{
@@ -90,4 +91,4 @@ suite('ServerTreeView onAddConnectionProfile handler tests', () => {
mockTree.verify(x => x.clearSelection(), TypeMoq.Times.never());
mockTree.verify(x => x.select(TypeMoq.It.isAny()), TypeMoq.Times.never());
});
});
});

View File

@@ -16,6 +16,7 @@ import { IAccountStore } from 'sql/platform/accountManagement/common/interfaces'
import { AccountProviderStub } from 'sqltest/stubs/accountManagementStubs';
import { EventVerifierSingle } from 'sqltest/utils/eventVerifier';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
// SUITE CONSTANTS /////////////////////////////////////////////////////////
const hasAccountProvider: azdata.AccountProviderMetadata = {
@@ -566,7 +567,7 @@ function getTestState(): AccountManagementState {
let mockMemento = {};
// Create the account management service
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, null, null);
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), null);
// Wire up event handlers
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();

View File

@@ -19,6 +19,7 @@ import { INotebookProvider } from 'sql/workbench/services/notebook/common/notebo
import { INotebookManagerDetails, INotebookSessionDetails, INotebookKernelDetails, INotebookFutureDetails } from 'sql/workbench/api/common/sqlExtHostTypes';
import { LocalContentManager } from 'sql/workbench/services/notebook/node/localContentManager';
import { ContextKeyServiceStub } from 'sqltest/stubs/contextKeyServiceStub';
import { TestLifecycleService } from 'vs/workbench/test/workbenchTestServices';
suite('MainThreadNotebook Tests', () => {
@@ -27,12 +28,13 @@ suite('MainThreadNotebook Tests', () => {
let notebookUri: URI;
let mockNotebookService: TypeMoq.Mock<NotebookService>;
let providerId = 'TestProvider';
setup(() => {
mockProxy = TypeMoq.Mock.ofType(ExtHostNotebookStub);
let extContext = <IExtHostContext>{
getProxy: proxyType => mockProxy.object
};
mockNotebookService = TypeMoq.Mock.ofType(NotebookService, undefined, undefined, undefined, undefined, undefined, new ContextKeyServiceStub());
mockNotebookService = TypeMoq.Mock.ofType(NotebookService, undefined, new TestLifecycleService(), undefined, undefined, undefined, undefined, new ContextKeyServiceStub());
notebookUri = URI.parse('file:/user/default/my.ipynb');
mainThreadNotebook = new MainThreadNotebook(extContext, mockNotebookService.object);
});

View File

@@ -585,10 +585,6 @@ export class Workbench extends Disposable implements IPartService {
serviceCollection.set(ICommandLineProcessing, this.instantiationService.createInstance(CommandLineService));
serviceCollection.set(IDacFxService, this.instantiationService.createInstance(DacFxService));
this._register(toDisposable(() => connectionManagementService.shutdown()));
this._register(toDisposable(() => accountManagementService.shutdown()));
this._register(toDisposable(() => notebookService.shutdown()));
this._register(toDisposable(() => capabilitiesService.shutdown()));
// {{SQL CARBON EDIT}} - End
}