mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-23 05:10:30 -04:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
56
src/sqltest/stubs/credentialsTestStubs.ts
Normal file
56
src/sqltest/stubs/credentialsTestStubs.ts
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user