Skip to content

Commit fbd1e3b

Browse files
committed
Merge Conflict
2 parents 0b907cd + ef35853 commit fbd1e3b

File tree

53 files changed

+7844
-408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+7844
-408
lines changed

setup/azurecmdfiles.wxi

Lines changed: 450 additions & 90 deletions
Large diffs are not rendered by default.

src/AzurePowershell.sln

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Express 2013 for Web
2+
# Visual Studio 2013
33
VisualStudioVersion = 12.0.31101.0
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}"
@@ -212,6 +212,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ApiManagement.Test
212212
EndProject
213213
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureBackup", "ResourceManager\AzureBackup\Commands.AzureBackup\Commands.AzureBackup.csproj", "{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}"
214214
EndProject
215+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureBackup.Test", "ResourceManager\AzureBackup\Commands.AzureBackup.Test\Commands.AzureBackup.Test.csproj", "{678AE95D-2364-47D7-888C-3FFA6D412CC8}"
216+
EndProject
215217
Global
216218
GlobalSection(SolutionConfigurationPlatforms) = preSolution
217219
Debug|Any CPU = Debug|Any CPU
@@ -518,6 +520,10 @@ Global
518520
{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Debug|Any CPU.Build.0 = Debug|Any CPU
519521
{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Release|Any CPU.ActiveCfg = Release|Any CPU
520522
{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Release|Any CPU.Build.0 = Release|Any CPU
523+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
524+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
525+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
526+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Release|Any CPU.Build.0 = Release|Any CPU
521527
EndGlobalSection
522528
GlobalSection(SolutionProperties) = preSolution
523529
HideSolutionNode = FALSE
@@ -559,5 +565,6 @@ Global
559565
{5764A3A4-586C-4536-8481-13007CAC111B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
560566
{59D1B5DC-9175-43EC-90C6-CBA601B3565F} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
561567
{BEC9ECE9-A3D6-4B24-A682-1FA890647D9D} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
568+
{678AE95D-2364-47D7-888C-3FFA6D412CC8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
562569
EndGlobalSection
563570
EndGlobal

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<DefineConstants>DEBUG;TRACE</DefineConstants>
2525
<ErrorReport>prompt</ErrorReport>
2626
<WarningLevel>4</WarningLevel>
27-
<PlatformTarget>x64</PlatformTarget>
27+
<PlatformTarget>AnyCPU</PlatformTarget>
2828
</PropertyGroup>
2929
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3030
<DebugType>pdbonly</DebugType>
@@ -80,9 +80,6 @@
8080
<Reference Include="Microsoft.WindowsAzure.Management">
8181
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
8282
</Reference>
83-
<Reference Include="Microsoft.WindowsAzure.Management.BackupServicesManagment">
84-
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll</HintPath>
85-
</Reference>
8683
<Reference Include="Microsoft.WindowsAzure.Testing, Version=1.0.5417.13285, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8784
<SpecificVersion>False</SpecificVersion>
8885
<HintPath>..\..\..\packages\Hydra.SpecTestSupport.1.0.5417.13285-prerelease\lib\net45\Microsoft.WindowsAzure.Testing.dll</HintPath>
@@ -123,11 +120,21 @@
123120
</Reference>
124121
</ItemGroup>
125122
<ItemGroup>
123+
<Compile Include="ScenarioTests\AzureBackupItemTestCases.cs" />
126124
<Compile Include="ScenarioTests\AzureBackupTests.cs" />
127125
<Compile Include="ScenarioTests\AzureBackupTestBase.cs" />
128126
<Compile Include="Properties\AssemblyInfo.cs" />
127+
<Compile Include="ScenarioTests\BackupItemTests.cs" />
128+
<Compile Include="ScenarioTests\AzureBackupJobTests.cs" />
129+
<Compile Include="ScenarioTests\RecoveryPointTests.cs" />
130+
<Compile Include="ScenarioTests\AzureBackupContainerTests.cs" />
131+
<Compile Include="ScenarioTests\AzureBackupVaultTests.cs" />
129132
</ItemGroup>
130133
<ItemGroup>
134+
<ProjectReference Include="..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\BackupServicesManagment.csproj">
135+
<Project>{38a6741c-77a3-42a8-a846-83373be57c7f}</Project>
136+
<Name>BackupServicesManagment</Name>
137+
</ProjectReference>
131138
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
132139
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
133140
<Name>Commands.Common</Name>
@@ -151,15 +158,42 @@
151158
<None Include="packages.config">
152159
<SubType>Designer</SubType>
153160
</None>
161+
<None Include="ScenarioTests\AzureBackupItemTestCases.ps1">
162+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
163+
</None>
154164
<None Include="ScenarioTests\AzureBackupTests.ps1">
155-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
165+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
166+
</None>
167+
<None Include="ScenarioTests\BackupItemTests.ps1">
168+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
169+
</None>
170+
<None Include="ScenarioTests\AzureBackupJobTests.ps1">
171+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
172+
</None>
173+
<None Include="ScenarioTests\RecoveryPointTests.ps1">
174+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
175+
</None>
176+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests\GetAzureBackupContainerTests.json" />
177+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests\RegisterAzureBackupContainerTest.json" />
178+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests\UnregisterAzureBackupContainerTest.json" />
179+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupItemTestCases\DisableAzureBackupProtectionTest.json" />
180+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupItemTestCases\EnableAzureBackupProtectionTest.json" />
181+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupItemTestCases\ListAzureBackupItemTests.json" />
182+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupJobTests\GetAzureBackupJobTests.json" />
183+
<None Include="ScenarioTests\AzureBackupContainerTests.ps1">
184+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
185+
</None>
186+
<None Include="ScenarioTests\AzureBackupVaultTests.ps1">
187+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
156188
</None>
157-
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\BackUpAzureBackUpItem.json" />
158-
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\GetRecoveryPointTests.json" />
159189
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\ListProtectionPolicyTests.json">
160190
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161191
</None>
192+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests\GetAzureBackupVaultCredentialsTests.json" />
193+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.BackupItemTests\BackUpAzureBackUpItem.json" />
194+
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.RecoveryPointTests\GetRecoveryPointTests.json" />
162195
</ItemGroup>
196+
<ItemGroup />
163197
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
164198
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
165199
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
using Xunit;
21+
22+
namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
23+
{
24+
public class AzureBackupContainerTests : AzureBackupTestsBase
25+
{
26+
[Fact]
27+
public void GetAzureBackupContainerTests()
28+
{
29+
this.RunPowerShellTest("Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers");
30+
31+
this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer");
32+
}
33+
34+
[Fact]
35+
public void RegisterAzureBackupContainerTest()
36+
{
37+
this.RunPowerShellTest("Test-RegisterAzureBackupContainer");
38+
}
39+
40+
[Fact]
41+
public void UnregisterAzureBackupContainerTest()
42+
{
43+
this.RunPowerShellTest("Test-UnregisterAzureBackupContainer");
44+
}
45+
}
46+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
$ResourceGroupName = "backuprg"
16+
$ResourceName = "backuprn"
17+
$Location = "SouthEast Asia"
18+
$ContainerResourceGroupName = "dev01Testing"
19+
$ContainerResourceName = "dev01Testing"
20+
21+
<#
22+
.SYNOPSIS
23+
Tests to test list containers
24+
#>
25+
function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers
26+
{
27+
$containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location
28+
Assert-NotNull $containers 'Container list should not be null';
29+
}
30+
31+
function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer
32+
{
33+
$container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -ContainerResourceGroupName $ContainerResourceGroupName -ContainerResourceName $ContainerResourceName
34+
Assert-NotNull $container 'Container should not be null';
35+
Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name';
36+
Assert-AreEqual $container.ResourceGroupName $ContainerResourceGroupName -CaseSensitive 'Returned container resource group name (a.k.a parent friendly name) does not match the test VM resource group name';
37+
}
38+
39+
<#
40+
.SYNOPSIS
41+
Tests to register the container
42+
#>
43+
function Test-RegisterAzureBackupContainer
44+
{
45+
$jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $ContainerResourceName -ServiceName $ContainerResourceGroupName
46+
47+
Assert-NotNull $jobId 'JobID should not be null';
48+
}
49+
50+
function Test-UnregisterAzureBackupContainer
51+
{
52+
$container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $ContainerResourceName -ContainerResourceGroupName $ContainerResourceGroupName
53+
$jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container
54+
55+
Assert-NotNull $jobId 'JobID should not be null';
56+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
19+
{
20+
public class AzureBackupItemTestCases : AzureBackupTestsBase
21+
{
22+
[Fact]
23+
public void ListAzureBackupItemTests()
24+
{
25+
this.RunPowerShellTest("Test-GetAzureBackupItemTests");
26+
}
27+
28+
[Fact]
29+
public void EnableAzureBackupProtectionTest()
30+
{
31+
this.RunPowerShellTest("Test-EnableAzureBackupProtection");
32+
}
33+
34+
[Fact]
35+
public void DisableAzureBackupProtectionTest()
36+
{
37+
this.RunPowerShellTest("Test-DisableAzureBackupProtection");
38+
}
39+
}
40+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
$ResourceGroupName = "backuprg"
2+
$ResourceName = "backuprn"
3+
$ContainerName = "iaasvmcontainer;dev01testing;dev01testing"
4+
$ContainerType = "IaasVMContainer"
5+
$DataSourceType = "VM"
6+
$DataSourceId = "17593283453810"
7+
$Location = "SouthEast Asia"
8+
$PolicyName = "Policy9";
9+
$PolicyId = "c87bbada-6e1b-4db2-b76c-9062d28959a4";
10+
$POName = "iaasvmcontainer;dev01testing;dev01testing"
11+
12+
13+
function Test-GetAzureBackupItemTests
14+
{
15+
$azureBackUpContainer = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupContainer
16+
$azureBackUpContainer.ResourceGroupName = $ResourceGroupName
17+
$azureBackUpContainer.ResourceName = $ResourceName
18+
$azureBackUpContainer.Location = $Location
19+
$azureBackUpContainer.ContainerUniqueName = $ContainerName
20+
$azureBackUpContainer.ContainerType = $ContainerType
21+
$item = Get-AzureBackupItem -Container $azureBackUpContainer
22+
if (!($item -eq $null))
23+
{
24+
foreach($backupitem in $item)
25+
{
26+
Assert-NotNull $backupitem.ProtectionStatus 'ProtectionStatus should not be null'
27+
Assert-NotNull $backupitem.Name 'Name should not be null'
28+
Assert-NotNull $backupitem.Type 'Type should not be null'
29+
Assert-NotNull $backupitem.ContainerType 'ContainerType should not be null'
30+
Assert-NotNull $backupitem.ContainerUniqueName 'ContainerUniqueName should not be null'
31+
Assert-NotNull $backupitem.ResourceGroupName 'ResourceGroupName should not be null'
32+
Assert-NotNull $backupitem.ResourceName 'ResourceName should not be null'
33+
Assert-NotNull $backupitem.Location 'Location should not be null'
34+
}
35+
}
36+
}
37+
38+
function Test-EnableAzureBackupProtection
39+
{
40+
$policy = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupProtectionPolicy
41+
$policy.InstanceId = $PolicyId
42+
$policy.Name = $PolicyName
43+
$policy.ResourceGroupName = $ResourceGroupName
44+
$policy.ResourceName = $ResourceName
45+
$policy.Location = $Location
46+
$policy.WorkloadType = "VM"
47+
$policy.RetentionType = "1"
48+
$policy.ScheduleRunTimes = "2015-06-13T20:30:00"
49+
50+
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
51+
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
52+
$azureBackUpItem.ResourceName = $ResourceName
53+
$azureBackUpItem.Location = $Location
54+
$azureBackUpItem.ContainerUniqueName = $ContainerName
55+
$azureBackUpItem.ContainerType = $ContainerType
56+
$azureBackUpItem.DataSourceId = $DataSourceId
57+
$azureBackUpItem.Type = $DataSourceType
58+
$azureBackUpItem.Name = $POName
59+
$jobId = Enable-AzureBackupProtection -Item $azureBackUpItem -Policy $policy
60+
61+
}
62+
63+
function Test-DisableAzureBackupProtection
64+
{
65+
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
66+
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
67+
$azureBackUpItem.ResourceName = $ResourceName
68+
$azureBackUpItem.Location = $Location
69+
$azureBackUpItem.ContainerUniqueName = $ContainerName
70+
$azureBackUpItem.ContainerType = $ContainerType
71+
$azureBackUpItem.DataSourceId = $DataSourceId
72+
$azureBackUpItem.Type = $DataSourceType
73+
$azureBackUpItem.Name = $POName
74+
$jobId1 = Disable-AzureBackupProtection -Item $azureBackUpItem
75+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
19+
{
20+
public class AzureBackupJobTests : AzureBackupTestsBase
21+
{
22+
23+
[Fact]
24+
public void GetAzureBackupJobTests()
25+
{
26+
this.RunPowerShellTest("Test-GetAzureBackupJob");
27+
}
28+
29+
[Fact]
30+
public void StopAzureBackupJobTests()
31+
{
32+
this.RunPowerShellTest("Test-StopAzureBackupJob");
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)