mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Revert "Revert "Adding new Dac Deployment Options and getting descriptions fr…" (#1507)
* Adding missing Deploy options
* SQL DB Project database genScript/Publish working but tests
* Test cases fixed for the changes for DacFx and SC services
* Refactored the model name and tested the changes with ADS extensions.
* updated DeploymentOptionProperty model and corresponding updates.
* Adding DisplayNames to the deploymentOptionProperty to maintain names in STS for all extensions.
* MapTabe intialization in constructor
* Updated comment with more meaning
* Porperty strong type update with actual type
* Creating model with generic type getting using Activator.CreateInstance
* Rebase to main and resolved merge conflicts
* Xml comments added and code updated
* Deployment options update
* Deployoptions typo and comments updates a
* updated deployment options comments
* removed unnecessary using statement
* code refactor
* Revert "Revert "Adding new Dac Deployment Options and getting descriptions from DacFx API (#1357)" (#1493)"
This reverts commit 2b48331115.
* removing duplicated default empty string value
This commit is contained in:
committed by
GitHub
parent
262fd00afd
commit
62d3cdc99a
@@ -586,8 +586,8 @@ FROM MissingEdgeHubInputStream'";
|
||||
UpgradeExisting = true,
|
||||
DeploymentOptions = new DeploymentOptions()
|
||||
{
|
||||
DropObjectsNotInSource = false,
|
||||
ExcludeObjectTypes = new[] { ObjectType.Views }
|
||||
DropObjectsNotInSource = new DeploymentOptionProperty<bool>(false),
|
||||
ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>(new[] { ObjectType.Views })
|
||||
}
|
||||
};
|
||||
|
||||
@@ -664,8 +664,8 @@ FROM MissingEdgeHubInputStream'";
|
||||
DatabaseName = targetDb.DatabaseName,
|
||||
DeploymentOptions = new DeploymentOptions()
|
||||
{
|
||||
DropObjectsNotInSource = false,
|
||||
ExcludeObjectTypes = new[] { ObjectType.Views }
|
||||
DropObjectsNotInSource = new DeploymentOptionProperty<bool>(false),
|
||||
ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>(new[] { ObjectType.Views })
|
||||
}
|
||||
};
|
||||
|
||||
@@ -682,8 +682,8 @@ FROM MissingEdgeHubInputStream'";
|
||||
DatabaseName = targetDb.DatabaseName,
|
||||
DeploymentOptions = new DeploymentOptions()
|
||||
{
|
||||
DropObjectsNotInSource = true,
|
||||
ExcludeObjectTypes = new[] { ObjectType.Views }
|
||||
DropObjectsNotInSource = new DeploymentOptionProperty<bool>(true),
|
||||
ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>( new[] { ObjectType.Views })
|
||||
}
|
||||
};
|
||||
|
||||
@@ -727,9 +727,10 @@ FROM MissingEdgeHubInputStream'";
|
||||
DeploymentOptions expectedResults = DeploymentOptions.GetDefaultPublishOptions();
|
||||
|
||||
expectedResults.ExcludeObjectTypes = null;
|
||||
expectedResults.IncludeCompositeObjects = true;
|
||||
expectedResults.BlockOnPossibleDataLoss = true;
|
||||
expectedResults.AllowIncompatiblePlatform = true;
|
||||
expectedResults.IncludeCompositeObjects = new DeploymentOptionProperty<bool>(true);
|
||||
expectedResults.BlockOnPossibleDataLoss = new DeploymentOptionProperty<bool>(true);
|
||||
expectedResults.AllowIncompatiblePlatform = new DeploymentOptionProperty<bool>(true);
|
||||
expectedResults.DisableIndexesForDataPhase = new DeploymentOptionProperty<bool>(false);
|
||||
|
||||
var dacfxRequestContext = new Mock<RequestContext<DacFxOptionsResult>>();
|
||||
dacfxRequestContext.Setup((RequestContext<DacFxOptionsResult> x) => x.SendResult(It.Is<DacFxOptionsResult>((result) => ValidateOptions(expectedResults, result.DeploymentOptions) == true))).Returns(Task.FromResult(new object()));
|
||||
@@ -754,6 +755,7 @@ FROM MissingEdgeHubInputStream'";
|
||||
{
|
||||
DeploymentOptions expectedResults = DeploymentOptions.GetDefaultPublishOptions();
|
||||
expectedResults.ExcludeObjectTypes = null;
|
||||
expectedResults.DisableIndexesForDataPhase = new DeploymentOptionProperty<bool>(false);
|
||||
|
||||
var dacfxRequestContext = new Mock<RequestContext<DacFxOptionsResult>>();
|
||||
dacfxRequestContext.Setup((RequestContext<DacFxOptionsResult> x) => x.SendResult(It.Is<DacFxOptionsResult>((result) => ValidateOptions(expectedResults, result.DeploymentOptions) == true))).Returns(Task.FromResult(new object()));
|
||||
@@ -843,7 +845,9 @@ Streaming query statement contains a reference to missing output stream 'Missing
|
||||
foreach (var v in deploymentOptionsProperties)
|
||||
{
|
||||
var defaultP = v.GetValue(expected);
|
||||
var defaultPValue = defaultP != null ? defaultP.GetType().GetProperty("Value").GetValue(defaultP): defaultP;
|
||||
var actualP = v.GetValue(actual);
|
||||
var actualPValue = actualP.GetType().GetProperty("Value").GetValue(actualP);
|
||||
|
||||
if (v.Name == "ExcludeObjectTypes")
|
||||
{
|
||||
@@ -851,7 +855,17 @@ Streaming query statement contains a reference to missing output stream 'Missing
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.True((defaultP == null && actualP == null) || (defaultP == null && (actualP as string) == string.Empty) || defaultP.Equals(actualP), $"Actual Property from Service is not equal to default property for {v.Name}, Actual value: {actualP} and Default value: {defaultP}");
|
||||
// Verifying expected and actual deployment options properties are equal
|
||||
Assert.True((defaultP == null && actualP == null)
|
||||
|| (defaultP == null && String.IsNullOrEmpty(actualP as string))
|
||||
|| defaultP.Equals(actualP)
|
||||
, $"Actual Property from Service is not equal to default property for {v.Name}, Actual property: {actualP} and Default property: {defaultP}");
|
||||
|
||||
// Verifying expected and actual deployment options property values are equal
|
||||
Assert.True((defaultPValue == null && actualPValue == null)
|
||||
|| (defaultPValue == null && String.IsNullOrEmpty(actualPValue as string))
|
||||
|| (defaultPValue).Equals(actualPValue)
|
||||
, $"Actual Property from Service is not equal to default property for {v.Name}, Actual value: {actualPValue} and Default value: {defaultPValue}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,39 +72,42 @@ END
|
||||
private DeploymentOptions GetIgnoreColumnOptions()
|
||||
{
|
||||
var options = new DeploymentOptions();
|
||||
options.IgnoreColumnOrder = true;
|
||||
options.IgnoreColumnOrder = new DeploymentOptionProperty<bool>(true);
|
||||
return options;
|
||||
}
|
||||
|
||||
private DeploymentOptions GetExcludeTableValuedFunctionOptions()
|
||||
{
|
||||
var options = new DeploymentOptions();
|
||||
options.ExcludeObjectTypes = new ObjectType[]{
|
||||
ObjectType.ServerTriggers,
|
||||
ObjectType.Routes,
|
||||
ObjectType.LinkedServerLogins,
|
||||
ObjectType.Endpoints,
|
||||
ObjectType.ErrorMessages,
|
||||
ObjectType.Filegroups,
|
||||
ObjectType.Files,
|
||||
ObjectType.Logins,
|
||||
ObjectType.LinkedServers,
|
||||
ObjectType.Credentials,
|
||||
ObjectType.DatabaseScopedCredentials,
|
||||
ObjectType.DatabaseEncryptionKeys,
|
||||
ObjectType.MasterKeys,
|
||||
ObjectType.DatabaseAuditSpecifications,
|
||||
ObjectType.Audits,
|
||||
ObjectType.ServerAuditSpecifications,
|
||||
ObjectType.CryptographicProviders,
|
||||
ObjectType.ServerRoles,
|
||||
ObjectType.EventSessions,
|
||||
ObjectType.DatabaseOptions,
|
||||
ObjectType.EventNotifications,
|
||||
ObjectType.ServerRoleMembership,
|
||||
ObjectType.AssemblyFiles,
|
||||
ObjectType.TableValuedFunctions, //added Functions to excluded types
|
||||
};
|
||||
options.ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>
|
||||
(
|
||||
new ObjectType[]{
|
||||
ObjectType.ServerTriggers,
|
||||
ObjectType.Routes,
|
||||
ObjectType.LinkedServerLogins,
|
||||
ObjectType.Endpoints,
|
||||
ObjectType.ErrorMessages,
|
||||
ObjectType.Filegroups,
|
||||
ObjectType.Files,
|
||||
ObjectType.Logins,
|
||||
ObjectType.LinkedServers,
|
||||
ObjectType.Credentials,
|
||||
ObjectType.DatabaseScopedCredentials,
|
||||
ObjectType.DatabaseEncryptionKeys,
|
||||
ObjectType.MasterKeys,
|
||||
ObjectType.DatabaseAuditSpecifications,
|
||||
ObjectType.Audits,
|
||||
ObjectType.ServerAuditSpecifications,
|
||||
ObjectType.CryptographicProviders,
|
||||
ObjectType.ServerRoles,
|
||||
ObjectType.EventSessions,
|
||||
ObjectType.DatabaseOptions,
|
||||
ObjectType.EventNotifications,
|
||||
ObjectType.ServerRoleMembership,
|
||||
ObjectType.AssemblyFiles,
|
||||
ObjectType.TableValuedFunctions, //added Functions to excluded types
|
||||
}
|
||||
);
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@@ -1355,8 +1355,8 @@ WITH VALUES
|
||||
DeploymentOptions options = new DeploymentOptions();
|
||||
|
||||
// ensure that files are excluded seperate from filegroups
|
||||
Assert.True(options.ExcludeObjectTypes.Contains(SqlServer.Dac.ObjectType.Files));
|
||||
Assert.False(options.ExcludeObjectTypes.Contains(SqlServer.Dac.ObjectType.Filegroups));
|
||||
Assert.True(options.ExcludeObjectTypes.Value.Contains(SqlServer.Dac.ObjectType.Files));
|
||||
Assert.False(options.ExcludeObjectTypes.Value.Contains(SqlServer.Dac.ObjectType.Filegroups));
|
||||
|
||||
var schemaCompareParams = new SchemaCompareParams
|
||||
{
|
||||
@@ -1826,12 +1826,13 @@ WITH VALUES
|
||||
DeploymentOptions = new DeploymentOptions()
|
||||
{
|
||||
// change some random ones explicitly
|
||||
AllowDropBlockingAssemblies = true,
|
||||
DropConstraintsNotInSource = true,
|
||||
IgnoreAnsiNulls = true,
|
||||
NoAlterStatementsToChangeClrTypes = false,
|
||||
PopulateFilesOnFileGroups = false,
|
||||
VerifyDeployment = false,
|
||||
AllowDropBlockingAssemblies = new DeploymentOptionProperty<bool>(true),
|
||||
DropConstraintsNotInSource = new DeploymentOptionProperty<bool>(true),
|
||||
IgnoreAnsiNulls = new DeploymentOptionProperty<bool>(true),
|
||||
NoAlterStatementsToChangeClrTypes = new DeploymentOptionProperty<bool>(false),
|
||||
PopulateFilesOnFileGroups = new DeploymentOptionProperty<bool>(false),
|
||||
VerifyDeployment = new DeploymentOptionProperty<bool>(false),
|
||||
DisableIndexesForDataPhase = new DeploymentOptionProperty<bool>(false)
|
||||
},
|
||||
ScmpFilePath = filePath,
|
||||
ExcludedSourceObjects = schemaCompareObjectIds,
|
||||
|
||||
@@ -135,11 +135,17 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
Assert.True(dacProp != null, $"DacDeploy property not present for {deployOptionsProp.Name}");
|
||||
|
||||
var deployOptionsValue = deployOptionsProp.GetValue(deploymentOptions);
|
||||
var dacValue = dacProp.GetValue(dacDeployOptions);
|
||||
var changedDacValue = deployOptionsValue != null ? deployOptionsValue.GetType().GetProperty("Value").GetValue(deployOptionsValue) : deployOptionsValue;
|
||||
var dafaultDacValue = dacProp.GetValue(dacDeployOptions);
|
||||
|
||||
if (deployOptionsProp.Name != "ExcludeObjectTypes") // do not compare for ExcludeObjectTypes because it will be different
|
||||
{
|
||||
Assert.True((deployOptionsValue == null && dacValue == null) || deployOptionsValue.Equals(dacValue), $"DacFx DacDeploy property not equal to Tools Service DeploymentOptions for { deployOptionsProp.Name}, SchemaCompareOptions value: {deployOptionsValue} and DacDeployOptions value: {dacValue} ");
|
||||
Assert.True((deployOptionsValue == null && dafaultDacValue == null)
|
||||
|| deployOptionsValue.Equals(dafaultDacValue)
|
||||
|| changedDacValue == null && (dafaultDacValue as string) == string.Empty
|
||||
|| changedDacValue == null && dafaultDacValue == null
|
||||
|| (changedDacValue).Equals(dafaultDacValue)
|
||||
, $"DacFx DacDeploy property not equal to Tools Service DeploymentOptions for { deployOptionsProp.Name}, SchemaCompareOptions value: {changedDacValue} and DacDeployOptions value: {dafaultDacValue} ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,14 +159,27 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
foreach (var v in deploymentOptionsProperties)
|
||||
{
|
||||
var defaultP = v.GetValue(defaultOpt);
|
||||
var defaultPValue = defaultP != null ? defaultP.GetType().GetProperty("Value").GetValue(defaultP) : defaultP;
|
||||
var actualP = v.GetValue(actualOpt);
|
||||
var actualPValue = actualP.GetType().GetProperty("Value").GetValue(actualP);
|
||||
|
||||
if (v.Name == "ExcludeObjectTypes")
|
||||
{
|
||||
Assert.True((defaultP as ObjectType[]).Length == (actualP as ObjectType[]).Length, $"Number of excluded objects is different; expected: {(defaultP as ObjectType[]).Length} actual: {(actualP as ObjectType[]).Length}");
|
||||
Assert.True((defaultPValue as ObjectType[]).Length == (actualPValue as ObjectType[]).Length, $"Number of excluded objects is different; expected: {(defaultPValue as ObjectType[]).Length} actual: {(actualPValue as ObjectType[]).Length}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.True((defaultP == null && actualP == null) || defaultP.Equals(actualP), $"Actual Property from Service is not equal to default property for { v.Name}, Actual value: {actualP} and Default value: {defaultP}");
|
||||
// Verifying expected and actual deployment options properties are equal
|
||||
Assert.True((defaultP == null && actualP == null)
|
||||
|| (defaultP == null && String.IsNullOrEmpty(actualP as string))
|
||||
|| defaultP.Equals(actualP)
|
||||
, $"Actual Property from Service is not equal to default property for {v.Name}, Actual property: {actualP} and Default property: {defaultP}");
|
||||
|
||||
// Verifying expected and actual deployment options property values are equal
|
||||
Assert.True((defaultPValue == null && actualPValue == null)
|
||||
|| (defaultPValue == null && String.IsNullOrEmpty(actualPValue as string))
|
||||
|| (defaultPValue).Equals(actualPValue)
|
||||
, $"Actual Property from Service is not equal to default property for {v.Name}, Actual value: {actualPValue} and Default value: {defaultPValue}");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user