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:
Alan Ren
2020-07-07 10:36:26 -07:00
committed by GitHub
parent 3084867d7e
commit 3cf48fb207
9 changed files with 798 additions and 38 deletions

View File

@@ -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();
});

View File

@@ -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);
}

View File

@@ -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