mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 09:59:48 -05:00
* Added AzureMonitor to Microsoft.Kusto.ServiceLayer. * Added Intellisense for AzureMonitor. Moved Intellisense logic from KustoIntellisenseClient to IntellisenseClientBase. * Added ServiceName as a command parameter for starting Kusto. * Added check to return null if connectionInfo is not in the connectionService. * Added support for Dashboard in MetadataService and AdminService. * Removed workspace id from databaseName for Monitor. Added logic for MetadataService and AdminService to return different information for AzureMonitor. * Moved providerName and providerDescription to DataSourceFactory. * Changed DatabaseName to include Name and Id. Changed ProviderName to LOGANALYTICS in DataSourceFactory * Fixed unit tests * Changed logic to use ServiceName instead of server to determine DataSourceType * Code review feedback and reverted changes to ObjectExplorerService. * Removed unused reference from HostLoader * Changed Parallel.Invoke to await Task.Run * Moved Kusto datasource and supporting classes to separate directory. * Removed unused datasourceFactory from ConnectionService. Added GetDatabases and GetDatabaseInfo to IDataSource and child classes * Renamed Instance variables in ObjectExplorerService. Removed unused attribute on TSqlFormatterService. Removed invalid comment in ConnectionService. * Fixed warnings in build. * Moved SizeInMB to DatabaseMetadata. Refactored ConvertToDatabaseInfo * Fixed unit test
65 lines
2.4 KiB
C#
65 lines
2.4 KiB
C#
using System;
|
|
using Microsoft.Kusto.ServiceLayer.DataSource.Contracts;
|
|
using Microsoft.Kusto.ServiceLayer.DataSource.Kusto;
|
|
using NUnit.Framework;
|
|
|
|
namespace Microsoft.Kusto.ServiceLayer.UnitTests.DataSource
|
|
{
|
|
public class KustoClientTests
|
|
{
|
|
[TestCase("dstsAuth")]
|
|
[TestCase("AzureMFA")]
|
|
public void Constructor_Throws_ArgumentException_For_MissingToken(string authType)
|
|
{
|
|
var connectionDetails = new DataSourceConnectionDetails
|
|
{
|
|
UserToken = "",
|
|
AuthenticationType = authType
|
|
};
|
|
|
|
Assert.Throws<ArgumentException>(() => new KustoClient(connectionDetails, "ownerUri"));
|
|
}
|
|
|
|
[Test]
|
|
[Ignore("This should be moved to an integration test since Kusto Client calls Query")]
|
|
public void Constructor_Sets_ClusterName_With_DefaultDatabaseName()
|
|
{
|
|
string clusterName = "https://fake.url.com";
|
|
var connectionDetails = new DataSourceConnectionDetails
|
|
{
|
|
UserToken = "UserToken",
|
|
ServerName = clusterName,
|
|
DatabaseName = "",
|
|
AuthenticationType = "AzureMFA"
|
|
};
|
|
|
|
var client = new KustoClient(connectionDetails, "ownerUri");
|
|
|
|
Assert.AreEqual(clusterName, client.ClusterName);
|
|
Assert.AreEqual("NetDefaultDB", client.DatabaseName);
|
|
}
|
|
|
|
[TestCase("dstsAuth")]
|
|
[TestCase("AzureMFA")]
|
|
[TestCase("NoAuth")]
|
|
[TestCase("SqlLogin")]
|
|
public void Constructor_Creates_Client_With_Valid_AuthenticationType(string authenticationType)
|
|
{
|
|
string clusterName = "https://fake.url.com";
|
|
var connectionDetails = new DataSourceConnectionDetails
|
|
{
|
|
UserToken = "UserToken",
|
|
ServerName = clusterName,
|
|
DatabaseName = "FakeDatabaseName",
|
|
AuthenticationType = authenticationType,
|
|
UserName = authenticationType == "SqlLogin" ? "username": null,
|
|
Password = authenticationType == "SqlLogin" ? "password": null
|
|
};
|
|
|
|
var client = new KustoClient(connectionDetails, "ownerUri");
|
|
|
|
Assert.AreEqual(clusterName, client.ClusterName);
|
|
Assert.AreEqual("FakeDatabaseName", client.DatabaseName);
|
|
}
|
|
}
|
|
} |