mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-27 17:24:26 -05:00
3278 Kusto Unit Tests - Part 1 (#1057)
* 3278 Added unit tests in MetadataFactoryTests and Microsoft.Kusto.ServiceLayer.UnitTests project * 3278 Removed todo and changed unit test to validate megabytes * 3278 Added file and unit tests in AutoCompleteHelperTests.cs * 3278 Removed unused functions from Kusto > ScriptAsScriptingOperation * 3278 Added unit tests for DataSourceFactory * 3278 Refactored AdminService to pass in ConnectionService rather than through instance variable. Added unit test for AdminServiceTests * 3278 Refactored DataSourceFactory to not have static functions for future unit tests * 3278 Re-added properties that were flagged as unused but are being used by ADS in ReliableDataSourceConnection.cs * 3278 Re-added properties that were flagged as unused but are being used by ADS in ReliableDataSourceConnection.cs * adding pipeline to execute tests (#1062) * 3278 Converted GetDefaultAutoComplete and GetDefaultSemanticMarkers to static functions in DataSourceFactory. Removed unused constructor in ScriptFile. Added positive unit tests for both functions * undoing release version bump * adding additional configs * adressing feedback * Correcting path in csproj Co-authored-by: Jorge Berumen <52225468+joberume@users.noreply.github.com> Co-authored-by: joberume <jberumen3@miners.utep.edu>
This commit is contained in:
@@ -59,6 +59,8 @@ namespace Microsoft.Kusto.ServiceLayer.Connection
|
||||
|
||||
private ConcurrentDictionary<string, IConnectedBindingQueue> connectedQueues = new ConcurrentDictionary<string, IConnectedBindingQueue>();
|
||||
|
||||
private IDataSourceFactory _dataSourceFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Map from script URIs to ConnectionInfo objects
|
||||
/// This is internal for testing access only
|
||||
@@ -397,7 +399,7 @@ namespace Microsoft.Kusto.ServiceLayer.Connection
|
||||
DataSourceObjectMetadata clusterMetadata = MetadataFactory.CreateClusterMetadata(connectionInfo.ConnectionDetails.ServerName);
|
||||
|
||||
DiagnosticsInfo clusterDiagnostics = dataSource.GetDiagnostics(clusterMetadata);
|
||||
ReliableConnectionHelper.ServerInfo serverInfo = DataSourceFactory.ConvertToServerinfoFormat(DataSourceType.Kusto, clusterDiagnostics);
|
||||
ReliableConnectionHelper.ServerInfo serverInfo = DataSourceFactory.ConvertToServerInfoFormat(DataSourceType.Kusto, clusterDiagnostics);
|
||||
|
||||
response.ServerInfo = new ServerInfo
|
||||
{
|
||||
@@ -789,10 +791,11 @@ namespace Microsoft.Kusto.ServiceLayer.Connection
|
||||
}
|
||||
|
||||
public void InitializeService(IProtocolEndpoint serviceHost, IDataSourceConnectionFactory dataSourceConnectionFactory,
|
||||
IConnectedBindingQueue connectedBindingQueue)
|
||||
IConnectedBindingQueue connectedBindingQueue, IDataSourceFactory dataSourceFactory)
|
||||
{
|
||||
ServiceHost = serviceHost;
|
||||
_dataSourceConnectionFactory = dataSourceConnectionFactory;
|
||||
_dataSourceFactory = dataSourceFactory;
|
||||
|
||||
connectedQueues.AddOrUpdate("Default", connectedBindingQueue, (key, old) => connectedBindingQueue);
|
||||
LockedDatabaseManager.ConnectionService = this;
|
||||
@@ -1411,7 +1414,7 @@ namespace Microsoft.Kusto.ServiceLayer.Connection
|
||||
string connectionString = BuildConnectionString(connInfo.ConnectionDetails);
|
||||
|
||||
// TODOKusto: Pass in type of DataSource needed to make this generic. Hard coded to Kusto right now.
|
||||
return DataSourceFactory.Create(DataSourceType.Kusto, connectionString, connInfo.ConnectionDetails.AzureAccountToken);
|
||||
return _dataSourceFactory.Create(DataSourceType.Kusto, connectionString, connInfo.ConnectionDetails.AzureAccountToken);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user