From 1849f8f0d5c2dbcad3c0742d9b3af04d619f1b81 Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Tue, 16 Jun 2015 22:23:48 +0530 Subject: [PATCH 1/6] PS tests and fixes for Vault and Get Container cmdlets --- .../Commands.AzureBackup.Test.csproj | 7 +-- .../ScenarioTests/AzureBackupTests.cs | 22 +++++++++ .../ScenarioTests/AzureBackupTests.ps1 | 47 +++++++++++++++++++ .../AzureBackupCmdletHelpMessage.cs | 2 +- .../Container/GetAzureBackupContainer.cs | 4 +- .../Commands.AzureBackup.csproj | 5 +- 6 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index d71137cf7849..ba13feb1aeea 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -80,9 +80,6 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll - - ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Release\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll - False ..\..\..\packages\Hydra.SpecTestSupport.1.0.5417.13285-prerelease\lib\net45\Microsoft.WindowsAzure.Testing.dll @@ -128,6 +125,10 @@ + + {38a6741c-77a3-42a8-a846-83373be57c7f} + BackupServicesManagment + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs index 5a175ae073e8..4e76a5362d35 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs @@ -59,5 +59,27 @@ public void BackUpAzureBackUpItem() { this.RunPowerShellTest("BackUpAzureBackUpItemTest"); } + + [Fact] + public void GetAzureBackupContainerTests() + { + this.RunPowerShellTest("Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers"); + + this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer"); + } + + [Fact] + public void GetAzureBackupVaultCredentialsTests() + { + this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert"); + } + + [Fact] + public void SetAzureBackupVaultStorageTypeTests() + { + this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException"); + + this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException"); + } } } diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 index 37fc2dc259f5..76ba6f476f4e 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 @@ -15,6 +15,8 @@ $ResourceGroupName = "backuprg" $ResourceName = "backuprn" $ContainerName = "iaasvmcontainer;dev01testing;dev01testing" +$ContainerResourceGroupName = "dev01Testing" +$ContainerResourceName = "dev01Testing" $ContainerType = "IaasVMContainer" $DataSourceType = "VM" $DataSourceId = "17593283453810" @@ -22,6 +24,7 @@ $Location = "SouthEast Asia" $PolicyName = "Policy9"; $PolicyId = "c87bbada-6e1b-4db2-b76c-9062d28959a4"; $POName = "iaasvmcontainer;dev01testing;dev01testing" +$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName; <# .SYNOPSIS @@ -174,3 +177,47 @@ function Test-StopAzureBackupJob $jobDetails = Get-AzureBackupJobDetails -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Job $jobsList[0]; #Assert-AreEqual 'Cancelling' $jobDetails.Status } + +function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers +{ + $containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location + Assert-NotNull $containers 'Container list should not be null'; +} + +function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer +{ + $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -ContainerResourceGroupName $ContainerResourceGroupName -ContainerResourceName $ContainerResourceName + Assert-NotNull $container 'Container should not be null'; + Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name'; + 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'; +} + +function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert +{ + $fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation + Assert-NotNull $fileName 'File name should not be null'; + $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName); + Assert-True {{ Test-Path $certFileFullPath }} +} + +function Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException +{ + # TODO: Create a new resource and use it for these calls. At the end, delete it. + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant +} + +function Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException +{ + # One of them is bound to fail + + Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant } + + Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs index 70c112b4309e..dc9f0e9d2e74 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs @@ -21,7 +21,7 @@ internal static class AzureBackupCmdletHelpMessage public const string ResourceGroupName = "The ResourceGroup name."; public const string ResourceName = "The Resource name."; public const string Location = "Location."; - public const string TargetLocation = "The directory where the credentials file will be saved."; + public const string TargetLocation = "The directory where the credentials file will be saved. This must be an absolute path."; public const string ContainerResourceName = "The container resource name aka friendly name."; public const string ContainerId = "The container ID."; public const string ContainerRegistrationStatus = "The container registration status."; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs index ebeb8f0748eb..fbe7b1ad1604 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs @@ -75,10 +75,10 @@ public override void ExecuteCmdlet() List containers = containerInfos.ConvertAll(containerInfo => { - return new AzureBackupContainer(containerInfo, ResourceGroupName, ResourceName, Location); + return new AzureBackupContainer(containerInfo, containerInfo.ParentContainerName, containerInfo.FriendlyName, Location); }); - if (!string.IsNullOrEmpty(ResourceName) & !string.IsNullOrEmpty(ResourceGroupName)) + if (!string.IsNullOrEmpty(ContainerResourceName) & !string.IsNullOrEmpty(ContainerResourceGroupName)) { if (containers.Any()) { diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index 5a1b6875e9b3..2cbab07d76ed 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -86,8 +86,9 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll - - ..\..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net40-Debug\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll + + False + ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll False From ee37157db9965984c79721d636b678680a7fe194 Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Wed, 17 Jun 2015 14:04:44 +0530 Subject: [PATCH 2/6] Including the session records for PS tests --- .../Commands.AzureBackup.Test.csproj | 2 + .../GetAzureBackupContainerTests.json | 72 ++++++++++++++++++ .../GetAzureBackupVaultCredentialsTests.json | 75 +++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index ba13feb1aeea..dcb6556569c2 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -157,7 +157,9 @@ + + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json new file mode 100644 index 000000000000..0cf761b79a2e --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json @@ -0,0 +1,72 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26FriendlyName%3Ddev01Testing", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkZyaWVuZGx5TmFtZSUzRGRldjAxVGVzdGluZw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMServiceContainer\",\r\n \"ParentContainerName\": null,\r\n \"ParentContainerFriendlyName\": null,\r\n \"RegistrationStatus\": \"NotRegistered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": \"\",\r\n \"InstanceId\": null,\r\n \"Name\": \"dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 2,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "763" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "cb36f6ae-187d-4a30-b367-d714c0733647" + ], + "x-ms-client-request-id": [ + "4b55cb3b-c4db-4dda-8db9-891256be4264", + "4b55cb3b-c4db-4dda-8db9-891256be4264" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "cb36f6ae-187d-4a30-b367-d714c0733647" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150616T144830Z:cb36f6ae-187d-4a30-b367-d714c0733647" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Tue, 16 Jun 2015 14:48:30 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json new file mode 100644 index 000000000000..16a38c9e8da8 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json @@ -0,0 +1,75 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/certificates/IdMgmtInternalCert?api-version=2015-03-15", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY2VydGlmaWNhdGVzL0lkTWdtdEludGVybmFsQ2VydD9hcGktdmVyc2lvbj0yMDE1LTAzLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQfAPxy3CY6JlCIBZLq9ZwVjANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNjE1NDQ1MVoXDTE1MDYxODE1NTQ1MVowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJcmOVXMwQS3uiV3xRbeRbbQxjbS/eT/n3m7b9nd2NoPsMhGT+uvypAL3iG2wxd7HzqjZswIVMhsLqYMzQIv6kcAlbyosuiaT56ga/xLBZJGJg7DHA4ndQf4UnigmqLCZeE5dyvJ/U070iHEBS1M9pa6TPmYgIEVKFZ1p3qDnmHsz6DPb39vdzxpKAsseGD2ocdLmb0Eq1s7ZnS9djzLkiY7x2P715Iivz1PZx/JcjTAwCorfWU9elI+sdSY62DZKhZbrXnK+qFEYnRO1cPWXe9AvJynQvS+FRkD8HCLHweWXEvCs/BX8CGJbKi9XYnuDlhuxm4dLBCs92tXrhu2hUsCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAGj+8Vo4WUUui7GepTrsRAKAx2ZpdfCTTBhsdQIxbtaz312xX93i6X0CCmJLRjeXNNoVv5b0zDFnIdoTqn3eraDNonkMUqNGGleC4gMnOLzbKURMWeJ2cfGIVGtHkSv8ZFgU+ttZtCPX6SpzAWcplCeEX8DNs87e9ew4jZg4gPYu9zEO+Z4iYQlGd55Pd8JiiCsVcs9KhtrbBHC9J4/tTAZsONPLqo3PFdXMqmuN5Yct+J5T93kW3FWb/X5oiNZXtn9O4j7T7rYSHje9IZnSoiNW0Nc9/JgQ5VPbUMpc6U6tE53yIQ1aWpLj49L+gxSoZ7KWefN/NDMGSXTzTuXJ9R0=\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "1035" + ], + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQfAPxy3CY6JlCIBZLq9ZwVjANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNjE1NDQ1MVoXDTE1MDYxODE1NTQ1MVowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJcmOVXMwQS3uiV3xRbeRbbQxjbS/eT/n3m7b9nd2NoPsMhGT+uvypAL3iG2wxd7HzqjZswIVMhsLqYMzQIv6kcAlbyosuiaT56ga/xLBZJGJg7DHA4ndQf4UnigmqLCZeE5dyvJ/U070iHEBS1M9pa6TPmYgIEVKFZ1p3qDnmHsz6DPb39vdzxpKAsseGD2ocdLmb0Eq1s7ZnS9djzLkiY7x2P715Iivz1PZx/JcjTAwCorfWU9elI+sdSY62DZKhZbrXnK+qFEYnRO1cPWXe9AvJynQvS+FRkD8HCLHweWXEvCs/BX8CGJbKi9XYnuDlhuxm4dLBCs92tXrhu2hUsCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAGj+8Vo4WUUui7GepTrsRAKAx2ZpdfCTTBhsdQIxbtaz312xX93i6X0CCmJLRjeXNNoVv5b0zDFnIdoTqn3eraDNonkMUqNGGleC4gMnOLzbKURMWeJ2cfGIVGtHkSv8ZFgU+ttZtCPX6SpzAWcplCeEX8DNs87e9ew4jZg4gPYu9zEO+Z4iYQlGd55Pd8JiiCsVcs9KhtrbBHC9J4/tTAZsONPLqo3PFdXMqmuN5Yct+J5T93kW3FWb/X5oiNZXtn9O4j7T7rYSHje9IZnSoiNW0Nc9/JgQ5VPbUMpc6U6tE53yIQ1aWpLj49L+gxSoZ7KWefN/NDMGSXTzTuXJ9R0=\",\r\n \"resourceId\": 3420983535961922368,\r\n \"globalAcsNamespace\": \"seadev01rp1users\",\r\n \"globalAcsHostName\": \"accesscontrol.windows.net\",\r\n \"globalAcsRPRealm\": \"http://windowscloudbackup/m3\",\r\n \"subject\": \"CN=Windows Azure Tools\",\r\n \"validFrom\": \"2015-06-16T21:14:51+05:30\",\r\n \"validTo\": \"2015-06-18T21:24:51+05:30\",\r\n \"thumbprint\": \"3C6F6F4C967A814B373E16F4E21903279E068704\",\r\n \"friendlyName\": \"\",\r\n \"issuer\": \"CN=Windows Azure Tools\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1409" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "8511ee99-3e25-405e-aa6f-0cb873bdab7c" + ], + "x-ms-client-request-id": [ + "0c51abcf-3be9-4c40-ba65-de8e5ed0d233", + "0c51abcf-3be9-4c40-ba65-de8e5ed0d233" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-correlation-request-id": [ + "8511ee99-3e25-405e-aa6f-0cb873bdab7c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150616T155458Z:8511ee99-3e25-405e-aa6f-0cb873bdab7c" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Tue, 16 Jun 2015 15:54:58 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file From d50b219ea260f0f4e03969d4e259d6cb83dcdbeb Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Wed, 17 Jun 2015 16:35:01 +0530 Subject: [PATCH 3/6] Splitting get container and vault tests into separate files --- .../Commands.AzureBackup.Test.csproj | 6 +++ .../ScenarioTests/AzureBackupTests.cs | 22 --------- .../ScenarioTests/AzureBackupTests.ps1 | 45 ------------------- .../GetAzureBackupContainerTests.cs | 34 ++++++++++++++ .../GetAzureBackupContainerTests.ps1 | 33 ++++++++++++++ .../GetAzureBackupVaultCredentialsTests.cs | 32 +++++++++++++ .../GetAzureBackupVaultCredentialsTests.ps1 | 26 +++++++++++ .../SetAzureBackupVaultStorageTypeTests.cs | 34 ++++++++++++++ .../SetAzureBackupVaultStorageTypeTests.ps1 | 39 ++++++++++++++++ 9 files changed, 204 insertions(+), 67 deletions(-) create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.ps1 create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index e13844c82449..817df7562a81 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -126,6 +126,9 @@ + + + @@ -154,6 +157,9 @@ Always + + + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs index b3840eb12170..c330f4eb2b73 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs @@ -65,27 +65,5 @@ public void BackUpAzureBackUpItem() { this.RunPowerShellTest("BackUpAzureBackUpItemTest"); } - - [Fact] - public void GetAzureBackupContainerTests() - { - this.RunPowerShellTest("Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers"); - - this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer"); - } - - [Fact] - public void GetAzureBackupVaultCredentialsTests() - { - this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert"); - } - - [Fact] - public void SetAzureBackupVaultStorageTypeTests() - { - this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException"); - - this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException"); - } } } diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 index f8254816120b..f2ba9330aacf 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 @@ -24,7 +24,6 @@ $Location = "SouthEast Asia" $PolicyName = "Policy9"; $PolicyId = "c87bbada-6e1b-4db2-b76c-9062d28959a4"; $POName = "iaasvmcontainer;dev01testing;dev01testing" -$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName; <# .SYNOPSIS @@ -187,47 +186,3 @@ function Test-StopAzureBackupJob $jobDetails = Get-AzureBackupJobDetails -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Job $jobsList[0]; #Assert-AreEqual 'Cancelling' $jobDetails.Status } - -function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers -{ - $containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location - Assert-NotNull $containers 'Container list should not be null'; -} - -function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer -{ - $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -ContainerResourceGroupName $ContainerResourceGroupName -ContainerResourceName $ContainerResourceName - Assert-NotNull $container 'Container should not be null'; - Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name'; - 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'; -} - -function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert -{ - $fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation - Assert-NotNull $fileName 'File name should not be null'; - $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName); - Assert-True {{ Test-Path $certFileFullPath }} -} - -function Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException -{ - # TODO: Create a new resource and use it for these calls. At the end, delete it. - - Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant - - Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant - - Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant - - Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant -} - -function Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException -{ - # One of them is bound to fail - - Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant } - - Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant } -} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs new file mode 100644 index 000000000000..c3ecc2a07ee7 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests +{ + public class GetAzureBackupContainerTests : AzureBackupTestsBase + { + [Fact] + public void GetAzureBackupContainerTests() + { + this.RunPowerShellTest("Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers"); + + this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer"); + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.ps1 new file mode 100644 index 000000000000..0e9b5b0805db --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.ps1 @@ -0,0 +1,33 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +$ResourceGroupName = "backuprg" +$ResourceName = "backuprn" +$Location = "SouthEast Asia" +$ContainerResourceGroupName = "dev01Testing" +$ContainerResourceName = "dev01Testing" + +function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers +{ + $containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location + Assert-NotNull $containers 'Container list should not be null'; +} + +function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer +{ + $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -ContainerResourceGroupName $ContainerResourceGroupName -ContainerResourceName $ContainerResourceName + Assert-NotNull $container 'Container should not be null'; + Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name'; + 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'; +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs new file mode 100644 index 000000000000..a75ea3333e4c --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs @@ -0,0 +1,32 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests +{ + public class GetAzureBackupVaultCredentialsTests : AzureBackupTestsBase + { + [Fact] + public void GetAzureBackupVaultCredentialsTests() + { + this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert"); + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 new file mode 100644 index 000000000000..78db70edc6fc --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 @@ -0,0 +1,26 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +$ResourceGroupName = "backuprg" +$ResourceName = "backuprn" +$Location = "SouthEast Asia" +$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName; + +function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert +{ + $fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation + Assert-NotNull $fileName 'File name should not be null'; + $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName); + Assert-True {{ Test-Path $certFileFullPath }} +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs new file mode 100644 index 000000000000..2b0c824eb2e1 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests +{ + public class SetAzureBackupVaultStorageTypeTests : AzureBackupTestsBase + { + [Fact] + public void SetAzureBackupVaultStorageTypeTests() + { + this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException"); + + this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException"); + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 new file mode 100644 index 000000000000..b2b80b7f6e57 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 @@ -0,0 +1,39 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +$ResourceGroupName = "backuprg" +$ResourceName = "backuprn" +$Location = "SouthEast Asia" + +function Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException +{ + # TODO: Create a new resource and use it for these calls. At the end, delete it. + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant + + Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant +} + +function Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException +{ + # One of them is bound to fail + + Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant } + + Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant } +} From d78f9ae1392b794689dbb355a4f53bce5ccc0958 Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Wed, 17 Jun 2015 22:42:46 +0530 Subject: [PATCH 4/6] Separated container and vault tests + session records --- .../Commands.AzureBackup.Test.csproj | 16 ++-- ...rTests.cs => AzureBackupContainerTests.cs} | 2 +- ...ests.ps1 => AzureBackupContainerTests.ps1} | 0 ...eTypeTests.cs => AzureBackupVaultTests.cs} | 8 +- ...ypeTests.ps1 => AzureBackupVaultTests.ps1} | 9 +++ .../GetAzureBackupVaultCredentialsTests.cs | 32 -------- .../GetAzureBackupVaultCredentialsTests.ps1 | 26 ------- .../GetAzureBackupContainerTests.json | 14 ++-- .../GetAzureBackupVaultCredentialsTests.json | 75 ------------------- .../GetAzureBackupVaultCredentialsTests.json | 75 +++++++++++++++++++ 10 files changed, 109 insertions(+), 148 deletions(-) rename src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/{GetAzureBackupContainerTests.cs => AzureBackupContainerTests.cs} (94%) rename src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/{GetAzureBackupContainerTests.ps1 => AzureBackupContainerTests.ps1} (100%) rename src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/{SetAzureBackupVaultStorageTypeTests.cs => AzureBackupVaultTests.cs} (83%) rename src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/{SetAzureBackupVaultStorageTypeTests.ps1 => AzureBackupVaultTests.ps1} (80%) delete mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs delete mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 rename src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/{Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests => Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests}/GetAzureBackupContainerTests.json (90%) delete mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index 031abce8de24..39aeb09ede93 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -130,9 +130,8 @@ - - - + + @@ -173,16 +172,21 @@ Always + - - - + + Always + + + Always + PreserveNewest + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs similarity index 94% rename from src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs rename to src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs index c3ecc2a07ee7..d82fef02114d 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests { - public class GetAzureBackupContainerTests : AzureBackupTestsBase + public class AzureBackupContainerTests : AzureBackupTestsBase { [Fact] public void GetAzureBackupContainerTests() diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 similarity index 100% rename from src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupContainerTests.ps1 rename to src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs similarity index 83% rename from src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs rename to src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs index 2b0c824eb2e1..b947043300e2 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.cs @@ -21,8 +21,14 @@ namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests { - public class SetAzureBackupVaultStorageTypeTests : AzureBackupTestsBase + public class AzureBackupVaultTests : AzureBackupTestsBase { + [Fact] + public void GetAzureBackupVaultCredentialsTests() + { + this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert"); + } + [Fact] public void SetAzureBackupVaultStorageTypeTests() { diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1 similarity index 80% rename from src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 rename to src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1 index b2b80b7f6e57..42fc08c4f601 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/SetAzureBackupVaultStorageTypeTests.ps1 +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupVaultTests.ps1 @@ -15,6 +15,15 @@ $ResourceGroupName = "backuprg" $ResourceName = "backuprn" $Location = "SouthEast Asia" +$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName; + +function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert +{ + $fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation + Assert-NotNull $fileName 'File name should not be null'; + $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName); + Assert-True {{ Test-Path $certFileFullPath }} +} function Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException { diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs deleted file mode 100644 index a75ea3333e4c..000000000000 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.cs +++ /dev/null @@ -1,32 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests -{ - public class GetAzureBackupVaultCredentialsTests : AzureBackupTestsBase - { - [Fact] - public void GetAzureBackupVaultCredentialsTests() - { - this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert"); - } - } -} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 deleted file mode 100644 index 78db70edc6fc..000000000000 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/GetAzureBackupVaultCredentialsTests.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -# ---------------------------------------------------------------------------------- -# -# Copyright Microsoft Corporation -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ---------------------------------------------------------------------------------- - -$ResourceGroupName = "backuprg" -$ResourceName = "backuprn" -$Location = "SouthEast Asia" -$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName; - -function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert -{ - $fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation - Assert-NotNull $fileName 'File name should not be null'; - $certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName); - Assert-True {{ Test-Path $certFileFullPath }} -} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/GetAzureBackupContainerTests.json similarity index 90% rename from src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json rename to src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/GetAzureBackupContainerTests.json index 0cf761b79a2e..5ac9d61bc7c5 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupContainerTests.json +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/GetAzureBackupContainerTests.json @@ -31,29 +31,29 @@ "no-cache" ], "x-ms-request-id": [ - "cb36f6ae-187d-4a30-b367-d714c0733647" + "ce4dfbf6-9708-49f2-9532-0dbc9e912bf7" ], "x-ms-client-request-id": [ - "4b55cb3b-c4db-4dda-8db9-891256be4264", - "4b55cb3b-c4db-4dda-8db9-891256be4264" + "0482c73c-7196-49f8-96a0-3dcd0ccdaa90", + "0482c73c-7196-49f8-96a0-3dcd0ccdaa90" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14999" + "14997" ], "x-ms-correlation-request-id": [ - "cb36f6ae-187d-4a30-b367-d714c0733647" + "ce4dfbf6-9708-49f2-9532-0dbc9e912bf7" ], "x-ms-routing-request-id": [ - "CENTRALUS:20150616T144830Z:cb36f6ae-187d-4a30-b367-d714c0733647" + "CENTRALUS:20150617T170930Z:ce4dfbf6-9708-49f2-9532-0dbc9e912bf7" ], "Cache-Control": [ "no-cache" ], "Date": [ - "Tue, 16 Jun 2015 14:48:30 GMT" + "Wed, 17 Jun 2015 17:09:30 GMT" ], "Server": [ "Microsoft-IIS/8.0" diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json deleted file mode 100644 index 16a38c9e8da8..000000000000 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetAzureBackupVaultCredentialsTests.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/certificates/IdMgmtInternalCert?api-version=2015-03-15", - "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY2VydGlmaWNhdGVzL0lkTWdtdEludGVybmFsQ2VydD9hcGktdmVyc2lvbj0yMDE1LTAzLTE1", - "RequestMethod": "PUT", - "RequestBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQfAPxy3CY6JlCIBZLq9ZwVjANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNjE1NDQ1MVoXDTE1MDYxODE1NTQ1MVowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJcmOVXMwQS3uiV3xRbeRbbQxjbS/eT/n3m7b9nd2NoPsMhGT+uvypAL3iG2wxd7HzqjZswIVMhsLqYMzQIv6kcAlbyosuiaT56ga/xLBZJGJg7DHA4ndQf4UnigmqLCZeE5dyvJ/U070iHEBS1M9pa6TPmYgIEVKFZ1p3qDnmHsz6DPb39vdzxpKAsseGD2ocdLmb0Eq1s7ZnS9djzLkiY7x2P715Iivz1PZx/JcjTAwCorfWU9elI+sdSY62DZKhZbrXnK+qFEYnRO1cPWXe9AvJynQvS+FRkD8HCLHweWXEvCs/BX8CGJbKi9XYnuDlhuxm4dLBCs92tXrhu2hUsCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAGj+8Vo4WUUui7GepTrsRAKAx2ZpdfCTTBhsdQIxbtaz312xX93i6X0CCmJLRjeXNNoVv5b0zDFnIdoTqn3eraDNonkMUqNGGleC4gMnOLzbKURMWeJ2cfGIVGtHkSv8ZFgU+ttZtCPX6SpzAWcplCeEX8DNs87e9ew4jZg4gPYu9zEO+Z4iYQlGd55Pd8JiiCsVcs9KhtrbBHC9J4/tTAZsONPLqo3PFdXMqmuN5Yct+J5T93kW3FWb/X5oiNZXtn9O4j7T7rYSHje9IZnSoiNW0Nc9/JgQ5VPbUMpc6U6tE53yIQ1aWpLj49L+gxSoZ7KWefN/NDMGSXTzTuXJ9R0=\"\r\n }\r\n}", - "RequestHeaders": { - "Content-Type": [ - "application/json" - ], - "Content-Length": [ - "1035" - ], - "Accept-Language": [ - "en-us" - ], - "x-ms-version": [ - "2013-03-01" - ], - "User-Agent": [ - "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" - ] - }, - "ResponseBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQfAPxy3CY6JlCIBZLq9ZwVjANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNjE1NDQ1MVoXDTE1MDYxODE1NTQ1MVowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJcmOVXMwQS3uiV3xRbeRbbQxjbS/eT/n3m7b9nd2NoPsMhGT+uvypAL3iG2wxd7HzqjZswIVMhsLqYMzQIv6kcAlbyosuiaT56ga/xLBZJGJg7DHA4ndQf4UnigmqLCZeE5dyvJ/U070iHEBS1M9pa6TPmYgIEVKFZ1p3qDnmHsz6DPb39vdzxpKAsseGD2ocdLmb0Eq1s7ZnS9djzLkiY7x2P715Iivz1PZx/JcjTAwCorfWU9elI+sdSY62DZKhZbrXnK+qFEYnRO1cPWXe9AvJynQvS+FRkD8HCLHweWXEvCs/BX8CGJbKi9XYnuDlhuxm4dLBCs92tXrhu2hUsCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAGj+8Vo4WUUui7GepTrsRAKAx2ZpdfCTTBhsdQIxbtaz312xX93i6X0CCmJLRjeXNNoVv5b0zDFnIdoTqn3eraDNonkMUqNGGleC4gMnOLzbKURMWeJ2cfGIVGtHkSv8ZFgU+ttZtCPX6SpzAWcplCeEX8DNs87e9ew4jZg4gPYu9zEO+Z4iYQlGd55Pd8JiiCsVcs9KhtrbBHC9J4/tTAZsONPLqo3PFdXMqmuN5Yct+J5T93kW3FWb/X5oiNZXtn9O4j7T7rYSHje9IZnSoiNW0Nc9/JgQ5VPbUMpc6U6tE53yIQ1aWpLj49L+gxSoZ7KWefN/NDMGSXTzTuXJ9R0=\",\r\n \"resourceId\": 3420983535961922368,\r\n \"globalAcsNamespace\": \"seadev01rp1users\",\r\n \"globalAcsHostName\": \"accesscontrol.windows.net\",\r\n \"globalAcsRPRealm\": \"http://windowscloudbackup/m3\",\r\n \"subject\": \"CN=Windows Azure Tools\",\r\n \"validFrom\": \"2015-06-16T21:14:51+05:30\",\r\n \"validTo\": \"2015-06-18T21:24:51+05:30\",\r\n \"thumbprint\": \"3C6F6F4C967A814B373E16F4E21903279E068704\",\r\n \"friendlyName\": \"\",\r\n \"issuer\": \"CN=Windows Azure Tools\"\r\n }\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "1409" - ], - "Content-Type": [ - "application/json" - ], - "Expires": [ - "-1" - ], - "Pragma": [ - "no-cache" - ], - "x-ms-request-id": [ - "8511ee99-3e25-405e-aa6f-0cb873bdab7c" - ], - "x-ms-client-request-id": [ - "0c51abcf-3be9-4c40-ba65-de8e5ed0d233", - "0c51abcf-3be9-4c40-ba65-de8e5ed0d233" - ], - "Strict-Transport-Security": [ - "max-age=31536000; includeSubDomains" - ], - "x-ms-ratelimit-remaining-subscription-writes": [ - "1197" - ], - "x-ms-correlation-request-id": [ - "8511ee99-3e25-405e-aa6f-0cb873bdab7c" - ], - "x-ms-routing-request-id": [ - "CENTRALUS:20150616T155458Z:8511ee99-3e25-405e-aa6f-0cb873bdab7c" - ], - "Cache-Control": [ - "no-cache" - ], - "Date": [ - "Tue, 16 Jun 2015 15:54:58 GMT" - ], - "Server": [ - "Microsoft-IIS/8.0" - ] - }, - "StatusCode": 200 - } - ], - "Names": {}, - "Variables": { - "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" - } -} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json new file mode 100644 index 000000000000..ecffd4ab1460 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests/GetAzureBackupVaultCredentialsTests.json @@ -0,0 +1,75 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/certificates/IdMgmtInternalCert?api-version=2015-03-15", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY2VydGlmaWNhdGVzL0lkTWdtdEludGVybmFsQ2VydD9hcGktdmVyc2lvbj0yMDE1LTAzLTE1", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQaa4WR+3Ra7pPjIzudnuuQTANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNzE3MDAwM1oXDTE1MDYxOTE3MTAwM1owHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJhjKYhKBkE9TN6WLn8mlvkg3nCgbYwWJSuyMpcE2NH3B/rxndF1a/Mz3MJ5s3+EB9FJpuh5W2ZoqcZ2fpA3nSd+L1zrXY9gOqKqrLmRI3TwSF8X4UVXlA3eFu2QV18FfaNyDE6eBX9Rf0cDTWvNraCW/31fVGs+66d1qDhiEevPo6B9JXXauAN4NgA6uI8rwY/UOQY+3hIVjWJ/FZOAgN/T6Jb/hglCqVcyBn5bxJa3Zz49P3YSBwauf2uyiJlU64B3xmrT75Qo/+cRk5BpkWsBh57PxZhfgwL6IXSezcGTEBl5S3LEMeo+T0To6d+f/F38g2PLqteWHrtTWu+SGYkCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAEspmwyUvBmbX97gwA3mMFiHyZXFL5MgcA0qjZWy7tUS3gcrLZRSv8SMmX8Yv9F4wMy1oe/H4PxCM2IX8cuQLZ2NfAo2sGVlmhdP12ksW/rKimHpnUTfSnslzqFg4sExu4WIkRn6AJMeqAjOul+A1a6UWKa+RRoRQc6MU/tvBAiEnlRAzFpv/4Ri3yS+KXD0gkOMpoJABkOEtdrgbyFICjfsaku4q1q8LycusFpbE+GEL5TWbUG9wwLZl/IPoy8NBtrv/7Dz8t8a6j/LUxvcChNSj4sID98uasBzOJ8I65xixv+XZXl76a0Q2J4icGkmomktz3TCd7yTVykjgyAbP8c=\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "1035" + ], + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"certificate\": \"MIIC3TCCAcWgAwIBAgIQaa4WR+3Ra7pPjIzudnuuQTANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTE1MDYxNzE3MDAwM1oXDTE1MDYxOTE3MTAwM1owHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJhjKYhKBkE9TN6WLn8mlvkg3nCgbYwWJSuyMpcE2NH3B/rxndF1a/Mz3MJ5s3+EB9FJpuh5W2ZoqcZ2fpA3nSd+L1zrXY9gOqKqrLmRI3TwSF8X4UVXlA3eFu2QV18FfaNyDE6eBX9Rf0cDTWvNraCW/31fVGs+66d1qDhiEevPo6B9JXXauAN4NgA6uI8rwY/UOQY+3hIVjWJ/FZOAgN/T6Jb/hglCqVcyBn5bxJa3Zz49P3YSBwauf2uyiJlU64B3xmrT75Qo/+cRk5BpkWsBh57PxZhfgwL6IXSezcGTEBl5S3LEMeo+T0To6d+f/F38g2PLqteWHrtTWu+SGYkCAwEAAaMXMBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADggEBAEspmwyUvBmbX97gwA3mMFiHyZXFL5MgcA0qjZWy7tUS3gcrLZRSv8SMmX8Yv9F4wMy1oe/H4PxCM2IX8cuQLZ2NfAo2sGVlmhdP12ksW/rKimHpnUTfSnslzqFg4sExu4WIkRn6AJMeqAjOul+A1a6UWKa+RRoRQc6MU/tvBAiEnlRAzFpv/4Ri3yS+KXD0gkOMpoJABkOEtdrgbyFICjfsaku4q1q8LycusFpbE+GEL5TWbUG9wwLZl/IPoy8NBtrv/7Dz8t8a6j/LUxvcChNSj4sID98uasBzOJ8I65xixv+XZXl76a0Q2J4icGkmomktz3TCd7yTVykjgyAbP8c=\",\r\n \"resourceId\": 3420983535961922368,\r\n \"globalAcsNamespace\": \"seadev01rp1users\",\r\n \"globalAcsHostName\": \"accesscontrol.windows.net\",\r\n \"globalAcsRPRealm\": \"http://windowscloudbackup/m3\",\r\n \"subject\": \"CN=Windows Azure Tools\",\r\n \"validFrom\": \"2015-06-17T22:30:03+05:30\",\r\n \"validTo\": \"2015-06-19T22:40:03+05:30\",\r\n \"thumbprint\": \"39D0915AC95DFD234575A54502AEBC78E344B3E8\",\r\n \"friendlyName\": \"\",\r\n \"issuer\": \"CN=Windows Azure Tools\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1409" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "c66c0373-80b0-43ff-8089-8075e57913e9" + ], + "x-ms-client-request-id": [ + "773dc534-8d14-4812-912f-d2834a9e8c05", + "773dc534-8d14-4812-912f-d2834a9e8c05" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "c66c0373-80b0-43ff-8089-8075e57913e9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T171018Z:c66c0373-80b0-43ff-8089-8075e57913e9" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:10:17 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file From 216c6817e05f9d82d863eeccc03f64be7d06277e Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Wed, 17 Jun 2015 22:53:24 +0530 Subject: [PATCH 5/6] Moving MKherani's tests to the common place for container tests --- .../Commands.AzureBackup.Test.csproj | 2 - .../AzureBackupContainerTests.cs | 12 ++++++ .../AzureBackupContainerTests.ps1 | 23 +++++++++++ .../ContainerTest/AzureBackupContainerTest.cs | 34 ---------------- .../AzureBackupContainerTest.ps1 | 39 ------------------- 5 files changed, 35 insertions(+), 75 deletions(-) delete mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs delete mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index b738fc9c7572..9f901adff40b 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -129,7 +129,6 @@ - @@ -170,7 +169,6 @@ Always - Always diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs index d82fef02114d..6289e8cd69bf 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.cs @@ -30,5 +30,17 @@ public void GetAzureBackupContainerTests() this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer"); } + + [Fact] + public void RegisterAzureBackupContainerTest() + { + this.RunPowerShellTest("Test-RegisterAzureBackupContainer"); + } + + [Fact] + public void UnregisterAzureBackupContainerTest() + { + this.RunPowerShellTest("Test-UnregisterAzureBackupContainer"); + } } } diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 index 0e9b5b0805db..a7a1bb39118d 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupContainerTests.ps1 @@ -18,6 +18,10 @@ $Location = "SouthEast Asia" $ContainerResourceGroupName = "dev01Testing" $ContainerResourceName = "dev01Testing" +<# +.SYNOPSIS +Tests to test list containers +#> function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers { $containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location @@ -31,3 +35,22 @@ function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name'; 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'; } + +<# +.SYNOPSIS +Tests to register the container +#> +function Test-RegisterAzureBackupContainer +{ + $jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $ContainerResourceName -ServiceName $ContainerResourceGroupName + + Assert-NotNull $jobId 'JobID should not be null'; +} + +function Test-UnregisterAzureBackupContainer +{ + $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $ContainerResourceName -ContainerResourceGroupName $ContainerResourceGroupName + $jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container + + Assert-NotNull $jobId 'JobID should not be null'; +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs deleted file mode 100644 index 98f8572f2e74..000000000000 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Xunit; - -namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests -{ - public class AzureBackupContainerTest : AzureBackupTestsBase - { - [Fact] - public void RegisterAzureBackupContainerTest() - { - this.RunPowerShellTest("Test-RegisterAzureBackupContainer"); - } - - [Fact] - public void UnregisterAzureBackupContainerTest() - { - this.RunPowerShellTest("Test-UnregisterAzureBackupContainer"); - } - } -} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 deleted file mode 100644 index bb2c01db7921..000000000000 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/ContainerTest/AzureBackupContainerTest.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# ---------------------------------------------------------------------------------- -# -# Copyright Microsoft Corporation -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ---------------------------------------------------------------------------------- - -$ResourceGroupName = "backuprg" -$ResourceName = "backuprn" -$Name = "dev01testing" -$VMServiceName = "dev01testing" -$ContainerType = "IaasVMContainer" -$Location = "westus" - -<# -.SYNOPSIS -Tests to register the container -#> -function Test-RegisterAzureBackupContainer -{ - $jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $VMName -ServiceName $VMServiceName - - Assert-NotNull $jobId 'JobID should not be null'; -} - -function Test-UnregisterAzureBackupContainer -{ - $container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $VMName -ContainerResourceGroupName $VMServiceName - $jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container - - Assert-NotNull $jobId 'JobID should not be null'; -} \ No newline at end of file From 959950b05e3299b5addbaa8838db9719a1126621 Mon Sep 17 00:00:00 2001 From: dragonfly91 Date: Wed, 17 Jun 2015 23:07:04 +0530 Subject: [PATCH 6/6] Including session records for register and unregister cmdlets. --- .../Commands.AzureBackup.Test.csproj | 9 +- .../RegisterAzureBackupContainerTest.json | 142 ++++++++++++++++++ .../UnregisterAzureBackupContainerTest.json | 139 +++++++++++++++++ .../Commands.AzureBackup.csproj | 7 +- 4 files changed, 291 insertions(+), 6 deletions(-) create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json create mode 100644 src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index 9f901adff40b..112f7e9e16df 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -39,9 +39,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.25-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - - ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.dll - False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -134,6 +131,10 @@ + + {38a6741c-77a3-42a8-a846-83373be57c7f} + BackupServicesManagment + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common @@ -173,6 +174,8 @@ Always + + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json new file mode 100644 index 000000000000..17c12738a42f --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/RegisterAzureBackupContainerTest.json @@ -0,0 +1,142 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26ContainerType%3DIaasVMContainer%26FriendlyName%3Ddev01Testing", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkNvbnRhaW5lclR5cGUlM0RJYWFzVk1Db250YWluZXIlMjZGcmllbmRseU5hbWUlM0RkZXYwMVRlc3Rpbmc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 1,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "425" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "440a2de2-c516-4b57-87ee-74839064470b" + ], + "x-ms-client-request-id": [ + "cdc53ea3-207a-4d07-b535-32e8e48f5b14", + "cdc53ea3-207a-4d07-b535-32e8e48f5b14" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-correlation-request-id": [ + "440a2de2-c516-4b57-87ee-74839064470b" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172637Z:440a2de2-c516-4b57-87ee-74839064470b" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:26:37 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/register?api-version=2014-09-01", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9yZWdpc3Rlcj9hcGktdmVyc2lvbj0yMDE0LTA5LTAx", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"ContainerUniqueNameList\": [\r\n \"iaasvmcontainer;dev01testing;dev01testing\"\r\n ],\r\n \"ContainerType\": \"IaasVMContainer\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "129" + ], + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "\"4a6fddd3-bdfc-482e-b7db-446cf9d729bc\"", + "ResponseHeaders": { + "Content-Length": [ + "38" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "e6efbb84-1593-4db6-b064-31838096cc99" + ], + "x-ms-client-request-id": [ + "d208a9ee-2876-4dc5-98e9-ed753b5a9014", + "d208a9ee-2876-4dc5-98e9-ed753b5a9014" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "x-ms-correlation-request-id": [ + "e6efbb84-1593-4db6-b064-31838096cc99" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172639Z:e6efbb84-1593-4db6-b064-31838096cc99" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:26:39 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 202 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json new file mode 100644 index 000000000000..fb251975358b --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests/UnregisterAzureBackupContainerTest.json @@ -0,0 +1,139 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26FriendlyName%3Ddev01Testing", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkZyaWVuZGx5TmFtZSUzRGRldjAxVGVzdGluZw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "x-ms-version": [ + "2013-03-01" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registering\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMServiceContainer\",\r\n \"ParentContainerName\": null,\r\n \"ParentContainerFriendlyName\": null,\r\n \"RegistrationStatus\": \"NotRegistered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": \"\",\r\n \"InstanceId\": null,\r\n \"Name\": \"dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 2,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "764" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "de369fec-4df6-4813-8ddb-24bceddba94e" + ], + "x-ms-client-request-id": [ + "341c6fb9-6b4c-4773-8450-32cf85173c91", + "341c6fb9-6b4c-4773-8450-32cf85173c91" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-correlation-request-id": [ + "de369fec-4df6-4813-8ddb-24bceddba94e" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172721Z:de369fec-4df6-4813-8ddb-24bceddba94e" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:27:21 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAx", + "RequestMethod": "DELETE", + "RequestBody": "{\r\n \"ContainerUniqueName\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"ContainerType\": \"IaasVMContainer\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json" + ], + "Content-Length": [ + "113" + ], + "Accept-Language": [ + "en-us" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "\"8386018b-db83-4f50-b496-a4e4e1ad1824\"", + "ResponseHeaders": { + "Content-Length": [ + "38" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "9756b21f-b792-4b7a-b2ae-825c6625302c" + ], + "x-ms-client-request-id": [ + "75d2fb2f-daf1-4c97-865f-2a2f6230ee34", + "75d2fb2f-daf1-4c97-865f-2a2f6230ee34" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1193" + ], + "x-ms-correlation-request-id": [ + "9756b21f-b792-4b7a-b2ae-825c6625302c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150617T172722Z:9756b21f-b792-4b7a-b2ae-825c6625302c" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 17 Jun 2015 17:27:22 GMT" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 202 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index 6b71dcb49e9f..b36222267916 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -65,9 +65,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - - ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.dll - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -175,6 +172,10 @@ + + {38a6741c-77a3-42a8-a846-83373be57c7f} + BackupServicesManagment + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common