mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-18 11:01:36 -05:00
connection contribution point (#880)
* init * finished compile erros * fixed all merge conflicts * fix dialog problems * formatting * fix opening dialog on first open * fix various problems with connectiondialog * formatting * fix tests * added connection contrib * formatting * formatting and adding capabilities to shutdown * fix connection buffering * formatting * fix tests
This commit is contained in:
@@ -32,7 +32,8 @@ import { WorkspaceConfigurationTestService } from 'sqltest/stubs/workspaceConfig
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import { IConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup';
|
||||
import { IConnectionProfileGroup, ConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup';
|
||||
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
|
||||
|
||||
suite('SQL ConnectionManagementService tests', () => {
|
||||
|
||||
@@ -86,6 +87,8 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
mssqlConnectionProvider = TypeMoq.Mock.ofType(ConnectionProviderStub);
|
||||
let resourceProviderStub = new ResourceProviderStub();
|
||||
resourceProviderStubMock = TypeMoq.Mock.ofInstance(resourceProviderStub);
|
||||
let root = new ConnectionProfileGroup(ConnectionProfileGroup.RootGroupName, undefined, ConnectionProfileGroup.RootGroupName, undefined, undefined);
|
||||
root.connections = [ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile)];
|
||||
|
||||
connectionDialogService.setup(x => x.showDialog(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), undefined)).returns(() => TPromise.as(none));
|
||||
connectionDialogService.setup(x => x.showDialog(TypeMoq.It.isAny(), TypeMoq.It.isAny(), undefined, undefined)).returns(() => TPromise.as(none));
|
||||
@@ -105,6 +108,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
c => c.serverName === connectionProfileWithEmptyUnsavedPassword.serverName))).returns(
|
||||
() => Promise.resolve({ profile: connectionProfileWithEmptyUnsavedPassword, savedCred: false }));
|
||||
connectionStore.setup(x => x.isPasswordRequired(TypeMoq.It.isAny())).returns(() => true);
|
||||
connectionStore.setup(x => x.getConnectionProfileGroups()).returns(() => [root]);
|
||||
|
||||
mssqlConnectionProvider.setup(x => x.connect(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => undefined);
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@ import * as sqlops from 'sqlops';
|
||||
import * as assert from 'assert';
|
||||
import { ConnectionOptionSpecialType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
|
||||
import { ConnectionProviderProperties } from 'sql/workbench/parts/connection/common/connectionProviderExtension';
|
||||
|
||||
suite('SQL ConnectionProfileInfo tests', () => {
|
||||
let msSQLCapabilities: sqlops.DataProtocolServerCapabilities;
|
||||
let msSQLCapabilities: ConnectionProviderProperties;
|
||||
let capabilitiesService: CapabilitiesTestService;
|
||||
|
||||
let connectionProfile: IConnectionProfile = {
|
||||
@@ -49,82 +50,75 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
||||
};
|
||||
|
||||
setup(() => {
|
||||
let capabilities: sqlops.DataProtocolServerCapabilities[] = [];
|
||||
let connectionProvider: sqlops.ConnectionProviderOptions = {
|
||||
options: [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
let connectionProvider: sqlops.ConnectionOption[] = [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
}
|
||||
];
|
||||
msSQLCapabilities = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: connectionProvider,
|
||||
adminServicesProvider: undefined,
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: connectionProvider
|
||||
};
|
||||
capabilities.push(msSQLCapabilities);
|
||||
capabilitiesService = new CapabilitiesTestService();
|
||||
capabilitiesService.capabilities['MSSQL'] = msSQLCapabilities;
|
||||
capabilitiesService.capabilities['MSSQL'] = { connection: msSQLCapabilities };
|
||||
});
|
||||
|
||||
test('set properties should set the values correctly', () => {
|
||||
|
||||
@@ -21,6 +21,7 @@ import { Emitter } from 'vs/base/common/event';
|
||||
import { ConnectionProfileGroup, IConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup';
|
||||
import { ConnectionOptionSpecialType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { CapabilitiesTestService } from '../../stubs/capabilitiesTestService';
|
||||
import { ConnectionProviderProperties } from 'sql/workbench/parts/connection/common/connectionProviderExtension';
|
||||
|
||||
suite('SQL ConnectionStore tests', () => {
|
||||
let defaultNamedProfile: IConnectionProfile;
|
||||
@@ -33,7 +34,7 @@ suite('SQL ConnectionStore tests', () => {
|
||||
let capabilitiesService: CapabilitiesTestService;
|
||||
let mementoArray: any = [];
|
||||
let maxRecent = 5;
|
||||
let msSQLCapabilities: sqlops.DataProtocolServerCapabilities;
|
||||
let msSQLCapabilities: ConnectionProviderProperties;
|
||||
let defaultNamedConnectionProfile: ConnectionProfile;
|
||||
|
||||
setup(() => {
|
||||
@@ -96,81 +97,74 @@ suite('SQL ConnectionStore tests', () => {
|
||||
};
|
||||
|
||||
capabilitiesService = new CapabilitiesTestService();
|
||||
let capabilities: { [id: string]: sqlops.DataProtocolServerCapabilities } = {};
|
||||
let connectionProvider: sqlops.ConnectionProviderOptions = {
|
||||
options: [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
let connectionProvider: sqlops.ConnectionOption[] = [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
}
|
||||
];
|
||||
msSQLCapabilities = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: connectionProvider,
|
||||
adminServicesProvider: undefined,
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: connectionProvider
|
||||
};
|
||||
capabilities['MSSQL'] = msSQLCapabilities;
|
||||
capabilitiesService.capabilities['MSSQL'] = msSQLCapabilities;
|
||||
capabilitiesService.capabilities['MSSQL'] = { connection: msSQLCapabilities };
|
||||
let groups: IConnectionProfileGroup[] = [
|
||||
{
|
||||
id: 'root',
|
||||
@@ -368,24 +362,19 @@ suite('SQL ConnectionStore tests', () => {
|
||||
|
||||
test('isPasswordRequired should return false if the password is not required in capabilities', () => {
|
||||
let providerName: string = 'providername';
|
||||
let connectionProvider: sqlops.ConnectionProviderOptions = {
|
||||
options: msSQLCapabilities.connectionProvider.options.map(o => {
|
||||
if (o.name === 'password') {
|
||||
o.isRequired = false;
|
||||
}
|
||||
return o;
|
||||
})
|
||||
};
|
||||
let connectionProvider = msSQLCapabilities.connectionOptions.map(o => {
|
||||
if (o.name === 'password') {
|
||||
o.isRequired = false;
|
||||
}
|
||||
return o;
|
||||
});
|
||||
let providerCapabilities = {
|
||||
protocolVersion: '1',
|
||||
providerName: providerName,
|
||||
providerDisplayName: providerName,
|
||||
connectionProvider: connectionProvider,
|
||||
adminServicesProvider: undefined,
|
||||
features: undefined
|
||||
providerId: providerName,
|
||||
displayName: providerName,
|
||||
connectionOptions: connectionProvider
|
||||
};
|
||||
|
||||
capabilitiesService.capabilities[providerName] = providerCapabilities;
|
||||
capabilitiesService.capabilities[providerName] = { connection: providerCapabilities };
|
||||
|
||||
let connectionStore = new ConnectionStore(storageServiceMock.object, context.object, undefined, workspaceConfigurationServiceMock.object,
|
||||
credentialStore.object, capabilitiesService, connectionConfig.object);
|
||||
|
||||
@@ -342,15 +342,12 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
test('RefreshConnectionAction - refresh should be called if connection status is connect', (done) => {
|
||||
let isConnectedReturnValue: boolean = true;
|
||||
let sqlProvider = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: { options: [] },
|
||||
adminServicesProvider: { databaseInfoOptions: [], databaseFileInfoOptions: [], fileGroupInfoOptions: [] },
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: [],
|
||||
};
|
||||
|
||||
capabilitiesService.capabilities['MSSQL'] = sqlProvider;
|
||||
capabilitiesService.capabilities['MSSQL'] = { connection: sqlProvider };
|
||||
|
||||
var connection = new ConnectionProfile(capabilitiesService, {
|
||||
savePassword: false,
|
||||
@@ -433,15 +430,12 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
test('RefreshConnectionAction - refresh should not be called if connection status is not connect', (done) => {
|
||||
let isConnectedReturnValue: boolean = false;
|
||||
let sqlProvider = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: { options: [] },
|
||||
adminServicesProvider: { databaseInfoOptions: [], databaseFileInfoOptions: [], fileGroupInfoOptions: [] },
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: []
|
||||
};
|
||||
|
||||
capabilitiesService.capabilities['MSSQL'] = sqlProvider;
|
||||
capabilitiesService.capabilities['MSSQL'] = { connection: sqlProvider };
|
||||
|
||||
var connection = new ConnectionProfile(capabilitiesService, {
|
||||
savePassword: false,
|
||||
|
||||
@@ -128,90 +128,86 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
let onCapabilitiesRegistered = new Emitter<string>();
|
||||
|
||||
let sqlProvider = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: {
|
||||
options: [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'encrypt',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: false,
|
||||
isRequired: false,
|
||||
specialValueType: undefined,
|
||||
valueType: 0
|
||||
}]
|
||||
},
|
||||
adminServicesProvider: { databaseInfoOptions: [], databaseFileInfoOptions: [], fileGroupInfoOptions: [] },
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'encrypt',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: false,
|
||||
isRequired: false,
|
||||
specialValueType: undefined,
|
||||
valueType: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let capabilitiesService = new CapabilitiesTestService();
|
||||
capabilitiesService.capabilities['MSSQL'] = sqlProvider;
|
||||
capabilitiesService.capabilities['MSSQL'] = { connection: sqlProvider };
|
||||
|
||||
connection = new ConnectionProfile(capabilitiesService, {
|
||||
savePassword: false,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesServ
|
||||
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
|
||||
|
||||
suite('SQL ProviderConnectionInfo tests', () => {
|
||||
let msSQLCapabilities: sqlops.DataProtocolServerCapabilities;
|
||||
let msSQLCapabilities: any;
|
||||
let capabilitiesService: CapabilitiesTestService;
|
||||
|
||||
let connectionProfile: IConnectionProfile = {
|
||||
@@ -37,93 +37,88 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
||||
|
||||
setup(() => {
|
||||
let capabilities: sqlops.DataProtocolServerCapabilities[] = [];
|
||||
let connectionProvider: sqlops.ConnectionProviderOptions = {
|
||||
options: [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'encrypt',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: false,
|
||||
isRequired: false,
|
||||
specialValueType: undefined,
|
||||
valueType: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
let connectionProvider: sqlops.ConnectionOption[] = [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'encrypt',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: false,
|
||||
isRequired: false,
|
||||
specialValueType: undefined,
|
||||
valueType: 0
|
||||
}
|
||||
];
|
||||
msSQLCapabilities = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: connectionProvider,
|
||||
adminServicesProvider: undefined,
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: connectionProvider,
|
||||
};
|
||||
capabilities.push(msSQLCapabilities);
|
||||
capabilitiesService = new CapabilitiesTestService();
|
||||
capabilitiesService.capabilities['MSSQL'] = msSQLCapabilities;
|
||||
capabilitiesService.capabilities['MSSQL'] = { connection: msSQLCapabilities };
|
||||
});
|
||||
|
||||
test('constructor should accept undefined parameters', () => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
import * as sqlops from 'sqlops';
|
||||
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
|
||||
import { ICapabilitiesService, clientCapabilities } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { ICapabilitiesService, clientCapabilities, ProviderFeatures } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { ConnectionOptionSpecialType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
@@ -18,95 +18,94 @@ export class CapabilitiesTestService implements ICapabilitiesService {
|
||||
|
||||
private _providers: sqlops.CapabilitiesProvider[] = [];
|
||||
|
||||
public capabilities: { [id: string]: sqlops.DataProtocolServerCapabilities } = {};
|
||||
public capabilities: { [id: string]: ProviderFeatures } = {};
|
||||
|
||||
constructor() {
|
||||
|
||||
let connectionProvider: sqlops.ConnectionProviderOptions = {
|
||||
options: [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
let connectionProvider: sqlops.ConnectionOption[] = [
|
||||
{
|
||||
name: 'serverName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'databaseName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'userName',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.userName,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'authenticationType',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.authType,
|
||||
valueType: 0
|
||||
},
|
||||
{
|
||||
name: 'password',
|
||||
displayName: undefined,
|
||||
description: undefined,
|
||||
groupName: undefined,
|
||||
categoryValues: undefined,
|
||||
defaultValue: undefined,
|
||||
isIdentity: true,
|
||||
isRequired: true,
|
||||
specialValueType: ConnectionOptionSpecialType.password,
|
||||
valueType: 0
|
||||
}
|
||||
];
|
||||
let msSQLCapabilities = {
|
||||
protocolVersion: '1',
|
||||
providerName: 'MSSQL',
|
||||
providerDisplayName: 'MSSQL',
|
||||
connectionProvider: connectionProvider,
|
||||
adminServicesProvider: undefined,
|
||||
features: undefined
|
||||
providerId: 'MSSQL',
|
||||
displayName: 'MSSQL',
|
||||
connectionOptions: connectionProvider,
|
||||
};
|
||||
this.capabilities['MSSQL'] = msSQLCapabilities;
|
||||
this.capabilities['MSSQL'] = { connection: msSQLCapabilities };
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of registered server capabilities
|
||||
*/
|
||||
public getCapabilities(provider: string): sqlops.DataProtocolServerCapabilities {
|
||||
public getCapabilities(provider: string): ProviderFeatures {
|
||||
return this.capabilities[provider];
|
||||
}
|
||||
|
||||
public get providers(): string[] {
|
||||
return Object.keys(this.capabilities);
|
||||
public getLegacyCapabilities(provider: string): sqlops.DataProtocolServerCapabilities {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
public get providers(): { [id: string]: ProviderFeatures } {
|
||||
return this.capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +128,7 @@ export class CapabilitiesTestService implements ICapabilitiesService {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
private _onCapabilitiesRegistered = new Emitter<string>();
|
||||
private _onCapabilitiesRegistered = new Emitter<ProviderFeatures>();
|
||||
public readonly onCapabilitiesRegistered = this._onCapabilitiesRegistered.event;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user