Ledger Objects Representation in Object Explorer (#1615)

* support for ledger objects in OE

* generated sr files

* update versionKey to sql 2022 in test env config

* more 2019 to 2022 updates

* add sql2022 instead of replacing

* missed filter on table

* add logging

* more logging

* adding Script160Compat options for sql2022

Co-authored-by: Alan Ren <alanren@microsoft.com>
This commit is contained in:
Jordan Hays
2022-08-05 13:53:17 -04:00
committed by GitHub
parent 1789fd1233
commit d78ff94b31
25 changed files with 442 additions and 53 deletions

View File

@@ -32,6 +32,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
public const string DefaultSqlAzureV12InstanceKey = "defaultSqlAzureV12";
public const string DefaultSql2016InstanceKey = "defaultSql2016";
public const string DefaultSql2019InstanceKey = "defaultSql2019";
public const string DefaultSql2022InstanceKey = "defaultSql2022";
public const string DefaultSqlvNextInstanceKey = "defaultSqlvNext";
private TestConnectionProfileService()
@@ -72,11 +73,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
get { return GetInstance(DefaultSql2016InstanceKey); }
}
public static InstanceInfo DefaultSql2019
public static InstanceInfo DefaultSql2019
{
get { return GetInstance(DefaultSql2019InstanceKey); }
}
public static InstanceInfo DefaultSql2022
{
get { return GetInstance(DefaultSql2022InstanceKey); }
}
public static InstanceInfo DefaultSqlvNext
{
get { return GetInstance(DefaultSqlvNextInstanceKey); }
@@ -93,7 +99,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
return instanceInfo;
}
public ConnectParams GetConnectionParameters(string key = DefaultSql2019InstanceKey, string databaseName = null)
public ConnectParams GetConnectionParameters(string key = DefaultSql2022InstanceKey, string databaseName = null)
{
InstanceInfo instanceInfo = GetInstance(key);
if (instanceInfo != null)
@@ -111,7 +117,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
public ConnectParams GetConnectionParameters(TestServerType serverType = TestServerType.OnPrem, string databaseName = null)
{
string key = ConvertServerTypeToVersionKey(serverType);
return GetConnectionParameters(key, databaseName);
return GetConnectionParameters(key, databaseName);
}
/// <summary>
@@ -134,7 +140,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
foreach (var serverIdentity in testServers)
{
var instance = settings != null ? settings.GetConnectionProfile(serverIdentity.ProfileName, serverIdentity.ServerName) : null;
if (instance.ServerType == TestServerType.None)
if (instance?.ServerType == TestServerType.None)
{
instance.ServerType = serverIdentity.ServerType;
AddInstance(instance);
@@ -149,7 +155,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
}
}
}
catch(Exception ex)
catch (Exception ex)
{
Assert.True(false, "Fail to load the SQL connection instances. error: " + ex.Message);
}
@@ -157,6 +163,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
private static void AddInstance(InstanceInfo instance)
{
Console.WriteLine($"Checking whether instance should be added to connections cache, server type: {instance.ServerType.ToString()}, version key: {instance.VersionKey}");
if (instance != null && (instance.ServerType != TestServerType.None || !string.IsNullOrEmpty(instance.VersionKey)))
{
TestServerType serverType = instance.ServerType == TestServerType.None ? TestServerType.OnPrem : instance.ServerType; //Default to onPrem
@@ -170,13 +177,22 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
instance.Password = credential.Password;
}
connectionProfilesCache.Add(versionKey, instance);
Console.WriteLine("Instance added.");
}
else
{
Console.WriteLine("Instance already in the cache.");
}
}
else
{
Console.WriteLine("Instance skipped.");
}
}
private static string ConvertServerTypeToVersionKey(TestServerType serverType)
{
return serverType == TestServerType.OnPrem ? DefaultSql2019InstanceKey : DefaultSqlAzureV12InstanceKey;
return serverType == TestServerType.OnPrem ? DefaultSql2022InstanceKey : DefaultSqlAzureV12InstanceKey;
}
/// <summary>