mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
fix menu item not showing up for non-English languages (#20224)
* new object type property * vbump sts * fix azure tree * mark as optional * Fix test errors
This commit is contained in:
@@ -80,8 +80,8 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Strict, connectionManagementService);
|
||||
objectExplorerService.callBase = true;
|
||||
objectExplorerService.setup(x => x.getTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve(getTreeNodeReturnVal));
|
||||
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => new TreeNode('', '', false, '', '', '', undefined, undefined, undefined, undefined));
|
||||
objectExplorerService.setup(x => x.getObjectExplorerNode(undefined)).returns(() => new TreeNode('', '', false, '', '', '', undefined, undefined, undefined, undefined));
|
||||
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => new TreeNode('', '', '', false, '', '', '', undefined, undefined, undefined, undefined));
|
||||
objectExplorerService.setup(x => x.getObjectExplorerNode(undefined)).returns(() => new TreeNode('', '', '', false, '', '', '', undefined, undefined, undefined, undefined));
|
||||
objectExplorerService.setup(x => x.onUpdateObjectExplorerNodes).returns(() => new Emitter<ObjectExplorerNodeEventArgs>().event);
|
||||
|
||||
objectExplorerService.setup(x => x.onUpdateObjectExplorerNodes).returns(() => new Emitter<ObjectExplorerNodeEventArgs>().event);
|
||||
@@ -192,7 +192,7 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
saveProfile: true,
|
||||
id: 'testId'
|
||||
});
|
||||
let treeNode = new TreeNode(NodeType.Database, 'db node', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||
let treeNode = new TreeNode(NodeType.Database, '', 'db node', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||
treeNode.connection = connection;
|
||||
let connectionManagementService = createConnectionManagementService(isConnectedReturnValue, connection);
|
||||
let objectExplorerService = createObjectExplorerService(connectionManagementService.object, treeNode);
|
||||
@@ -409,6 +409,7 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
rootNode: {
|
||||
nodePath: 'testServerName\tables',
|
||||
nodeType: NodeType.Folder,
|
||||
objectType: '',
|
||||
label: 'Tables',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -419,11 +420,11 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
errorMessage: ''
|
||||
};
|
||||
|
||||
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
let tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
tablesNode.session = objectExplorerSession;
|
||||
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table1Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
tablesNode.children = [table1Node, table2Node];
|
||||
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Loose, connectionManagementService.object);
|
||||
objectExplorerService.callBase = true;
|
||||
@@ -495,6 +496,7 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
rootNode: {
|
||||
nodePath: 'testServerName\tables',
|
||||
nodeType: NodeType.Folder,
|
||||
objectType: '',
|
||||
label: 'Tables',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -505,11 +507,11 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
errorMessage: ''
|
||||
};
|
||||
|
||||
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
let tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
tablesNode.session = objectExplorerSession;
|
||||
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table1Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
tablesNode.children = [table1Node, table2Node];
|
||||
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Loose, connectionManagementService.object);
|
||||
objectExplorerService.callBase = true;
|
||||
@@ -582,6 +584,7 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
rootNode: {
|
||||
nodePath: 'testServerName\tables',
|
||||
nodeType: NodeType.Folder,
|
||||
objectType: '',
|
||||
label: 'Tables',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -592,11 +595,11 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
errorMessage: ''
|
||||
};
|
||||
|
||||
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
let tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
tablesNode.session = objectExplorerSession;
|
||||
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table1Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
tablesNode.children = [table1Node, table2Node];
|
||||
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Loose, connectionManagementService.object);
|
||||
objectExplorerService.callBase = true;
|
||||
@@ -678,6 +681,7 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
rootNode: {
|
||||
nodePath: 'testServerName\tables',
|
||||
nodeType: NodeType.Folder,
|
||||
objectType: '',
|
||||
label: 'Tables',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -688,11 +692,11 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
errorMessage: ''
|
||||
};
|
||||
|
||||
let tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
let tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName\Db1\tables', '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
tablesNode.session = objectExplorerSession;
|
||||
let table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table1Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
let table2Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\tables\dbo.Table1', '', '', tablesNode, null, undefined, undefined);
|
||||
tablesNode.children = [table1Node, table2Node];
|
||||
let objectExplorerService = TypeMoq.Mock.ofType(ObjectExplorerService, TypeMoq.MockBehavior.Loose, connectionManagementService.object);
|
||||
objectExplorerService.callBase = true;
|
||||
|
||||
@@ -42,6 +42,7 @@ const connection: azdata.IConnectionProfile = {
|
||||
|
||||
const nodeInfo: azdata.NodeInfo = {
|
||||
nodePath: 'MyServer',
|
||||
objectType: '',
|
||||
nodeStatus: '',
|
||||
nodeSubType: '',
|
||||
nodeType: 'Server',
|
||||
@@ -51,7 +52,7 @@ const nodeInfo: azdata.NodeInfo = {
|
||||
errorMessage: ''
|
||||
};
|
||||
|
||||
const treeNode = new TreeNode(NodeType.Database, 'db node', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||
const treeNode = new TreeNode(NodeType.Database, '', 'db node', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||
const oeActionArgs: ObjectExplorerActionsContext = { connectionProfile: connection, isConnectionNode: false, nodeInfo: nodeInfo };
|
||||
|
||||
let instantiationService: IInstantiationService;
|
||||
|
||||
@@ -38,6 +38,7 @@ export class MssqlNodeContext extends Disposable {
|
||||
static IsWindows = new RawContextKey<boolean>('isWindows', isWindows);
|
||||
static IsCloud = new RawContextKey<boolean>('isCloud', false);
|
||||
static NodeType = new RawContextKey<string>('nodeType', undefined);
|
||||
static ObjectType = new RawContextKey<string>('objectType', undefined);
|
||||
static NodeLabel = new RawContextKey<string>('nodeLabel', undefined);
|
||||
static EngineEdition = new RawContextKey<number>('engineEdition', DatabaseEngineEdition.Unknown);
|
||||
static CanOpenInAzurePortal = new RawContextKey<boolean>('canOpenInAzurePortal', false);
|
||||
@@ -53,6 +54,7 @@ export class MssqlNodeContext extends Disposable {
|
||||
private nodeProviderKey!: IContextKey<string>;
|
||||
private isCloudKey!: IContextKey<boolean>;
|
||||
private nodeTypeKey!: IContextKey<string>;
|
||||
private objectTypeKey!: IContextKey<string>;
|
||||
private nodeLabelKey!: IContextKey<string>;
|
||||
private isDatabaseOrServerKey!: IContextKey<boolean>;
|
||||
private engineEditionKey!: IContextKey<number>;
|
||||
@@ -96,6 +98,7 @@ export class MssqlNodeContext extends Disposable {
|
||||
if (node.label) {
|
||||
this.nodeLabelKey.set(node.label.label);
|
||||
}
|
||||
this.objectTypeKey.set(node.nodeInfo?.objectType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +106,7 @@ export class MssqlNodeContext extends Disposable {
|
||||
this.isCloudKey = MssqlNodeContext.IsCloud.bindTo(this.contextKeyService);
|
||||
this.engineEditionKey = MssqlNodeContext.EngineEdition.bindTo(this.contextKeyService);
|
||||
this.nodeTypeKey = MssqlNodeContext.NodeType.bindTo(this.contextKeyService);
|
||||
this.objectTypeKey = MssqlNodeContext.ObjectType.bindTo(this.contextKeyService);
|
||||
this.nodeLabelKey = MssqlNodeContext.NodeLabel.bindTo(this.contextKeyService);
|
||||
this.isDatabaseOrServerKey = MssqlNodeContext.IsDatabaseOrServer.bindTo(this.contextKeyService);
|
||||
this.canScriptAsSelectKey = MssqlNodeContext.CanScriptAsSelect.bindTo(this.contextKeyService);
|
||||
|
||||
@@ -469,6 +469,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
let allNodes: azdata.NodeInfo[] = [];
|
||||
let errorNode: azdata.NodeInfo = {
|
||||
nodePath: nodePath,
|
||||
objectType: 'error',
|
||||
label: 'Error',
|
||||
errorMessage: '',
|
||||
nodeType: 'error',
|
||||
@@ -625,7 +626,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
}
|
||||
}
|
||||
|
||||
let node = new TreeNode(nodeInfo.nodeType, nodeInfo.label, isLeaf, nodeInfo.nodePath,
|
||||
let node = new TreeNode(nodeInfo.nodeType, nodeInfo.objectType, nodeInfo.label, isLeaf, nodeInfo.nodePath,
|
||||
nodeInfo.nodeSubType!, nodeInfo.nodeStatus, parent, nodeInfo.metadata, nodeInfo.iconType, nodeInfo.icon, {
|
||||
getChildren: (treeNode?: TreeNode) => this.getChildren(treeNode),
|
||||
isExpanded: treeNode => this.isExpanded(treeNode),
|
||||
|
||||
@@ -142,7 +142,7 @@ export class OEShimService extends Disposable implements IOEShimService {
|
||||
|
||||
const sessionId = await this.getOrCreateSession(viewId, node);
|
||||
const requestHandle = this.nodeHandleMap.get(generateNodeMapKey(viewId, node)) || node.handle;
|
||||
const treeNode = new TreeNode(undefined!, undefined!, undefined!, requestHandle, undefined!); // hack since this entire system is a hack anyways
|
||||
const treeNode = new TreeNode(undefined!, undefined!, undefined!, undefined!, requestHandle, undefined!); // hack since this entire system is a hack anyways
|
||||
treeNode.connection = new ConnectionProfile(this.capabilities, node.payload);
|
||||
const childrenNodes = await this.oe.refreshTreeNode({
|
||||
success: true,
|
||||
@@ -186,6 +186,7 @@ export class OEShimService extends Disposable implements IOEShimService {
|
||||
const nodeInfo: azdata.NodeInfo = {
|
||||
nodePath: nodePath,
|
||||
nodeType: node.nodeTypeId,
|
||||
objectType: node.objectType,
|
||||
nodeSubType: node.nodeSubType,
|
||||
nodeStatus: node.nodeStatus,
|
||||
label: node.label,
|
||||
|
||||
@@ -69,7 +69,7 @@ export class ServerTreeActionProvider {
|
||||
* Return actions for connection elements
|
||||
*/
|
||||
private getConnectionActions(tree: AsyncServerTree | ITree, profile: ConnectionProfile): IAction[] {
|
||||
let node = new TreeNode(NodeType.Server, '', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||
let node = new TreeNode(NodeType.Server, NodeType.Server, '', false, '', '', '', undefined, undefined, undefined, undefined);
|
||||
node.connection = profile;
|
||||
return this.getAllActions({
|
||||
tree: tree,
|
||||
|
||||
@@ -42,6 +42,11 @@ export class TreeNode {
|
||||
*/
|
||||
public nodeTypeId: string;
|
||||
|
||||
/**
|
||||
* The object type.
|
||||
*/
|
||||
public objectType: string;
|
||||
|
||||
/**
|
||||
* Label to display to the user, describing this node
|
||||
*/
|
||||
@@ -94,12 +99,13 @@ export class TreeNode {
|
||||
|
||||
public icon?: IconPath | SqlThemeIcon;
|
||||
|
||||
constructor(nodeTypeId: string, label: string, isAlwaysLeaf: boolean, nodePath: string,
|
||||
constructor(nodeTypeId: string, objectType: string, label: string, isAlwaysLeaf: boolean, nodePath: string,
|
||||
nodeSubType: string, nodeStatus?: string, parent?: TreeNode, metadata?: azdata.ObjectMetadata,
|
||||
iconType?: string | SqlThemeIcon,
|
||||
icon?: IconPath | SqlThemeIcon,
|
||||
private _objectExplorerCallbacks?: ObjectExplorerCallbacks) {
|
||||
this.nodeTypeId = nodeTypeId;
|
||||
this.objectType = objectType;
|
||||
this.label = label;
|
||||
this.isAlwaysLeaf = isAlwaysLeaf;
|
||||
this.nodePath = nodePath;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
|
||||
export class TreeNodeContextKey implements IContextKey<TreeNode> {
|
||||
|
||||
static NodeType = new RawContextKey<string>('nodeType', undefined);
|
||||
static ObjectType = new RawContextKey<string>('objectType', undefined);
|
||||
static SubType = new RawContextKey<string>('nodeSubType', undefined);
|
||||
static Status = new RawContextKey<string>('nodeStatus', undefined);
|
||||
static TreeNode = new RawContextKey<TreeNode>('treeNode', undefined);
|
||||
@@ -18,6 +19,7 @@ export class TreeNodeContextKey implements IContextKey<TreeNode> {
|
||||
static IsQueryProvider = new RawContextKey<boolean>('isQueryProvider', false);
|
||||
|
||||
private _nodeTypeKey: IContextKey<string>;
|
||||
private _objectTypeKey: IContextKey<string>;
|
||||
private _subTypeKey: IContextKey<string>;
|
||||
private _statusKey: IContextKey<string>;
|
||||
private _treeNodeKey: IContextKey<TreeNode>;
|
||||
@@ -30,6 +32,7 @@ export class TreeNodeContextKey implements IContextKey<TreeNode> {
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
this._nodeTypeKey = TreeNodeContextKey.NodeType.bindTo(contextKeyService);
|
||||
this._objectTypeKey = TreeNodeContextKey.ObjectType.bindTo(contextKeyService);
|
||||
this._subTypeKey = TreeNodeContextKey.SubType.bindTo(contextKeyService);
|
||||
this._statusKey = TreeNodeContextKey.Status.bindTo(contextKeyService);
|
||||
this._treeNodeKey = TreeNodeContextKey.TreeNode.bindTo(contextKeyService);
|
||||
@@ -41,6 +44,7 @@ export class TreeNodeContextKey implements IContextKey<TreeNode> {
|
||||
set(value: TreeNode) {
|
||||
this._treeNodeKey.set(value);
|
||||
this._nodeTypeKey.set(value && value.nodeTypeId);
|
||||
this._objectTypeKey.set(value && value.objectType);
|
||||
this._subTypeKey.set(value && value.nodeSubType);
|
||||
if (value.nodeStatus) {
|
||||
this._statusKey.set(value && value.nodeStatus);
|
||||
@@ -54,6 +58,7 @@ export class TreeNodeContextKey implements IContextKey<TreeNode> {
|
||||
|
||||
reset(): void {
|
||||
this._nodeTypeKey.reset();
|
||||
this._objectTypeKey.reset();
|
||||
this._subTypeKey.reset();
|
||||
this._statusKey.reset();
|
||||
this._treeNodeKey.reset();
|
||||
|
||||
@@ -47,7 +47,7 @@ suite('AsyncServerTreeDragAndDrop', () => {
|
||||
let connectionProfileArray = [connectionProfile];
|
||||
let connectionProfileGroupId = new ConnectionProfileGroup('name', undefined, 'd936bb32-422b-49c3-963f-ae9532d63dc5', 'color', 'description');
|
||||
let connectionProfileGroupArray = [connectionProfileGroupId];
|
||||
let treeNode = new TreeNode('Column', 'label', undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
let treeNode = new TreeNode('Column', '', 'label', undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
let treeNodeArray = [treeNode];
|
||||
|
||||
setup(() => {
|
||||
|
||||
@@ -72,7 +72,7 @@ suite('SQL Drag And Drop Controller tests', () => {
|
||||
let connectionProfileGroupId = new ConnectionProfileGroup('name', undefined, 'd936bb32-422b-49c3-963f-ae9532d63dc5', 'color', 'description');
|
||||
connectionProfileGroupId.addConnections([connectionProfileId_pgsql]);
|
||||
let connectionProfileGroupArray = [connectionProfileGroupId];
|
||||
let treeNode = new TreeNode('Column', 'label', undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
let treeNode = new TreeNode('Column', '', 'label', undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
let treeNodeArray = [treeNode];
|
||||
|
||||
setup(() => {
|
||||
|
||||
@@ -43,6 +43,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
const NodeInfoTable1 = {
|
||||
nodePath: 'testServerName/tables/dbo.Table1',
|
||||
nodeType: NodeType.Table,
|
||||
objectType: '',
|
||||
label: 'dbo.Table1',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -53,6 +54,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
const NodeInfoTable2 = {
|
||||
nodePath: 'testServerName/tables/dbo.Table2',
|
||||
nodeType: NodeType.Table,
|
||||
objectType: '',
|
||||
label: 'dbo.Table2',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -64,6 +66,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
const NodeInfoTable3 = {
|
||||
nodePath: 'testServerName/tables/dbo.Table3',
|
||||
nodeType: NodeType.Table,
|
||||
objectType: '',
|
||||
label: 'dbo.Table3',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -78,6 +81,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
rootNode: {
|
||||
nodePath: 'testServerName/tables',
|
||||
nodeType: NodeType.Folder,
|
||||
objectType: '',
|
||||
label: 'Tables',
|
||||
isLeaf: false,
|
||||
metadata: null,
|
||||
@@ -325,7 +329,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
});
|
||||
|
||||
test('expand node should expand node correctly', async () => {
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
await objectExplorerService.createNewSession(mssqlProviderName, connection);
|
||||
objectExplorerService.onSessionCreated(1, objectExplorerSession);
|
||||
const expandInfo = await objectExplorerService.expandNode(mssqlProviderName, objectExplorerSession, tablesNode);
|
||||
@@ -338,7 +342,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
});
|
||||
|
||||
test('refresh node should refresh node correctly', async () => {
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
await objectExplorerService.createNewSession(mssqlProviderName, connection);
|
||||
objectExplorerService.onSessionCreated(1, objectExplorerSession);
|
||||
const expandInfo = await objectExplorerService.refreshNode(mssqlProviderName, objectExplorerSession, tablesNode);
|
||||
@@ -351,7 +355,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
});
|
||||
|
||||
test('expand tree node should get correct children', async () => {
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
await objectExplorerService.createNewSession(mssqlProviderName, connection);
|
||||
objectExplorerService.onSessionCreated(1, objectExplorerSession);
|
||||
@@ -366,7 +370,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
});
|
||||
|
||||
test('refresh tree node should children correctly', async () => {
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName/tables', '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
await objectExplorerService.createNewSession(mssqlProviderName, connection);
|
||||
objectExplorerService.onSessionCreated(1, objectExplorerSession);
|
||||
@@ -413,13 +417,13 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
parentName: undefined,
|
||||
parentTypeName: undefined
|
||||
};
|
||||
const databaseNode = new TreeNode(NodeType.Database, 'Db1', false, 'testServerName\\Db1', '', '', undefined, databaseMetaData, undefined, undefined);
|
||||
const databaseNode = new TreeNode(NodeType.Database, '', 'Db1', false, 'testServerName\\Db1', '', '', undefined, databaseMetaData, undefined, undefined);
|
||||
databaseNode.connection = connection;
|
||||
databaseNode.session = objectExplorerSession;
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\\Db1\\tables', '', '', databaseNode, undefined, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName\\Db1\\tables', '', '', databaseNode, undefined, undefined, undefined);
|
||||
databaseNode.children = [tablesNode];
|
||||
const table1Node = new TreeNode(NodeType.Table, 'dbo.Table1', false, 'testServerName\\Db1\\tables\\dbo.Table1', '', '', tablesNode, undefined, undefined, undefined);
|
||||
const table2Node = new TreeNode(NodeType.Table, 'dbo.Table2', false, 'testServerName\\Db1\\tables\\dbo.Table2', '', '', tablesNode, undefined, undefined, undefined);
|
||||
const table1Node = new TreeNode(NodeType.Table, '', 'dbo.Table1', false, 'testServerName\\Db1\\tables\\dbo.Table1', '', '', tablesNode, undefined, undefined, undefined);
|
||||
const table2Node = new TreeNode(NodeType.Table, '', 'dbo.Table2', false, 'testServerName\\Db1\\tables\\dbo.Table2', '', '', tablesNode, undefined, undefined, undefined);
|
||||
tablesNode.children = [table1Node, table2Node];
|
||||
assert.strictEqual(table1Node.getSession(), objectExplorerSession);
|
||||
assert.strictEqual(table1Node.getConnectionProfile(), connection);
|
||||
@@ -438,7 +442,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
|
||||
test('getSelectedProfileAndDatabase returns the profile but no database if children of a server are selected', () => {
|
||||
const serverTreeView = TypeMoq.Mock.ofInstance({ getSelection: () => undefined, onSelectionOrFocusChange: Event.None } as IServerTreeView);
|
||||
const databaseNode = new TreeNode(NodeType.Folder, 'Folder1', false, 'testServerName\\Folder1', '', '', undefined, undefined, undefined, undefined);
|
||||
const databaseNode = new TreeNode(NodeType.Folder, '', 'Folder1', false, 'testServerName\\Folder1', '', '', undefined, undefined, undefined, undefined);
|
||||
databaseNode.connection = connection;
|
||||
serverTreeView.setup(x => x.getSelection()).returns(() => [databaseNode]);
|
||||
objectExplorerService.registerServerTreeView(serverTreeView.object);
|
||||
@@ -460,8 +464,8 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
parentTypeName: undefined
|
||||
};
|
||||
const databaseName = 'Db1';
|
||||
const databaseNode = new TreeNode(NodeType.Database, databaseName, false, 'testServerName\\Db1', '', '', undefined, databaseMetadata, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, 'testServerName\\Db1\\tables', '', '', databaseNode, undefined, undefined, undefined);
|
||||
const databaseNode = new TreeNode(NodeType.Database, '', databaseName, false, 'testServerName\\Db1', '', '', undefined, databaseMetadata, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, 'testServerName\\Db1\\tables', '', '', databaseNode, undefined, undefined, undefined);
|
||||
databaseNode.connection = connection;
|
||||
databaseNode.children = [tablesNode];
|
||||
serverTreeView.setup(x => x.getSelection()).returns(() => [tablesNode]);
|
||||
@@ -653,7 +657,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
sqlOEProvider.setup(x => x.expandNode(TypeMoq.It.is(x => x.nodePath === nodePath))).callback(() => { }).returns(() => Promise.resolve(true));
|
||||
|
||||
// If I queue a second expand request (the first compconstes normally because of the original mock) and then close the session
|
||||
const rootNode = new TreeNode(NodeType.Root, '', false, objectExplorerSession.rootNode.nodePath, '', '', null, null, undefined, undefined);
|
||||
const rootNode = new TreeNode(NodeType.Root, '', '', false, objectExplorerSession.rootNode.nodePath, '', '', null, null, undefined, undefined);
|
||||
await objectExplorerService.expandNode(mssqlProviderName, objectExplorerSession, rootNode);
|
||||
const expandPromise = objectExplorerService.expandNode(mssqlProviderName, objectExplorerSession, rootNode);
|
||||
const closeSessionResult = await objectExplorerService.closeSession(mssqlProviderName, objectExplorerSession);
|
||||
@@ -670,7 +674,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
|
||||
// If I call resolveTreeNodeChildren once, set an error on the node, and then call it again
|
||||
const tablesNodePath = 'testServerName/tables';
|
||||
const tablesNode = new TreeNode(NodeType.Folder, 'Tables', false, tablesNodePath, '', '', null, null, undefined, undefined);
|
||||
const tablesNode = new TreeNode(NodeType.Folder, '', 'Tables', false, tablesNodePath, '', '', null, null, undefined, undefined);
|
||||
tablesNode.connection = connection;
|
||||
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, tablesNode);
|
||||
sqlOEProvider.verify(x => x.refreshNode(TypeMoq.It.is(x => x.nodePath === tablesNodePath)), TypeMoq.Times.never());
|
||||
|
||||
Reference in New Issue
Block a user