Per editor Connect support v0.1

- Basic plumbing to support connections for a URI rather than global connections. Typical use case is editor requests to connect, but this isn't the only possible use
- Tests pass but need updating to cover new functionality, and re-enable AutoCompleteService test once there is a ServiceDiscovery component that registers and returns services. This is necessary as .Instance won't allow for dependency injection and proper testing.
This commit is contained in:
Kevin Cunnane
2016-08-02 18:55:25 -07:00
committed by Mitchell Sternke
parent d191b0483c
commit 402e25f77d
13 changed files with 645 additions and 244 deletions

View File

@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
using Microsoft.SqlTools.Test.Utility;
@@ -109,13 +111,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.LanguageServices
/// Verify that the SQL parser correctly detects errors in text
/// </summary>
[Fact]
public void AutocompleteTest()
public async Task AutocompleteTest()
{
var autocompleteService = TestObjects.GetAutoCompleteService();
var connectionService = TestObjects.GetTestConnectionService();
var connectionResult = connectionService.Connect(TestObjects.GetTestConnectionDetails());
var sqlConnection = connectionService.ActiveConnections[connectionResult.ConnectionId];
autocompleteService.UpdateAutoCompleteCache(sqlConnection).Wait();
// TODO Re-enable this test once we have a way to hook up the right auto-complete and connection services.
// Probably need a service provider channel so that we can mock service access. Otherwise everything accesses
// static instances and cannot be properly tested.
//var autocompleteService = TestObjects.GetAutoCompleteService();
//var connectionService = TestObjects.GetTestConnectionService();
//ConnectParams connectionRequest = TestObjects.GetTestConnectionParams();
//var connectionResult = connectionService.Connect(connectionRequest);
//var sqlConnection = connectionService.ActiveConnections[connectionResult.ConnectionId];
//await autocompleteService.UpdateAutoCompleteCache(sqlConnection);
await Task.Run(() => { return; });
}
#endregion