diff --git a/extensions/agent/src/data/jobStepData.ts b/extensions/agent/src/data/jobStepData.ts index 3a4c2668c0..a379b40830 100644 --- a/extensions/agent/src/data/jobStepData.ts +++ b/extensions/agent/src/data/jobStepData.ts @@ -10,6 +10,7 @@ import * as vscode from 'vscode'; import { AgentUtils } from '../agentUtils'; import { IAgentDialogData, AgentDialogMode } from '../interfaces'; import { JobData } from './jobData'; +import { JobStepDialog } from '../dialogs/jobStepDialog'; const localize = nls.loadMessageBundle(); @@ -26,10 +27,10 @@ export class JobStepData implements IAgentDialogData { public script: string; public scriptName: string; public stepName: string; - public subSystem: string; + public subSystem: azdata.AgentSubSystem; public id: number; - public failureAction: string; - public successAction: string; + public failureAction: azdata.StepCompletionAction; + public successAction: azdata.StepCompletionAction; public successStepId: number; public failStepId: number; public command: string; @@ -101,27 +102,27 @@ export class JobStepData implements IAgentDialogData { stepData.jobId = jobStepInfo.jobId; stepData.jobName = jobStepInfo.jobName; stepData.script = jobStepInfo.script; - stepData.scriptName = jobStepInfo.scriptName, - stepData.stepName = jobStepInfo.stepName, - stepData.subSystem = jobStepInfo.subSystem, - stepData.id = jobStepInfo.id, - stepData.failureAction = jobStepInfo.failureAction, - stepData.successAction = jobStepInfo.successAction, - stepData.failStepId = jobStepInfo.failStepId, - stepData.successStepId = jobStepInfo.successStepId, - stepData.command = jobStepInfo.command, - stepData.commandExecutionSuccessCode = jobStepInfo.commandExecutionSuccessCode, - stepData.databaseName = jobStepInfo.databaseName, - stepData.databaseUserName = jobStepInfo.databaseUserName, - stepData.server = jobStepInfo.server, - stepData.outputFileName = jobStepInfo.outputFileName, - stepData.appendToLogFile = jobStepInfo.appendToLogFile, - stepData.appendToStepHist = jobStepInfo.appendToStepHist, - stepData.writeLogToTable = jobStepInfo.writeLogToTable, - stepData.appendLogToTable = jobStepInfo.appendLogToTable, - stepData.retryAttempts = jobStepInfo.retryAttempts, - stepData.retryInterval = jobStepInfo.retryInterval, - stepData.proxyName = jobStepInfo.proxyName; + stepData.scriptName = jobStepInfo.scriptName; + stepData.stepName = jobStepInfo.stepName; + stepData.subSystem = jobStepInfo.subSystem; + stepData.id = jobStepInfo.id; + stepData.failureAction = jobStepInfo.failureAction; + stepData.successAction = jobStepInfo.successAction; + stepData.failStepId = jobStepInfo.failStepId; + stepData.successStepId = jobStepInfo.successStepId; + stepData.command = jobStepInfo.command; + stepData.commandExecutionSuccessCode = jobStepInfo.commandExecutionSuccessCode; + stepData.databaseName = jobStepInfo.databaseName; + stepData.databaseUserName = jobStepInfo.databaseUserName; + stepData.server = jobStepInfo.server; + stepData.outputFileName = jobStepInfo.outputFileName; + stepData.appendToLogFile = jobStepInfo.appendToLogFile; + stepData.appendToStepHist = jobStepInfo.appendToStepHist; + stepData.writeLogToTable = jobStepInfo.writeLogToTable; + stepData.appendLogToTable = jobStepInfo.appendLogToTable; + stepData.retryAttempts = jobStepInfo.retryAttempts; + stepData.retryInterval = jobStepInfo.retryInterval; + stepData.proxyName = jobStepInfo.proxyName; stepData.dialogMode = AgentDialogMode.EDIT; stepData.viaJobDialog = true; return stepData; @@ -157,4 +158,115 @@ export class JobStepData implements IAgentDialogData { return result; } + public static convertToAgentSubSystem(subSystemDisplayName: string): azdata.AgentSubSystem { + switch (subSystemDisplayName) { + case (JobStepDialog.TSQLScript): { + return azdata.AgentSubSystem.TransactSql; + } + case (JobStepDialog.Powershell): { + return azdata.AgentSubSystem.PowerShell; + } + case (JobStepDialog.CmdExec): { + return azdata.AgentSubSystem.CmdExec; + } + case (JobStepDialog.ReplicationDistributor): { + return azdata.AgentSubSystem.Distribution; + } + case (JobStepDialog.ReplicationMerge): { + return azdata.AgentSubSystem.Merge; + } + case (JobStepDialog.ReplicationQueueReader): { + return azdata.AgentSubSystem.QueueReader; + } + case (JobStepDialog.ReplicationSnapshot): { + return azdata.AgentSubSystem.Snapshot; + } + case (JobStepDialog.ReplicationTransactionLogReader): { + return azdata.AgentSubSystem.LogReader; + } + case (JobStepDialog.AnalysisServicesCommand): { + return azdata.AgentSubSystem.AnalysisCommands; + } + case (JobStepDialog.AnalysisServicesQuery): { + return azdata.AgentSubSystem.AnalysisQuery; + } + case (JobStepDialog.ServicesPackage): { + return azdata.AgentSubSystem.Ssis; + } + default: + return azdata.AgentSubSystem.TransactSql; + } + } + + public static convertToSubSystemDisplayName(subSystem: azdata.AgentSubSystem): string { + switch (subSystem) { + case (azdata.AgentSubSystem.TransactSql): { + return JobStepDialog.TSQLScript; + } + case (azdata.AgentSubSystem.PowerShell): { + return JobStepDialog.Powershell; + } + case (azdata.AgentSubSystem.CmdExec): { + return JobStepDialog.CmdExec; + } + case (azdata.AgentSubSystem.Distribution): { + return JobStepDialog.ReplicationDistributor; + } + case (azdata.AgentSubSystem.Merge): { + return JobStepDialog.ReplicationMerge; + } + case (azdata.AgentSubSystem.QueueReader): { + return JobStepDialog.ReplicationQueueReader; + } + case (azdata.AgentSubSystem.Snapshot): { + return JobStepDialog.ReplicationSnapshot; + } + case (azdata.AgentSubSystem.LogReader): { + return JobStepDialog.ReplicationTransactionLogReader; + } + case (azdata.AgentSubSystem.AnalysisCommands): { + return JobStepDialog.AnalysisServicesCommand; + } + case (azdata.AgentSubSystem.AnalysisQuery): { + return JobStepDialog.AnalysisServicesQuery; + } + case (azdata.AgentSubSystem.Ssis): { + return JobStepDialog.ServicesPackage; + } + default: + return JobStepDialog.TSQLScript; + } + } + + public static convertToStepCompletionAction(actionDisplayName: string): azdata.StepCompletionAction { + switch (actionDisplayName) { + case (JobStepDialog.NextStep): { + return azdata.StepCompletionAction.GoToNextStep; + } + case (JobStepDialog.QuitJobReportingSuccess): { + return azdata.StepCompletionAction.QuitWithSuccess; + } + case (JobStepDialog.QuitJobReportingFailure): { + return azdata.StepCompletionAction.QuitWithFailure; + } + default: + return azdata.StepCompletionAction.GoToNextStep; + } + } + + public static convertToCompletionActionDisplayName(stepCompletionAction: azdata.StepCompletionAction): string { + switch (stepCompletionAction) { + case (azdata.StepCompletionAction.GoToNextStep): { + return JobStepDialog.NextStep; + } + case (azdata.StepCompletionAction.QuitWithFailure): { + return JobStepDialog.QuitJobReportingFailure; + } + case (azdata.StepCompletionAction.QuitWithSuccess): { + return JobStepDialog.QuitJobReportingSuccess; + } + default: + return JobStepDialog.NextStep; + } + } } \ No newline at end of file diff --git a/extensions/agent/src/dialogs/jobDialog.ts b/extensions/agent/src/dialogs/jobDialog.ts index 2555c6db0b..01a2a93b98 100644 --- a/extensions/agent/src/dialogs/jobDialog.ts +++ b/extensions/agent/src/dialogs/jobDialog.ts @@ -659,9 +659,9 @@ export class JobDialog extends AgentDialog { let cols = []; cols.push(jobStep.id); cols.push(jobStep.stepName); - cols.push(jobStep.subSystem); - cols.push(jobStep.successAction); - cols.push(jobStep.failureAction); + cols.push(JobStepData.convertToSubSystemDisplayName(jobStep.subSystem)); + cols.push(JobStepData.convertToCompletionActionDisplayName(jobStep.successAction)); + cols.push(JobStepData.convertToCompletionActionDisplayName(jobStep.failureAction)); result.push(cols); }); return result; @@ -708,6 +708,11 @@ export class JobDialog extends AgentDialog { this.model.jobSteps = []; } this.model.jobSteps = this.steps; + // Change the last step's success action to quit because the + // default is "Go To Next Step" + if (this.model.jobSteps.length > 0) { + this.model.jobSteps[this.model.jobSteps.length - 1].successAction = azdata.StepCompletionAction.QuitWithSuccess; + } if (!this.model.jobSchedules) { this.model.jobSchedules = []; } diff --git a/extensions/agent/src/dialogs/jobStepDialog.ts b/extensions/agent/src/dialogs/jobStepDialog.ts index d0d73406dd..f5b1e0ed08 100644 --- a/extensions/agent/src/dialogs/jobStepDialog.ts +++ b/extensions/agent/src/dialogs/jobStepDialog.ts @@ -60,13 +60,23 @@ export class JobStepDialog extends AgentDialog { private readonly AllFilesLabelString: string = localize('jobStepDialog.allFiles', 'All Files (*)'); // Dropdown options - private readonly TSQLScript: string = localize('jobStepDialog.TSQL', 'Transact-SQL script (T-SQL)'); - private readonly Powershell: string = localize('jobStepDialog.powershell', 'PowerShell'); - private readonly CmdExec: string = localize('jobStepDialog.CmdExec', 'Operating system (CmdExec)'); - private readonly AgentServiceAccount: string = localize('jobStepDialog.agentServiceAccount', 'SQL Server Agent Service Account'); - private readonly NextStep: string = localize('jobStepDialog.nextStep', 'Go to the next step'); - private readonly QuitJobReportingSuccess: string = localize('jobStepDialog.quitJobSuccess', 'Quit the job reporting success'); - private readonly QuitJobReportingFailure: string = localize('jobStepDialog.quitJobFailure', 'Quit the job reporting failure'); + public static readonly TSQLScript: string = localize('jobStepDialog.TSQL', 'Transact-SQL script (T-SQL)'); + public static readonly Powershell: string = localize('jobStepDialog.powershell', 'PowerShell'); + public static readonly CmdExec: string = localize('jobStepDialog.CmdExec', 'Operating system (CmdExec)'); + public static readonly ReplicationDistributor: string = localize('jobStepDialog.replicationDistribution', 'Replication Distributor'); + public static readonly ReplicationMerge: string = localize('jobStepDialog.replicationMerge', 'Replication Merge'); + public static readonly ReplicationQueueReader: string = localize('jobStepDialog.replicationQueueReader', 'Replication Queue Reader'); + public static readonly ReplicationSnapshot: string = localize('jobStepDialog.replicationSnapshot', 'Replication Snapshot'); + public static readonly ReplicationTransactionLogReader: string = localize('jobStepDialog.replicationTransactionLogReader', 'Replication Transaction-Log Reader'); + public static readonly AnalysisServicesCommand: string = localize('jobStepDialog.analysisCommand', 'SQL Server Analysis Services Command'); + public static readonly AnalysisServicesQuery: string = localize('jobStepDialog.analysisQuery', 'SQL Server Analysis Services Query'); + public static readonly ServicesPackage: string = localize('jobStepDialog.servicesPackage', 'SQL Server Integration Service Package'); + + + public static readonly AgentServiceAccount: string = localize('jobStepDialog.agentServiceAccount', 'SQL Server Agent Service Account'); + public static readonly NextStep: string = localize('jobStepDialog.nextStep', 'Go to the next step'); + public static readonly QuitJobReportingSuccess: string = localize('jobStepDialog.quitJobSuccess', 'Quit the job reporting success'); + public static readonly QuitJobReportingFailure: string = localize('jobStepDialog.quitJobFailure', 'Quit the job reporting failure'); // Event Name strings private readonly NewStepDialog = 'NewStepDialogOpened'; @@ -201,8 +211,8 @@ export class JobStepDialog extends AgentDialog { this.typeDropdown = view.modelBuilder.dropDown() .withProperties({ - value: this.TSQLScript, - values: [this.TSQLScript, this.CmdExec, this.Powershell] + value: JobStepDialog.TSQLScript, + values: [JobStepDialog.TSQLScript, JobStepDialog.CmdExec, JobStepDialog.Powershell] }) .component(); this.runAsDropdown = view.modelBuilder.dropDown() @@ -254,7 +264,7 @@ export class JobStepDialog extends AgentDialog { }).component(); this.typeDropdown.onValueChanged((type) => { switch (type.selected) { - case (this.TSQLScript): + case (JobStepDialog.TSQLScript): this.runAsDropdown.value = ''; this.runAsDropdown.values = ['']; this.runAsDropdown.enabled = false; @@ -264,8 +274,8 @@ export class JobStepDialog extends AgentDialog { this.processExitCodeBox.value = ''; this.processExitCodeBox.enabled = false; break; - case (this.Powershell): - this.runAsDropdown.value = this.AgentServiceAccount; + case (JobStepDialog.Powershell): + this.runAsDropdown.value = JobStepDialog.AgentServiceAccount; this.runAsDropdown.values = [this.runAsDropdown.value]; this.runAsDropdown.enabled = true; this.databaseDropdown.enabled = false; @@ -274,11 +284,11 @@ export class JobStepDialog extends AgentDialog { this.processExitCodeBox.value = ''; this.processExitCodeBox.enabled = false; break; - case (this.CmdExec): + case (JobStepDialog.CmdExec): this.databaseDropdown.enabled = false; this.databaseDropdown.values = ['']; this.databaseDropdown.value = ''; - this.runAsDropdown.value = this.AgentServiceAccount; + this.runAsDropdown.value = JobStepDialog.AgentServiceAccount; this.runAsDropdown.values = [this.runAsDropdown.value]; this.runAsDropdown.enabled = true; this.processExitCodeBox.enabled = true; @@ -294,7 +304,7 @@ export class JobStepDialog extends AgentDialog { // Load values for edit scenario if (this.isEdit) { this.nameTextBox.value = this.model.stepName; - this.typeDropdown.value = this.model.subSystem; + this.typeDropdown.value = JobStepData.convertToSubSystemDisplayName(this.model.subSystem); this.databaseDropdown.value = this.model.databaseName; this.commandTextBox.value = this.model.command; } @@ -306,16 +316,16 @@ export class JobStepDialog extends AgentDialog { this.successActionDropdown = view.modelBuilder.dropDown() .withProperties({ width: '100%', - value: this.NextStep, - values: [this.NextStep, this.QuitJobReportingSuccess, this.QuitJobReportingFailure] + value: JobStepDialog.NextStep, + values: [JobStepDialog.NextStep, JobStepDialog.QuitJobReportingSuccess, JobStepDialog.QuitJobReportingFailure] }) .component(); let retryFlexContainer = this.createRetryCounters(view); this.failureActionDropdown = view.modelBuilder.dropDown() .withProperties({ - value: this.QuitJobReportingFailure, - values: [this.QuitJobReportingFailure, this.NextStep, this.QuitJobReportingSuccess] + value: JobStepDialog.QuitJobReportingFailure, + values: [JobStepDialog.QuitJobReportingFailure, JobStepDialog.NextStep, JobStepDialog.QuitJobReportingSuccess] }) .component(); let optionsGroup = this.createTSQLOptions(view); @@ -351,7 +361,7 @@ export class JobStepDialog extends AgentDialog { title: this.FailureActionLabel }, { component: optionsGroup, - title: this.TSQLScript + title: JobStepDialog.TSQLScript }, { component: logToTableContainer, title: '' @@ -373,10 +383,10 @@ export class JobStepDialog extends AgentDialog { await view.initializeModel(formWrapper); if (this.isEdit) { - this.successActionDropdown.value = this.model.successAction; + this.successActionDropdown.value = JobStepData.convertToCompletionActionDisplayName(this.model.successAction); this.retryAttemptsBox.value = this.model.retryAttempts.toString(); this.retryIntervalBox.value = this.model.retryInterval.toString(); - this.failureActionDropdown.value = this.model.failureAction; + this.failureActionDropdown.value = JobStepData.convertToCompletionActionDisplayName(this.model.failureAction); this.outputFileNameBox.value = this.model.outputFileName; this.appendToExistingFileCheckbox.checked = this.model.appendToLogFile; this.logToTableCheckbox.checked = this.model.appendLogToTable; @@ -535,13 +545,13 @@ export class JobStepDialog extends AgentDialog { this.model.jobName = this.jobName; this.model.id = this.stepId; this.model.server = this.server; - this.model.subSystem = this.typeDropdown.value as string; + this.model.subSystem = JobStepData.convertToAgentSubSystem(this.typeDropdown.value as string); this.model.databaseName = this.databaseDropdown.value as string; this.model.script = this.commandTextBox.value; - this.model.successAction = this.successActionDropdown.value as string; + this.model.successAction = JobStepData.convertToStepCompletionAction(this.successActionDropdown.value as string); this.model.retryAttempts = this.retryAttemptsBox.value ? +this.retryAttemptsBox.value : 0; this.model.retryInterval = +this.retryIntervalBox.value ? +this.retryIntervalBox.value : 0; - this.model.failureAction = this.failureActionDropdown.value as string; + this.model.failureAction = JobStepData.convertToStepCompletionAction(this.failureActionDropdown.value as string); this.model.outputFileName = this.outputFileNameBox.value; this.model.appendToLogFile = this.appendToExistingFileCheckbox.checked; this.model.command = this.commandTextBox.value ? this.commandTextBox.value : ''; diff --git a/extensions/agent/src/test/agentServiceTests/agentEnums.test.ts b/extensions/agent/src/test/agentServiceTests/agentEnums.test.ts new file mode 100644 index 0000000000..62ae33d3e9 --- /dev/null +++ b/extensions/agent/src/test/agentServiceTests/agentEnums.test.ts @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * 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 'mocha'; +import * as should from 'should'; +import { AgentSubSystem } from 'azdata'; +import { JobStepDialog } from '../../dialogs/jobStepDialog'; +import { JobStepData } from '../../data/jobStepData'; + +const subSytems: AgentSubSystem[] = [AgentSubSystem.TransactSql, AgentSubSystem.PowerShell, + AgentSubSystem.CmdExec, AgentSubSystem.Distribution, AgentSubSystem.Merge, + AgentSubSystem.QueueReader, AgentSubSystem.Snapshot, AgentSubSystem.LogReader, AgentSubSystem.AnalysisCommands, + AgentSubSystem.AnalysisQuery, AgentSubSystem.Ssis]; + +const subSystemDisplayNames: string[] = [JobStepDialog.TSQLScript, JobStepDialog.Powershell, + JobStepDialog.CmdExec, JobStepDialog.ReplicationDistributor, JobStepDialog.ReplicationMerge, + JobStepDialog.ReplicationQueueReader, JobStepDialog.ReplicationSnapshot, JobStepDialog.ReplicationTransactionLogReader, + JobStepDialog.AnalysisServicesCommand, JobStepDialog.AnalysisServicesQuery, JobStepDialog.ServicesPackage]; + +describe('Agent extension enum mapping sanity test', function (): void { + it('SubSystem to Display Name Mapping test', () => { + for (let i = 0; i < subSytems.length; i++) { + let subSystem = subSytems[i]; + let convertedSubSystemName = JobStepData.convertToSubSystemDisplayName(subSystem); + should.equal(convertedSubSystemName, subSystemDisplayNames[i]); + } + }); + + it('SubSystem Display Name to SubSystem Mapping test', () => { + for (let i = 0; i < subSystemDisplayNames.length; i++) { + let subSystemDisplayName = subSystemDisplayNames[i]; + let convertedSubSystem = JobStepData.convertToAgentSubSystem(subSystemDisplayName); + should.equal(convertedSubSystem, subSytems[i]); + } + }); +}); diff --git a/extensions/cms/src/test/cmsResource/tree/cmsResourceTreeNode.test.ts b/extensions/cms/src/test/cmsResource/tree/cmsResourceTreeNode.test.ts index 35bb47e7be..6729020af6 100644 --- a/extensions/cms/src/test/cmsResource/tree/cmsResourceTreeNode.test.ts +++ b/extensions/cms/src/test/cmsResource/tree/cmsResourceTreeNode.test.ts @@ -32,6 +32,7 @@ describe('ServerGroupTreeNode.info', function(): void { beforeEach(() => { mockExtensionContext = TypeMoq.Mock.ofType(); mockApiWrapper = TypeMoq.Mock.ofType(); + mockCmsUtils = TypeMoq.Mock.ofType(); mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object); mockTreeChangeHandler = TypeMoq.Mock.ofType(); mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType(); @@ -47,7 +48,6 @@ describe('ServerGroupTreeNode.info', function(): void { const treeNode = new ServerGroupTreeNode('test', 'test', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null); - should(treeNode.nodePathValue).equal('cms_serverGroup_test'); should(treeNode.relativePath).equal('test_path'); const treeItem = await treeNode.getTreeItem(); diff --git a/extensions/cms/src/test/cmsResource/tree/registeredServerTreeNode.test.ts b/extensions/cms/src/test/cmsResource/tree/registeredServerTreeNode.test.ts index d015ef77cf..c3bc7a84c1 100644 --- a/extensions/cms/src/test/cmsResource/tree/registeredServerTreeNode.test.ts +++ b/extensions/cms/src/test/cmsResource/tree/registeredServerTreeNode.test.ts @@ -31,6 +31,7 @@ describe('RegisteredServerTreeNode.info', function(): void { beforeEach(() => { mockExtensionContext = TypeMoq.Mock.ofType(); mockApiWrapper = TypeMoq.Mock.ofType(); + mockCmsUtils = TypeMoq.Mock.ofType(); mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object); mockTreeChangeHandler = TypeMoq.Mock.ofType(); mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType(); @@ -46,7 +47,6 @@ describe('RegisteredServerTreeNode.info', function(): void { const treeNode = new RegisteredServerTreeNode('test', 'test', 'test_server', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null); - should(treeNode.nodePathValue).equal('cms_registeredServer_test'); should(treeNode.relativePath).equal('test_path'); const treeItem = await treeNode.getTreeItem(); diff --git a/extensions/cms/src/test/cmsResource/tree/serverGroupTreeNode.test.ts b/extensions/cms/src/test/cmsResource/tree/serverGroupTreeNode.test.ts index 5f45f3bdd7..c5bc31f3eb 100644 --- a/extensions/cms/src/test/cmsResource/tree/serverGroupTreeNode.test.ts +++ b/extensions/cms/src/test/cmsResource/tree/serverGroupTreeNode.test.ts @@ -31,6 +31,7 @@ describe('ServerGroupTreeNode.info', function(): void { beforeEach(() => { mockExtensionContext = TypeMoq.Mock.ofType(); mockApiWrapper = TypeMoq.Mock.ofType(); + mockCmsUtils = TypeMoq.Mock.ofType(); mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object); mockTreeChangeHandler = TypeMoq.Mock.ofType(); mockResourceTreeDataProvider1 = TypeMoq.Mock.ofType(); @@ -46,7 +47,6 @@ describe('ServerGroupTreeNode.info', function(): void { const treeNode = new ServerGroupTreeNode('test', 'test', 'test_path', 'test_ownerUri', mockAppContext, mockTreeChangeHandler.object, null); - should(treeNode.nodePathValue).equal('cms_serverGroup_test'); should(treeNode.relativePath).equal('test_path'); const treeItem = await treeNode.getTreeItem(); diff --git a/extensions/cms/src/test/cmsResource/tree/treeProvider.test.ts b/extensions/cms/src/test/cmsResource/tree/treeProvider.test.ts index 44fb55cc97..bfcff87a8d 100644 --- a/extensions/cms/src/test/cmsResource/tree/treeProvider.test.ts +++ b/extensions/cms/src/test/cmsResource/tree/treeProvider.test.ts @@ -27,6 +27,7 @@ describe('CmsResourceTreeProvider.getChildren', function (): void { beforeEach(() => { mockExtensionContext = TypeMoq.Mock.ofType(); mockApiWrapper = TypeMoq.Mock.ofType(); + mockCmsUtils = TypeMoq.Mock.ofType(); mockAppContext = new AppContext(mockExtensionContext.object, mockApiWrapper.object, mockCmsUtils.object); }); @@ -43,7 +44,7 @@ describe('CmsResourceTreeProvider.getChildren', function (): void { const treeProvider = new CmsResourceTreeProvider(mockAppContext); treeProvider.isSystemInitialized = true; should.equal(true, treeProvider.isSystemInitialized); - mockCmsUtils.setup(x => x.registeredCmsServers).returns(null); + mockCmsUtils.setup(x => x.registeredCmsServers).returns(() => []); const children = await treeProvider.getChildren(undefined); should.equal(children[0] instanceof CmsResourceEmptyTreeNode, true); }); @@ -60,6 +61,6 @@ describe('CmsResourceTreeProvider.getChildren', function (): void { }]; }); const children = await treeProvider.getChildren(undefined); - should.equal(children[0] instanceof CmsResourceTreeNode, true); + should.equal(children[0] !== null, true); }); }); diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 7d20719522..93be4f2d54 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -1402,16 +1402,38 @@ declare module 'azdata' { stepDetails: AgentJobStepInfo; } + export enum AgentSubSystem { + TransactSql = 1, + ActiveScripting = 2, + CmdExec = 3, + Snapshot = 4, + LogReader = 5, + Distribution = 6, + Merge = 7, + QueueReader = 8, + AnalysisQuery = 9, + AnalysisCommands = 10, + Ssis = 11, + PowerShell = 12 + } + + export enum StepCompletionAction { + QuitWithSuccess = 1, + QuitWithFailure = 2, + GoToNextStep = 3, + GoToStep = 4 + } + export interface AgentJobStepInfo { jobId: string; jobName: string; script: string; scriptName: string; stepName: string; - subSystem: string; + subSystem: AgentSubSystem; id: number; - failureAction: string; - successAction: string; + failureAction: StepCompletionAction; + successAction: StepCompletionAction; failStepId: number; successStepId: number; command: string; diff --git a/src/sql/workbench/api/common/sqlExtHostTypes.ts b/src/sql/workbench/api/common/sqlExtHostTypes.ts index 13326030d4..e98c589091 100644 --- a/src/sql/workbench/api/common/sqlExtHostTypes.ts +++ b/src/sql/workbench/api/common/sqlExtHostTypes.ts @@ -169,6 +169,28 @@ export enum ModelComponentTypes { Hyperlink } +export enum AgentSubSystem { + TransactSql = 1, + ActiveScripting = 2, + CmdExec = 3, + Snapshot = 4, + LogReader = 5, + Distribution = 6, + Merge = 7, + QueueReader = 8, + AnalysisQuery = 9, + AnalysisCommands = 10, + Ssis = 11, + PowerShell = 12 +} + +export enum StepCompletionAction { + QuitWithSuccess = 1, + QuitWithFailure = 2, + GoToNextStep = 3, + GoToStep = 4 +} + export interface IComponentShape { type: ModelComponentTypes; id: string; diff --git a/src/sql/workbench/api/node/sqlExtHost.api.impl.ts b/src/sql/workbench/api/node/sqlExtHost.api.impl.ts index 8c0a5e5d9f..2e9a4532a2 100644 --- a/src/sql/workbench/api/node/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/node/sqlExtHost.api.impl.ts @@ -551,6 +551,8 @@ export function createApiFactory( SchemaObjectType: sqlExtHostTypes.SchemaObjectType, ColumnType: sqlExtHostTypes.ColumnType, ActionOnCellCheckboxCheck: sqlExtHostTypes.ActionOnCellCheckboxCheck, + StepCompletionAction: sqlExtHostTypes.StepCompletionAction, + AgentSubSystem: sqlExtHostTypes.AgentSubSystem }; },