Simplify Object Management APIs (#2015)

* unify requests-wip

* wip

* unify api

* fix test

* add credential handler

* fix credential handler issue.

* generic type update

* fix scripting for user
This commit is contained in:
Alan Ren
2023-04-19 15:43:01 -07:00
committed by GitHub
parent 98ad0197e4
commit e314f839d8
57 changed files with 1802 additions and 2234 deletions

View File

@@ -9,7 +9,7 @@ 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.Security;
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectManagement;
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
using Microsoft.SqlTools.ServiceLayer.Test.Common;
using Moq;
@@ -50,17 +50,17 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
{
// setup
var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath);
var credential = await SecurityTestUtils.SetupCredential(connectionResult);
var credential = await ObjectManagementTestUtils.SetupCredential(connectionResult.ConnectionInfo.OwnerUri);
var service = new AgentService();
var proxy = AgentTestUtils.GetTestProxyInfo();
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
// test
await AgentTestUtils.CreateAgentProxy(service, connectionResult, proxy);
// cleanup
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
await SecurityTestUtils.CleanupCredential(connectionResult, credential);
await ObjectManagementTestUtils.CleanupCredential(connectionResult.ConnectionInfo.OwnerUri, credential);
}
}
@@ -74,20 +74,20 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
{
// setup
var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath);
var credential = await SecurityTestUtils.SetupCredential(connectionResult);
var credential = await ObjectManagementTestUtils.SetupCredential(connectionResult.ConnectionInfo.OwnerUri);
var service = new AgentService();
var proxy = AgentTestUtils.GetTestProxyInfo();
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
await AgentTestUtils.CreateAgentProxy(service, connectionResult, proxy);
// test
string originalProxyName = proxy.AccountName;
proxy.AccountName = proxy.AccountName + " Updated";
await AgentTestUtils.UpdateAgentProxy(service, connectionResult, originalProxyName, proxy);
await AgentTestUtils.UpdateAgentProxy(service, connectionResult, originalProxyName, proxy);
// cleanup
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
await SecurityTestUtils.CleanupCredential(connectionResult, credential);
await ObjectManagementTestUtils.CleanupCredential(connectionResult.ConnectionInfo.OwnerUri, credential);
}
}
@@ -101,13 +101,13 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
{
// setup
var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath);
var credential = await SecurityTestUtils.SetupCredential(connectionResult);
var credential = await ObjectManagementTestUtils.SetupCredential(connectionResult.ConnectionInfo.OwnerUri);
var service = new AgentService();
var proxy = AgentTestUtils.GetTestProxyInfo();
// test
await AgentTestUtils.DeleteAgentProxy(service, connectionResult, proxy);
await SecurityTestUtils.CleanupCredential(connectionResult, credential);
await ObjectManagementTestUtils.CleanupCredential(connectionResult.ConnectionInfo.OwnerUri, credential);
}
}
}

View File

@@ -12,7 +12,7 @@ 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.Security;
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectManagement;
using Microsoft.SqlTools.ServiceLayer.Management;
using Microsoft.SqlTools.ServiceLayer.Utility;
using Moq;
@@ -81,7 +81,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Agent
return new AgentProxyInfo()
{
AccountName = "Test Proxy",
CredentialName = SecurityTestUtils.TestCredentialName,
CredentialName = ObjectManagementTestUtils.TestCredentialName,
Description = "Test proxy description",
IsEnabled = true
};