mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Test fixes to enable integration suites
This commit is contained in:
@@ -153,16 +153,19 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.LanguageServices
|
|||||||
// Test is causing failures in build lab..investigating to reenable
|
// Test is causing failures in build lab..investigating to reenable
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ServiceInitiailzation()
|
public void ServiceInitiailzation()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
InitializeTestServices();
|
InitializeTestServices();
|
||||||
|
}
|
||||||
|
catch (System.ArgumentException)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Assert.True(LanguageService.Instance.Context != null);
|
Assert.True(LanguageService.Instance.Context != null);
|
||||||
Assert.True(LanguageService.ConnectionServiceInstance != null);
|
Assert.True(LanguageService.ConnectionServiceInstance != null);
|
||||||
Assert.True(LanguageService.Instance.CurrentSettings != null);
|
Assert.True(LanguageService.Instance.CurrentSettings != null);
|
||||||
Assert.True(LanguageService.Instance.CurrentWorkspace != null);
|
Assert.True(LanguageService.Instance.CurrentWorkspace != null);
|
||||||
|
|
||||||
LanguageService.ConnectionServiceInstance = null;
|
|
||||||
Assert.True(LanguageService.ConnectionServiceInstance == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -178,15 +181,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.LanguageServices
|
|||||||
ScriptFile scriptFile = WorkspaceService<SqlToolsSettings>.Instance.Workspace.GetFile(sqlFilePath);
|
ScriptFile scriptFile = WorkspaceService<SqlToolsSettings>.Instance.Workspace.GetFile(sqlFilePath);
|
||||||
|
|
||||||
string ownerUri = scriptFile.ClientFilePath;
|
string ownerUri = scriptFile.ClientFilePath;
|
||||||
var connectionService = TestObjects.GetTestConnectionService();
|
var connectionService = TestObjects.GetLiveTestConnectionService();
|
||||||
var connectionResult =
|
var connectionResult =
|
||||||
connectionService
|
connectionService
|
||||||
.Connect(new ConnectParams()
|
.Connect(new ConnectParams()
|
||||||
{
|
{
|
||||||
OwnerUri = ownerUri,
|
OwnerUri = ownerUri,
|
||||||
Connection = TestObjects.GetTestConnectionDetails()
|
Connection = TestObjects.GetIntegratedTestConnectionDetails()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connectionResult.Wait();
|
||||||
|
|
||||||
ConnectionInfo connInfo = null;
|
ConnectionInfo connInfo = null;
|
||||||
connectionService.TryFindConnection(ownerUri, out connInfo);
|
connectionService.TryFindConnection(ownerUri, out connInfo);
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
//#define USE_LIVE_CONNECTION
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -28,13 +26,14 @@ namespace Microsoft.SqlTools.Test.Utility
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static ConnectionService GetTestConnectionService()
|
public static ConnectionService GetTestConnectionService()
|
||||||
{
|
{
|
||||||
#if !USE_LIVE_CONNECTION
|
|
||||||
// use mock database connection
|
// use mock database connection
|
||||||
return new ConnectionService(new TestSqlConnectionFactory());
|
return new ConnectionService(new TestSqlConnectionFactory());
|
||||||
#else
|
}
|
||||||
|
|
||||||
|
public static ConnectionService GetLiveTestConnectionService()
|
||||||
|
{
|
||||||
// connect to a real server instance
|
// connect to a real server instance
|
||||||
return ConnectionService.Instance;
|
return ConnectionService.Instance;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -65,9 +64,19 @@ namespace Microsoft.SqlTools.Test.Utility
|
|||||||
return new ConnectionDetails()
|
return new ConnectionDetails()
|
||||||
{
|
{
|
||||||
UserName = "sa",
|
UserName = "sa",
|
||||||
Password = "Yukon900",
|
Password = "...",
|
||||||
DatabaseName = "AdventureWorks2016CTP3_2",
|
DatabaseName = "master",
|
||||||
ServerName = "sqltools11"
|
ServerName = "localhost"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConnectionDetails GetIntegratedTestConnectionDetails()
|
||||||
|
{
|
||||||
|
return new ConnectionDetails()
|
||||||
|
{
|
||||||
|
DatabaseName = "master",
|
||||||
|
ServerName = "localhost",
|
||||||
|
AuthenticationType = "Integrated"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,14 +94,17 @@ namespace Microsoft.SqlTools.Test.Utility
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static ISqlConnectionFactory GetTestSqlConnectionFactory()
|
public static ISqlConnectionFactory GetTestSqlConnectionFactory()
|
||||||
{
|
{
|
||||||
#if !USE_LIVE_CONNECTION
|
|
||||||
// use mock database connection
|
// use mock database connection
|
||||||
return new TestSqlConnectionFactory();
|
return new TestSqlConnectionFactory();
|
||||||
#else
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a test sql connection factory instance
|
||||||
|
/// </summary>
|
||||||
|
public static ISqlConnectionFactory GetLiveTestSqlConnectionFactory()
|
||||||
|
{
|
||||||
// connect to a real server instance
|
// connect to a real server instance
|
||||||
return ConnectionService.Instance.ConnectionFactory;
|
return ConnectionService.Instance.ConnectionFactory;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user