Revert "Adding new Dac Deployment Options and getting descriptions from DacFx API (#1357)" (#1493)

This reverts commit a3a66137b8.
This commit is contained in:
Udeesha Gautam
2022-05-12 13:30:04 -07:00
committed by GitHub
parent a70402fe60
commit 2b48331115
6 changed files with 145 additions and 402 deletions

View File

@@ -586,8 +586,8 @@ FROM MissingEdgeHubInputStream'";
UpgradeExisting = true,
DeploymentOptions = new DeploymentOptions()
{
DropObjectsNotInSource = new DeploymentOptionProperty<bool>(false),
ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>(new[] { ObjectType.Views })
DropObjectsNotInSource = false,
ExcludeObjectTypes = new[] { ObjectType.Views }
}
};
@@ -664,8 +664,8 @@ FROM MissingEdgeHubInputStream'";
DatabaseName = targetDb.DatabaseName,
DeploymentOptions = new DeploymentOptions()
{
DropObjectsNotInSource = new DeploymentOptionProperty<bool>(false),
ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>(new[] { ObjectType.Views })
DropObjectsNotInSource = false,
ExcludeObjectTypes = new[] { ObjectType.Views }
}
};
@@ -682,8 +682,8 @@ FROM MissingEdgeHubInputStream'";
DatabaseName = targetDb.DatabaseName,
DeploymentOptions = new DeploymentOptions()
{
DropObjectsNotInSource = new DeploymentOptionProperty<bool>(true),
ExcludeObjectTypes = new DeploymentOptionProperty<ObjectType[]>( new[] { ObjectType.Views })
DropObjectsNotInSource = true,
ExcludeObjectTypes = new[] { ObjectType.Views }
}
};
@@ -727,10 +727,9 @@ FROM MissingEdgeHubInputStream'";
DeploymentOptions expectedResults = DeploymentOptions.GetDefaultPublishOptions();
expectedResults.ExcludeObjectTypes = null;
expectedResults.IncludeCompositeObjects = new DeploymentOptionProperty<bool>(true);
expectedResults.BlockOnPossibleDataLoss = new DeploymentOptionProperty<bool>(true);
expectedResults.AllowIncompatiblePlatform = new DeploymentOptionProperty<bool>(true);
expectedResults.DisableIndexesForDataPhase = new DeploymentOptionProperty<bool>(false);
expectedResults.IncludeCompositeObjects = true;
expectedResults.BlockOnPossibleDataLoss = true;
expectedResults.AllowIncompatiblePlatform = true;
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()));
@@ -755,7 +754,6 @@ 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()));
@@ -845,9 +843,7 @@ 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")
{
@@ -855,17 +851,7 @@ Streaming query statement contains a reference to missing output stream 'Missing
}
else
{
// 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}");
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}");
}
}

View File

@@ -72,42 +72,39 @@ END
private DeploymentOptions GetIgnoreColumnOptions()
{
var options = new DeploymentOptions();
options.IgnoreColumnOrder = new DeploymentOptionProperty<bool>(true);
options.IgnoreColumnOrder = true;
return options;
}
private DeploymentOptions GetExcludeTableValuedFunctionOptions()
{
var options = new DeploymentOptions();
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
}
);
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
};
return options;
}

View File

@@ -1355,8 +1355,8 @@ WITH VALUES
DeploymentOptions options = new DeploymentOptions();
// ensure that files are excluded seperate from filegroups
Assert.True(options.ExcludeObjectTypes.Value.Contains(SqlServer.Dac.ObjectType.Files));
Assert.False(options.ExcludeObjectTypes.Value.Contains(SqlServer.Dac.ObjectType.Filegroups));
Assert.True(options.ExcludeObjectTypes.Contains(SqlServer.Dac.ObjectType.Files));
Assert.False(options.ExcludeObjectTypes.Contains(SqlServer.Dac.ObjectType.Filegroups));
var schemaCompareParams = new SchemaCompareParams
{
@@ -1826,13 +1826,12 @@ WITH VALUES
DeploymentOptions = new DeploymentOptions()
{
// change some random ones explicitly
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)
AllowDropBlockingAssemblies = true,
DropConstraintsNotInSource = true,
IgnoreAnsiNulls = true,
NoAlterStatementsToChangeClrTypes = false,
PopulateFilesOnFileGroups = false,
VerifyDeployment = false,
},
ScmpFilePath = filePath,
ExcludedSourceObjects = schemaCompareObjectIds,

View File

@@ -135,17 +135,11 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
Assert.True(dacProp != null, $"DacDeploy property not present for {deployOptionsProp.Name}");
var deployOptionsValue = deployOptionsProp.GetValue(deploymentOptions);
var changedDacValue = deployOptionsValue != null ? deployOptionsValue.GetType().GetProperty("Value").GetValue(deployOptionsValue) : deployOptionsValue;
var dafaultDacValue = dacProp.GetValue(dacDeployOptions);
var dacValue = dacProp.GetValue(dacDeployOptions);
if (deployOptionsProp.Name != "ExcludeObjectTypes") // do not compare for ExcludeObjectTypes because it will be different
{
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} ");
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} ");
}
}
}
@@ -159,27 +153,14 @@ 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((defaultPValue as ObjectType[]).Length == (actualPValue as ObjectType[]).Length, $"Number of excluded objects is different; expected: {(defaultPValue as ObjectType[]).Length} actual: {(actualPValue as ObjectType[]).Length}");
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}");
}
else
{
// 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}");
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}");
}
}
return true;