Commit Graph

24 Commits

Author SHA1 Message Date
Cheena Malhotra
187b6ecc14 Introduce AAD interactive auth mode (#1860) 2023-03-02 09:39:54 -08:00
Karl Burtram
f288bee294 Make nullable warnings a per file opt-in (#1842)
* Make nullable warnings a per file opt-in

* Remove unneeded compiler directives

* Remove compiler directive for User Data
2023-02-03 18:10:07 -08:00
Cheena Malhotra
c0f8482e26 Update Microsoft.Data.SqlClient to v5.0.1 (#1708) 2022-10-24 20:10:04 -07:00
Charles Gagnon
82118f6431 Add code coverage reporting (#1585)
* Add code coverage

* fix and add publishTestResults

* Use PublishTestResults

* Add coverlet.msbuild

* Generate report

* Update coverage report location

* Add one more
2022-07-18 15:31:47 -07:00
Charles Gagnon
dd11be3d38 Consolidate to net6.0 (#1547)
* Add SqlClient event listener

* comments

* ensure not disposed early

* initial

* net6.0

* undo
2022-06-21 08:53:23 -07:00
Charles Gagnon
40c5d48c5e Fail build on unneeded usings (#1417) 2022-03-04 16:38:01 -08:00
Charles Gagnon
c248400a6c Add linting for copyright and unused usings (#1416)
* Add linting for copyright and unused usings

* Add one more + comment

* Enforce in build and fix errors

* Fix build
2022-03-04 15:17:29 -08:00
Justin M
f2da10f23a 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
2021-10-07 11:46:13 -07:00
Justin M
1f7da97e6c Added AzureMonitor to Microsoft.Kusto.ServiceLayer (#1208)
* 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
2021-06-25 21:40:45 -07:00
Aasim Khan
9877af54b9 Updating to dotnet 5.0 (#1218)
* adding network file validator contract

* updating to dotnet 5

* reverting change in pipeline

* updating target framework to 5.0

* updating srgen and using target framework var

* reverting srgen back to 3.1

* Adding dotnet 3.1 to build

* Fixing task def

* removing global json

* updating other 3.1 refs to 5.0

* removing netcore folder from build.cake

* Moving and renaming dotnet 3.1 task
2021-06-25 13:53:01 -07:00
Alex Ma
993b094db9 Localization added to sqlservicetools (#1216)
* added other languages to ServiceLayer

* fixed travis and appveyor yaml, added other languages for localization

* added spanish and german strings to credentialslocalization, also WIP for coreservices test

* added WIP localization test for CoreServices

* Removed unit test for coreservices, need to work on those later.

* restored travis and appveyor

* added kusto string resource localization test

* added localization test and locale change for SqlToolsCredentials

* added locale command options to ResourceProvider

* revert resourceprovider test

* Localized SqlTools.Credentials

* added hosting localization

* replaced new with translation to be consistent with main service layer

* reverted external changes as it is unnecessary

* Translated ManagedBatchParser

* test culture value

* test culture change

* temporarily comment out service layer command options

* returned sr.cs

* temporarily remove bad tests

* restored tests and allowed for SR culture to change for dependencies (for future testing)

* localization for resourceprovider components added.

* Set LocaleSetter to public and also removed InternalsVisible for Kusto, Credentials and ResourceProvider

* removed unnecessary changes

* Removed CredentialsCommandOptions

* renamed pt-BR to pt-br

* Rename sr.pt-BR.xlf.template to sr.pt-br.xlf.template

* Rename src/Microsoft.SqlTools.ServiceLayer/Localization/LCL/pt-BR/sr.resx.lcl to src/Microsoft.SqlTools.ServiceLayer/Localization/LCL/pt-br/sr.resx.lcl

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* restored newlines

* Update sr.pt-br.xlf.template

Removed newline

* removed newline

* fixing newlines for consistency

* removed unnecessary newline
2021-06-10 15:50:53 -07:00
Justin M
516553f72a Default Kusto database name (#1187)
* Added check to set the databaseName to the first database on the cluster when no database is provided

* Changed kusto query for loading databases to follow best practices

* Fixed failing unit test

* Optimized query for getting first database
2021-04-13 00:00:56 -07:00
Justin M
13a7d4aa2b Kusto NoAuth authentication (#1161)
* Added username and password to DataSourceConnectionDetails. Refactored KustoClient>GetKustoConnectionStringBuilder to accept no username or password for no credentials authentication.

* Removed invalid Unit Test and added 2 unit tests for testing authentication type.

* Added validation for dstsAuth and AzureMFA in DataSourceFactory. Added unit test for validation.
2021-02-23 17:29:09 -08:00
Justin M
6f22dcf241 Kusto Auth Refactor Tests (#1148)
* Refactored Kusto.ServiceLayer to pass ConnectionDetails to DataSourceFactory instead of connection string. Created KustoConnectionDetails to map needed details to KustoClient.

* Removed unused ScriptingScriptOperation from KustoServiceLayer.

* Created DstsAuthenticationManager and moved logic for getting DstsToken. Updated error message for failing to create KustoConnection.

* Removed DstsAuthenticationManager.cs. Refactored DataSourceFactory to retrieve UserToken from ConnectionDetails.

* Renamed AzureAccountToken in ConnectionDetails to AccountToken. Changed mapping to KustoConnectionDetails based on the AccountToken.

* Removed Kusto.Data reference from ConnectionService and ScriptingListObjectsOperation. Moved creation of KustoConnectionStringBuilder to DataSourceFactory

* Added accountToken validation to DataSourceFactory Create.

* Renamed KustoConnectionDetails to DataSourceConnectionDetails. Renamed AzureToken to AuthToken.

* Refactored SchemaState and intellisense out of KustoClient to KustoIntellisenseClient. Added IIntellisenseClient. Added unit tests for KustoIntellisenseClient and KustoClient.

* Removed unused property dataSourceFactory from LanguageService > InitializeService. Moved KustoIntellisense functions from KustoIntellisenseHelper to KustoIntellisenseClient and made SchemaState private. Added IIntellisenseClient to IDataSource.

* Renamed directory from DataSourceIntellisense to Intellisense and updated namespace. Fixed namespace in ScriptDocumentInfo.
2021-01-29 11:25:23 -08:00
Justin M
f0a5e11d51 dSTS Authentication (#1125)
* Refactored Kusto.ServiceLayer to pass ConnectionDetails to DataSourceFactory instead of connection string. Created KustoConnectionDetails to map needed details to KustoClient.

* Removed unused ScriptingScriptOperation from KustoServiceLayer.

* Created DstsAuthenticationManager and moved logic for getting DstsToken. Updated error message for failing to create KustoConnection.

* Removed DstsAuthenticationManager.cs. Refactored DataSourceFactory to retrieve UserToken from ConnectionDetails.

* Renamed AzureAccountToken in ConnectionDetails to AccountToken. Changed mapping to KustoConnectionDetails based on the AccountToken.

* Removed Kusto.Data reference from ConnectionService and ScriptingListObjectsOperation. Moved creation of KustoConnectionStringBuilder to DataSourceFactory

* Added accountToken validation to DataSourceFactory Create.

* Renamed KustoConnectionDetails to DataSourceConnectionDetails. Renamed AzureToken to AuthToken.
2021-01-14 13:49:09 -08:00
Justin M
fd84367008 4094 Kusto AAD Authentication Refactor (#1115)
* 4094 Upgraded Kusto.Data and Kusto.Language to 9.0.3. Refactored KustoServiceLayer to use KustoConnectionStringBuilder instead of Sql.

* 4094 Refactored KustoClient>Initialize to take connectionString as optional. Removed unused properties from ConnectionService>ParseConnectionString

* 4094 Updated Kusto.Data and Kusto.Language nuget packages to 9.0.4. Removed IsDedicatedAdminConnection function in ConnectionService.

* 4094 Fixed unit tests
2020-11-20 11:54:40 -08:00
Charles Gagnon
978a2cb525 Fix nunit package reference (#1120)
* Fix nunit package reference

* update more packages

* Fix casing
2020-11-11 13:31:03 -08:00
Justin M
954df47ec9 13159 Kusto Aria Fix (#1112)
* 13159 Changed NodeValue in TreeNode to PrettyName instead of Name. In KustoDataSource, changed Exists to run different query for Aria. Changed GetClusterDiagnostics to return empty DiagnosticsInfo for Aria. Changed SetDatabaseMetadata to not includeSizeDetails for Aria connections.

* 13159 Fixed unit test Refresh_Returns_Children
2020-11-02 15:35:37 -08:00
Justin M
f2eb590d97 3490 Kusto Connection Refresh Fix (#1085)
* 3490 Injected OwnerUri into KustClient to store for token refreshing. Removed UpdateAzureToken from IDataSource, DataSourceBase, and KustoDataSource. Removed logic for retrying queries related to Unauthorized datasource in Batch and Query. Changed ScriptingService, ScriptingScriptOperation, and ScriptAsScriptingOperation to take DataSource in the constructor instead of datasourcefactory. Changed ScriptingService to inject ConnectionService through InitializeService function.

* 3490 Removed Catch block for DataSourceUnauthorizedException in ExecuteControlCommandAsync

* 3490 Removed OwnerUri from KustoClient and used azureAccountToken to refresh token in ConnectionService.

* 3490 Reverted unneeded changes.

* 3490 Split ExecuteQuery in KustoClient to execute first query then remaining queries after

* 3490 Passed OwnerUri down into KustoClient to refresh token.

* 3490 Removed DataSourceUnauthorizedException. Refactored ExecuteQuery to catch aggregate exception. Added RefreshAzureToken logic to ExecuteControlCommand

* 3490 Added logic to update ReliableDataSourceConnection azure token within ConnectionInfo.

* 3490 Add retry logic to ExecuteQuery and ExecuteControlCommand in KustoClient
2020-10-06 17:20:13 -07:00
Justin M
2b022d2e48 3326 Kusto HTTPS url fix (#1086)
* 3326 Removed sqlConnection.Open from CreateSqlConnection in ConnectionService.

* 3326 Removed unused variables and functions from ConnectedBindingContext, ConnectedBindingQueue, IBindingContext, and IConnectedBindingQueue

* 3326 Removed unused constant SqlAzureEdition and unused functions CreateSqlConnection and CreateServerConnection from ConnectionService. Removed ServerConnection, MetadataDisplayInfoProvider, Binder, and SmoMetaDataProvider from ConnectedBindingContext. Deleted SqlConnectionOpener and ISqlConnectionOpener.
2020-10-05 00:56:40 -07:00
Monica Gupta
86dabba2f8 Change default kusto query to get 10 rows (#1077)
* Query to get 10 rows for Kusto queries

* fix unit tests

* Addressed comments

Co-authored-by: Monica Gupta <mogupt@microsoft.com>
2020-09-17 17:00:26 -07:00
Justin M
cd1e4f5ec5 3647 Kusto Refresh Logic (#1067)
* 3647 Renamed ParentMetadata to DatabaseMetadata in FolderMetadata.cs. Removed Refresh function from IDataSource and DataSourceBase since it's not used outside of KustoDataSource. Added unit tests for ServerNode.cs. Removed unused constructor from TreeNode and unused AddChild function.

* 3647 Refactored KustoDataSource. Moved Set logic for DatabaseMetadata and columns into separate functions

* 3647 Reverted Rename of ParentMetadata in FolderMetadata. Reverted removal of Refresh function from DataSourceBase and IDatasource

* 3647 Renamed SmoModel directories to DataSourceModel in Kusto projects.

* 3647 Removed reference to Kusto.ServiceLayer in SqlTools.ServiceLayer
2020-09-08 08:01:39 -07:00
Justin M
c932ef8613 3278 Kusto Unit Tests - Part 2 (#1063)
* 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

* 3278 Minor refactors in ConnectionInfo, BindingQueue, DiagnosticsHelper, MetadataService, and HostLoader. Changed AssemblyInfo to only allow Kusto Unit Tests for internal access. Added lots of unit tests.

* 3278 Commented out bindingContext.IsConnected in AddConnectionContext_Sets_BindingContext

* 3278 Reversed order of unit tests in ConnectedBindingQueueTests and added throw to Catch block.

* 3278 Reverted change to ConnectedBindingQueue. Removed unit test from AddConnectionContext for NeedsMetaData True

Co-authored-by: Jorge Berumen <52225468+joberume@users.noreply.github.com>
Co-authored-by: joberume <jberumen3@miners.utep.edu>
2020-09-03 16:17:39 -07:00
Justin M
1577177153 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>
2020-08-31 11:11:12 -07:00