Skip to content

Commit 81db5b2

Browse files
committed
Temporary commit
1 parent 4c939ca commit 81db5b2

File tree

7 files changed

+66
-18
lines changed

7 files changed

+66
-18
lines changed

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

Lines changed: 3 additions & 3 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>
@@ -81,7 +81,7 @@
8181
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
8282
</Reference>
8383
<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>
84+
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Release\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll</HintPath>
8585
</Reference>
8686
<Reference Include="Microsoft.WindowsAzure.Testing, Version=1.0.5417.13285, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8787
<SpecificVersion>False</SpecificVersion>
@@ -153,7 +153,7 @@
153153
</None>
154154
<None Include="ScenarioTests\AzureBackupTests.ps1">
155155
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
156-
</None>
156+
</None>
157157
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\ListProtectionPolicyTests.json">
158158
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
159159
</None>

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@ public void ListProtectionPolicyTests()
2424
{
2525
this.RunPowerShellTest("Test-GetAzureBackupProtectionPolicyTests");
2626
}
27+
28+
[Fact]
29+
public void GetAzureBackupJobTests()
30+
{
31+
this.RunPowerShellTest("Test-GetAzureBackupJob");
32+
}
33+
34+
[Fact]
35+
public void StopAzureBackupJobTests()
36+
{
37+
this.RunPowerShellTest("Test-StopAzureBackupJob");
38+
}
2739
}
2840
}

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
$ResourceGroupName = "swatirg1";
16-
$ResourceName = "swatirn1"
15+
$ResourceGroupName = "swatirg";
16+
$ResourceName = "swatirn"
17+
$Location = "WestUS"
1718

1819
<#
1920
.SYNOPSIS
2021
Tests creating new resource group and a simple resource.
2122
#>
2223
function Test-GetAzureBackupProtectionPolicyTests
2324
{
24-
$protectionPolicies = Get-AzureBackupProtectionPolicy -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName
25+
$protectionPolicies = Get-AzureBackupProtectionPolicy -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location
2526
Assert-NotNull $protectionPolicies 'Protection Policies should not be null'
2627
foreach($protectionPolicy in $protectionPolicies)
2728
{
@@ -37,3 +38,43 @@ function Test-GetAzureBackupProtectionPolicyTests
3738
}
3839

3940

41+
function Test-GetAzureBackupJob
42+
{
43+
$OneMonthBack = Get-Date;
44+
$OneMonthBack = $OneMonthBack.AddDays(-30);
45+
$jobs = Get-AzureBackupJob -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -From $OneMonthBack -Debug
46+
Assert-NotNull $jobs 'Jobs list should not be null'
47+
foreach($job in $jobs)
48+
{
49+
Assert-NotNull $jobs.InstanceId 'JobID should not be null';
50+
Assert-NotNull $jobs.StartTime 'StartTime should not be null';
51+
Assert-NotNull $jobs.WorkloadType 'WorkloadType should not be null';
52+
Assert-NotNull $jobs.WorkloadName 'WorkloadName should not be null';
53+
Assert-NotNull $jobs.Status 'Status should not be null';
54+
Assert-NotNull $jobs.Operation 'Operation should not be null';
55+
56+
$jobDetails = Get-AzureBackupJobDetails -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Job $job
57+
Assert-NotNull $jobDetails.InstanceId 'JobID should not be null';
58+
Assert-NotNull $jobDetails.StartTime 'StartTime should not be null';
59+
Assert-NotNull $jobDetails.WorkloadType 'WorkloadType should not be null';
60+
Assert-NotNull $jobDetails.WorkloadName 'WorkloadName should not be null';
61+
Assert-NotNull $jobDetails.Status 'Status should not be null';
62+
Assert-NotNull $jobDetails.Operation 'Operation should not be null';
63+
Assert-NotNull $jobDetails.Properties 'Properties in job details cannot be null';
64+
Assert-NotNull $jobDetails.SubTasks 'SubTasks in job details cannot be null';
65+
}
66+
}
67+
68+
69+
function Test-StopAzureBackupJob
70+
{
71+
$OneMonthBack = Get-Date;
72+
$OneMonthBack = $OneMonthBack.AddDays(-30);
73+
#TODO
74+
#Call trigger backup and get an inprogress job
75+
$jobsList = Get-AzureBackupJob -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -From $OneMonthBack #-Operation 'Backup' -Status 'InProgress'
76+
77+
Stop-AzureBackupJob -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Job $jobsList[0];
78+
$jobDetails = Get-AzureBackupJobDetails -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Job $jobsList[0];
79+
#Assert-AreEqual 'Cancelling' $jobDetails.Status
80+
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Jobs/GetAzureBackupJob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class GetAzureBackupJob : AzureBackupVaultCmdletBase
3333
[ValidateNotNullOrEmpty]
3434
public string JobId { get; set; }
3535

36-
[Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.JobFilterJobHelpMessage)]
36+
[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.JobFilterJobHelpMessage)]
3737
[ValidateNotNull]
3838
public AzureBackupJob Job { get; set; }
3939

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/RegisterContainer/RegisterAzureBackupContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets.RegisterContainer
99
{
10-
[Cmdlet(VerbsCommon.Get, ProfileNouns.VirtualMachine, DefaultParameterSetName = ListAllVirtualMachinesParamSet)]
10+
//[Cmdlet(VerbsCommon.Get, ProfileNouns.VirtualMachine, DefaultParameterSetName = ListAllVirtualMachinesParamSet)]
1111
class RegisterAzureBackupContainer
1212
{
1313
}

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
2929
<RunCodeAnalysis>true</RunCodeAnalysis>
3030
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
31+
<PlatformTarget>AnyCPU</PlatformTarget>
3132
</PropertyGroup>
3233
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3334
<OutputPath>..\..\..\Package\Release\ServiceManagement\Azure\StorSimple\</OutputPath>
@@ -139,16 +140,11 @@
139140
<Compile Include="Cmdlets\RecoveryPoint\GetAzureBackupRecoveryPoint.cs" />
140141
<Compile Include="Cmdlets\Container\GetAzureBackupContainer.cs" />
141142
<Compile Include="Cmdlets\Jobs\AzureBackupJobHelper.cs" />
142-
<Compile Include="Cmdlets\Container\RegisterAzureBackupContainer.cs" />
143-
<Compile Include="Cmdlets\Container\UnregisterAzureBackupContainer.cs" />
144143
<Compile Include="Cmdlets\Jobs\GetAzureBackupJob.cs" />
145144
<Compile Include="Cmdlets\Jobs\GetAzureBackupJobDetails.cs" />
146145
<Compile Include="Cmdlets\Jobs\StopAzureBackukpJob.cs" />
147146
<Compile Include="Cmdlets\Jobs\WaitAzureBackupJob.cs" />
148147
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureBackupProtectionPolicy.cs" />
149-
<Compile Include="Cmdlets\RegisterContainer\RegisterAzureBackupContainer.cs">
150-
<SubType>Code</SubType>
151-
</Compile>
152148
<Compile Include="Cmdlets\Vault\GetAzureBackupVaultCredentials\AcsNamespace.cs" />
153149
<Compile Include="Cmdlets\Vault\GetAzureBackupVaultCredentials\CertUtils.cs" />
154150
<Compile Include="Cmdlets\Vault\GetAzureBackupVaultCredentials\Constants.cs" />
@@ -178,10 +174,6 @@
178174
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
179175
<Name>Commands.Common</Name>
180176
</ProjectReference>
181-
<ProjectReference Include="..\..\Compute\Commands.Compute\Commands.Compute.csproj">
182-
<Project>{52643bd5-6378-49bd-9f6e-dac9dd8a867b}</Project>
183-
<Name>Commands.Compute</Name>
184-
</ProjectReference>
185177
</ItemGroup>
186178
<ItemGroup>
187179
<None Include="Microsoft.Azure.Commands.AzureBackup.format.ps1xml">
@@ -208,6 +200,9 @@
208200
<Content Include="Resources\Microsoft.WindowsAzure.Management.Common.dll" />
209201
<Content Include="Resources\Security.Cryptography.dll" />
210202
</ItemGroup>
203+
<ItemGroup>
204+
<Folder Include="Cmdlets\RegisterContainer\" />
205+
</ItemGroup>
211206
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
212207
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
213208
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/RegisterContainer/RegisterContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public AzureBackupRegisterContainer()
4949
}
5050

5151
public AzureBackupRegisterContainer(string resourceGroupName, string resourceName, ProtectionPolicyInfo sourcePolicy)
52-
: base(resourceGroupName, resourceName)
52+
: base(resourceGroupName, resourceName, "")
5353
{
5454
InstanceId = sourcePolicy.InstanceId;
5555
Name = sourcePolicy.Name;

0 commit comments

Comments
 (0)