SQL Operations Studio Public Preview 1 (0.23) release source code

This commit is contained in:
Karl Burtram
2017-11-09 14:30:27 -08:00
parent b88ecb8d93
commit 3cdac41339
8829 changed files with 759707 additions and 286 deletions

View File

@@ -0,0 +1,82 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as data from 'data';
import Event from 'vs/base/common/event';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { AccountProviderAddedEventParams, UpdateAccountListEventParams } from 'sql/services/accountManagement/eventTypes';
import { TPromise } from 'vs/base/common/winjs.base';
export class AccountManagementTestService implements IAccountManagementService {
_serviceBrand: any;
public get addAccountProviderEvent(): Event<AccountProviderAddedEventParams> {return () => {return undefined;};}
public get removeAccountProviderEvent(): Event<data.AccountProviderMetadata> {return () => {return undefined;};}
public get updateAccountListEvent(): Event<UpdateAccountListEventParams> {return () => {return undefined;};}
addAccount(providerId: string): Thenable<data.Account> {
return undefined;
}
getAccountProviderMetadata(): Thenable<data.AccountProviderMetadata[]> {
return undefined;
}
getAccountsForProvider(providerId: string): Thenable<data.Account[]> {
return undefined;
}
getSecurityToken(account: data.Account): Thenable<{}> {
return undefined;
}
removeAccount(accountKey: data.AccountKey): Thenable<boolean> {
return undefined;
}
openAccountListDialog(): TPromise<any> {
return undefined;
}
performOAuthAuthorization(url: string, silent: boolean): Thenable<string> {
return undefined;
}
registerProvider(providerMetadata: data.AccountProviderMetadata, provider: data.AccountProvider): void {
return undefined;
}
shutdown(): void {
return undefined;
}
unregisterProvider(providerMetadata: data.AccountProviderMetadata): void {
return undefined;
}
}
export class AccountProviderStub implements data.AccountProvider {
clear(account: data.AccountKey): Thenable<void> {
return Promise.resolve();
}
getSecurityToken(account: data.Account): Thenable<{}> {
return Promise.resolve({});
}
initialize(storedAccounts: data.Account[]): Thenable<data.Account[]> {
return Promise.resolve(storedAccounts);
}
prompt(): Thenable<data.Account> {
return Promise.resolve(undefined);
}
refresh(account: data.Account): Thenable<data.Account> {
return Promise.resolve(account);
}
}

View File

@@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import data = require('data');
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
import Event from 'vs/base/common/event';
import { Action } from 'vs/base/common/actions';
export class CapabilitiesTestService implements ICapabilitiesService {
public _serviceBrand: any;
private _providers: data.CapabilitiesProvider[] = [];
private _capabilities: data.DataProtocolServerCapabilities[] = [];
constructor() {
let connectionProvider: data.ConnectionProviderOptions = {
options: [
{
name: 'serverName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
isIdentity: true,
isRequired: true,
specialValueType: 0,
valueType: 0
},
{
name: 'databaseName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
isIdentity: true,
isRequired: true,
specialValueType: 1,
valueType: 0
},
{
name: 'userName',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
isIdentity: true,
isRequired: true,
specialValueType: 3,
valueType: 0
},
{
name: 'authenticationType',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
isIdentity: true,
isRequired: true,
specialValueType: 2,
valueType: 0
},
{
name: 'password',
displayName: undefined,
description: undefined,
groupName: undefined,
categoryValues: undefined,
defaultValue: undefined,
isIdentity: true,
isRequired: true,
specialValueType: 4,
valueType: 0
}
]
};
let msSQLCapabilities = {
protocolVersion: '1',
providerName: 'MSSQL',
providerDisplayName: 'MSSQL',
connectionProvider: connectionProvider,
adminServicesProvider: undefined,
features: undefined
};
this._capabilities.push(msSQLCapabilities);
}
/**
* Retrieve a list of registered server capabilities
*/
public getCapabilities(): data.DataProtocolServerCapabilities[] {
return this._capabilities;
}
/**
* Register the capabilities provider and query the provider for its capabilities
* @param provider
*/
public registerProvider(provider: data.CapabilitiesProvider): void {
}
// Event Emitters
public get onProviderRegisteredEvent(): Event<data.DataProtocolServerCapabilities> {
return undefined;
}
public isFeatureAvailable(featureName: Action, connectionManagementInfo: ConnectionManagementInfo): boolean {
return true;
}
public onCapabilitiesReady(): Promise<void> {
return Promise.resolve(null);
}
}

View File

@@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {
IConnectionDialogService, IConnectionManagementService, INewConnectionParams
} from 'sql/parts/connection/common/connectionManagement';
import { TPromise } from 'vs/base/common/winjs.base';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
export class ConnectionDialogTestService implements IConnectionDialogService {
_serviceBrand: any;
public showDialog(connectionManagementService: IConnectionManagementService,
params: INewConnectionParams, model: IConnectionProfile, error?: string): TPromise<void> {
let none: void;
return TPromise.as(none);
}
}

View File

@@ -0,0 +1,236 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IConnectionManagementService, IConnectableInput, IConnectionCompletionOptions, IConnectionCallbacks, IConnectionResult, INewConnectionParams }
from 'sql/parts/connection/common/connectionManagement';
import { IConnectionProfileGroup, ConnectionProfileGroup } from 'sql/parts/connection/common/connectionProfileGroup';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
import data = require('data');
import Event, { Emitter } from 'vs/base/common/event';
// Test stubs for commonly used objects
export class TestConnectionManagementService implements IConnectionManagementService {
_serviceBrand: any;
onAddConnectionProfile = undefined;
onDeleteConnectionProfile = undefined;
onConnectionChanged = undefined;
onLanguageFlavorChanged = undefined;
public get onConnect(): Event<any> {
let conEvent = new Emitter<any>();
return conEvent.event;
}
public get onDisconnect(): Event<any> {
let conEvent = new Emitter<any>();
return conEvent.event;
}
registerProvider(providerId: string, provider: data.ConnectionProvider): void {
}
showConnectionDialog(params?: INewConnectionParams, model?: IConnectionProfile, error?: string): Promise<void> {
return undefined;
}
showCreateServerGroupDialog(): Promise<void> {
return undefined;
}
showEditServerGroupDialog(group: ConnectionProfileGroup): Promise<void> {
return undefined;
}
onConnectionComplete(handle: number, connectionInfoSummary: data.ConnectionInfoSummary): void {
}
onIntelliSenseCacheComplete(handle: number, connectionUri: string): void {
}
public onConnectionChangedNotification(handle: number, changedConnInfo: data.ChangedConnectionInfo): void {
}
getCurrentConnectionSummary(): data.ConnectionSummary {
return undefined;
}
getConnectionGroups(): ConnectionProfileGroup[] {
return [];
}
getActiveConnections(): ConnectionProfile[] {
return [];
}
saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
return undefined;
}
getRecentConnections(): ConnectionProfile[] {
return [];
}
public clearRecentConnectionsList(): void {
return;
}
getUnsavedConnections(): ConnectionProfile[] {
return [];
}
changeGroupIdForConnectionGroup(source: IConnectionProfileGroup, target: IConnectionProfileGroup): Promise<void> {
return Promise.resolve();
}
changeGroupIdForConnection(source: ConnectionProfile, targetGroupId: string): Promise<void> {
return Promise.resolve();
}
deleteConnection(connection: ConnectionProfile): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
resolve(true);
});
}
deleteConnectionGroup(group: ConnectionProfileGroup): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
resolve(true);
});
}
getAdvancedProperties(): data.ConnectionOption[] {
return [];
}
getConnectionId(connectionProfile: ConnectionProfile): string {
return undefined;
}
getFormattedUri(uri: string, connectionProfile: ConnectionProfile): string {
return undefined;
}
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean {
return false;
}
isRecent(connectionProfile: ConnectionProfile): boolean {
return false;
}
isProfileConnected(connectionProfile: IConnectionProfile): boolean {
return false;
}
isProfileConnecting(connectionProfile: IConnectionProfile): boolean {
return false;
}
findExistingConnection(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): ConnectionProfile {
return undefined;
}
connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
return new Promise<IConnectionResult>((resolve, reject) => {
resolve({ connected: true, errorMessage: undefined, errorCode: undefined });
});
}
connectAndSaveProfile(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
return new Promise<IConnectionResult>(() => true);
}
disconnectEditor(owner: IConnectableInput): Promise<boolean> {
return new Promise<boolean>(() => true);
}
disconnect(connection: IConnectionProfile);
disconnect(uri: string);
disconnect(input: any): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
resolve(true);
});
}
getConnectionProfile(fileUri: string): IConnectionProfile {
return undefined;
}
getConnectionInfo(fileUri: string): ConnectionManagementInfo {
return undefined;
}
addSavedPassword(connectionProfile: IConnectionProfile): Promise<IConnectionProfile> {
return new Promise<IConnectionProfile>(() => connectionProfile);
}
public listDatabases(connectionUri: string): Thenable<data.ListDatabasesResult> {
return Promise.resolve(undefined);
}
cancelConnection(connection: IConnectionProfile): Thenable<boolean> {
return undefined;
}
cancelEditorConnection(owner: IConnectableInput): Thenable<boolean> {
return undefined;
}
showDashboard(connection: ConnectionProfile): Promise<boolean> {
return new Promise(() => true);
}
closeDashboard(uri: string): void {
}
changeDatabase(connectionUri: string, databaseName: string): Thenable<boolean> {
return new Promise(() => true);
}
editGroup(group: ConnectionProfileGroup): Promise<void> {
return Promise.resolve();
}
getProviderIdFromUri(ownerUri: string): string {
return undefined;
}
hasRegisteredServers(): boolean {
return true;
}
getCapabilities(providerName: string): data.DataProtocolServerCapabilities {
return undefined;
}
canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
return true;
}
doChangeLanguageFlavor(uri: string, language: string, flavor: string): void {
}
ensureDefaultLanguageFlavor(uri: string): void {
}
public getProviderNames(): string[] {
return [];
}
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): Promise<string> {
return undefined;
}
rebuildIntelliSenseCache(uri: string): Thenable<void> {
return undefined;
}
}

View File

@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import data = require('data');
export class ConnectionProviderStub implements data.ConnectionProvider {
handle: number = 1;
connect(connectionUri: string, connectionInfo: data.ConnectionInfo): Thenable<boolean> {
return undefined;
}
disconnect(connectionUri: string): Thenable<boolean> {
return undefined;
}
cancelConnect(connectionUri: string): Thenable<boolean> {
return undefined;
}
listDatabases(connectionUri: string): Thenable<data.ListDatabasesResult> {
return undefined;
}
changeDatabase(connectionUri: string, newDatabase: string): Thenable<boolean> {
return undefined;
}
rebuildIntelliSenseCache(connectionUri: string): Thenable<void> {
return undefined;
}
registerOnConnectionComplete(handler: (connSummary: data.ConnectionInfoSummary) => any) {
return undefined;
}
registerOnIntelliSenseCacheComplete(handler: (connectionUri: string) => any) {
return undefined;
}
registerOnConnectionChanged(handler: (changedConnInfo: data.ChangedConnectionInfo) => any) {
return undefined;
}
}

View File

@@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IContextKeyService, IContextKeyServiceTarget, IContextKey, ContextKeyExpr, IContext } from 'vs/platform/contextkey/common/contextkey';
import Event from 'vs/base/common/event';
export class ContextKeyServiceStub implements IContextKeyService {
_serviceBrand: any;
dispose(): void {
//
}
onDidChangeContext: Event<string[]>;
createKey<T>(key: string, defaultValue: T): IContextKey<T> {
return undefined;
}
contextMatchesRules(rules: ContextKeyExpr): boolean {
return undefined;
}
getContextKeyValue<T>(key: string): T {
return undefined;
}
createScoped(target?: IContextKeyServiceTarget): IContextKeyService {
return undefined;
}
getContext(target: IContextKeyServiceTarget): IContext {
return undefined;
}
}

View File

@@ -0,0 +1,56 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as data from 'data';
import { TPromise } from 'vs/base/common/winjs.base';
import {CredentialManagementEvents, ICredentialsService} from "sql/services/credentials/credentialsService";
import {IDisposable} from "vs/base/common/lifecycle";
export class CredentialsTestProvider implements data.CredentialProvider {
handle: number;
public storedCredentials: {[K: string]: data.Credential} = {};
saveCredential(credentialId: string, password: string): Thenable<boolean> {
this.storedCredentials[credentialId] = {
credentialId: credentialId,
password: password
};
return TPromise.as(true);
}
readCredential(credentialId: string): Thenable<data.Credential> {
return TPromise.as(this.storedCredentials[credentialId]);
}
deleteCredential(credentialId: string): Thenable<boolean> {
let exists = this.storedCredentials[credentialId] !== undefined;
delete this.storedCredentials[credentialId];
return TPromise.as(exists);
}
}
export class CredentialsTestService implements ICredentialsService {
_serviceBrand: any;
saveCredential(credentialId: string, password: string): Thenable<boolean> {
return undefined;
}
readCredential(credentialId: string): Thenable<data.Credential> {
return undefined;
}
deleteCredential(credentialId: string): Thenable<boolean> {
return undefined;
}
addEventListener(handle: number, events: CredentialManagementEvents): IDisposable {
return undefined;
}
}

View File

@@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { Position, IEditorInput } from 'vs/platform/editor/common/editor';
import { IEditorStacksModel, IEditorGroup, EditorInput } from 'vs/workbench/common/editor';
import Event from 'vs/base/common/event';
import { ITabOptions, GroupArrangement, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { IEditorGroupService, IMoveOptions } from 'vs/workbench/services/group/common/groupService';
import { EditorGroup } from "vs/workbench/common/editor/editorStacksModel";
export class EditorGroupTestService implements IEditorGroupService {
_serviceBrand: ServiceIdentifier<any>;
/**
* Emitted when editors or inputs change. Examples: opening, closing of editors. Active editor change.
*/
onEditorsChanged: Event<void>;
/**
* Emitted when opening an editor fails.
*/
onEditorOpenFail: Event<IEditorInput>;
/**
* Emitted when a editors are moved to another position.
*/
onEditorsMoved: Event<void>;
/**
* Emitted when the editor group orientation was changed.
*/
onGroupOrientationChanged: Event<void>;
/**
* Emitted when tab options changed.
*/
onTabOptionsChanged: Event<ITabOptions>;
/**
* Keyboard focus the editor group at the provided position.
*/
public focusGroup(group: EditorGroup): void;
public focusGroup(position: Position): void;
public focusGroup(arg1: any) {
return;
}
/**
* Activate the editor group at the provided position without moving focus.
*/
public activateGroup(group: EditorGroup): void;
public activateGroup(position: Position): void;
public activateGroup(arg1: any): void {
}
/**
* Allows to move the editor group from one position to another.
*/
public moveGroup(from: EditorGroup, to: EditorGroup): void;
public moveGroup(from: Position, to: Position): void;
public moveGroup(arg1: any, arg2: any): void {
}
/**
* Allows to arrange editor groups according to the GroupArrangement enumeration.
*/
arrangeGroups(arrangement: GroupArrangement): void {
}
/**
* Changes the editor group layout between vertical and horizontal orientation. Only applies
* if more than one editor is opened.
*/
setGroupOrientation(orientation: GroupOrientation): void {
}
/**
* Returns the current editor group layout.
*/
getGroupOrientation(): GroupOrientation {
return undefined;
}
/**
* Moves an editor from one group to another. The index in the group is optional.
*/
moveEditor(input: IEditorInput, from: IEditorGroup, to: IEditorGroup, moveOptions?: IMoveOptions): void;
moveEditor(input: IEditorInput, from: Position, to: Position, moveOptions?: IMoveOptions): void;
moveEditor(input: EditorInput, arg2: any, arg3: any, index?: IMoveOptions): void {
}
/**
* Provides access to the editor stacks model
*/
getStacksModel(): IEditorStacksModel {
return undefined;
}
/**
* Returns true if tabs are shown, false otherwise.
*/
getTabOptions(): ITabOptions {
return undefined;
}
public pinEditor(group: EditorGroup, input: EditorInput): void;
public pinEditor(position: Position, input: EditorInput): void;
public pinEditor(arg1: any, input: EditorInput): void {
}
public unpinEditor(group: EditorGroup, input: EditorInput): void;
public unpinEditor(position: Position, input: EditorInput): void;
public unpinEditor(arg1: any, input: EditorInput): void {
}
/**
* Resize visible editor groups
*/
public resizeGroup(position: Position, groupSizeChange: number): void {
}
}

View File

@@ -0,0 +1,14 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
import Severity from 'vs/base/common/severity';
export class ErrorMessageServiceStub implements IErrorMessageService {
_serviceBrand: any;
showDialog(severity: Severity, headerTitle: string, message: string): void {
}
}

View File

@@ -0,0 +1,30 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import Severity from 'vs/base/common/severity';
import { IConfirmation, IMessageService, IMessageWithAction } from 'vs/platform/message/common/message';
export class MessageServiceStub implements IMessageService{
_serviceBrand: any;
show(sev: Severity, message: string): () => void;
show(sev: Severity, message: Error): () => void;
show(sev: Severity, message: string[]): () => void;
show(sev: Severity, message: Error[]): () => void;
show(sev: Severity, message: IMessageWithAction): () => void;
show(sev: Severity, message): () => void {
return undefined;
}
hideAll(): void {
return undefined;
}
confirm(confirmation: IConfirmation): boolean {
return undefined;
}
}

View File

@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import data = require('data');
// Test stubs for commonly used objects
export class ObjectExplorerProviderTestService implements data.ObjectExplorerProvider {
public createNewSession(connInfo: data.ConnectionInfo): Thenable<data.ObjectExplorerCloseSessionResponse> {
return Promise.resolve(undefined);
}
public expandNode(nodeInfo: data.ExpandNodeInfo): Thenable<boolean> {
return Promise.resolve(undefined);
}
public refreshNode(nodeInfo: data.ExpandNodeInfo): Thenable<boolean> {
return Promise.resolve(undefined);
}
public closeSession(closeSessionInfo: data.ObjectExplorerCloseSessionInfo): Thenable<data.ObjectExplorerCloseSessionResponse> {
return Promise.resolve(undefined);
}
public registerOnSessionCreated(handler: (response: data.ObjectExplorerSession) => any): void {
}
public registerOnExpandCompleted(handler: (response: data.ObjectExplorerExpandInfo) => any): void {
}
}

View File

@@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ISqlOAuthService } from 'sql/common/sqlOAuthService';
export class SqlOAuthTestService implements ISqlOAuthService {
_serviceBrand: any;
performOAuthAuthorization(eventId: string, url: string, silent: boolean): void {
}
registerOAuthCallback(handler: (event, args) => void): void {
}
}

View File

@@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
export class StorageTestService implements IStorageService {
_serviceBrand: any;
/**
* Store a string value under the given key to local storage.
*
* The optional scope argument allows to define the scope of the operation.
*/
store(key: string, value: any, scope?: StorageScope): void {
}
/**
* Swap the value of a stored element to one of the two provided
* values and use the defaultValue if no element with the given key
* exists.
*
* The optional scope argument allows to define the scope of the operation.
*/
swap(key: string, valueA: any, valueB: any, scope?: StorageScope, defaultValue?: any): void {
}
/**
* Delete an element stored under the provided key from local storage.
*
* The optional scope argument allows to define the scope of the operation.
*/
remove(key: string, scope?: StorageScope): void {
}
/**
* Retrieve an element stored with the given key from local storage. Use
* the provided defaultValue if the element is null or undefined.
*
* The optional scope argument allows to define the scope of the operation.
*/
get(key: string, scope?: StorageScope, defaultValue?: string): string {
return undefined;
}
/**
* Retrieve an element stored with the given key from local storage. Use
* the provided defaultValue if the element is null or undefined. The element
* will be converted to a number using parseInt with a base of 10.
*
* The optional scope argument allows to define the scope of the operation.
*/
getInteger(key: string, scope?: StorageScope, defaultValue?: number): number {
return 0;
}
/**
* Retrieve an element stored with the given key from local storage. Use
* the provided defaultValue if the element is null or undefined. The element
* will be converted to a boolean.
*
* The optional scope argument allows to define the scope of the operation.
*/
getBoolean(key: string, scope?: StorageScope, defaultValue?: boolean): boolean {
return true;
}
}

View File

@@ -0,0 +1,27 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ITelemetryService, ITelemetryData, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
import { TPromise } from 'vs/base/common/winjs.base';
// Test stubs for commonly used objects
export class TelemetryServiceStub implements ITelemetryService {
_serviceBrand: any;
/**
* Sends a telemetry event that has been privacy approved.
* Do not call this unless you have been given approval.
*/
publicLog(eventName: string, data?: ITelemetryData): TPromise<void> {
return undefined;
}
getTelemetryInfo(): TPromise<ITelemetryInfo> {
return undefined;
}
isOptedIn: boolean;
}

View File

@@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThemeService, ITheme, IThemingParticipant } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color';
import { IDisposable } from 'vs/base/common/lifecycle';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
export class TestTheme implements ITheme {
selector: string;
type: 'light' | 'dark' | 'hc';
getColor(color: string, useDefault?: boolean): Color {
return Color.white;
}
isDefault(color: string): boolean {
throw new Error('Method not implemented.');
}
defines(color: ColorIdentifier): boolean {
throw new Error('Method not implemented.');
}
}
const testTheme = new TestTheme();
export class TestThemeService implements IThemeService {
_serviceBrand: any;
getTheme(): ITheme {
return testTheme;
}
onThemeChange(participant: IThemingParticipant): IDisposable {
return { dispose: () => { } };
}
}

View File

@@ -0,0 +1,107 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IEditorService, IEditor, IEditorInput, IEditorOptions, ITextEditorOptions, Position, Direction, IResourceInput, IResourceDiffInput, IResourceSideBySideInput }
from 'vs/platform/editor/common/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorInput, EditorOptions, IFileEditorInput, TextEditorOptions, IEditorRegistry, Extensions, SideBySideEditorInput } from 'vs/workbench/common/editor';
export class WorkbenchEditorTestService implements IWorkbenchEditorService {
_serviceBrand: ServiceIdentifier<any>;
/**
* Returns the currently active editor or null if none.
*/
getActiveEditor(): IEditor {
return undefined;
}
/**
* Returns the currently active editor input or null if none.
*/
getActiveEditorInput(): IEditorInput {
return undefined;
}
/**
* Returns an array of visible editors.
*/
getVisibleEditors(): IEditor[] {
return undefined;
}
/**
* Returns iff the provided input is currently visible.
*
* @param includeDiff iff set to true, will also consider diff editors to find out if the provided
* input is opened either on the left or right hand side of the diff editor.
*/
isVisible(input: IEditorInput, includeDiff: boolean): boolean {
return undefined;
}
protected doOpenEditor(input: IEditorInput, options?: EditorOptions, sideBySide?: boolean): TPromise<IEditor>;
protected doOpenEditor(input: IEditorInput, options?: EditorOptions, position?: Position): TPromise<IEditor>;
protected doOpenEditor(input: IEditorInput, options?: EditorOptions, arg3?: any): TPromise<IEditor> {
return undefined;
}
/**
* Opens an Editor on the given input with the provided options at the given position. If sideBySide parameter
* is provided, causes the editor service to decide in what position to open the input.
*/
public openEditor(input: IEditorInput, options?: IEditorOptions, sideBySide?: boolean): TPromise<IEditor>;
public openEditor(input: IEditorInput, options?: IEditorOptions, position?: Position): TPromise<IEditor>;
public openEditor(input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, position?: Position): TPromise<IEditor>;
public openEditor(input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, sideBySide?: boolean): TPromise<IEditor>;
public openEditor(input: any, arg2?: any, arg3?: any): TPromise<IEditor> {
return undefined;
}
public openEditors(editors: { input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, position: Position }[]): TPromise<IEditor[]>;
public openEditors(editors: { input: IEditorInput, position: Position, options?: IEditorOptions }[]): TPromise<IEditor[]>;
public openEditors(editors: any[]): TPromise<IEditor[]> {
return undefined;
}
public replaceEditors(editors: { toReplace: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, replaceWith: IResourceInput | IResourceDiffInput | IResourceSideBySideInput }[], position?: Position): TPromise<BaseEditor[]>;
public replaceEditors(editors: { toReplace: IEditorInput, replaceWith: IEditorInput, options?: IEditorOptions }[], position?: Position): TPromise<BaseEditor[]>;
public replaceEditors(editors: any[], position?: Position): TPromise<BaseEditor[]> {
return undefined;
}
/**
* Closes the editor at the provided position.
*/
closeEditor(position: Position, input: IEditorInput): TPromise<void> {
return undefined;
}
/**
* Closes editors of a specific group at the provided position. If the optional editor is provided to exclude, it
* will not be closed. The direction can be used in that case to control if all other editors should get closed,
* or towards a specific direction.
*/
closeEditors(position: Position, filter?: { except?: IEditorInput, direction?: Direction, unmodifiedOnly?: boolean }): TPromise<void> {
return undefined;
}
/**
* Closes all editors across all groups. The optional position allows to keep one group alive.
*/
closeAllEditors(except?: Position): TPromise<void> {
return undefined;
}
/**
* Allows to resolve an untyped input to a workbench typed instanceof editor input
*/
createInput(input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput): IEditorInput {
return undefined;
}
}

View File

@@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import {
IConfigurationValue, IConfigurationData, IConfigurationKeys,
IConfigurationServiceEvent, IConfigurationValues } from 'vs/platform/configuration/common/configuration';
import { TPromise } from 'vs/base/common/winjs.base';
import Event from 'vs/base/common/event';
export class WorkspaceConfigurationTestService implements IWorkspaceConfigurationService {
_serviceBrand: any;
getConfigurationData<T>(): IConfigurationData<T> {
return undefined;
}
/**
* Returns untrusted configuration keys for the current workspace.
*/
getUnsupportedWorkspaceKeys(): string[] {
return [];
}
/**
* Returns iff the workspace has configuration or not.
*/
hasWorkspaceConfiguration(): boolean {
return true;
}
/**
* Returns untrusted configuration keys for the current workspace.
*/
getUntrustedConfigurations(): string[] {
return [];
}
/**
* Returns if the user explicitly configured to not trust the current workspace.
*/
isExplicitlyUntrusted(): boolean {
return true;
}
/**
* Override for the IConfigurationService#lookup() method that adds information about workspace settings.
*/
lookup<T>(key: string): IConfigurationValue<T> {
return undefined;
}
getConfiguration<T>(section?: string): T {
return undefined;
}
reloadConfiguration<T>(section?: string): TPromise<T> {
return undefined;
}
/**
* Override for the IConfigurationService#keys() method that adds information about workspace settings.
*/
keys(): IConfigurationKeys {
return undefined;
}
/**
* Returns the defined values of configurations in the different scopes.
*/
values(): IConfigurationValues {
return undefined;
}
onDidUpdateConfiguration: Event<IConfigurationServiceEvent>;
}