diff --git a/src/Microsoft.SqlTools.ServiceLayer/Agent/Common/AgentUtilities.cs b/src/Microsoft.SqlTools.ServiceLayer/Agent/Common/AgentUtilities.cs
index e0453917..3c727a11 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Agent/Common/AgentUtilities.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Agent/Common/AgentUtilities.cs
@@ -72,10 +72,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
stepInfo.JobId = jobId;
stepInfo.JobName = logEntry.JobName;
stepInfo.StepName = step.Name;
- stepInfo.SubSystem = step.SubSystem.ToString();
+ stepInfo.SubSystem = step.SubSystem;
stepInfo.Id = step.ID;
- stepInfo.FailureAction = step.OnFailAction.ToString();
- stepInfo.SuccessAction = step.OnSuccessAction.ToString();
+ stepInfo.FailureAction = step.OnFailAction;
+ stepInfo.SuccessAction = step.OnSuccessAction;
stepInfo.FailStepId = step.OnFailStep;
stepInfo.SuccessStepId = step.OnSuccessStep;
stepInfo.Command = step.Command;
@@ -103,10 +103,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
stepInfo.JobId = jobId;
stepInfo.JobName = jobName;
stepInfo.StepName = step.Name;
- stepInfo.SubSystem = step.SubSystem.ToString();
+ stepInfo.SubSystem = step.SubSystem;
stepInfo.Id = step.ID;
- stepInfo.FailureAction = step.OnFailAction.ToString();
- stepInfo.SuccessAction = step.OnSuccessAction.ToString();
+ stepInfo.FailureAction = step.OnFailAction;
+ stepInfo.SuccessAction = step.OnSuccessAction;
stepInfo.FailStepId = step.OnFailStep;
stepInfo.SuccessStepId = step.OnSuccessStep;
stepInfo.Command = step.Command;
@@ -221,20 +221,5 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
}
return jobs;
}
-
- public static AgentSubSystem ConvertToAgentSubSytem(string subSystem)
- {
- switch(subSystem)
- {
- case ("Transact-SQL script (T-SQL"):
- return AgentSubSystem.TransactSql;
- case ("Operating system (CmdExec)"):
- return AgentSubSystem.CmdExec;
- case ("PowerShell"):
- return AgentSubSystem.PowerShell;
- default:
- return AgentSubSystem.TransactSql;
- }
- }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Agent/Contracts/AgentJobStepInfo.cs b/src/Microsoft.SqlTools.ServiceLayer/Agent/Contracts/AgentJobStepInfo.cs
index 12bebc0b..8bf8a9f0 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Agent/Contracts/AgentJobStepInfo.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Agent/Contracts/AgentJobStepInfo.cs
@@ -3,6 +3,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
+using Microsoft.SqlServer.Management.Smo.Agent;
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
using Microsoft.SqlTools.Utility;
@@ -21,7 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
public string StepName { get; set; }
- public string SubSystem { get; set; }
+ public AgentSubSystem SubSystem { get; set; }
///
/// Current step id
@@ -30,12 +31,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
/// action to take if the step fails
///
- public string FailureAction { get; set; }
+ public StepCompletionAction FailureAction { get; set; }
///
/// Action to take if the step succeeds
///
- public string SuccessAction { get; set; }
+ public StepCompletionAction SuccessAction { get; set; }
// note we will have either the id or step
// for the steps to go to on failure
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepData.cs b/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepData.cs
index 135b2654..d7b0dc6d 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepData.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepData.cs
@@ -365,6 +365,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
}
return this.failureAction;
}
+ set
+ {
+ if (this.failureAction != value) {
+ this.failureAction = value;
+ }
+ }
}
public JobStepData FailStep
@@ -390,6 +396,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
}
return this.successAction;
}
+ set
+ {
+ if (this.successAction != value) {
+ this.successAction = value;
+ }
+ }
}
public JobStepData SuccessStep
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepsActions.cs b/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepsActions.cs
index 8b7e361a..96a16ba5 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepsActions.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobStepsActions.cs
@@ -44,7 +44,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
this.data.ID = stepInfo.Id;
this.data.Name = stepInfo.StepName;
this.data.Command = stepInfo.Command;
- this.data.Subsystem = AgentUtilities.ConvertToAgentSubSytem(stepInfo.SubSystem);
+ this.data.Subsystem = stepInfo.SubSystem;
+ this.data.FailureAction = stepInfo.FailureAction;
+ this.data.SuccessAction = stepInfo.SuccessAction;
}
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)
diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Agent/AgentTestUtils.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Agent/AgentTestUtils.cs
index 0ad1f917..c288cadc 100644
--- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Agent/AgentTestUtils.cs
+++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Agent/AgentTestUtils.cs
@@ -30,7 +30,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
Id = 1,
JobName = job.Name,
StepName = stepName,
- SubSystem = "T-SQL",
+ SubSystem = SqlServer.Management.Smo.Agent.AgentSubSystem.TransactSql,
Script = "SELECT @@VERSION",
DatabaseName = connectionResult.ConnectionInfo.ConnectionDetails.DatabaseName,
DatabaseUserName = connectionResult.ConnectionInfo.ConnectionDetails.UserName,