mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 17:23:42 -05:00
SQL Edge deployment using Azure IoT hub (#11202)
* Azure IoT deployment type * more updates * organize fields * a few more improvements * resolve merge issues * new rg improvement * fix tests * comments 1 * comments 2
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IAccountManagementService } from 'sql/platform/accounts/common/interfaces';
|
||||
|
||||
CommandsRegistry.registerCommand('workbench.actions.modal.linkedAccount', accessor => {
|
||||
CommandsRegistry.registerCommand('workbench.actions.modal.linkedAccount', async accessor => {
|
||||
const accountManagementService = accessor.get(IAccountManagementService);
|
||||
accountManagementService.openAccountListDialog();
|
||||
await accountManagementService.openAccountListDialog();
|
||||
});
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
// UI METHODS //////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Opens the account list dialog
|
||||
* @return Promise that finishes when the account list dialog opens
|
||||
* @return Promise that finishes when the account list dialog closes
|
||||
*/
|
||||
public openAccountListDialog(): Thenable<void> {
|
||||
let self = this;
|
||||
@@ -308,9 +308,8 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
if (!self._accountDialogController) {
|
||||
self._accountDialogController = self._instantiationService.createInstance(AccountDialogController);
|
||||
}
|
||||
|
||||
self._accountDialogController.openAccountDialog();
|
||||
resolve();
|
||||
self._accountDialogController.accountDialog.onCloseEvent(resolve);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
|
||||
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { EventVerifierSingle } from 'sql/base/test/common/event';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { AccountDialog } from 'sql/workbench/services/accountManagement/browser/accountDialog';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
// SUITE CONSTANTS /////////////////////////////////////////////////////////
|
||||
const hasAccountProvider: azdata.AccountProviderMetadata = {
|
||||
@@ -398,7 +400,14 @@ suite('Account Management Service Tests:', () => {
|
||||
|
||||
// ... Add mocking for instantiating an account dialog controller
|
||||
let mockDialogController = TypeMoq.Mock.ofType(AccountDialogController);
|
||||
let mockAccountDialog = {};
|
||||
mockDialogController.setup(x => x.openAccountDialog());
|
||||
mockDialogController.setup(x => x.accountDialog).returns(() => <AccountDialog>mockAccountDialog);
|
||||
let mockAccountDialogCloseEvent = new Emitter<void>();
|
||||
mockAccountDialog['onCloseEvent'] = mockAccountDialogCloseEvent.event;
|
||||
setTimeout(() => {
|
||||
mockAccountDialogCloseEvent.fire();
|
||||
}, 1000);
|
||||
state.instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountDialogController)))
|
||||
.returns(() => mockDialogController.object);
|
||||
|
||||
@@ -421,13 +430,25 @@ suite('Account Management Service Tests:', () => {
|
||||
|
||||
// ... Add mocking for instantiating an account dialog controller
|
||||
let mockDialogController = TypeMoq.Mock.ofType(AccountDialogController);
|
||||
let mockAccountDialog = {};
|
||||
mockDialogController.setup(x => x.openAccountDialog());
|
||||
mockDialogController.setup(x => x.accountDialog).returns(() => <AccountDialog>mockAccountDialog);
|
||||
let mockAccountDialogCloseEvent = new Emitter<void>();
|
||||
mockAccountDialog['onCloseEvent'] = mockAccountDialogCloseEvent.event;
|
||||
setTimeout(() => {
|
||||
mockAccountDialogCloseEvent.fire();
|
||||
}, 1000);
|
||||
state.instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountDialogController)))
|
||||
.returns(() => mockDialogController.object);
|
||||
|
||||
// If: I open the account dialog for a second time
|
||||
return state.accountManagementService.openAccountListDialog()
|
||||
.then(() => state.accountManagementService.openAccountListDialog())
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
mockAccountDialogCloseEvent.fire();
|
||||
}, 1000);
|
||||
state.accountManagementService.openAccountListDialog();
|
||||
})
|
||||
.then(() => {
|
||||
// Then:
|
||||
// ... The instantiation service should have only been called once
|
||||
|
||||
Reference in New Issue
Block a user