Clean up some of the extensions (#8267)

* 💄

* prune unused code

* more cleanup

* remove abunch of used code
This commit is contained in:
Anthony Dresser
2019-11-08 11:44:43 -08:00
committed by GitHub
parent 738ca479e4
commit 7f7052ad42
94 changed files with 366 additions and 1158 deletions

View File

@@ -55,7 +55,6 @@
"chai": "3.5.0",
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"uuid": "^3.3.2",
"vscode": "1.1.5"
},
"dependencies": {

View File

@@ -3,14 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import * as mssql from '../../mssql';
import * as utils from './utils';
import * as uuid from 'uuid';
import * as uuid from './uuid';
import { context } from './testContext';
import assert = require('assert');
import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as azdata from 'azdata';
import * as utils from './utils';
@@ -15,7 +13,7 @@ import * as mssql from '../../mssql';
import * as vscode from 'vscode';
import { context } from './testContext';
import { getStandaloneServer } from './testConfig';
import assert = require('assert');
import * as assert from 'assert';
const retryCount = 24; // 2 minutes
const dacpac1: string = path.join(__dirname, '../testData/Database1.dacpac');

View File

@@ -10,7 +10,7 @@ import { SuiteType, getSuiteType } from 'adstest';
import { context } from './testContext';
import path = require('path');
import * as path from 'path';
const suite = getSuiteType();

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as assert from 'assert';
import * as azdata from 'azdata';
@@ -458,4 +456,3 @@ class NotebookTester {
assert(languageInNotebook === languageConfigured, `Expected cell language is: ${languageConfigured}, Actual: ${languageInNotebook}`);
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as azdata from 'azdata';
import * as vscode from 'vscode';

View File

@@ -3,14 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as azdata from 'azdata';
import { context } from './testContext';
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
import { connectToServer, createDB, deleteDB, DefaultConnectTimeoutInMs, asyncTimeout } from './utils';
import assert = require('assert');
import * as assert from 'assert';
import { stressify } from 'adstest';
if (context.RunTest) {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
@@ -14,7 +12,7 @@ import * as os from 'os';
import * as fs from 'fs';
const path = require('path');
import { context } from './testContext';
import assert = require('assert');
import * as assert from 'assert';
import { getStandaloneServer } from './testConfig';
import { stressify } from 'adstest';

View File

@@ -3,12 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as vscode from 'vscode';
import { context } from './testContext';
import assert = require('assert');
import * as assert from 'assert';
import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './testConfig';
assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined &&
@@ -34,4 +32,4 @@ if (!context.RunTest) {
await vscode.commands.executeCommand('workbench.action.reloadWindow');
});
});
}
}

View File

@@ -41,8 +41,8 @@ export enum EngineType {
BigDataCluster
}
let connectionProviderMapping = {};
let authenticationTypeMapping = {};
let connectionProviderMapping: { [key: string]: { name: string; displayName: string } } = {};
let authenticationTypeMapping: { [key: string]: { name: string; displayName: string } } = {};
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import assert = require('assert');
import * as assert from 'assert';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as fs from 'fs';

View File

@@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Represents a UUID as defined by rfc4122.
*/
export interface UUID {
/**
* @returns the canonical representation in sets of hexadecimal numbers separated by dashes.
*/
asHex(): string;
}
class ValueUUID implements UUID {
constructor(public _value: string) {
// empty
}
public asHex(): string {
return this._value;
}
}
class V4UUID extends ValueUUID {
private static readonly _chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
private static readonly _timeHighBits = ['8', '9', 'a', 'b'];
private static _oneOf(array: string[]): string {
return array[Math.floor(array.length * Math.random())];
}
private static _randomHex(): string {
return V4UUID._oneOf(V4UUID._chars);
}
constructor() {
super([
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
'4',
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
V4UUID._oneOf(V4UUID._timeHighBits),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
].join(''));
}
}
export function v4(): UUID {
return new V4UUID();
}
const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
export function isUUID(value: string): boolean {
return _UUIDPattern.test(value);
}
/**
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
* @param value A uuid string.
*/
export function parse(value: string): UUID {
if (!isUUID(value)) {
throw new Error('invalid uuid');
}
return new ValueUUID(value);
}
export function generateUuid(): string {
return v4().asHex();
}