Skip to content

Commit

Permalink
Merge pull request #14 from MabOneSdk/panbha5
Browse files Browse the repository at this point in the history
BackUpAndRecoveryScenario
  • Loading branch information
panbha committed Jun 11, 2015
2 parents ac6e572 + 7d32401 commit ac20df1
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<Import Project="$(LibraryToolsFolder)\Test.Dependencies.target" />
<ItemGroup>
<Compile Include="ScenarioTests\BackupServicesTestBase.cs" />
<Compile Include="ScenarioTests\BackUpTests.cs" />
<Compile Include="ScenarioTests\ProtectionPolicyTests.cs" />
<Compile Include="ScenarioTests\RecoveryPointTests.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Runtime.Serialization" />
Expand All @@ -28,7 +30,9 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="SessionRecords\BackupServices.Tests.BackUpTests\TriggerBackUpTest.json" />
<None Include="SessionRecords\BackupServices.Tests.ProtectionPolicyTests\ListProtectionPolicyTest.json" />
<None Include="SessionRecords\BackupServices.Tests.RecoveryPointTests\ListRecoveryPointTest.json" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.Azure.Management.BackupServices.Models;
using Microsoft.Azure.Management.BackupServices;
using Microsoft.Azure.Test;
using System.Net;
using Xunit;
using System.Configuration;
using System;

namespace BackupServices.Tests
{
public class BackUpTests : BackupServicesTestsBase
{
[Fact]
public void TriggerBackUpTest()
{
using (UndoContext context = UndoContext.Current)
{
context.Start();
var client = GetServiceClient<BackupServicesManagementClient>();

string containerName = ConfigurationManager.AppSettings["ContainerName"];
string dataSourceType = ConfigurationManager.AppSettings["DataSourceType"];
string dataSourceId = ConfigurationManager.AppSettings["DataSourceId"];

var response = client.BackUp.TriggerBackUp(GetCustomRequestHeaders(), containerName, dataSourceType, dataSourceId);


/*
foreach (var ppo in response.RecoveryPoints.Objects)
{
Assert.True(!string.IsNullOrEmpty(ppo.InstanceId), "RecoveryPointId can't be null or empty");
Assert.True((ppo.RecoveryPointTime != null), "RecoveryPointTime can't be null or empty");
Assert.True(!string.IsNullOrEmpty(ppo.RecoveryPointType), "RecoveryPointType can't be null or empty");
}
*/
Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.Azure.Management.BackupServices.Models;
using Microsoft.Azure.Management.BackupServices;
using Microsoft.Azure.Test;
using System.Net;
using Xunit;
using System.Configuration;
using System;

namespace BackupServices.Tests
{
public class RecoveryPointTests : BackupServicesTestsBase
{
[Fact]
public void ListRecoveryPointTest()
{
using (UndoContext context = UndoContext.Current)
{
context.Start();
var client = GetServiceClient<BackupServicesManagementClient>();

string containerName = ConfigurationManager.AppSettings["ContainerName"];
string dataSourceType = ConfigurationManager.AppSettings["DataSourceType"];
string dataSourceId = ConfigurationManager.AppSettings["DataSourceId"];

var response = client.RecoveryPoint.List(GetCustomRequestHeaders(), containerName, dataSourceType, dataSourceId);

Assert.True(response.RecoveryPoints.ResultCount > 0, "Recovery Points Result count can't be less than 1");

foreach (var ppo in response.RecoveryPoints.Objects)
{
Assert.True(!string.IsNullOrEmpty(ppo.InstanceId), "RecoveryPointId can't be null or empty");
Assert.True((ppo.RecoveryPointTime != null), "RecoveryPointTime can't be null or empty");
Assert.True(!string.IsNullOrEmpty(ppo.RecoveryPointType), "RecoveryPointType can't be null or empty");
}

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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": "\"47ac4ee3-a249-4d8d-b737-b67bd0d9ada1\"",
"ResponseHeaders": {
"Content-Length": [
"38"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"959bc754-f55e-461b-aeff-d32b56c6218d"
],
"x-ms-client-request-id": [
"380700e8-5f65-4790-b6a9-77085f633b6d",
"380700e8-5f65-4790-b6a9-77085f633b6d"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1199"
],
"x-ms-correlation-request-id": [
"959bc754-f55e-461b-aeff-d32b56c6218d"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150611T105041Z:959bc754-f55e-461b-aeff-d32b56c6218d"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Thu, 11 Jun 2015 10:50:40 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 202
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Original file line number Diff line number Diff line change
@@ -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 \"ResultCount\": 1,\r\n \"Skiptoken\": null\r\n}",
"ResponseHeaders": {
"Content-Length": [
"238"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"309bda36-8fc0-4708-ac3c-3ba1a6dd791e"
],
"x-ms-client-request-id": [
"750381bf-21f7-4a9c-b4db-d0a4dbfc86f9",
"750381bf-21f7-4a9c-b4db-d0a4dbfc86f9"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"14999"
],
"x-ms-correlation-request-id": [
"309bda36-8fc0-4708-ac3c-3ba1a6dd791e"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150611T114322Z:309bda36-8fc0-4708-ac3c-3ba1a6dd791e"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Thu, 11 Jun 2015 11:43:21 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="ResourceName" value="swatirn1" />
<add key="ResourceGroupName" value="swatirg1" />
<add key="ResourceId" value="7368183945769329045" />
<add key="ResourceName" value="backuprn" />
<add key="ResourceGroupName" value="backuprg" />
<add key="ResourceId" value="3420983535961922368" />
<add key="ContainerName" value="iaasvmcontainer;dev01testing;dev01testing" />
<add key="DataSourceType" value="VM" />
<add key="DataSourceId" value="17593283453810" />
<add key="Location" value="SouthEast Asia" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
Expand Down

0 comments on commit ac20df1

Please sign in to comment.