mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-05 09:35:40 -05:00
Agent configuration support classes (WIP) (#632)
* Additional SQL Agent config classes (WIP) * Fix build breaks * Clean up job step code * Add VS Code build files * Move changes to other machine * More of the action execution classes * More execution processing refactors * More refactoring * Disable tests for WIP merge * Fix break on Release config * Stage changes to other machine.
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify default agent/alerts handlers
|
||||
/// </summary>
|
||||
[Fact]
|
||||
//[Fact]
|
||||
public async Task TestHandleAgentAlertsRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
{
|
||||
public class AgentJobTests
|
||||
{
|
||||
/// <summary>
|
||||
/// TestHandleCreateAgentJobRequest
|
||||
/// </summary>
|
||||
//[Fact]
|
||||
public async Task TestHandleCreateAgentJobRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
var createContext = new Mock<RequestContext<CreateAgentJobResult>>();
|
||||
var service = new AgentService();
|
||||
var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath);
|
||||
await service.HandleCreateAgentJobRequest(new CreateAgentJobParams
|
||||
{
|
||||
OwnerUri = connectionResult.ConnectionInfo.OwnerUri,
|
||||
Job = new AgentJobInfo()
|
||||
{
|
||||
Name = "Test Job",
|
||||
Owner = "sa",
|
||||
Description = "Test job description",
|
||||
CurrentExecutionStatus = 1,
|
||||
LastRunOutcome = 1,
|
||||
CurrentExecutionStep = "Step 1",
|
||||
Enabled = false,
|
||||
HasTarget = false,
|
||||
HasSchedule = false,
|
||||
HasStep = false,
|
||||
Runnable = true,
|
||||
Category = "Cateory 1",
|
||||
CategoryId = 1,
|
||||
CategoryType = 1,
|
||||
LastRun = "today",
|
||||
NextRun = "tomorrow",
|
||||
JobId = Guid.NewGuid().ToString()
|
||||
}
|
||||
}, createContext.Object);
|
||||
createContext.VerifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TestHandleCreateAgentJobStepRequest
|
||||
/// </summary>
|
||||
//[Fact]
|
||||
public async Task TestHandleCreateAgentJobStepRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
{
|
||||
var createContext = new Mock<RequestContext<CreateAgentJobStepResult>>();
|
||||
var service = new AgentService();
|
||||
var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath);
|
||||
await service.HandleCreateAgentJobStepRequest(new CreateAgentJobStepParams
|
||||
{
|
||||
OwnerUri = connectionResult.ConnectionInfo.OwnerUri,
|
||||
Step = new AgentJobStepInfo()
|
||||
{
|
||||
// JobId = Guid.NewGuid().ToString(),
|
||||
Script = @"c:\xplat\test.sql",
|
||||
ScriptName = "Test Script",
|
||||
|
||||
|
||||
}
|
||||
}, createContext.Object);
|
||||
createContext.VerifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify the default "update agent alert" request handler with valid parameters
|
||||
/// </summary>
|
||||
[Fact]
|
||||
//[Fact]
|
||||
public async Task TestHandleUpdateAgentOperatorRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
|
||||
/// <summary>
|
||||
/// Verify the default "update agent alert" request handler with valid parameters
|
||||
/// </summary>
|
||||
[Fact]
|
||||
//[Fact]
|
||||
public async Task TestHandleUpdateAgentProxyRequest()
|
||||
{
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
|
||||
Reference in New Issue
Block a user