Skip to content

Commit

Permalink
Merge pull request #34 from jtlibing/dev5
Browse files Browse the repository at this point in the history
[Please merge this one] Azure Data Factory Dec release updates for Sprint 42
  • Loading branch information
ogail committed Dec 5, 2014
2 parents 7352114 + e41cf6f commit 2258c37
Show file tree
Hide file tree
Showing 40 changed files with 4,155 additions and 5,259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.11.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.DataFactories">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.11.4-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.12.0-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Monitoring">
<HintPath>..\..\..\packages\Microsoft.Azure.Monitoring.2.2.0-preview\lib\net40\Microsoft.Azure.Monitoring.dll</HintPath>
Expand Down Expand Up @@ -140,7 +140,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ScenarioTests\HubTests.cs" />
<Compile Include="ScenarioTests\PipelineTests.cs" />
<Compile Include="UnitTests\GetHubTests.cs" />
<Compile Include="UnitTests\NewDataFactoryEncryptValueTests.cs" />
<Compile Include="ScenarioTests\DataFactoryGatewayTests.cs" />
Expand Down Expand Up @@ -259,9 +258,6 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.DataFactories.Test.LinkedServiceTests\TestLinkedServiceWithDataFactoryParameter.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.DataFactories.Test.PipelineTests\TestPipeline.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.DataFactories.Test.TableTests\TestGetTableWithEmptyName.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
inputs: [ {name: "inputTable"} ],
outputs: [ {name: "outputTable"} ],
linkedServiceName: "foo2",
type: "CustomActivity",
type: "DotNetActivity",
transformation:
{
assemblyName: "mycode.dll",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ function Test-DataFactoryGateway
$gwname = "foo"
$description = "description"

$actual = New-AzureDataFactoryGateway -ResourceGroupName $rgname -DataFactoryName $dfname -Name $gwname -Location $dflocation
$actual = New-AzureDataFactoryGateway -ResourceGroupName $rgname -DataFactoryName $dfname -Name $gwname
$expected = Get-AzureDataFactoryGateway -ResourceGroupName $rgname -DataFactoryName $dfname -Name $gwname
Assert-AreEqual $actual.Name $expected.Name
Assert-AreEqual $actual.Location $expected.Location

$key = New-AzureDataFactoryGatewayKey -ResourceGroupName $rgname -DataFactoryName $dfname -GatewayName $gwname
Assert-NotNull $key
Expand Down Expand Up @@ -91,10 +90,9 @@ function Test-DataFactoryGatewayWithDataFactoryParameter
$gwname = "foo"
$description = "description"

$actual = New-AzureDataFactoryGateway -DataFactory $datafactory -Name $gwname -Location $dflocation
$actual = New-AzureDataFactoryGateway -DataFactory $datafactory -Name $gwname
$expected = Get-AzureDataFactoryGateway -DataFactory $datafactory -Name $gwname
Assert-AreEqual $actual.Name $expected.Name
Assert-AreEqual $actual.Location $expected.Location

$key = New-AzureDataFactoryGatewayKey -DataFactory $datafactory -GatewayName $gwname
Assert-NotNull $key
Expand Down

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void CanGetGateway()
var expectedOutput = new PSDataFactoryGateway
{
Name = GatewayName,
Location = Location,
Status = GatewayStatus.NeedRegistration
};

Expand All @@ -74,14 +73,12 @@ public void CanListGateways()
new PSDataFactoryGateway()
{
Name = GatewayName,
Location = Location,
Status = GatewayStatus.NeedRegistration
},

new PSDataFactoryGateway()
{
Name = "foo2",
Location = Location,
Status = GatewayStatus.NeedRegistration
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using System;
using System.Management.Automation;
using System.Security;
using Xunit;

Expand All @@ -31,7 +32,7 @@ public NewDataFactoryEncryptValueTests()

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestOnPermDatasourceEncryptionWithRawJsonContent()
public void TestOnPremDatasourceEncryptionSQLAuth()
{
SecureString secureString = new SecureString();
string expectedOutput = "My encrypted string " + Guid.NewGuid();
Expand All @@ -47,13 +48,45 @@ public void TestOnPermDatasourceEncryptionWithRawJsonContent()
};

// Arrange
this.dataFactoriesClientMock.Setup(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName)).Returns(expectedOutput);
this.dataFactoriesClientMock.Setup(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, null)).Returns(expectedOutput);

// Action
cmdlet.ExecuteCmdlet();

// Assert
this.dataFactoriesClientMock.Verify(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName), Times.Once());
this.dataFactoriesClientMock.Verify(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, null), Times.Once());
this.commandRuntimeMock.Verify(f => f.WriteObject(expectedOutput), Times.Once());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestOnPremDatasourceEncryptionWinAuth()
{
SecureString secureString = new SecureString();
string expectedOutput = "My encrypted string " + Guid.NewGuid();
string winAuthUserName = "foo";
SecureString winAuthPassword = new SecureString();
PSCredential credential = new PSCredential(winAuthUserName, winAuthPassword);

var cmdlet = new NewAzureDataFactoryEncryptValueCommand
{
CommandRuntime = this.commandRuntimeMock.Object,
DataFactoryClient = this.dataFactoriesClientMock.Object,
Value = secureString,
ResourceGroupName = ResourceGroupName,
DataFactoryName = DataFactoryName,
GatewayName = GatewayName,
Credential = credential
};

// Arrange
this.dataFactoriesClientMock.Setup(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, credential)).Returns(expectedOutput);

// Action
cmdlet.ExecuteCmdlet();

// Assert
this.dataFactoriesClientMock.Verify(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, credential), Times.Once());
this.commandRuntimeMock.Verify(f => f.WriteObject(expectedOutput), Times.Once());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public void CanNewGatewayKey()
var expectedOutput = new PSDataFactoryGateway
{
Name = GatewayName,
Location = Location,
Status = GatewayStatus.Online,
Description = "New gateway description for test"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public void CanNewGateway()
var expectedOutput = new PSDataFactoryGateway
{
Name = GatewayName,
Location = Location,
Status = GatewayStatus.Online,
Description = "New gateway description for test",
};
Expand All @@ -71,7 +70,6 @@ public void CanNewGateway()

_cmdlet.Name = GatewayName;
_cmdlet.DataFactoryName = DataFactoryName;
_cmdlet.Location = Location;

_cmdlet.ExecuteCmdlet();

Expand All @@ -86,7 +84,6 @@ public void CanThrowWhenCreateExistingGateway()
var expectedOutput = new PSDataFactoryGateway
{
Name = GatewayName,
Location = Location,
Status = GatewayStatus.Online,
Description = "New gateway description for test"
};
Expand All @@ -97,7 +94,6 @@ public void CanThrowWhenCreateExistingGateway()

_cmdlet.Name = GatewayName;
_cmdlet.DataFactoryName = DataFactoryName;
_cmdlet.Location = Location;

Assert.Throws<PSInvalidOperationException>(() => _cmdlet.ExecuteCmdlet());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public void CanSetGateway()
var expectedOutput = new PSDataFactoryGateway
{
Name = GatewayName,
Location = Location,
Status = GatewayStatus.NeedRegistration,
Description = description
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="Hydra.SpecTestSupport" version="1.0.5417.13285-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Gallery" version="2.2.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.11.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.DataFactories" version="0.11.4-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.DataFactories" version="0.12.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Monitoring" version="2.2.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Management.DataFactories">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.11.4-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.12.0-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DataFactories.Runtime">
<HintPath>..\..\..\packages\Microsoft.DataFactories.Runtime.0.11.1-preview\lib\net45\Microsoft.DataFactories.Runtime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DataTransfer.Gateway.Encryption">
<HintPath>..\..\..\packages\Microsoft.DataTransfer.Gateway.Encryption.1.0.0-preview\lib\net45\Microsoft.DataTransfer.Gateway.Encryption.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.DataTransfer.Gateway.Encryption.1.1.0-preview\lib\net45\Microsoft.DataTransfer.Gateway.Encryption.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -224,6 +223,7 @@
<ItemGroup>
<Content Include="Microsoft.Azure.Commands.DataFactories.dll-Help.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public class NewAzureDataFactoryEncryptValueCommand : DataFactoryBaseCmdlet
[Parameter(ParameterSetName = ByFactoryName, Position = 3, Mandatory = false, HelpMessage = "The gateway group name.")]
public string GatewayName { get; set; }

[Parameter(ParameterSetName = ByFactoryObject, Position = 3, Mandatory = false, HelpMessage = "The windows authentication credential.")]
[Parameter(ParameterSetName = ByFactoryName, Position = 4, Mandatory = false, HelpMessage = "The windows authentication credential.")]
public PSCredential Credential { get; set; }

[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
public override void ExecuteCmdlet()
{
Expand All @@ -68,7 +72,7 @@ public override void ExecuteCmdlet()
else
{
// On-premises encryption with Gateway
encryptedValue = DataFactoryClient.OnPremisesEncryptString(Value, ResourceGroupName, DataFactoryName, GatewayName);
encryptedValue = DataFactoryClient.OnPremisesEncryptString(Value, ResourceGroupName, DataFactoryName, GatewayName, Credential);
}

WriteObject(encryptedValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ public class NewAzureDataFactoryGatewayCommand : DataFactoryBaseCmdlet
[ValidateNotNullOrEmpty]
public string Name { get; set; }

[Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "The geographic region to create the data factory.")]
[ValidateNotNullOrEmpty]
public string Location { get; set; }

[Parameter(Position = 4, Mandatory = false, ValueFromPipelineByPropertyName = true,
[Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The description to update.")]
public string Description { get; set; }

Expand Down Expand Up @@ -79,21 +74,11 @@ public override void ExecuteCmdlet()
var request = new PSDataFactoryGateway
{
Name = Name,
Location = NormalizeLocation(Location),
Description = Description
};

PSDataFactoryGateway response = DataFactoryClient.CreateOrUpdateGateway(ResourceGroupName, DataFactoryName, request);
WriteObject(response);
}

// As a nested resource of data factory, CSM will not normalize location when
// creating gateway, so we have to do this by ourselves.
private static string NormalizeLocation(string location)
{
return String.IsNullOrEmpty(location)
? String.Empty
: location.Trim().Replace(" ", String.Empty).ToUpperInvariant();
}
}
}
Loading

0 comments on commit 2258c37

Please sign in to comment.