public void CloudFileShareDeleteTask() { CloudFileShare share = GetRandomShareReference(); share.CreateAsync().Wait(); Assert.IsTrue(share.Exists()); share.DeleteAsync().Wait(); Assert.IsFalse(share.Exists()); }
public void CloudFileClientWithUppercaseAccountName() { StorageCredentials credentials = new StorageCredentials(TestBase.StorageCredentials.AccountName.ToUpper(), TestBase.StorageCredentials.ExportKey()); Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.FileServiceEndpoint); CloudFileClient fileClient = new CloudFileClient(baseAddressUri, TestBase.StorageCredentials); CloudFileShare share = fileClient.GetShareReference("share"); share.Exists(); }
public void CloudFileShareExists() { CloudFileShare share = GetRandomShareReference(); CloudFileShare share2 = share.ServiceClient.GetShareReference(share.Name); Assert.IsFalse(share2.Exists()); share.Create(); try { Assert.IsTrue(share2.Exists()); Assert.IsNotNull(share2.Properties.ETag); } finally { share.Delete(); } Assert.IsFalse(share2.Exists()); }
public void CloudFileClientCreateShareSharedKeyLite() { CloudFileClient fileClient = GenerateCloudFileClient(); fileClient.AuthenticationScheme = AuthenticationScheme.SharedKeyLite; string shareName = GetRandomShareName(); CloudFileShare share = fileClient.GetShareReference(shareName); share.Create(); bool exists = share.Exists(); Assert.IsTrue(exists); share.Delete(); }
public AzureSession(string connectionString, string shareName, string systemDir, int waitForLockMilliseconds = 5000, bool optimisticLocking = true, bool enableCache = true, CacheEnum objectCachingDefaultPolicy = CacheEnum.Yes) : base(systemDir, waitForLockMilliseconds, optimisticLocking, enableCache, objectCachingDefaultPolicy) { m_cloudStorageAccount = CloudStorageAccount.Parse(connectionString); if (Path.IsPathRooted(systemDir) == false) SystemDirectory = systemDir; m_shareName = shareName; m_cloudFileClient = m_cloudStorageAccount.CreateCloudFileClient(); m_cloudShare = m_cloudFileClient.GetShareReference(shareName); if (m_cloudShare.Exists()) { m_rootDir = m_cloudShare.GetRootDirectoryReference(); m_databaseDir = m_rootDir.GetDirectoryReference(systemDir); m_databaseDir.CreateIfNotExists(); } }
public void CloudFileClientServerTimeout() { CloudFileClient client = GenerateCloudFileClient(); CloudFileShare share = client.GetShareReference("timeouttest"); string timeout = null; OperationContext context = new OperationContext(); context.SendingRequest += (sender, e) => { IDictionary <string, string> query = HttpWebUtility.ParseQueryString(e.Request.RequestUri.Query); if (!query.TryGetValue("timeout", out timeout)) { timeout = null; } }; FileRequestOptions options = new FileRequestOptions(); share.Exists(null, context); Assert.IsNull(timeout); share.Exists(options, context); Assert.IsNull(timeout); options.ServerTimeout = TimeSpan.FromSeconds(100); share.Exists(options, context); Assert.AreEqual("100", timeout); client.DefaultRequestOptions.ServerTimeout = TimeSpan.FromSeconds(90); share.Exists(null, context); Assert.AreEqual("90", timeout); share.Exists(options, context); Assert.AreEqual("100", timeout); options.ServerTimeout = null; share.Exists(options, context); Assert.AreEqual("90", timeout); options.ServerTimeout = TimeSpan.Zero; share.Exists(options, context); Assert.IsNull(timeout); }