本文整理汇总了TypeScript中sql/parts/objectExplorer/common/objectExplorerService.ObjectExplorerService.onUpdateObjectExplorerNodes方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ObjectExplorerService.onUpdateObjectExplorerNodes方法的具体用法?TypeScript ObjectExplorerService.onUpdateObjectExplorerNodes怎么用?TypeScript ObjectExplorerService.onUpdateObjectExplorerNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql/parts/objectExplorer/common/objectExplorerService.ObjectExplorerService
的用法示例。
在下文中一共展示了ObjectExplorerService.onUpdateObjectExplorerNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setup
//.........这里部分代码省略.........
valueType: ServiceOptionType.string
},
{
name: 'encrypt',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
isIdentity: false,
isRequired: false,
specialValueType: undefined,
valueType: ServiceOptionType.string
}
]
};
let capabilitiesService = new CapabilitiesTestService();
capabilitiesService.capabilities['MSSQL'] = { connection: sqlProvider };
connection = new ConnectionProfile(capabilitiesService, {
connectionName: 'newName',
savePassword: false,
groupFullName: 'testGroup',
serverName: 'testServerName',
databaseName: 'testDatabaseName',
authenticationType: 'inetgrated',
password: 'test',
userName: 'testUsername',
groupId: undefined,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'testID'
});
conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
connectionToFail = new ConnectionProfile(capabilitiesService, {
connectionName: 'newName2',
savePassword: false,
groupFullName: 'testGroup',
serverName: 'testServerName2',
databaseName: 'testDatabaseName2',
authenticationType: 'inetgrated',
password: 'test',
userName: 'testUsername',
groupId: undefined,
providerName: 'MSSQL',
options: {},
saveProfile: true,
id: 'testID2'
});
conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
conProfGroup.connections = [connection];
connectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
connectionManagementService.setup(x => x.getConnectionGroups()).returns(() => [conProfGroup]);
connectionManagementService.setup(x => x.getActiveConnections()).returns(() => [connection]);
connectionManagementService.setup(x => x.addSavedPassword(TypeMoq.It.isAny())).returns(() => new Promise<ConnectionProfile>((resolve) => {
resolve(connection);
}));
connectionManagementService.setup(x => x.getCapabilities('MSSQL')).returns(() => undefined);
let extensionManagementServiceMock = {
getInstalled: () => {
return Promise.resolve([]);
}
};
objectExplorerService = new ObjectExplorerService(connectionManagementService.object, undefined, capabilitiesService);
objectExplorerService.registerProvider('MSSQL', sqlOEProvider.object);
sqlOEProvider.setup(x => x.createNewSession(TypeMoq.It.is<sqlops.ConnectionInfo>(x => x.options['serverName'] === connection.serverName))).returns(() => new Promise<any>((resolve) => {
resolve(response);
}));
sqlOEProvider.setup(x => x.createNewSession(TypeMoq.It.is<sqlops.ConnectionInfo>(x => x.options['serverName'] === connectionToFail.serverName))).returns(() => new Promise<any>((resolve) => {
resolve(failedResponse);
}));
sqlOEProvider.setup(x => x.expandNode(TypeMoq.It.isAny())).callback(() => {
objectExplorerService.onNodeExpanded(1, objectExplorerExpandInfo);
}).returns(() => TPromise.as(true));
sqlOEProvider.setup(x => x.refreshNode(TypeMoq.It.isAny())).callback(() => {
objectExplorerService.onNodeExpanded(1, objectExplorerExpandInfoRefresh);
}).returns(() => TPromise.as(true));
sqlOEProvider.setup(x => x.closeSession(TypeMoq.It.isAny())).returns(() => TPromise.as(objectExplorerCloseSessionResponse));
objectExplorerService.onUpdateObjectExplorerNodes(args => {
if (args && args.errorMessage !== undefined) {
numberOfFailedSession++;
}
});
serverTreeView = TypeMoq.Mock.ofInstance({
setExpandedState: (element, expandedState) => Promise.resolve() as Thenable<void>,
reveal: element => Promise.resolve() as Thenable<void>,
setSelected: (element, selected, clearOtherSelections) => undefined,
isExpanded: element => undefined,
onSelectionOrFocusChange: Event.None,
refreshElement: (element) => Promise.resolve() as Thenable<void>
} as ServerTreeView);
});