mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add --command command line argument (#3690)
This commit is contained in:
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@@ -92,6 +92,30 @@
|
|||||||
"webRoot": "${workspaceFolder}",
|
"webRoot": "${workspaceFolder}",
|
||||||
"timeout": 45000
|
"timeout": 45000
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch azuredatastudio with new notebook command",
|
||||||
|
"windows": {
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/scripts/sql.bat"
|
||||||
|
},
|
||||||
|
"osx": {
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/scripts/sql.sh"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/scripts/sql.sh"
|
||||||
|
},
|
||||||
|
"urlFilter": "*index.html*",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--inspect=5875",
|
||||||
|
"--command=notebook.command.new"
|
||||||
|
],
|
||||||
|
"skipFiles": [
|
||||||
|
"**/winjs*.js"
|
||||||
|
],
|
||||||
|
"webRoot": "${workspaceFolder}",
|
||||||
|
"timeout": 45000
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export interface ICommandLineProcessing {
|
|||||||
* Interprets the various Azure Data Studio-specific command line switches and
|
* Interprets the various Azure Data Studio-specific command line switches and
|
||||||
* performs the requisite tasks such as connecting to a server
|
* performs the requisite tasks such as connecting to a server
|
||||||
*/
|
*/
|
||||||
processCommandLine() : void;
|
processCommandLine() : Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ICommandLineProcessing = createDecorator<ICommandLineProcessing>('commandLineService');
|
export const ICommandLineProcessing = createDecorator<ICommandLineProcessing>('commandLineService');
|
||||||
@@ -15,10 +15,13 @@ import { ConnectionProviderProperties, IConnectionProviderRegistry, Extensions a
|
|||||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
|
import { warn } from 'sql/base/common/log';
|
||||||
|
|
||||||
export class CommandLineService implements ICommandLineProcessing {
|
export class CommandLineService implements ICommandLineProcessing {
|
||||||
private _connectionProfile: ConnectionProfile;
|
private _connectionProfile: ConnectionProfile;
|
||||||
private _showConnectionDialog: boolean;
|
private _showConnectionDialog: boolean;
|
||||||
|
private _commandName:string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||||
@@ -27,49 +30,96 @@ export class CommandLineService implements ICommandLineProcessing {
|
|||||||
@IQueryEditorService private _queryEditorService: IQueryEditorService,
|
@IQueryEditorService private _queryEditorService: IQueryEditorService,
|
||||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||||
@IEditorService private _editorService: IEditorService,
|
@IEditorService private _editorService: IEditorService,
|
||||||
|
@ICommandService private _commandService: ICommandService
|
||||||
) {
|
) {
|
||||||
let profile = null;
|
let profile = null;
|
||||||
if (this._environmentService && this._environmentService.args.server) {
|
if (this._environmentService) {
|
||||||
profile = new ConnectionProfile(_capabilitiesService, null);
|
if (this._commandService) {
|
||||||
// We want connection store to use any matching password it finds
|
this._commandName = this._environmentService.args.command;
|
||||||
profile.savePassword = true;
|
}
|
||||||
profile.providerName = Constants.mssqlProviderName;
|
if (this._environmentService.args.server) {
|
||||||
profile.serverName = _environmentService.args.server;
|
profile = new ConnectionProfile(_capabilitiesService, null);
|
||||||
profile.databaseName = _environmentService.args.database ? _environmentService.args.database : '';
|
// We want connection store to use any matching password it finds
|
||||||
profile.userName = _environmentService.args.user ? _environmentService.args.user : '';
|
profile.savePassword = true;
|
||||||
profile.authenticationType = _environmentService.args.integrated ? 'Integrated' : 'SqlLogin';
|
profile.providerName = Constants.mssqlProviderName;
|
||||||
profile.connectionName = '';
|
profile.serverName = _environmentService.args.server;
|
||||||
profile.setOptionValue('applicationName', Constants.applicationName);
|
profile.databaseName = _environmentService.args.database ? _environmentService.args.database : '';
|
||||||
profile.setOptionValue('databaseDisplayName', profile.databaseName);
|
profile.userName = _environmentService.args.user ? _environmentService.args.user : '';
|
||||||
profile.setOptionValue('groupId', profile.groupId);
|
profile.authenticationType = _environmentService.args.integrated ? 'Integrated' : 'SqlLogin';
|
||||||
|
profile.connectionName = '';
|
||||||
|
profile.setOptionValue('applicationName', Constants.applicationName);
|
||||||
|
profile.setOptionValue('databaseDisplayName', profile.databaseName);
|
||||||
|
profile.setOptionValue('groupId', profile.groupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._connectionProfile = profile;
|
this._connectionProfile = profile;
|
||||||
const registry = platform.Registry.as<IConnectionProviderRegistry>(ConnectionProviderExtensions.ConnectionProviderContributions);
|
const registry = platform.Registry.as<IConnectionProviderRegistry>(ConnectionProviderExtensions.ConnectionProviderContributions);
|
||||||
let sqlProvider = registry.getProperties(Constants.mssqlProviderName);
|
let sqlProvider = registry.getProperties(Constants.mssqlProviderName);
|
||||||
// We can't connect to object explorer until the MSSQL connection provider is registered
|
// We can't connect to object explorer until the MSSQL connection provider is registered
|
||||||
if (sqlProvider) {
|
if (sqlProvider) {
|
||||||
this.processCommandLine();
|
this.processCommandLine().catch(reason=>{warn('processCommandLine failed: ' + reason);});
|
||||||
} else {
|
} else {
|
||||||
registry.onNewProvider(e => {
|
registry.onNewProvider(e => {
|
||||||
if (e.id === Constants.mssqlProviderName) {
|
if (e.id === Constants.mssqlProviderName) {
|
||||||
this.processCommandLine();
|
this.processCommandLine().catch(reason=>{warn('processCommandLine failed: ' + reason);});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public _serviceBrand: any;
|
public _serviceBrand: any;
|
||||||
public processCommandLine(): void {
|
// We base our logic on the combination of (server, command) values.
|
||||||
if (!this._connectionProfile && !this._connectionManagementService.hasRegisteredServers()) {
|
// (serverName, commandName) => Connect object explorer and execute the command, passing the connection profile to the command. Do not load query editor.
|
||||||
// prompt the user for a new connection on startup if no profiles are registered
|
// (null, commandName) => Launch the command with a null connection. If the command implementation needs a connection, it will need to create it.
|
||||||
this._connectionManagementService.showConnectionDialog();
|
// (serverName, null) => Connect object explorer and open a new query editor
|
||||||
} else if (this._connectionProfile) {
|
// (null, null) => Prompt for a connection unless there are registered servers
|
||||||
this._connectionManagementService.connectIfNotConnected(this._connectionProfile, 'connection', true)
|
public processCommandLine(): Promise<void> {
|
||||||
.then(result => TaskUtilities.newQuery(this._connectionProfile,
|
|
||||||
this._connectionManagementService,
|
let self = this;
|
||||||
this._queryEditorService,
|
return new Promise<void>((resolve, reject) => {
|
||||||
this._objectExplorerService,
|
|
||||||
this._editorService))
|
if (!self._commandName && !self._connectionProfile && !self._connectionManagementService.hasRegisteredServers()) {
|
||||||
.catch(() => { });
|
// prompt the user for a new connection on startup if no profiles are registered
|
||||||
}
|
self._connectionManagementService.showConnectionDialog()
|
||||||
|
.then(() => {
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
} else if (self._connectionProfile) {
|
||||||
|
if (!self._commandName) {
|
||||||
|
self._connectionManagementService.connectIfNotConnected(self._connectionProfile, 'connection', true)
|
||||||
|
.then(() => {
|
||||||
|
TaskUtilities.newQuery(self._connectionProfile,
|
||||||
|
self._connectionManagementService,
|
||||||
|
self._queryEditorService,
|
||||||
|
self._objectExplorerService,
|
||||||
|
self._editorService)
|
||||||
|
.then( () => {
|
||||||
|
resolve();
|
||||||
|
}, error => {
|
||||||
|
// ignore query editor failing to open.
|
||||||
|
// the tests don't mock this out
|
||||||
|
warn('unable to open query editor ' + error);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}, error => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
self._connectionManagementService.connectIfNotConnected(self._connectionProfile, 'connection', true)
|
||||||
|
.then(() => {
|
||||||
|
self._commandService.executeCommand(self._commandName, self._connectionProfile).then(() => resolve(), error => reject(error));
|
||||||
|
}, error => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (self._commandName) {
|
||||||
|
self._commandService.executeCommand(self._commandName).then(() => resolve(), error => reject(error));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,8 @@ import {
|
|||||||
} from 'sql/parts/connection/common/connectionManagement';
|
} from 'sql/parts/connection/common/connectionManagement';
|
||||||
import { ConnectionStore } from 'sql/parts/connection/common/connectionStore';
|
import { ConnectionStore } from 'sql/parts/connection/common/connectionStore';
|
||||||
import { TestConnectionManagementService } from 'sqltest/stubs/connectionManagementService.test';
|
import { TestConnectionManagementService } from 'sqltest/stubs/connectionManagementService.test';
|
||||||
|
import { ICommandService, ICommandEvent, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||||
|
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';
|
||||||
|
|
||||||
class TestParsedArgs implements ParsedArgs{
|
class TestParsedArgs implements ParsedArgs{
|
||||||
[arg: string]: any;
|
[arg: string]: any;
|
||||||
@@ -38,6 +39,7 @@ class TestParsedArgs implements ParsedArgs{
|
|||||||
aad?: boolean;
|
aad?: boolean;
|
||||||
add?: boolean;
|
add?: boolean;
|
||||||
database?:string;
|
database?:string;
|
||||||
|
command?:string;
|
||||||
debugBrkPluginHost?: string;
|
debugBrkPluginHost?: string;
|
||||||
debugBrkSearch?: string;
|
debugBrkSearch?: string;
|
||||||
debugId?: string;
|
debugId?: string;
|
||||||
@@ -111,7 +113,8 @@ suite('commandLineService tests', () => {
|
|||||||
|
|
||||||
function getCommandLineService(connectionManagementService : IConnectionManagementService,
|
function getCommandLineService(connectionManagementService : IConnectionManagementService,
|
||||||
environmentService? : IEnvironmentService,
|
environmentService? : IEnvironmentService,
|
||||||
capabilitiesService? : ICapabilitiesService
|
capabilitiesService? : ICapabilitiesService,
|
||||||
|
commandService? : ICommandService
|
||||||
) : CommandLineService
|
) : CommandLineService
|
||||||
{
|
{
|
||||||
let service= new CommandLineService(
|
let service= new CommandLineService(
|
||||||
@@ -120,7 +123,8 @@ suite('commandLineService tests', () => {
|
|||||||
environmentService,
|
environmentService,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined
|
undefined,
|
||||||
|
commandService
|
||||||
);
|
);
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
@@ -129,14 +133,18 @@ suite('commandLineService tests', () => {
|
|||||||
const connectionManagementService : TypeMoq.Mock<IConnectionManagementService>
|
const connectionManagementService : TypeMoq.Mock<IConnectionManagementService>
|
||||||
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||||
|
|
||||||
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable();
|
connectionManagementService.setup((c) => c.showConnectionDialog())
|
||||||
|
.returns(() => new Promise<void>((resolve, reject) => { resolve();}))
|
||||||
|
.verifiable();
|
||||||
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => false);
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => false);
|
||||||
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||||
.verifiable(TypeMoq.Times.never());
|
.returns(() => new Promise<string>((resolve, reject) => { resolve('unused');}))
|
||||||
|
.verifiable(TypeMoq.Times.never());
|
||||||
let service = getCommandLineService(connectionManagementService.object);
|
let service = getCommandLineService(connectionManagementService.object);
|
||||||
service.processCommandLine();
|
service.processCommandLine().then( () => {
|
||||||
connectionManagementService.verifyAll();
|
connectionManagementService.verifyAll();
|
||||||
done();
|
done();
|
||||||
|
}, error => {assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('processCommandLine does nothing if registered servers exist and no server name is provided', done => {
|
test('processCommandLine does nothing if registered servers exist and no server name is provided', done => {
|
||||||
@@ -146,11 +154,13 @@ suite('commandLineService tests', () => {
|
|||||||
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||||
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true);
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true);
|
||||||
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||||
.verifiable(TypeMoq.Times.never());
|
.returns(() => new Promise<string>((resolve, reject) => { resolve('unused');}))
|
||||||
|
.verifiable(TypeMoq.Times.never());
|
||||||
let service = getCommandLineService(connectionManagementService.object);
|
let service = getCommandLineService(connectionManagementService.object);
|
||||||
service.processCommandLine();
|
service.processCommandLine().then( () => {
|
||||||
connectionManagementService.verifyAll();
|
connectionManagementService.verifyAll();
|
||||||
done();
|
done();
|
||||||
|
}, error => {assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('processCommandLine opens a new connection if a server name is passed', done => {
|
test('processCommandLine opens a new connection if a server name is passed', done => {
|
||||||
@@ -165,12 +175,88 @@ suite('commandLineService tests', () => {
|
|||||||
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||||
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
||||||
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), 'connection', true))
|
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), 'connection', true))
|
||||||
.returns(() => new Promise<string>((resolve, reject) => { reject('unused');}))
|
.returns(() => new Promise<string>((resolve, reject) => { resolve('unused');}))
|
||||||
.verifiable(TypeMoq.Times.once());
|
.verifiable(TypeMoq.Times.once());
|
||||||
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService);
|
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService);
|
||||||
service.processCommandLine();
|
service.processCommandLine().then( () => {
|
||||||
environmentService.verifyAll();
|
environmentService.verifyAll();
|
||||||
connectionManagementService.verifyAll();
|
connectionManagementService.verifyAll();
|
||||||
done();
|
done();
|
||||||
|
}, error => {assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('processCommandLine invokes a command without a profile parameter when no server is passed', done => {
|
||||||
|
const connectionManagementService : TypeMoq.Mock<IConnectionManagementService>
|
||||||
|
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||||
|
const environmentService : TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||||
|
const commandService : TypeMoq.Mock<ICommandService> = TypeMoq.Mock.ofType<ICommandService>(TestCommandService);
|
||||||
|
const args : TestParsedArgs = new TestParsedArgs();
|
||||||
|
|
||||||
|
args.command = 'mycommand';
|
||||||
|
environmentService.setup(e => e.args).returns(() => args);
|
||||||
|
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||||
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
||||||
|
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||||
|
.verifiable(TypeMoq.Times.never());
|
||||||
|
commandService.setup(c => c.executeCommand('mycommand'))
|
||||||
|
.returns(() => TPromise.wrap(1))
|
||||||
|
.verifiable(TypeMoq.Times.once());
|
||||||
|
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService, commandService.object);
|
||||||
|
service.processCommandLine().then( () => {
|
||||||
|
connectionManagementService.verifyAll();
|
||||||
|
commandService.verifyAll();
|
||||||
|
done();
|
||||||
|
}, error => {assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('processCommandLine invokes a command with a profile parameter when a server is passed', done => {
|
||||||
|
|
||||||
|
const connectionManagementService : TypeMoq.Mock<IConnectionManagementService>
|
||||||
|
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||||
|
|
||||||
|
const environmentService : TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||||
|
const commandService : TypeMoq.Mock<ICommandService> = TypeMoq.Mock.ofType<ICommandService>(TestCommandService);
|
||||||
|
const args : TestParsedArgs = new TestParsedArgs();
|
||||||
|
args.command = 'mycommand';
|
||||||
|
args.server = 'myserver';
|
||||||
|
environmentService.setup(e => e.args).returns(() => args);
|
||||||
|
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||||
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
||||||
|
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.is<ConnectionProfile>( p => p.serverName === 'myserver'), 'connection', true))
|
||||||
|
.returns(() => new Promise<string>((resolve, reject) => { resolve('unused');}))
|
||||||
|
.verifiable(TypeMoq.Times.once());
|
||||||
|
commandService.setup(c => c.executeCommand('mycommand', TypeMoq.It.is<ConnectionProfile>( p => p.serverName === 'myserver')))
|
||||||
|
.returns(() => TPromise.wrap(1))
|
||||||
|
.verifiable(TypeMoq.Times.once());
|
||||||
|
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService, commandService.object);
|
||||||
|
service.processCommandLine().then( () => {
|
||||||
|
connectionManagementService.verifyAll();
|
||||||
|
commandService.verifyAll();
|
||||||
|
done();
|
||||||
|
}, error => {assert.fail(error, null, 'processCommandLine rejected ' + error); done(); });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('processCommandLine rejects unknown commands', done => {
|
||||||
|
const connectionManagementService : TypeMoq.Mock<IConnectionManagementService>
|
||||||
|
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
|
||||||
|
const environmentService : TypeMoq.Mock<IEnvironmentService> = TypeMoq.Mock.ofType<IEnvironmentService>(EnvironmentService);
|
||||||
|
const commandService : TypeMoq.Mock<ICommandService> = TypeMoq.Mock.ofType<ICommandService>(TestCommandService);
|
||||||
|
const args : TestParsedArgs = new TestParsedArgs();
|
||||||
|
|
||||||
|
args.command = 'mycommand';
|
||||||
|
environmentService.setup(e => e.args).returns(() => args);
|
||||||
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true);
|
||||||
|
commandService.setup(c => c.executeCommand('mycommand'))
|
||||||
|
.returns(() => TPromise.wrapError(new Error('myerror')))
|
||||||
|
.verifiable(TypeMoq.Times.once());
|
||||||
|
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService, commandService.object);
|
||||||
|
service.processCommandLine().then( () => {
|
||||||
|
assert.fail(1,null, 'processCommandLine should reject when executeCommand errors out');
|
||||||
|
done();
|
||||||
|
}, error => {
|
||||||
|
assert.equal(error.message, 'myerror', 'unexpected error from processCommandLine ' + error);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export interface ParsedArgs {
|
|||||||
integrated?: boolean;
|
integrated?: boolean;
|
||||||
server?: string;
|
server?: string;
|
||||||
user?: string;
|
user?: string;
|
||||||
|
command?: string;
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ const options: minimist.Opts = {
|
|||||||
'database',
|
'database',
|
||||||
'server',
|
'server',
|
||||||
'user',
|
'user',
|
||||||
|
'command'
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
],
|
],
|
||||||
boolean: [
|
boolean: [
|
||||||
@@ -99,6 +100,7 @@ const options: minimist.Opts = {
|
|||||||
integrated: 'E',
|
integrated: 'E',
|
||||||
server: 'S',
|
server: 'S',
|
||||||
user: 'U',
|
user: 'U',
|
||||||
|
command : 'c',
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user