Revert "Remove typings and replace missing methods with vscodes (#8217)" (#8240)

This reverts commit 22a427f934.
This commit is contained in:
Elliot Boschwitz
2019-11-06 11:33:55 -08:00
committed by GitHub
parent 3b1eaca58e
commit e801a04bcf
184 changed files with 43388 additions and 634 deletions

View File

@@ -17,7 +17,6 @@ import * as TypeMoq from 'typemoq';
import { Emitter } from 'vs/base/common/event';
import { deepClone, deepFreeze } from 'vs/base/common/objects';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { find } from 'vs/base/common/arrays';
suite('ConnectionConfig', () => {
let capabilitiesService: TypeMoq.Mock<ICapabilitiesService>;
@@ -211,7 +210,7 @@ suite('ConnectionConfig', () => {
}
for (let group of groups1) {
let g2 = find(groups2, g => g.name === group.name);
let g2 = groups2.find(g => g.name === group.name);
// if we couldn't find the group it means they must not be equal
if (!g2) {
return false;
@@ -374,12 +373,12 @@ suite('ConnectionConfig', () => {
let allConnections = config.getConnections(false);
assert.equal(allConnections.length, testConnections.length);
allConnections.forEach(connection => {
let userConnection = find(testConnections, u => u.options['serverName'] === connection.serverName);
let userConnection = testConnections.find(u => u.options['serverName'] === connection.serverName);
if (userConnection !== undefined) {
assert.notEqual(connection.id, connection.getOptionsKey());
assert.ok(!!connection.id);
} else {
let workspaceConnection = find(workspaceConnections, u => u.options['serverName'] === connection.serverName);
let workspaceConnection = workspaceConnections.find(u => u.options['serverName'] === connection.serverName);
assert.notEqual(connection.id, connection.getOptionsKey());
assert.equal(workspaceConnection.id, connection.id);
}
@@ -395,7 +394,7 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'new-group2');
let newGroup = result.groups.find(g => g.name === 'new-group2');
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
});
@@ -408,7 +407,7 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'g2-5');
let newGroup = result.groups.find(g => g.name === 'g2-5');
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
});
@@ -421,7 +420,7 @@ suite('ConnectionConfig', () => {
let result: ISaveGroupResult = config.saveGroup(groups, newGroups, color, newGroups);
assert.ok(!!result);
assert.equal(result.groups.length, testGroups.length, 'The result groups length is invalid');
let newGroup = find(result.groups, g => g.name === 'g2-1');
let newGroup = result.groups.find(g => g.name === 'g2-1');
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
});
@@ -531,7 +530,7 @@ suite('ConnectionConfig', () => {
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').user;
assert.equal(editedGroups.length, testGroups.length);
let editedGroup = find(editedGroups, group => group.id === 'g2');
let editedGroup = editedGroups.find(group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup.name, 'g-renamed');
});
@@ -548,7 +547,7 @@ suite('ConnectionConfig', () => {
assert.fail();
} catch (e) {
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').user;
let originalGroup = find(groups, g => g.id === 'g2');
let originalGroup = groups.find(g => g.id === 'g2');
assert.ok(!!originalGroup);
assert.equal(originalGroup.name, 'g2');
}
@@ -566,7 +565,7 @@ suite('ConnectionConfig', () => {
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').user;
assert.equal(editedGroups.length, testGroups.length);
let editedGroup = find(editedGroups, group => group.id === 'g2');
let editedGroup = editedGroups.find(group => group.id === 'g2');
assert.ok(!!editedGroup);
assert.equal(editedGroup.parentId, 'g3');
});
@@ -623,7 +622,7 @@ suite('ConnectionConfig', () => {
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').user;
// two
assert.equal(editedConnections.length, _testConnections.length);
let editedConnection = find(editedConnections, con => con.id === 'server3-2');
let editedConnection = editedConnections.find(con => con.id === 'server3-2');
assert.ok(!!editedConnection);
assert.equal(editedConnection.groupId, 'g3');
}
@@ -659,7 +658,7 @@ suite('ConnectionConfig', () => {
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').user;
assert.equal(editedConnections.length, testConnections.length);
let editedConnection = find(editedConnections, con => con.id === 'server3');
let editedConnection = editedConnections.find(con => con.id === 'server3');
assert.ok(!!editedConnection);
assert.equal(editedConnection.groupId, 'newid');
});

View File

@@ -11,7 +11,6 @@ import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/workbench/ap
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
import { assign } from 'vs/base/common/objects';
suite('SQL ConnectionProfileInfo tests', () => {
let msSQLCapabilities: ConnectionProviderProperties;
@@ -188,7 +187,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
});
test('createFromStoredProfile should set the id to new guid if not set in stored profile', () => {
let savedProfile = assign({}, storedProfile, { id: undefined });
let savedProfile = Object.assign({}, storedProfile, { id: undefined });
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, capabilitiesService);
assert.equal(savedProfile.groupId, connectionProfile.groupId);
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);

View File

@@ -13,12 +13,11 @@ import { TestConfigurationService } from 'sql/platform/connection/test/common/te
import { TestCredentialsService } from 'sql/platform/credentials/test/common/testCredentialsService';
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
import { deepClone, deepFreeze, assign } from 'vs/base/common/objects';
import { deepClone, deepFreeze } from 'vs/base/common/objects';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
import { InMemoryStorageService } from 'vs/platform/storage/common/storage';
import { find } from 'vs/base/common/arrays';
suite('ConnectionStore', () => {
let defaultNamedProfile: IConnectionProfile = deepFreeze({
@@ -154,7 +153,7 @@ suite('ConnectionStore', () => {
const connectionStore = new ConnectionStore(storageService, configurationService,
credentialsService, capabilitiesService);
for (let i = 0; i < numCreds; i++) {
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
await connectionStore.addRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();
@@ -190,7 +189,7 @@ suite('ConnectionStore', () => {
// Then expect the only 1 instance of that connection to be listed in the MRU
const connectionStore = new ConnectionStore(storageService, configurationService,
credentialsService, capabilitiesService);
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + 1 });
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + 1 });
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
await connectionStore.addRecentConnection(defaultNamedConnectionProfile);
await connectionStore.addRecentConnection(connectionProfile);
@@ -212,13 +211,13 @@ suite('ConnectionStore', () => {
// Given we save 1 connection with password and multiple other connections without
const connectionStore = new ConnectionStore(storageService, configurationService,
credentialsService, capabilitiesService);
const integratedCred = assign({}, defaultNamedProfile, {
const integratedCred = Object.assign({}, defaultNamedProfile, {
serverName: defaultNamedProfile.serverName + 'Integrated',
authenticationType: 'Integrated',
userName: '',
password: ''
});
const noPwdCred = assign({}, defaultNamedProfile, {
const noPwdCred = Object.assign({}, defaultNamedProfile, {
serverName: defaultNamedProfile.serverName + 'NoPwd',
password: ''
});
@@ -233,7 +232,7 @@ suite('ConnectionStore', () => {
// Then verify that since its password based we save the password
assert.equal(credentialsService.credentials.size, 1);
assert.strictEqual(recentCredential.password, defaultNamedProfile.password);
assert.ok(recentCredential.credentialId.indexOf('Profile') > -1, 'Expect credential to be marked as an Profile cred');
assert.ok(recentCredential.credentialId.includes('Profile'), 'Expect credential to be marked as an Profile cred');
assert.ok(!current[0].password);
// When add integrated auth connection
const integratedCredConnectionProfile = new ConnectionProfile(capabilitiesService, integratedCred);
@@ -313,7 +312,7 @@ suite('ConnectionStore', () => {
const connectionStore = new ConnectionStore(storageService, configurationService,
credentialsService, capabilitiesService);
const connectionProfile: IConnectionProfile = assign({}, defaultNamedProfile, { providerName: providerName });
const connectionProfile: IConnectionProfile = Object.assign({}, defaultNamedProfile, { providerName: providerName });
assert.ok(!connectionStore.isPasswordRequired(connectionProfile));
});
@@ -324,7 +323,7 @@ suite('ConnectionStore', () => {
const credentialsService = new TestCredentialsService();
const password: string = 'asdf!@#$';
const connectionProfile: IConnectionProfile = assign({}, defaultNamedProfile, { password });
const connectionProfile: IConnectionProfile = Object.assign({}, defaultNamedProfile, { password });
const connectionStore = new ConnectionStore(storageService, configurationService,
credentialsService, capabilitiesService);
@@ -394,7 +393,7 @@ suite('ConnectionStore', () => {
const profile = deepClone(defaultNamedProfile);
profile.options['password'] = profile.password;
profile.id = 'testId';
let expectedProfile = assign({}, profile);
let expectedProfile = Object.assign({}, profile);
expectedProfile.password = '';
expectedProfile.options['password'] = '';
expectedProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, expectedProfile).toIConnectionProfile();
@@ -407,7 +406,7 @@ suite('ConnectionStore', () => {
const configurationService = new TestConfigurationService();
const credentialsService = new TestCredentialsService();
const profile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, assign({}, defaultNamedProfile, { password: undefined }));
const profile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, Object.assign({}, defaultNamedProfile, { password: undefined }));
const credId = `Microsoft.SqlTools|itemtype:Profile|id:${profile.getConnectionInfoId()}`;
const password: string = 'asdf!@#$';
@@ -454,7 +453,7 @@ suite('ConnectionStore', () => {
const connectionGroups = connectionStore.getConnectionProfileGroups();
for (const group of connectionGroups) {
const foundGroup = find(groups, g => g.id === group.id);
const foundGroup = groups.find(g => g.id === group.id);
assert.ok(foundGroup);
}
});
@@ -468,7 +467,7 @@ suite('ConnectionStore', () => {
credentialsService, capabilitiesService);
for (let i = 0; i < 5; i++) {
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
await connectionStore.addRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();
@@ -476,7 +475,7 @@ suite('ConnectionStore', () => {
}
for (let i = 0; i < 5; i++) {
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
connectionStore.removeRecentConnection(connectionProfile);
const current = connectionStore.getRecentlyUsedConnections();

View File

@@ -10,7 +10,6 @@ import * as assert from 'assert';
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { assign } from 'vs/base/common/objects';
suite('SQL ProviderConnectionInfo tests', () => {
let msSQLCapabilities: any;
@@ -203,7 +202,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
test('constructor should initialize the options given a valid model with options', () => {
let options = {};
options['encrypt'] = 'test value';
let conn2 = assign({}, connectionProfile, { options: options });
let conn2 = Object.assign({}, connectionProfile, { options: options });
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
assert.equal(conn.connectionName, conn2.connectionName);
@@ -224,7 +223,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
test('getOptionsKey should create different id for different server names', () => {
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
let conn2 = new ProviderConnectionInfo(capabilitiesService, assign({}, connectionProfile, { serverName: connectionProfile.serverName + '1' }));
let conn2 = new ProviderConnectionInfo(capabilitiesService, Object.assign({}, connectionProfile, { serverName: connectionProfile.serverName + '1' }));
assert.notEqual(conn.getOptionsKey(), conn2.getOptionsKey());
});
@@ -261,4 +260,4 @@ suite('SQL ProviderConnectionInfo tests', () => {
assert.equal(expectedProviderId, actual);
});
});
});