protected static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob)
        {
            Process          currentProcess = Process.GetCurrentProcess();
            StringDictionary environment    = currentProcess.StartInfo.EnvironmentVariables;

            string storageAccount    = environment[CredentialHelper.StorageAccountVariable];
            string storageAccountKey = environment[CredentialHelper.StorageAccountKeyVariable];

            // Create a container
            try
            {
                vmPowershellCmdlets.RunPSScript("Get-AzureStorageContainer -Name " + destContainer);
            }
            catch
            {
                // Create a container.
                vmPowershellCmdlets.RunPSScript("New-AzureStorageContainer -Name " + destContainer);
            }

            // Make SAS Uri for the source blob.
            string srcSasUri = Utilities.GenerateSasUri(CredentialHelper.CredentialBlobUriFormat, storageAccount, storageAccountKey, srcContainer, srcBlob);

            vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
            vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));

            for (int i = 0; i < 60; i++)
            {
                var result = vmPowershellCmdlets.CheckCopyBlobStatus(destContainer, destBlob);
                if (result.Status.ToString().Equals("Success"))
                {
                    break;
                }
                else
                {
                    Thread.Sleep(10 * 1000);
                }
            }
        }
Exemplo n.º 2
0
        public static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob)
        {
            ServiceManagementCmdletTestHelper vmPowershellCmdlets = new ServiceManagementCmdletTestHelper();
            Process currentProcess = Process.GetCurrentProcess();
            StringDictionary environment = currentProcess.StartInfo.EnvironmentVariables;

            string storageAccount = environment[CredentialHelper.StorageAccountVariable];
            string storageAccountKey = environment[CredentialHelper.StorageAccountKeyVariable];

            // Create a container
            try
            {
                vmPowershellCmdlets.RunPSScript("Get-AzureStorageContainer -Name " + destContainer);
            }
            catch
            {
                // Create a container.
                vmPowershellCmdlets.RunPSScript("New-AzureStorageContainer -Name " + destContainer);
            }

            // Make SAS Uri for the source blob.
            string srcSasUri = Utilities.GenerateSasUri(CredentialHelper.CredentialBlobUriFormat, storageAccount, storageAccountKey, srcContainer, srcBlob);

            vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));

            for (int i = 0; i < 60; i++)
            {
                var result = vmPowershellCmdlets.CheckCopyBlobStatus(destContainer, destBlob);
                if (result.Status.ToString().Equals("Success"))
                {
                    break;
                }
                else
                {
                    System.Threading.Thread.Sleep(10 * 1000);
                }
            }
        }