mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-24 01:25:42 -05:00
Kusto AdminService Unit Tests (#1257)
* Added unit tests for AdminService. Added interface for IConnectionService. * Kusto connection map to ConnectionManager (#1258) * Created ConnectionManager and moved connectionMap. Changed references from ConnectionService to ConnectionManager. * Changed creation of ConnectionManager to MEF instead of Instance creation
This commit is contained in:
@@ -123,6 +123,8 @@ namespace Microsoft.Kusto.ServiceLayer.QueryExecution
|
||||
/// </summary>
|
||||
private ConnectionService ConnectionService { get; }
|
||||
|
||||
private IConnectionManager _connectionManager;
|
||||
|
||||
private WorkspaceService<SqlToolsSettings> WorkspaceService { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -160,8 +162,10 @@ namespace Microsoft.Kusto.ServiceLayer.QueryExecution
|
||||
/// event handler.
|
||||
/// </summary>
|
||||
/// <param name="serviceHost">The service host instance to register with</param>
|
||||
public void InitializeService(ServiceHost serviceHost)
|
||||
public void InitializeService(ServiceHost serviceHost, IConnectionManager connectionManager)
|
||||
{
|
||||
_connectionManager = connectionManager;
|
||||
|
||||
// Register handlers for requests
|
||||
serviceHost.SetRequestHandler(ExecuteDocumentSelectionRequest.Type, HandleExecuteRequest);
|
||||
serviceHost.SetRequestHandler(ExecuteDocumentStatementRequest.Type, HandleExecuteRequest);
|
||||
@@ -252,7 +256,7 @@ namespace Microsoft.Kusto.ServiceLayer.QueryExecution
|
||||
|
||||
// get connection
|
||||
ConnectionInfo connInfo;
|
||||
if (!ConnectionService.TryFindConnection(executeParams.OwnerUri, out connInfo))
|
||||
if (!_connectionManager.TryGetValue(executeParams.OwnerUri, out connInfo))
|
||||
{
|
||||
await requestContext.SendError(SR.QueryServiceQueryInvalidOwnerUri);
|
||||
return;
|
||||
@@ -269,7 +273,7 @@ namespace Microsoft.Kusto.ServiceLayer.QueryExecution
|
||||
await ConnectionService.Connect(connectParams);
|
||||
|
||||
ConnectionInfo newConn;
|
||||
ConnectionService.TryFindConnection(randomUri, out newConn);
|
||||
_connectionManager.TryGetValue(randomUri, out newConn);
|
||||
|
||||
Func<string, Task> queryCreateFailureAction = message => requestContext.SendError(message);
|
||||
|
||||
@@ -707,7 +711,7 @@ namespace Microsoft.Kusto.ServiceLayer.QueryExecution
|
||||
{
|
||||
connectionInfo = connInfo;
|
||||
}
|
||||
else if (!ConnectionService.TryFindConnection(executeParams.OwnerUri, out connectionInfo))
|
||||
else if (!_connectionManager.TryGetValue(executeParams.OwnerUri, out connectionInfo))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(executeParams.OwnerUri), SR.QueryServiceQueryInvalidOwnerUri);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.Kusto.ServiceLayer.QueryExecution
|
||||
{
|
||||
|
||||
[Export(typeof(IHostedService))]
|
||||
|
||||
public class SerializationService : HostedService<SerializationService>, IComposableService
|
||||
{
|
||||
private ConcurrentDictionary<string, DataSerializer> inProgressSerializations;
|
||||
|
||||
Reference in New Issue
Block a user