diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config index 3b4ad2203e51..749e8d87fdbd 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/App.config @@ -1,8 +1,8 @@  - - + + 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 27d0e0d2f5f1..6dd20038948d 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -153,7 +153,9 @@ PreserveNewest - + + + PreserveNewest diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs index 97a25779fd49..46dad36884c2 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.cs @@ -24,5 +24,17 @@ public void ListProtectionPolicyTests() { this.RunPowerShellTest("Test-GetAzureBackupProtectionPolicyTests"); } + + [Fact] + public void GetRecoveryPointTests() + { + this.RunPowerShellTest("GetAzureRecoveryPointTest"); + } + + [Fact] + public void BackUpAzureBackUpItem() + { + this.RunPowerShellTest("BackUpAzureBackUpItemTest"); + } } } diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 index 1b4589e511f7..da3bbf0c8961 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTests.ps1 @@ -12,8 +12,13 @@ # limitations under the License. # ---------------------------------------------------------------------------------- -$ResourceGroupName = "swatirg1"; -$ResourceName = "swatirn1" +$ResourceGroupName = "backuprg"; +$ResourceName = "backuprn" +$ContainerName = "iaasvmcontainer;dev01testing;dev01testing" +$ContainerType = "IaasVMContainer" +$DataSourceType = "VM" +$DataSourceId = "17593283453810" +$Location = "SouthEast Asia" <# .SYNOPSIS @@ -36,4 +41,36 @@ function Test-GetAzureBackupProtectionPolicyTests } } +function GetAzureRecoveryPointTest +{ + $azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem + $azureBackUpItem.ResourceGroupName = $ResourceGroupName + $azureBackUpItem.ResourceName = $ResourceGroupName + $azureBackUpItem.Location = $Location + $azureBackUpItem.ContainerUniqueName = $ContainerName + $azureBackUpItem.ContainerType = $ContainerType + $azureBackUpItem.DataSourceId = $DataSourceId + $azureBackUpItem.Type = $DataSourceType + $recoveryPoints = Get-AzureBackupRecoveryPoint -item $azureBackUpItem + Assert-NotNull $recoveryPoints 'Recovery Points should not be null' + foreach($recoveryPoint in $recoveryPoints) + { + Assert-NotNull $recoveryPoint.RecoveryPointTime 'RecoveryPointTime should not be null' + Assert-NotNull $recoveryPoint.RecoveryPointType 'RecoveryPointType should not be null' + } +} + +function BackUpAzureBackUpItemTest +{ + $azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem + $azureBackUpItem.ResourceGroupName = $ResourceGroupName + $azureBackUpItem.ResourceName = $ResourceName + $azureBackUpItem.Location = $Location + $azureBackUpItem.ContainerUniqueName = $ContainerName + $azureBackUpItem.ContainerType = $ContainerType + $azureBackUpItem.DataSourceId = $DataSourceId + $azureBackUpItem.Type = $DataSourceType + $operationId = Backup-AzureBackupItem -item $azureBackUpItem +} + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/BackUpAzureBackUpItem.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/BackUpAzureBackUpItem.json new file mode 100644 index 000000000000..c7a2412615bc --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/BackUpAzureBackUpItem.json @@ -0,0 +1,69 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/backup?api-version=2014-09-01", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvYmFja3VwP2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "\"062c55cd-a201-4464-a628-4ee1cc20397a\"", + "ResponseHeaders": { + "Content-Length": [ + "38" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "7bd6b748-c6b1-4bf1-8583-841a4292e5aa" + ], + "x-ms-client-request-id": [ + "76b831b2-0644-4703-becd-5831a9deae65", + "76b831b2-0644-4703-becd-5831a9deae65" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-correlation-request-id": [ + "7bd6b748-c6b1-4bf1-8583-841a4292e5aa" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150612T143521Z:7bd6b748-c6b1-4bf1-8583-841a4292e5aa" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 12 Jun 2015 14:35:21 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.AzureBackupTests/GetRecoveryPointTests.json b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetRecoveryPointTests.json new file mode 100644 index 000000000000..456622690c7a --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/SessionRecords/Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests/GetRecoveryPointTests.json @@ -0,0 +1,69 @@ +{ + "Entries": [ + { + "RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/recoverypoints?api-version=2014-09-01", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvcmVjb3Zlcnlwb2ludHM/YXBpLXZlcnNpb249MjAxNC0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept-Language": [ + "en-us" + ], + "User-Agent": [ + "Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-11T10:52:30.0345282Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"19591702463836\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T06:05:46.9189974Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"20483888156836\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T05:49:51.2034409Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"20920255378610\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-12T06:24:33.0768703Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"26453384139263\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"RecoveryPointType\": \"AppConsistent\",\r\n \"RecoveryPointTime\": \"2015-06-11T14:41:46.0950893Z\",\r\n \"RecoveryPointAdditionalInfo\": \"\",\r\n \"InstanceId\": \"32528401668178\",\r\n \"Name\": null,\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 5,\r\n \"Skiptoken\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1006" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "3e21bbb3-afb6-4d88-a2f7-4af14d817853" + ], + "x-ms-client-request-id": [ + "0762a614-5fd9-468c-97f1-f0742060deef", + "0762a614-5fd9-468c-97f1-f0742060deef" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-correlation-request-id": [ + "3e21bbb3-afb6-4d88-a2f7-4af14d817853" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150612T133209Z:3e21bbb3-afb6-4d88-a2f7-4af14d817853" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 12 Jun 2015 13:32:08 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