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

* 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
This commit is contained in:
Sai Avishkar Sreerama
2022-05-10 22:59:26 +05:30
committed by GitHub
parent 70be8f5ef5
commit a3a66137b8
6 changed files with 402 additions and 145 deletions

View File

@@ -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}");
}
}