Beispiel #1
0
 public void ReplicateWithAsyncWorkerProgressTest()
 {
     // We need exclusive access to the queue to validate queue behavior
     lock (this)
     {
         // The initial write doesn't replicate - we trigger that manually & then
         // directly invoke the replication progress methods to verify the progress behavior
         string blobName = "test/" + Guid.NewGuid().ToString();
         string blobUri  = "http://localhost/blob/" + ContainerName + "/" + blobName;
         var    content  = new StringContent(new String('b', 1024 * 1024 * 20), System.Text.Encoding.UTF8, "text/plain");
         content.Headers.Add("x-ms-version", "2013-08-15");
         content.Headers.Add("x-ms-date", "Wed, 23 Oct 2013 22:33:355 GMT");
         content.Headers.Add("x-ms-blob-type", "BlockBlob");
         var response = _runner.ExecuteRequest(blobUri,
                                               "PUT",
                                               content,
                                               HttpStatusCode.Created);
         // Fetch the blob so that we can determine it's primary data account
         var    result          = BlobRequest("HEAD", blobUri);
         string dataAccountName = new Uri(result.Location).Host.Split('.')[0];
         foreach (var dataAccount in DashConfiguration.DataAccounts
                  .Where(account => !String.Equals(account.Credentials.AccountName, dataAccountName, StringComparison.OrdinalIgnoreCase)))
         {
             // Specify 0 wait time will cause a progress message to be enqueued
             Assert.IsTrue(BlobReplicator.BeginBlobReplication(dataAccountName, dataAccount.Credentials.AccountName, ContainerName, blobName, 0));
         }
         AssertReplicationWorker(ContainerName, blobName, dataAccountName, false);
         // Cleanup
         _runner.ExecuteRequest(blobUri,
                                "DELETE",
                                expectedStatusCode: HttpStatusCode.Accepted);
         AssertReplicationWorker(ContainerName, blobName, dataAccountName, true);
     }
 }
Beispiel #2
0
 static bool DoDeleteReplicaJob(QueueMessage message, int?invisibilityTimeout = null)
 {
     return(BlobReplicator.DeleteReplica(
                message.Payload[DeleteReplicaPayload.Source],
                message.Payload[DeleteReplicaPayload.Container],
                message.Payload[DeleteReplicaPayload.BlobName],
                message.Payload[DeleteReplicaPayload.ETag]));
 }
Beispiel #3
0
 static bool DoReplicateJob(QueueMessage message, int?invisibilityTimeout = null)
 {
     return(BlobReplicator.BeginBlobReplication(
                message.Payload[ReplicatePayload.Source],
                message.Payload[ReplicatePayload.Destination],
                message.Payload[ReplicatePayload.Container],
                message.Payload[ReplicatePayload.BlobName],
                invisibilityTimeout));
 }