From 5be800125c06c8104ba10d26402a617fc134b72c Mon Sep 17 00:00:00 2001 From: jehine-MSFT Date: Wed, 6 Apr 2016 14:14:19 -0700 Subject: [PATCH] Remove deleted files --- .../Blob/ExceptionHResultTest.cs | 180 ------------------ .../File/FileExceptionHResultTest.cs | 167 ---------------- .../Queue/ExceptionHResultTest.cs | 85 --------- 3 files changed, 432 deletions(-) delete mode 100644 Test/WindowsRuntime/Blob/ExceptionHResultTest.cs delete mode 100644 Test/WindowsRuntime/File/FileExceptionHResultTest.cs delete mode 100644 Test/WindowsRuntime/Queue/ExceptionHResultTest.cs diff --git a/Test/WindowsRuntime/Blob/ExceptionHResultTest.cs b/Test/WindowsRuntime/Blob/ExceptionHResultTest.cs deleted file mode 100644 index df1f25598..000000000 --- a/Test/WindowsRuntime/Blob/ExceptionHResultTest.cs +++ /dev/null @@ -1,180 +0,0 @@ -// ----------------------------------------------------------------------------------------- -// -// Copyright 2013 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------------------- - -using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; -using Microsoft.WindowsAzure.Storage.Core.Util; -using Microsoft.WindowsAzure.Storage.RetryPolicies; -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.WindowsAzure.Storage.Blob -{ - [TestClass] - public class ExceptionHResultTest : TestBase -#if XUNIT -, IDisposable -#endif - { - -#if XUNIT - // Todo: The simple/nonefficient workaround is to minimize change and support Xunit, - public ExceptionHResultTest() - { - MyTestInitialize(); - } - public void Dispose() - { - MyTestCleanup(); - } -#endif - - private readonly CloudBlobClient DefaultBlobClient = new CloudBlobClient(new Uri(TestBase.TargetTenantConfig.BlobServiceEndpoint), TestBase.StorageCredentials); - - // - // Use TestInitialize to run code before running each test - [TestInitialize()] - public void MyTestInitialize() - { - if (TestBase.BlobBufferManager != null) - { - TestBase.BlobBufferManager.OutstandingBufferCount = 0; - } - } - // - // Use TestCleanup to run code after each test has run - [TestCleanup()] - public void MyTestCleanup() - { - if (TestBase.BlobBufferManager != null) - { - Assert.AreEqual(0, TestBase.BlobBufferManager.OutstandingBufferCount); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.Blob)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudContainerCreateNegativeConflictAsync() - { - try - { - string name = "abc"; - CloudBlobContainer container = DefaultBlobClient.GetContainerReference(name); - await container.CreateAsync(); - await container.CreateAsync(); - Assert.Fail(); - } - catch (Exception e) - { - Assert.AreEqual(WindowsAzureErrorCode.HttpConflict, e.HResult); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.Blob)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudBlobUploadTimeoutAsync() - { - CloudBlobContainer container = DefaultBlobClient.GetContainerReference(Guid.NewGuid().ToString("N")); - byte[] buffer = BlobTestBase.GetRandomBuffer(4 * 1024 * 1024); - - try - { - await container.CreateAsync(); - - CloudBlockBlob blob = container.GetBlockBlobReference("blob1"); - BlobRequestOptions requestOptions = new BlobRequestOptions() - { - MaximumExecutionTime = TimeSpan.FromMilliseconds(500), - RetryPolicy = new NoRetry() - }; - - using (MemoryStream ms = new MemoryStream(buffer)) - { - await blob.UploadFromStreamAsync(ms.AsInputStream(), null, requestOptions, null); - } - - Assert.Fail(); - } - catch (Exception e) - { - Assert.AreEqual(WindowsAzureErrorCode.HttpRequestTimeout, e.HResult); - } - finally - { - container.DeleteIfExistsAsync().AsTask().Wait(); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.Blob)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudBlobUploadCancellationAsync() - { - CloudBlobContainer container = DefaultBlobClient.GetContainerReference(Guid.NewGuid().ToString("N")); - byte[] buffer = BlobTestBase.GetRandomBuffer(16 * 1024 * 1024); - - try - { - await container.CreateAsync(); - - CloudBlockBlob blob = container.GetBlockBlobReference("blob1"); - BlobRequestOptions requestOptions = new BlobRequestOptions() - { - RetryPolicy = new NoRetry() - }; - - CancellationTokenSource cts = new CancellationTokenSource(); - CancellationToken token = cts.Token; - - new Task(() => - { - new System.Threading.ManualResetEvent(false).WaitOne(500); - cts.Cancel(false); - }).Start(); - - using (MemoryStream ms = new MemoryStream(buffer)) - { -#if ASPNET_K - blob.UploadFromStreamAsync(ms, ms.Length, null, requestOptions, null, token).Wait(); -#else - blob.UploadFromStreamAsync(ms.AsInputStream(), null, requestOptions, null).AsTask(token).Wait(); -#endif - } - - Assert.Fail(); - } - catch (AggregateException e) - { - TaskCanceledException ex = new TaskCanceledException(); - Assert.AreEqual(ex.HResult, e.InnerException.HResult); - } - finally - { - container.DeleteIfExistsAsync().AsTask().Wait(); - } - } - } -} diff --git a/Test/WindowsRuntime/File/FileExceptionHResultTest.cs b/Test/WindowsRuntime/File/FileExceptionHResultTest.cs deleted file mode 100644 index 298c7ae32..000000000 --- a/Test/WindowsRuntime/File/FileExceptionHResultTest.cs +++ /dev/null @@ -1,167 +0,0 @@ -// ----------------------------------------------------------------------------------------- -// -// Copyright 2013 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------------------- - -using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; -using Microsoft.WindowsAzure.Storage.Core.Util; -using Microsoft.WindowsAzure.Storage.RetryPolicies; -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.WindowsAzure.Storage.File -{ - [TestClass] - public class ExceptionHResultTest : TestBase - { - private readonly CloudFileClient DefaultFileClient = new CloudFileClient(new Uri(TestBase.TargetTenantConfig.FileServiceEndpoint), TestBase.StorageCredentials); - - [TestMethod] - [TestCategory(ComponentCategory.File)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudFileShareCreateNegativeBadRequestAsync() - { - try - { - string name = "ABCD"; - CloudFileShare share = DefaultFileClient.GetShareReference(name); - await share.CreateAsync(); - Assert.Fail(); - } - catch (Exception e) - { - Assert.AreEqual(WindowsAzureErrorCode.HttpBadRequest, e.HResult); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.File)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudFileShareCreateNegativeConflictAsync() - { - try - { - string name = "abc"; - CloudFileShare share = DefaultFileClient.GetShareReference(name); - await share.CreateAsync(); - await share.CreateAsync(); - Assert.Fail(); - } - catch (Exception e) - { - Assert.AreEqual(WindowsAzureErrorCode.HttpConflict, e.HResult); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.File)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudFileUploadTimeoutAsync() - { - CloudFileShare share = DefaultFileClient.GetShareReference(Guid.NewGuid().ToString("N")); - byte[] buffer = FileTestBase.GetRandomBuffer(4 * 1024 * 1024); - - try - { - await share.CreateAsync(); - - CloudFile file = share.GetRootDirectoryReference().GetFileReference("file1"); - FileRequestOptions requestOptions = new FileRequestOptions() - { - MaximumExecutionTime = TimeSpan.FromMilliseconds(10), - RetryPolicy = new NoRetry() - }; - - using (MemoryStream ms = new MemoryStream(buffer)) - { - await file.UploadFromStreamAsync(ms.AsInputStream(), null, requestOptions, null); - } - - Assert.Fail(); - } - catch (Exception e) - { -#if ASPNET_K - Assert.AreEqual(WindowsAzureErrorCode.TimeoutException, e.InnerException.InnerException.HResult); -#else - Assert.AreEqual(WindowsAzureErrorCode.HttpRequestTimeout, e.HResult); -#endif - } - finally - { - share.DeleteIfExistsAsync().AsTask().Wait(); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.File)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudFileUploadCancellationAsync() - { - CloudFileShare share = DefaultFileClient.GetShareReference(Guid.NewGuid().ToString("N")); - byte[] buffer = FileTestBase.GetRandomBuffer(4 * 1024 * 1024); - - try - { - await share.CreateAsync(); - - CloudFile file = share.GetRootDirectoryReference().GetFileReference("file1"); - FileRequestOptions requestOptions = new FileRequestOptions() - { - RetryPolicy = new NoRetry() - }; - - CancellationTokenSource cts = new CancellationTokenSource(); - CancellationToken token = cts.Token; - - new Task(() => - { - new System.Threading.ManualResetEvent(false).WaitOne(10); - cts.Cancel(false); - }).Start(); - - using (MemoryStream ms = new MemoryStream(buffer)) - { -#if ASPNET_K - file.UploadFromStreamAsync(ms, ms.Length, null, requestOptions, null, token).Wait(); -#else - file.UploadFromStreamAsync(ms.AsInputStream(), null, requestOptions, null).AsTask(token).Wait(); -#endif - } - - Assert.Fail(); - } - catch (AggregateException e) - { - TaskCanceledException ex = new TaskCanceledException(); - Assert.AreEqual(ex.HResult, e.InnerException.HResult); - } - finally - { - share.DeleteIfExistsAsync().AsTask().Wait(); - } - } - } -} diff --git a/Test/WindowsRuntime/Queue/ExceptionHResultTest.cs b/Test/WindowsRuntime/Queue/ExceptionHResultTest.cs deleted file mode 100644 index ab4251b1a..000000000 --- a/Test/WindowsRuntime/Queue/ExceptionHResultTest.cs +++ /dev/null @@ -1,85 +0,0 @@ -// ----------------------------------------------------------------------------------------- -// -// Copyright 2013 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ----------------------------------------------------------------------------------------- - -using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; -using Microsoft.WindowsAzure.Storage.Core.Util; -using System; -using System.Threading.Tasks; - -namespace Microsoft.WindowsAzure.Storage.Queue -{ - [TestClass] - public class ExceptionHResultTest : TestBase -#if XUNIT -, IDisposable -#endif - { - -#if XUNIT - // Todo: The simple/nonefficient workaround is to minimize change and support Xunit, - public ExceptionHResultTest() - { - MyTestInitialize(); - } - public void Dispose() - { - MyTestCleanup(); - } -#endif - // - // Use TestInitialize to run code before running each test - [TestInitialize()] - public void MyTestInitialize() - { - if (TestBase.QueueBufferManager != null) - { - TestBase.QueueBufferManager.OutstandingBufferCount = 0; - } - } - // - // Use TestCleanup to run code after each test has run - [TestCleanup()] - public void MyTestCleanup() - { - if (TestBase.QueueBufferManager != null) - { - Assert.AreEqual(0, TestBase.QueueBufferManager.OutstandingBufferCount); - } - } - - [TestMethod] - [TestCategory(ComponentCategory.Queue)] - [TestCategory(TestTypeCategory.UnitTest)] - [TestCategory(SmokeTestCategory.NonSmoke)] - [TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)] - public async Task CloudQueueCreateNegativeBadRequestAsync() - { - CloudQueueClient client = GenerateCloudQueueClient(); - try - { - string name = Guid.NewGuid().ToString("N"); - CloudQueue queue = client.GetQueueReference(name); - await queue.FetchAttributesAsync(); - Assert.Fail(); - } - catch (Exception e) - { - Assert.AreEqual(WindowsAzureErrorCode.HttpNotFound, e.HResult); - } - } - } -}