From c209bd2d0fd2fd44d59c8248bd417112e32d9be5 Mon Sep 17 00:00:00 2001 From: Amar Zavery Date: Wed, 25 Nov 2015 14:45:06 -0800 Subject: [PATCH 1/3] fix building and signing packages for non dnx and non autorest projects --- build.proj | 4 ++-- tools/Test.Dependencies.target | 2 +- tools/nuget.targets | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.proj b/build.proj index f215ea1cf485..c319895765af 100644 --- a/build.proj +++ b/build.proj @@ -108,9 +108,9 @@ - + Targets="Build" /> - $(LibraryNugetPackageFolder)\Hyak.Common.1.0.3\lib\net45\Hyak.Common.dll + $(LibraryNugetPackageFolder)\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll $(LibraryNugetPackageFolder)\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll diff --git a/tools/nuget.targets b/tools/nuget.targets index 4e2e5cb143a6..385751e64651 100644 --- a/tools/nuget.targets +++ b/tools/nuget.targets @@ -75,7 +75,7 @@ Build NuGet packages --> - + Date: Wed, 25 Nov 2015 15:51:41 -0800 Subject: [PATCH 2/3] removed hdinsight and keyvault dataplane projects from building when scope is specified as 'all' and removed Common. --- build.proj | 9 +- .../CertificateCloudCredentials.cs | 142 ------- .../Common.NetFramework.csproj | 54 --- .../Internals/PlatformConfigurationHelper.cs | 123 ------ .../Platform/HttpTransportHandlerProvider.cs | 28 -- .../Properties/AssemblyAdditionalInfo.cs | 32 -- .../Properties/Resources.Designer.cs | 72 ---- .../Properties/Resources.resx | 123 ------ .../Settings.SourceAnalysis | 185 --------- .../Common.NetFramework/packages.config | 9 - src/Common/Common.Tests/CloudExceptionTest.cs | 297 --------------- src/Common/Common.Tests/Common.Tests.csproj | 64 ---- .../AddHeaderResponseDelegatingHandler.cs | 40 -- .../Fakes/BadResponseDelegatingHandler.cs | 48 --- .../Common.Tests/Fakes/FakeHttpHandler.cs | 49 --- .../Common.Tests/Fakes/FakeServiceClient.cs | 67 ---- .../Fakes/FakeServiceClientWithCredentials.cs | 124 ------ .../Fakes/RecordedDelegatingHandler.cs | 92 ----- .../Internals/LazyDictionaryTest.cs | 64 ---- .../Common.Tests/Internals/LazyListTest.cs | 50 --- .../Internals/ParserHelperTests.cs | 92 ----- .../Common.Tests/Properties/AssemblyInfo.cs | 32 -- src/Common/Common.Tests/ServiceClientTest.cs | 128 ------- .../Common.Tests/TokenCloudCredentialsTest.cs | 67 ---- .../Tracing/CloudTracingExtensionsTest.cs | 155 -------- .../DefaultHttpErrorDetectionStrategyTests.cs | 55 --- .../GeneralRetryPolicyTests.cs | 144 ------- src/Common/Common.Tests/packages.config | 11 - src/Common/Common.sln | 89 ----- src/Common/Common/Common.csproj | 56 --- .../SubscriptionCloudCredentials.cs | 33 -- .../Credentials/TokenCloudCredentials.cs | 136 ------- .../Handlers/ClientRequestTrackingHandler.cs | 44 --- ...osoft.Azure.Common.Dependencies.nuget.proj | 14 - ...Microsoft.Azure.Common.Dependencies.nuspec | 45 --- .../Common/Microsoft.Azure.Common.nuget.proj | 13 - .../Common/Microsoft.Azure.Common.nuspec | 65 ---- .../Common/Models/AzureOperationResponse.cs | 32 -- src/Common/Common/Models/OperationStatus.cs | 38 -- .../Common/Models/OperationStatusResponse.cs | 120 ------ src/Common/Common/Models/ResourceBase.cs | 77 ---- .../Common/Models/ResourceBaseExtended.cs | 85 ----- src/Common/Common/Models/ResourceIdentity.cs | 143 ------- .../Common/OData/FilterParameterAttribute.cs | 55 --- src/Common/Common/OData/FilterString.cs | 39 -- .../Common/OData/UrlExpressionVisitor.cs | 359 ------------------ .../Properties/AssemblyAdditionalInfo.cs | 28 -- src/Common/Common/Properties/AssemblyInfo.cs | 22 -- .../Common/Properties/Resources.Designer.cs | 235 ------------ src/Common/Common/Properties/Resources.resx | 178 --------- src/Common/Common/Settings.SourceAnalysis | 196 ---------- src/Common/Common/packages.config | 9 - .../Configuration.ScenarioTest.WebRole.csproj | 78 ---- .../Properties/AssemblyInfo.cs | 35 -- .../Web.Debug.config | 30 -- .../Web.Release.config | 31 -- .../Web.config | 28 -- .../WebRole.cs | 39 -- .../packages.config | 8 - .../diagnostics.wadcfg | 21 - .../Configuration.ScenarioTest.ccproj | 48 --- .../ServiceConfiguration.Cloud.cscfg | 9 - .../ServiceConfiguration.Local.cscfg | 9 - .../ServiceDefinition.csdef | 18 - .../packages.config | 10 - .../CloudConfigurationManagerTest.cs | 32 -- .../Configuration.Tests.csproj | 44 --- .../Properties/AssemblyInfo.cs | 47 --- .../Configuration.Tests/packages.config | 8 - .../Configuration/AzureApplicationSettings.cs | 234 ------------ .../CloudConfigurationManager.cs | 72 ---- src/Common/Configuration/Configuration.csproj | 43 --- .../Configuration/GlobalSuppressions.cs | 26 -- ...ndowsAzure.ConfigurationManager.nuget.proj | 13 - ...t.WindowsAzure.ConfigurationManager.nuspec | 27 -- src/Common/Configuration/NativeMethods.cs | 81 ---- .../Configuration/Properties/AssemblyInfo.cs | 36 -- .../Properties/Resources.Designer.cs | 72 ---- .../Configuration/Properties/Resources.resx | 123 ------ .../Configuration/Settings.SourceAnalysis | 185 --------- src/Common/Configuration/packages.config | 8 - src/Common/NuGet.Config | 6 - .../Customizations/Shoebox/ShoeboxClient.cs | 2 +- 83 files changed, 6 insertions(+), 5884 deletions(-) delete mode 100644 src/Common/Common.NetFramework/CertificateCloudCredentials.cs delete mode 100644 src/Common/Common.NetFramework/Common.NetFramework.csproj delete mode 100644 src/Common/Common.NetFramework/Internals/PlatformConfigurationHelper.cs delete mode 100644 src/Common/Common.NetFramework/Platform/HttpTransportHandlerProvider.cs delete mode 100644 src/Common/Common.NetFramework/Properties/AssemblyAdditionalInfo.cs delete mode 100644 src/Common/Common.NetFramework/Properties/Resources.Designer.cs delete mode 100644 src/Common/Common.NetFramework/Properties/Resources.resx delete mode 100644 src/Common/Common.NetFramework/Settings.SourceAnalysis delete mode 100644 src/Common/Common.NetFramework/packages.config delete mode 100644 src/Common/Common.Tests/CloudExceptionTest.cs delete mode 100644 src/Common/Common.Tests/Common.Tests.csproj delete mode 100644 src/Common/Common.Tests/Fakes/AddHeaderResponseDelegatingHandler.cs delete mode 100644 src/Common/Common.Tests/Fakes/BadResponseDelegatingHandler.cs delete mode 100644 src/Common/Common.Tests/Fakes/FakeHttpHandler.cs delete mode 100644 src/Common/Common.Tests/Fakes/FakeServiceClient.cs delete mode 100644 src/Common/Common.Tests/Fakes/FakeServiceClientWithCredentials.cs delete mode 100644 src/Common/Common.Tests/Fakes/RecordedDelegatingHandler.cs delete mode 100644 src/Common/Common.Tests/Internals/LazyDictionaryTest.cs delete mode 100644 src/Common/Common.Tests/Internals/LazyListTest.cs delete mode 100644 src/Common/Common.Tests/Internals/ParserHelperTests.cs delete mode 100644 src/Common/Common.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/Common/Common.Tests/ServiceClientTest.cs delete mode 100644 src/Common/Common.Tests/TokenCloudCredentialsTest.cs delete mode 100644 src/Common/Common.Tests/Tracing/CloudTracingExtensionsTest.cs delete mode 100644 src/Common/Common.Tests/TransientFaultHandling/DefaultHttpErrorDetectionStrategyTests.cs delete mode 100644 src/Common/Common.Tests/TransientFaultHandling/GeneralRetryPolicyTests.cs delete mode 100644 src/Common/Common.Tests/packages.config delete mode 100644 src/Common/Common.sln delete mode 100644 src/Common/Common/Common.csproj delete mode 100644 src/Common/Common/Credentials/SubscriptionCloudCredentials.cs delete mode 100644 src/Common/Common/Credentials/TokenCloudCredentials.cs delete mode 100644 src/Common/Common/Handlers/ClientRequestTrackingHandler.cs delete mode 100644 src/Common/Common/Microsoft.Azure.Common.Dependencies.nuget.proj delete mode 100644 src/Common/Common/Microsoft.Azure.Common.Dependencies.nuspec delete mode 100644 src/Common/Common/Microsoft.Azure.Common.nuget.proj delete mode 100644 src/Common/Common/Microsoft.Azure.Common.nuspec delete mode 100644 src/Common/Common/Models/AzureOperationResponse.cs delete mode 100644 src/Common/Common/Models/OperationStatus.cs delete mode 100644 src/Common/Common/Models/OperationStatusResponse.cs delete mode 100644 src/Common/Common/Models/ResourceBase.cs delete mode 100644 src/Common/Common/Models/ResourceBaseExtended.cs delete mode 100644 src/Common/Common/Models/ResourceIdentity.cs delete mode 100644 src/Common/Common/OData/FilterParameterAttribute.cs delete mode 100644 src/Common/Common/OData/FilterString.cs delete mode 100644 src/Common/Common/OData/UrlExpressionVisitor.cs delete mode 100644 src/Common/Common/Properties/AssemblyAdditionalInfo.cs delete mode 100644 src/Common/Common/Properties/AssemblyInfo.cs delete mode 100644 src/Common/Common/Properties/Resources.Designer.cs delete mode 100644 src/Common/Common/Properties/Resources.resx delete mode 100644 src/Common/Common/Settings.SourceAnalysis delete mode 100644 src/Common/Common/packages.config delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Configuration.ScenarioTest.WebRole.csproj delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Properties/AssemblyInfo.cs delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Debug.config delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Release.config delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.config delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/WebRole.cs delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/packages.config delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRoleContent/diagnostics.wadcfg delete mode 100644 src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.ccproj delete mode 100644 src/Common/Configuration.ScenarioTest/ServiceConfiguration.Cloud.cscfg delete mode 100644 src/Common/Configuration.ScenarioTest/ServiceConfiguration.Local.cscfg delete mode 100644 src/Common/Configuration.ScenarioTest/ServiceDefinition.csdef delete mode 100644 src/Common/Configuration.ScenarioTest/packages.config delete mode 100644 src/Common/Configuration.Tests/CloudConfigurationManagerTest.cs delete mode 100644 src/Common/Configuration.Tests/Configuration.Tests.csproj delete mode 100644 src/Common/Configuration.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/Common/Configuration.Tests/packages.config delete mode 100644 src/Common/Configuration/AzureApplicationSettings.cs delete mode 100644 src/Common/Configuration/CloudConfigurationManager.cs delete mode 100644 src/Common/Configuration/Configuration.csproj delete mode 100644 src/Common/Configuration/GlobalSuppressions.cs delete mode 100644 src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuget.proj delete mode 100644 src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuspec delete mode 100644 src/Common/Configuration/NativeMethods.cs delete mode 100644 src/Common/Configuration/Properties/AssemblyInfo.cs delete mode 100644 src/Common/Configuration/Properties/Resources.Designer.cs delete mode 100644 src/Common/Configuration/Properties/Resources.resx delete mode 100644 src/Common/Configuration/Settings.SourceAnalysis delete mode 100644 src/Common/Configuration/packages.config delete mode 100644 src/Common/NuGet.Config diff --git a/build.proj b/build.proj index c319895765af..a6d74a3e8b5c 100644 --- a/build.proj +++ b/build.proj @@ -48,7 +48,6 @@ $(LibraryRoot)tools $(LibraryRoot)\packages Microsoft Azure Management Libraries - src\Common\Common.sln src\Authentication\Authentication.sln AzureManagementLibraries.sln $(LibraryRoot)binaries @@ -65,7 +64,10 @@ - + + @@ -167,7 +169,7 @@ - $(LibrarySourceFolder)\Common;$(LibrarySourceFolder)\Authentication + $(LibrarySourceFolder)\Authentication 31bf3856ad364e35 @@ -271,7 +273,6 @@ - diff --git a/src/Common/Common.NetFramework/CertificateCloudCredentials.cs b/src/Common/Common.NetFramework/CertificateCloudCredentials.cs deleted file mode 100644 index 93b70b426334..000000000000 --- a/src/Common/Common.NetFramework/CertificateCloudCredentials.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Net.Http; -using System.Security.Cryptography.X509Certificates; -using System.Threading; -using System.Threading.Tasks; -using Hyak.Common; -using Hyak.Common.Internals; -using Microsoft.Azure.Common.Internals; - -namespace Microsoft.Azure -{ - /// - /// Credentials using a management certificate to authorize requests. - /// - public sealed class CertificateCloudCredentials - : SubscriptionCloudCredentials - { - // The Microsoft Azure Subscription ID. - private readonly string _subscriptionId = null; - - /// - /// Gets subscription ID which uniquely identifies Microsoft Azure - /// subscription. The subscription ID forms part of the URI for - /// every call that you make to the Service Management API. - /// - public override string SubscriptionId - { - get { return _subscriptionId; } - } - - /// - /// The Microsoft Azure Service Management API use mutual authentication - /// of management certificates over SSL to ensure that a request made - /// to the service is secure. No anonymous requests are allowed. - /// - public X509Certificate2 ManagementCertificate { get; private set; } - - /// - /// Initializes a new instance of the CertificateCloudCredentials - /// class. - /// - /// The Subscription ID. - /// - /// The management certificate. - /// - public CertificateCloudCredentials(string subscriptionId, X509Certificate2 managementCertificate) - { - if (string.IsNullOrEmpty(subscriptionId)) - { - throw new ArgumentNullException("subscriptionId"); - } - else if (managementCertificate == null) - { - throw new ArgumentNullException("managementCertificate"); - } - - _subscriptionId = subscriptionId; - ManagementCertificate = managementCertificate; - } - - /// - /// Attempt to create certificate credentials from a collection of - /// settings. - /// - /// The settings to use. - /// - /// CertificateCloudCredentials is created, null otherwise. - /// - [Obsolete("Deprecated method. Use public constructor instead.")] - public static CertificateCloudCredentials Create(IDictionary settings) - { - if (settings == null) - { - throw new ArgumentNullException("settings"); - } - - X509Certificate2 certificate = PlatformConfigurationHelper.GetCertificate(settings, "ManagementCertificate", false); - if (settings.ContainsKey("SubscriptionId")) - { - return new CertificateCloudCredentials(settings["SubscriptionId"].ToString(), certificate); - } - - return null; - } - - /// - /// Initialize a ServiceClient instance to process credentials. - /// - /// Type of ServiceClient. - /// The ServiceClient. - /// - /// This will add a certificate to the shared root WebRequestHandler in - /// the ServiceClient's HttpClient handler pipeline. - /// - public override void InitializeServiceClient(ServiceClient client) - { - WebRequestHandler handler = client.GetHttpPipeline().OfType().FirstOrDefault(); - if (handler == null) - { - throw new PlatformNotSupportedException( - string.Format( - CultureInfo.InvariantCulture, - Common.Properties.Resources.CertificateCloudCredentials_InitializeServiceClient_NoWebRequestHandler, - client.GetType().Name, - typeof(WebRequestHandler).Name)); - } - - handler.ClientCertificates.Add(ManagementCertificate); - } - - /// - /// Apply the credentials to the HTTP request. - /// - /// The HTTP request. - /// Cancellation token. - /// - /// Task that will complete when processing has completed. - /// - public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - return base.ProcessHttpRequestAsync(request, cancellationToken); - } - } -} diff --git a/src/Common/Common.NetFramework/Common.NetFramework.csproj b/src/Common/Common.NetFramework/Common.NetFramework.csproj deleted file mode 100644 index 4d4fdd490440..000000000000 --- a/src/Common/Common.NetFramework/Common.NetFramework.csproj +++ /dev/null @@ -1,54 +0,0 @@ - - - - - AnyCPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B} - Properties - Microsoft.Azure.Common - Microsoft.Azure.Common.NetFramework - Library - true - - - - - Properties\AssemblyInfo.cs - - - - - - - True - True - Resources.resx - - - - - False - $(LibraryNugetPackageFolder)\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - - - - - - - - {856a1d19-c3bf-439a-bebf-e822a332bc12} - Common - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - \ No newline at end of file diff --git a/src/Common/Common.NetFramework/Internals/PlatformConfigurationHelper.cs b/src/Common/Common.NetFramework/Internals/PlatformConfigurationHelper.cs deleted file mode 100644 index 42ad41ef2b3c..000000000000 --- a/src/Common/Common.NetFramework/Internals/PlatformConfigurationHelper.cs +++ /dev/null @@ -1,123 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Collections.Generic; -using System.Globalization; -using System.Security.Cryptography.X509Certificates; - -namespace Microsoft.Azure.Common.Internals -{ - public static class PlatformConfigurationHelper - { - public static X509Certificate2 GetCertificate(IDictionary parameters, string name, bool isRequired = true) - { - if (isRequired && !parameters.ContainsKey(name)) - { - throw new ArgumentException(name); - } - - object value = null; - if (parameters.ContainsKey(name)) - { - value = parameters[name]; - } - - X509Certificate2 certificate = value as X509Certificate2; - if (certificate == null) - { - // Try to load the value as a serialized certificate - byte[] bytes = value as byte[]; - string text = value as string; - if (bytes == null && text != null) - { - bytes = Convert.FromBase64String(text); - } - if (bytes != null) - { - certificate = GetCertificate(bytes); - } - - // Try to load the value as a thumbprint from the store - if (certificate == null && !string.IsNullOrEmpty(text)) - { - certificate = - GetCertificateFromStore(text, StoreLocation.CurrentUser) ?? - GetCertificateFromStore(text, StoreLocation.LocalMachine); - } - } - - if (isRequired && certificate == null) - { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentNullException(name); - } - - string message = - string.Format( - CultureInfo.InvariantCulture, - "Failed to convert parameter {0} value '{1}' to type {2}.", - name, - value == null ? "(null)" : value.ToString(), - typeof(X509Certificate2).FullName); - throw new FormatException(message); - } - - return certificate; - } - - private static X509Certificate2 GetCertificate(byte[] bytes) - { - try - { - return new X509Certificate2(bytes); - } - catch - { - } - return null; - } - - private static X509Certificate2 GetCertificateFromStore(string thumbprint, StoreLocation location) - { - if (thumbprint != null) - { - X509Store store = null; - try - { - store = new X509Store(StoreName.My, location); - store.Open(OpenFlags.ReadOnly); - X509Certificate2Collection certificates = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false); - if (certificates.Count > 0) - { - return certificates[0]; - } - } - catch - { - } - finally - { - if (store != null) - { - store.Close(); - } - } - } - return null; - } - } -} diff --git a/src/Common/Common.NetFramework/Platform/HttpTransportHandlerProvider.cs b/src/Common/Common.NetFramework/Platform/HttpTransportHandlerProvider.cs deleted file mode 100644 index 4c61c663f5d6..000000000000 --- a/src/Common/Common.NetFramework/Platform/HttpTransportHandlerProvider.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net.Http; -using Hyak.Common.Platform; - -namespace Microsoft.Azure.Common.Platform -{ - internal class HttpTransportHandlerProvider : IHttpTransportHandlerProvider - { - public HttpMessageHandler CreateHttpTransportHandler() - { - return new WebRequestHandler(); - } - } -} diff --git a/src/Common/Common.NetFramework/Properties/AssemblyAdditionalInfo.cs b/src/Common/Common.NetFramework/Properties/AssemblyAdditionalInfo.cs deleted file mode 100644 index a17feb2d4c85..000000000000 --- a/src/Common/Common.NetFramework/Properties/AssemblyAdditionalInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Microsoft Azure Common Library (.NET Framework)")] -[assembly: AssemblyDescription("Provides .NET Framework-specific extensions to the common Microsoft Azure library.")] - -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Azure .NET SDK")] -[assembly: AssemblyCopyright("Copyright © Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] - -[assembly: ComVisible(false)] -[assembly: Guid("a99b718b-01c2-42ad-a721-7f5c66cb9a91")] diff --git a/src/Common/Common.NetFramework/Properties/Resources.Designer.cs b/src/Common/Common.NetFramework/Properties/Resources.Designer.cs deleted file mode 100644 index 5a7579d5c6a6..000000000000 --- a/src/Common/Common.NetFramework/Properties/Resources.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Azure.Common.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Common.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to {0} requires a {1} in its HTTP pipeline to work with client certificates.. - /// - internal static string CertificateCloudCredentials_InitializeServiceClient_NoWebRequestHandler { - get { - return ResourceManager.GetString("CertificateCloudCredentials_InitializeServiceClient_NoWebRequestHandler", resourceCulture); - } - } - } -} diff --git a/src/Common/Common.NetFramework/Properties/Resources.resx b/src/Common/Common.NetFramework/Properties/Resources.resx deleted file mode 100644 index e8b1a934a85d..000000000000 --- a/src/Common/Common.NetFramework/Properties/Resources.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - {0} requires a {1} in its HTTP pipeline to work with client certificates. - - \ No newline at end of file diff --git a/src/Common/Common.NetFramework/Settings.SourceAnalysis b/src/Common/Common.NetFramework/Settings.SourceAnalysis deleted file mode 100644 index 23ae9543b4d8..000000000000 --- a/src/Common/Common.NetFramework/Settings.SourceAnalysis +++ /dev/null @@ -1,185 +0,0 @@ - - - NoMerge - - - - - - - True - - - - - True - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - Microsoft - [###LICENSE_NAME###] - True - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - - as - do - id - if - in - is - my - no - on - to - ui - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/src/Common/Common.NetFramework/packages.config b/src/Common/Common.NetFramework/packages.config deleted file mode 100644 index 5a90686bb01e..000000000000 --- a/src/Common/Common.NetFramework/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Common.Tests/CloudExceptionTest.cs b/src/Common/Common.Tests/CloudExceptionTest.cs deleted file mode 100644 index 37004562198d..000000000000 --- a/src/Common/Common.Tests/CloudExceptionTest.cs +++ /dev/null @@ -1,297 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.IO; -using System.Net; -using System.Net.Http; -using Hyak.Common; -using Microsoft.Azure.Common; -using Xunit; -using Xunit.Extensions; - -namespace Microsoft.Azure.Common.Test -{ - public class CloudExceptionTest - { - private HttpResponseMessage notFoundResponse; - private HttpResponseMessage serverErrorResponse; - private HttpResponseMessage serverErrorResponseWithCamelCase; - private HttpResponseMessage serverErrorResponseWithParent; - private HttpResponseMessage serverErrorResponseWithParent2; - private string genericMessageString = "{'key'='value'}"; - private string jsonErrorMessageString = @"{ - 'code': 'BadRequest', - 'message': 'The provided database ‘foo’ has an invalid username.', - 'target': 'query', - 'details': [ - { - 'code': '301', - 'target': '$search', - 'message': '$search query option not supported.', - } - ] - }"; - private string jsonErrorMessageStringWithCamelCase = @"{ - 'Code': 'BadRequest', - 'Message': 'The provided database ‘foo’ has an invalid username.', - 'Target': 'query', - 'Details': [ - { - 'Code': '301', - 'Target': '$search', - 'Message': '$search query option not supported.', - } - ] - }"; - private string jsonErrorMessageWithParent = @"{ - 'error' : { - 'code': 'BadRequest', - 'message': 'The provided database ‘foo’ has an invalid username.', - 'target': 'query', - 'details': [ - { - 'code': '301', - 'target': '$search', - 'message': '$search query option not supported.', - } - ] - } - }"; - private string jsonErrorMessageWithParent2 = @"{'error':{'code':'ResourceGroupNotFound','message': - 'Resource group `ResourceGroup_crosoftAwillAofferAmoreAWebAservicemnopqrstuvwxyz1` could not be found.'}}"; - - private HttpRequestMessage genericMessage; - private HttpRequestMessage genericMessageWithoutBody; - - public CloudExceptionTest() - { - genericMessage = new HttpRequestMessage(HttpMethod.Get, "http//test/url"); - genericMessage.Content = new StringContent(genericMessageString); - genericMessageWithoutBody = new HttpRequestMessage(HttpMethod.Get, "http//test/url"); - notFoundResponse = new HttpResponseMessage(HttpStatusCode.NotFound); - notFoundResponse.Headers.Add("x-ms-request-id", "content1"); - notFoundResponse.Headers.Add("x-ms-routing-request-id", "content2"); - - notFoundResponse.Content = new StreamContent(new MemoryStream()); - serverErrorResponse = new HttpResponseMessage(HttpStatusCode.InternalServerError); - serverErrorResponse.Content = new StringContent(jsonErrorMessageString); - serverErrorResponseWithCamelCase = new HttpResponseMessage(HttpStatusCode.InternalServerError); - serverErrorResponseWithCamelCase.Content = new StringContent(jsonErrorMessageStringWithCamelCase); - serverErrorResponseWithParent = new HttpResponseMessage(HttpStatusCode.InternalServerError); - serverErrorResponseWithParent.Content = new StringContent(jsonErrorMessageWithParent); - serverErrorResponseWithParent2 = new HttpResponseMessage(HttpStatusCode.NotFound); - serverErrorResponseWithParent2.Content = new StringContent(jsonErrorMessageWithParent2); - } - - [Fact] - public void ExceptionIsCreatedFromHeaderlessResponse() - { - var ex = CloudException.Create(genericMessage, genericMessageString, notFoundResponse, ""); - - Assert.Null(notFoundResponse.Content.Headers.ContentType); - Assert.NotNull(ex); - } - - [Fact] - public void ExceptionIsCreatedFromNullResponseString() - { - var ex = CloudException.Create(genericMessage, genericMessageString, notFoundResponse, null); - - Assert.Null(notFoundResponse.Content.Headers.ContentType); - Assert.NotNull(ex); - } - - [Fact] - public void ExceptionContainsHttpStatusCodeIfBodyIsEmpty() - { - var ex = CloudException.Create(genericMessage, genericMessageString, notFoundResponse, ""); - - Assert.Equal("Not Found", ex.Message); - } - - [Fact] - public void JsonExceptionIsParsedCorrectlyWithLowerCase() - { - var ex = CloudException.Create(genericMessage, genericMessageString, serverErrorResponse, jsonErrorMessageString); - - Assert.Equal("BadRequest: The provided database ‘foo’ has an invalid username.", ex.Message); - Assert.Equal("The provided database ‘foo’ has an invalid username.", ex.Error.Message); - Assert.Equal("BadRequest", ex.Error.Code); - } - - [Fact] - public void JsonExceptionIsParsedCorrectlyWithCamelCase() - { - var ex = CloudException.Create(genericMessage, genericMessageString, serverErrorResponseWithCamelCase, - jsonErrorMessageStringWithCamelCase); - - Assert.Equal("BadRequest: The provided database ‘foo’ has an invalid username.", ex.Message); - Assert.Equal("The provided database ‘foo’ has an invalid username.", ex.Error.Message); - Assert.Equal("BadRequest", ex.Error.Code); - } - - [Fact] - public void JsonExceptionIsParsedCorrectlyWithParent() - { - var ex = CloudException.Create(genericMessage, genericMessageString, serverErrorResponseWithParent, - jsonErrorMessageWithParent); - - Assert.Equal("BadRequest: The provided database ‘foo’ has an invalid username.", ex.Message); - Assert.Equal("The provided database ‘foo’ has an invalid username.", ex.Error.Message); - Assert.Equal("BadRequest", ex.Error.Code); - } - - [Fact] - public void JsonExceptionIsParsedCorrectlyWithoutMessageBody() - { - var ex = CloudException.Create(genericMessageWithoutBody, null, serverErrorResponseWithParent2, jsonErrorMessageWithParent2); - - Assert.Equal("ResourceGroupNotFound: Resource group `ResourceGroup_crosoftAwillAofferAmoreAWebAservicemnopqrstuvwxyz1` could not be found.", ex.Message); - Assert.Equal("Resource group `ResourceGroup_crosoftAwillAofferAmoreAWebAservicemnopqrstuvwxyz1` could not be found.", ex.Error.Message); - Assert.Equal("ResourceGroupNotFound", ex.Error.Code); - } - - [Fact] - public void ParseJsonErrorSupportsFlatErrors() - { - string message = @"{ - 'code': 'BadRequest', - 'message': 'The provided database ‘foo’ has an invalid username.', - 'target': 'query', - 'details': [ - { - 'code': '301', - 'target': '$search', - 'message': '$search query option not supported.', - } - ] - }"; - - var error = CloudException.ParseJsonError(message); - - Assert.Equal("The provided database ‘foo’ has an invalid username.", error.Message); - Assert.Equal("BadRequest", error.Code); - Assert.Equal(message, error.OriginalMessage); - } - - [Fact] - public void ParseJsonErrorDeepErrors() - { - string message = @"{ - 'error' : { - 'code': 'BadRequest', - 'message': 'The provided database ‘foo’ has an invalid username.', - 'target': 'query', - 'details': [ - { - 'code': '301', - 'target': '$search', - 'message': '$search query option not supported.', - } - ] - } - }"; - - var error = CloudException.ParseJsonError(message); - - Assert.Equal("The provided database ‘foo’ has an invalid username.", error.Message); - Assert.Equal("BadRequest", error.Code); - Assert.Equal(message, error.OriginalMessage); - } - - [Fact] - public void ParseJsonErrorSupportsEmptyErrors() - { - Assert.Null(CloudException.ParseJsonError(null).Code); - Assert.Null(CloudException.ParseJsonError(string.Empty).Message); - } - - [Theory] - [InlineData(@"{'some error' : {'some message': 'The provided database ‘foo’ has an invalid username.',}}")] - [InlineData(@"{'error' : {'some message': 'The provided database ‘foo’ has an invalid username.',}}")] - [InlineData(@"{'error' : {'some message': 'The provided database ‘foo’ has an invalid username.'")] - public void ParseJsonErrorSupportsIncorrectlyFormattedJsonErrors(string message) - { - var error = CloudException.ParseJsonError(message); - - Assert.Equal(message, error.OriginalMessage); - Assert.Null(error.Message); - Assert.Null(error.Code); - } - - [Fact] - public void ParseXmlErrorSupportsErrorsWithCamelCase() - { - string message = @" - BadRequest - The provided database ‘foo’ has an invalid username. - "; - - var error = CloudException.ParseXmlError(message); - Assert.Equal("The provided database ‘foo’ has an invalid username.", error.Message); - Assert.Equal("BadRequest", error.Code); - Assert.Equal(message, error.OriginalMessage); - } - - [Fact] - public void ParseXmlErrorSupportsErrorsWithLowerCase() - { - string message = @" - BadRequest - The provided database ‘foo’ has an invalid username. - "; - - var error = CloudException.ParseXmlError(message); - Assert.Equal("The provided database ‘foo’ has an invalid username.", error.Message); - Assert.Equal(message, error.OriginalMessage); - } - - [Fact] - public void ParseXmlErrorSupportsEmptyErrors() - { - Assert.Null(CloudException.ParseXmlError(null).Code); - Assert.Null(CloudException.ParseXmlError(null).Message); - Assert.Null(CloudException.ParseXmlError(null).OriginalMessage); - Assert.Null(CloudException.ParseXmlError(string.Empty).Code); - Assert.Null(CloudException.ParseXmlError(string.Empty).Message); - Assert.Equal(string.Empty, CloudException.ParseXmlError(string.Empty).OriginalMessage); - } - - [Fact] - public void ParseXmlErrorIgnoresParentElement() - { - string xmlErrorMessageWithBadParent = @" - BadRequest - The provided database ‘foo’ has an invalid username. - "; - - Assert.Equal("The provided database ‘foo’ has an invalid username.", CloudException.ParseXmlError(xmlErrorMessageWithBadParent).Message); - Assert.Equal("BadRequest", CloudException.ParseXmlError(xmlErrorMessageWithBadParent).Code); - } - - [Theory] - [InlineData("The provided database ‘foo’ has an invalid username.")] - [InlineData("The provided database ‘foo’ has an invalid username.")] - [InlineData("The provided database ‘foo’ has an invalid username.")] - [InlineData(@"BadRequestThe provided database ‘foo’ has an invalid username.}")] - public void ParseXmlErrorSupportsIncorrectlyFormattedXmlErrors(string message) - { - var error = CloudException.ParseXmlError(message); - Assert.Equal(message, error.OriginalMessage); - Assert.Null(error.Message); - Assert.Null(error.Code); - } - } -} diff --git a/src/Common/Common.Tests/Common.Tests.csproj b/src/Common/Common.Tests/Common.Tests.csproj deleted file mode 100644 index 2c99260c8ede..000000000000 --- a/src/Common/Common.Tests/Common.Tests.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - - - AnyCPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE} - Library - Properties - Microsoft.WindowsAzure.Common.Test - Microsoft.WindowsAzure.Common.Tests - 512 - true - - - - - False - $(LibraryNugetPackageFolder)\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - - - $(LibraryNugetPackageFolder)\xunit.1.9.2\lib\net20\xunit.dll - - - $(LibraryNugetPackageFolder)\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll - - - - - - - - - - - - - - - - - - - - - - - - - - {14529261-9f9f-4d2f-80d5-b26677f51e8b} - Common.NetFramework - - - {856a1d19-c3bf-439a-bebf-e822a332bc12} - Common - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Common.Tests/Fakes/AddHeaderResponseDelegatingHandler.cs b/src/Common/Common.Tests/Fakes/AddHeaderResponseDelegatingHandler.cs deleted file mode 100644 index 22bb57d82b07..000000000000 --- a/src/Common/Common.Tests/Fakes/AddHeaderResponseDelegatingHandler.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net.Http; -using System.Threading.Tasks; - -namespace Microsoft.Azure.Common.Test.Fakes -{ - public class AddHeaderResponseDelegatingHandler : DelegatingHandler - { - public string HeaderName { get; set; } - - public string HeaderValue { get; set; } - - public AddHeaderResponseDelegatingHandler(string headerName, string headerValue) - { - HeaderName = headerName; - HeaderValue = headerValue; - } - - protected override async Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) - { - HttpResponseMessage response = await base.SendAsync(request, cancellationToken); - response.Headers.Add(HeaderName, HeaderValue); - return response; - } - } -} diff --git a/src/Common/Common.Tests/Fakes/BadResponseDelegatingHandler.cs b/src/Common/Common.Tests/Fakes/BadResponseDelegatingHandler.cs deleted file mode 100644 index c0341bd1a26e..000000000000 --- a/src/Common/Common.Tests/Fakes/BadResponseDelegatingHandler.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net; -using System.Net.Http; -using System.Threading.Tasks; - -namespace Microsoft.Azure.Common.Test.Fakes -{ - public class BadResponseDelegatingHandler : DelegatingHandler - { - public BadResponseDelegatingHandler() - { - StatusCodeToReturn = HttpStatusCode.InternalServerError; - NumberOfTimesToFail = int.MaxValue; - } - - public int NumberOfTimesFailedSoFar { get; private set; } - - public int NumberOfTimesToFail { get; set; } - - public HttpStatusCode StatusCodeToReturn { get; set; } - - protected override Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) - { - HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); - if (NumberOfTimesToFail > NumberOfTimesFailedSoFar) - { - response = new HttpResponseMessage(StatusCodeToReturn); - NumberOfTimesFailedSoFar++; - } - - return Task.Run(() => response); - } - } -} diff --git a/src/Common/Common.Tests/Fakes/FakeHttpHandler.cs b/src/Common/Common.Tests/Fakes/FakeHttpHandler.cs deleted file mode 100644 index 58ebd5a318db..000000000000 --- a/src/Common/Common.Tests/Fakes/FakeHttpHandler.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.Azure.Common.Test.Fakes -{ - public class FakeHttpHandler : HttpClientHandler - { - public FakeHttpHandler() - { - StatusCodeToReturn = HttpStatusCode.InternalServerError; - NumberOfTimesToFail = int.MaxValue; - } - - public int NumberOfTimesToFail { get; set; } - - public int NumberOfTimesFailedSoFar { get; private set; } - - public HttpStatusCode StatusCodeToReturn { get; set; } - - protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - var response = new HttpResponseMessage(HttpStatusCode.OK); - if (NumberOfTimesToFail > NumberOfTimesFailedSoFar) - { - response = new HttpResponseMessage(StatusCodeToReturn); - NumberOfTimesFailedSoFar++; - } - - return Task.Run(() => response); - } - } -} diff --git a/src/Common/Common.Tests/Fakes/FakeServiceClient.cs b/src/Common/Common.Tests/Fakes/FakeServiceClient.cs deleted file mode 100644 index 6068b1348b40..000000000000 --- a/src/Common/Common.Tests/Fakes/FakeServiceClient.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Hyak.Common; - -namespace Microsoft.Azure.Common.Test.Fakes -{ - public class FakeServiceClient : ServiceClient - { - public FakeServiceClient() - { - // Prevent base constructor from executing - } - - public FakeServiceClient(HttpMessageHandler httpMessageHandler) - : this() - { - InitializeHttpClient(httpMessageHandler); - } - - public async Task DoStuff() - { - // Construct URL - string url = "http://www.microsoft.com"; - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - - httpRequest = new HttpRequestMessage(); - httpRequest.Method = HttpMethod.Get; - httpRequest.RequestUri = new Uri(url); - - // Set Headers - httpRequest.Headers.Add("x-ms-version", "2013-11-01"); - - // Set Credentials - var cancellationToken = new CancellationToken(); - cancellationToken.ThrowIfCancellationRequested(); - return await this.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get an instance of the FakeServiceClient class that uses the handler while initiating web requests. - /// - /// the handler - public override FakeServiceClient WithHandler(DelegatingHandler handler) - { - return WithHandler(new FakeServiceClient(), handler); - } - } -} diff --git a/src/Common/Common.Tests/Fakes/FakeServiceClientWithCredentials.cs b/src/Common/Common.Tests/Fakes/FakeServiceClientWithCredentials.cs deleted file mode 100644 index 23190c4430f2..000000000000 --- a/src/Common/Common.Tests/Fakes/FakeServiceClientWithCredentials.cs +++ /dev/null @@ -1,124 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Hyak.Common; - -namespace Microsoft.Azure.Common.Test.Fakes -{ - public class FakeServiceClientWithCredentials : ServiceClient - { - private Uri _baseUri; - private SubscriptionCloudCredentials _credentials; - - /// - /// Initializes a new instance of the FakeServiceClientWithCredentials class. - /// - private FakeServiceClientWithCredentials() - : base() - { - HttpClient.Timeout = TimeSpan.FromSeconds(300); - } - - /// - /// Initializes a new instance of the FakeServiceClientWithCredentials class. - /// - public FakeServiceClientWithCredentials(SubscriptionCloudCredentials credentials, Uri baseUri) - : this() - { - if (credentials == null) - { - throw new ArgumentNullException("credentials"); - } - if (baseUri == null) - { - throw new ArgumentNullException("baseUri"); - } - this._credentials = credentials; - this._baseUri = baseUri; - - this.Credentials.InitializeServiceClient(this); - } - - /// - /// Initializes a new instance of the FakeServiceClientWithCredentials class. - /// - public FakeServiceClientWithCredentials(SubscriptionCloudCredentials credentials) - : this() - { - if (credentials == null) - { - throw new ArgumentNullException("credentials"); - } - this._credentials = credentials; - this._baseUri = new Uri("https://TBD"); - - this.Credentials.InitializeServiceClient(this); - } - - public Uri BaseUri - { - get { return _baseUri; } - } - - public SubscriptionCloudCredentials Credentials - { - get { return _credentials; } - } - - protected override void Clone(ServiceClient client) - { - base.Clone(client); - FakeServiceClientWithCredentials management = client as FakeServiceClientWithCredentials; - if (management != null) - { - management._credentials = Credentials; - management._baseUri = BaseUri; - management.Credentials.InitializeServiceClient(management); - } - } - - public async Task DoStuff() - { - // Construct URL - string url = "http://www.microsoft.com"; - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - - httpRequest = new HttpRequestMessage(); - httpRequest.Method = HttpMethod.Get; - httpRequest.RequestUri = new Uri(url); - - await this.Credentials.ProcessHttpRequestAsync(httpRequest, new CancellationToken()); - - // Set Headers - httpRequest.Headers.Add("x-ms-version", "2013-11-01"); - - // Set Credentials - var cancellationToken = new CancellationToken(); - cancellationToken.ThrowIfCancellationRequested(); - return await HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - } - - public override FakeServiceClientWithCredentials WithHandler(DelegatingHandler handler) - { - return (FakeServiceClientWithCredentials)WithHandler(new FakeServiceClientWithCredentials(), handler); - } - } -} diff --git a/src/Common/Common.Tests/Fakes/RecordedDelegatingHandler.cs b/src/Common/Common.Tests/Fakes/RecordedDelegatingHandler.cs deleted file mode 100644 index 5084adbfa2fa..000000000000 --- a/src/Common/Common.Tests/Fakes/RecordedDelegatingHandler.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading.Tasks; - -namespace Microsoft.Azure.Common.Test.Fakes -{ - public class RecordedDelegatingHandler : DelegatingHandler - { - private readonly HttpResponseMessage _response; - - public RecordedDelegatingHandler() - { - StatusCodeToReturn = HttpStatusCode.Created; - } - - public RecordedDelegatingHandler(HttpResponseMessage response) - { - StatusCodeToReturn = HttpStatusCode.Created; - _response = response; - } - - public HttpContentHeaders ContentHeaders { get; private set; } - - public bool IsPassThrough { get; set; } - - public HttpMethod Method { get; private set; } - - public string Request { get; private set; } - - public HttpRequestHeaders RequestHeaders { get; private set; } - - public HttpStatusCode StatusCodeToReturn { get; set; } - - public Uri Uri { get; private set; } - - protected override async Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) - { - // Save request - if (request.Content == null) - { - Request = string.Empty; - } - else - { - Request = await request.Content.ReadAsStringAsync(); - } - RequestHeaders = request.Headers; - if (request.Content != null) - { - ContentHeaders = request.Content.Headers; - } - Method = request.Method; - Uri = request.RequestUri; - - // Prepare response - if (IsPassThrough) - { - return await base.SendAsync(request, cancellationToken); - } - else - { - if (_response != null) - { - return _response; - } - else - { - HttpResponseMessage response = new HttpResponseMessage(StatusCodeToReturn); - response.Content = new StringContent(""); - return response; - } - } - } - } -} diff --git a/src/Common/Common.Tests/Internals/LazyDictionaryTest.cs b/src/Common/Common.Tests/Internals/LazyDictionaryTest.cs deleted file mode 100644 index 513acb7f2b30..000000000000 --- a/src/Common/Common.Tests/Internals/LazyDictionaryTest.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 Hyak.Common; -using Xunit; - -namespace Microsoft.Azure.Common.Test.Internals -{ - public class LazyDictionaryTest - { - [Fact] - public void LazyByDefaultTest() - { - // Arrange - var lazyDictionary = new LazyDictionary(); - - // Act - var initialized = lazyDictionary.IsInitialized; - - // Assert - Assert.False(initialized); - } - - [Fact] - public void LazyAddTest() - { - // Arrange - var lazyDictionary = new LazyDictionary(); - - // Act - lazyDictionary.Add("key", "value"); - var initialized = lazyDictionary.IsInitialized; - - // Assert - Assert.True(initialized); - } - - [Fact] - public void LazyKeyAddTest() - { - // Arrange - var lazyDictionary = new LazyDictionary(); - - // Act - lazyDictionary["key"] = "value"; - var initialized = lazyDictionary.IsInitialized; - - // Assert - Assert.True(initialized); - } - } -} diff --git a/src/Common/Common.Tests/Internals/LazyListTest.cs b/src/Common/Common.Tests/Internals/LazyListTest.cs deleted file mode 100644 index e174f256dc9c..000000000000 --- a/src/Common/Common.Tests/Internals/LazyListTest.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 Hyak.Common; -using Xunit; - -namespace Microsoft.Azure.Common.Test.Internals -{ - public class LazyListTest - { - [Fact] - public void LazyByDefaultTest() - { - // Arrange - var lazyList = new LazyList(); - - // Act - var initialized = lazyList.IsInitialized; - - // Assert - Assert.False(initialized); - } - - [Fact] - public void LazyAddTest() - { - // Arrange - var lazyList = new LazyList(); - - // Act - lazyList.Add("item"); - var initialized = lazyList.IsInitialized; - - // Assert - Assert.True(initialized); - } - } -} diff --git a/src/Common/Common.Tests/Internals/ParserHelperTests.cs b/src/Common/Common.Tests/Internals/ParserHelperTests.cs deleted file mode 100644 index 72a379ea20bd..000000000000 --- a/src/Common/Common.Tests/Internals/ParserHelperTests.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 Hyak.Common; -using Hyak.Common.Internals; -using Xunit; -using Xunit.Extensions; - -namespace Microsoft.Azure.Common.Test.Internals -{ - public class ParserHelperTests - { - [Theory] - [InlineData("{ error }", true)] - [InlineData(" { error }", true)] - [InlineData(" { error }", true)] - [InlineData(" }", false)] - [InlineData(" }", false)] - [InlineData("}", false)] - [InlineData("", false)] - [InlineData(" ", false)] - [InlineData(" ", false)] - [InlineData(null, false)] - public void IsJsonWorksWithoutValidation(string body, bool expectedResult) - { - Assert.Equal(expectedResult, CloudException.IsJson(body)); - } - - [Theory] - [InlineData("{ }", true)] - [InlineData("{ 'error' : 'message' }", true)] - [InlineData(" { 'error' : 'message' }", true)] - [InlineData(" { 'error' : 'message' }", true)] - [InlineData(" { 'error' : ", false)] - [InlineData(" }", false)] - [InlineData(" }", false)] - [InlineData("}", false)] - [InlineData("", false)] - [InlineData(" ", false)] - [InlineData(" ", false)] - [InlineData(null, false)] - public void IsJsonWorksWithValidation(string body, bool expectedResult) - { - Assert.Equal(expectedResult, CloudException.IsJson(body, true)); - } - - [Theory] - [InlineData("", true)] - [InlineData(" ", true)] - [InlineData(" ", true)] - [InlineData(" >", false)] - [InlineData(" >", false)] - [InlineData(">", false)] - [InlineData("", false)] - [InlineData(" ", false)] - [InlineData(" ", false)] - [InlineData(null, false)] - public void IsXmlWorksWithoutValidation(string body, bool expectedResult) - { - Assert.Equal(expectedResult, CloudException.IsXml(body)); - } - - [Theory] - [InlineData("", true)] - [InlineData(" ", true)] - [InlineData(" ", true)] - [InlineData(" ", false)] - [InlineData(" >", false)] - [InlineData(" >", false)] - [InlineData(">", false)] - [InlineData("", false)] - [InlineData(" ", false)] - [InlineData(" ", false)] - [InlineData(null, false)] - public void IsXmlWorksWithValidation(string body, bool expectedResult) - { - Assert.Equal(expectedResult, CloudException.IsXml(body, true)); - } - } -} diff --git a/src/Common/Common.Tests/Properties/AssemblyInfo.cs b/src/Common/Common.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 8bc0384877c8..000000000000 --- a/src/Common/Common.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Reflection; -using System.Resources; - -[assembly: AssemblyTitle("Microsoft Azure Common Library Tests")] -[assembly: AssemblyDescription("Tests for the Microsoft Azure Common Library.")] - -[assembly: AssemblyVersion("0.9.0.0")] -[assembly: AssemblyFileVersion("0.9.0.0")] - -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Azure .NET SDK")] -[assembly: AssemblyCopyright("Copyright © Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] \ No newline at end of file diff --git a/src/Common/Common.Tests/ServiceClientTest.cs b/src/Common/Common.Tests/ServiceClientTest.cs deleted file mode 100644 index 3c336d9fa8e2..000000000000 --- a/src/Common/Common.Tests/ServiceClientTest.cs +++ /dev/null @@ -1,128 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net; -using System.Net.Http; -using System.Linq; -using Hyak.Common; -using Hyak.Common.Internals; -using Hyak.Common.TransientFaultHandling; -using Microsoft.Azure.Common.Test.Fakes; -using Xunit; -using Hyak.Common.Platform; - -namespace Microsoft.Azure.Common.Test -{ - public class ServiceClientTest - { - [Fact] - public void VerifyWebRequestHandlerCreation() - { - var someProvider = PortablePlatformAbstraction.Get(true); - var webRequestHandler = someProvider.CreateHttpTransportHandler(); - Assert.IsType(webRequestHandler); - } - - [Fact] - public void ClientAddHandlerToPipelineAddsHandler() - { - var fakeClient = new FakeServiceClient(new WebRequestHandler()); - var result1 = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.OK, result1.Result.StatusCode); - - fakeClient.AddHandlerToPipeline(new BadResponseDelegatingHandler()); - - var result2 = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.InternalServerError, result2.Result.StatusCode); - } - - [Fact] - public void ClientAddHandlersToPipelineAddSingleHandler() - { - var fakeClient = new FakeServiceClient(new WebRequestHandler()); - var result1 = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.OK, result1.Result.StatusCode); - - fakeClient = fakeClient.WithHandlers(new[] { - new BadResponseDelegatingHandler() - }); - - var result2 = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.InternalServerError, result2.Result.StatusCode); - } - - [Fact] - public void ClientAddHandlersToPipelineAddMultipleHandler() - { - var fakeClient = new FakeServiceClient(new WebRequestHandler()); - var result1 = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.OK, result1.Result.StatusCode); - - fakeClient = fakeClient.WithHandlers(new DelegatingHandler[] { - new BadResponseDelegatingHandler(), - new AddHeaderResponseDelegatingHandler("foo", "bar"), - }); - - var result2 = fakeClient.DoStuff(); - Assert.Equal(result2.Result.Headers.GetValues("foo").FirstOrDefault(), "bar"); - Assert.Equal(HttpStatusCode.InternalServerError, result2.Result.StatusCode); - } - - [Fact] - public void RetryHandlerRetriesWith500Errors() - { - var fakeClient = new FakeServiceClient(new FakeHttpHandler()); - int attemptsFailed = 0; - - fakeClient.SetRetryPolicy(new RetryPolicy(2)); - var retryHandler = fakeClient.GetHttpPipeline().OfType().FirstOrDefault(); - retryHandler.Retrying += (sender, args) => { attemptsFailed++; }; - - var result = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.InternalServerError, result.Result.StatusCode); - Assert.Equal(2, attemptsFailed); - } - - [Fact] - public void RetryHandlerRetriesWith500ErrorsAndSucceeds() - { - var fakeClient = new FakeServiceClient(new FakeHttpHandler() { NumberOfTimesToFail = 1 }); - int attemptsFailed = 0; - - fakeClient.SetRetryPolicy(new RetryPolicy(2)); - var retryHandler = fakeClient.GetHttpPipeline().OfType().FirstOrDefault(); - retryHandler.Retrying += (sender, args) => { attemptsFailed++; }; - - var result = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.OK, result.Result.StatusCode); - Assert.Equal(1, attemptsFailed); - } - - [Fact] - public void RetryHandlerDoesntRetryFor400Errors() - { - var fakeClient = new FakeServiceClient(new FakeHttpHandler() { StatusCodeToReturn = HttpStatusCode.Conflict }); - int attemptsFailed = 0; - - fakeClient.SetRetryPolicy(new RetryPolicy(2)); - var retryHandler = fakeClient.GetHttpPipeline().OfType().FirstOrDefault(); - retryHandler.Retrying += (sender, args) => { attemptsFailed++; }; - - var result = fakeClient.DoStuff(); - Assert.Equal(HttpStatusCode.Conflict, result.Result.StatusCode); - Assert.Equal(0, attemptsFailed); - } - } -} diff --git a/src/Common/Common.Tests/TokenCloudCredentialsTest.cs b/src/Common/Common.Tests/TokenCloudCredentialsTest.cs deleted file mode 100644 index 3d3307cd3236..000000000000 --- a/src/Common/Common.Tests/TokenCloudCredentialsTest.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net; -using Microsoft.Azure.Common.Test.Fakes; -using Xunit; - -namespace Microsoft.Azure.Common.Test -{ - public class TokenCloudCredentialsTest - { - [Fact] - public void TokenCloudCredentialAddsHeader() - { - var tokenCredentials = new TokenCloudCredentials("123","abc"); - var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; - var fakeClient = new FakeServiceClientWithCredentials(tokenCredentials).WithHandler(handler); - fakeClient.DoStuff().Wait(); - - Assert.Equal("Bearer", handler.RequestHeaders.Authorization.Scheme); - Assert.Equal("abc", handler.RequestHeaders.Authorization.Parameter); - } - - [Fact] - public void TokenCloudCredentialWithoutSubscriptionAddsHeader() - { - var tokenCredentials = new TokenCloudCredentials("abc"); - var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; - var fakeClient = new FakeServiceClientWithCredentials(tokenCredentials).WithHandler(handler); - fakeClient.DoStuff().Wait(); - - Assert.Null(fakeClient.Credentials.SubscriptionId); - Assert.Equal("Bearer", handler.RequestHeaders.Authorization.Scheme); - Assert.Equal("abc", handler.RequestHeaders.Authorization.Parameter); - } - - [Fact] - public void TokenCloudCredentialUpdatesHeader() - { - var credentials = new TokenCloudCredentials("123", "abc"); - var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; - var fakeClient = new FakeServiceClientWithCredentials(credentials).WithHandler(handler); - fakeClient.DoStuff().Wait(); - - Assert.Equal("Bearer", handler.RequestHeaders.Authorization.Scheme); - Assert.Equal("abc", handler.RequestHeaders.Authorization.Parameter); - - credentials.Token = "xyz"; - fakeClient.DoStuff().Wait(); - - Assert.Equal("Bearer", handler.RequestHeaders.Authorization.Scheme); - Assert.Equal("xyz", handler.RequestHeaders.Authorization.Parameter); - } - } -} diff --git a/src/Common/Common.Tests/Tracing/CloudTracingExtensionsTest.cs b/src/Common/Common.Tests/Tracing/CloudTracingExtensionsTest.cs deleted file mode 100644 index a6ca8fd96e70..000000000000 --- a/src/Common/Common.Tests/Tracing/CloudTracingExtensionsTest.cs +++ /dev/null @@ -1,155 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using Hyak.Common; -using Xunit; - -namespace Microsoft.Azure.Common.Tracing.Etw.Test -{ - public class CloudTracingExtensionsTest - { - [Fact] - public void HttpRequestMessageAsFormattedStringThrowsArgumentNullException() - { - Assert.Throws(() => TracingExtensions.AsFormattedString((HttpRequestMessage)null)); - } - - [Fact] - public void HttpRequestMessageAsFormattedStringHandlesEmptyRequests() - { - using (var httpRequest = new HttpRequestMessage()) - { - var formattedString = TracingExtensions.AsFormattedString(httpRequest); - - Assert.Contains("Method: GET", formattedString); - } - } - - [Fact] - public void HttpRequestMessageAsFormattedStringHandlesRequestsWithHeaders() - { - using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test")) - { - httpRequest.Headers.Add("x-ms-version", "2013-11-01"); - var formattedString = TracingExtensions.AsFormattedString(httpRequest); - - Assert.Contains("Method: GET", formattedString); - Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString); - Assert.Contains("x-ms-version: 2013-11-01", formattedString); - } - } - - [Fact] - public void HttpRequestMessageAsFormattedStringHandlesRequestsWithContent() - { - using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test")) - { - httpRequest.Content = new StringContent(""); - var formattedString = TracingExtensions.AsFormattedString(httpRequest); - - Assert.Contains("Method: GET", formattedString); - Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString); - Assert.Contains("", formattedString); - } - } - - [Fact] - public void HttpResponseMessageAsFormattedStringThrowsArgumentNullException() - { - Assert.Throws(() => TracingExtensions.AsFormattedString((HttpResponseMessage)null)); - } - - [Fact] - public void HttpResponseMessageAsFormattedStringHandlesEmptyRequests() - { - using (var httpRequest = new HttpResponseMessage()) - { - var formattedString = TracingExtensions.AsFormattedString(httpRequest); - - Assert.Contains("StatusCode: 200", formattedString); - } - } - - [Fact] - public void HttpResponseMessageAsFormattedStringHandlesRequestsWithHeaders() - { - using (var httpRequest = new HttpResponseMessage(HttpStatusCode.OK)) - { - httpRequest.Headers.Add("x-ms-version", "2013-11-01"); - var formattedString = TracingExtensions.AsFormattedString(httpRequest); - - Assert.Contains("StatusCode: 200", formattedString); - Assert.Contains("x-ms-version: 2013-11-01", formattedString); - } - } - - [Fact] - public void HttpResponseMessageAsFormattedStringHandlesRequestsWithContent() - { - using (var httpRequest = new HttpResponseMessage(HttpStatusCode.OK)) - { - httpRequest.Content = new StringContent(""); - var formattedString = TracingExtensions.AsFormattedString(httpRequest); - - Assert.Contains("StatusCode: 200", formattedString); - Assert.Contains("", formattedString); - } - } - - [Fact] - public void DictionaryAsFormattedStringReturnsEmptyBracesForNull() - { - var formattedString = TracingExtensions.AsFormattedString((Dictionary)null); - - Assert.Equal("{}", formattedString); - } - - [Fact] - public void DictionaryAsFormattedStringReturnsEmptyBracesForEmptySet() - { - var formattedString = TracingExtensions.AsFormattedString(new Dictionary()); - - Assert.Equal("{}", formattedString); - } - - [Fact] - public void DictionaryAsFormattedStringReturnsSet() - { - var parameters = new Dictionary(); - parameters["a"] = 1; - parameters["b"] = "str"; - parameters["c"] = true; - var formattedString = TracingExtensions.AsFormattedString(parameters); - - Assert.Equal("{a=1,b=str,c=True}", formattedString); - } - - [Fact] - public void DictionaryAsFormattedStringWorksWithNulls() - { - var parameters = new Dictionary(); - parameters["a"] = 1; - parameters["b"] = "str"; - parameters["c"] = null; - var formattedString = TracingExtensions.AsFormattedString(parameters); - - Assert.Equal("{a=1,b=str,c=}", formattedString); - } - } -} diff --git a/src/Common/Common.Tests/TransientFaultHandling/DefaultHttpErrorDetectionStrategyTests.cs b/src/Common/Common.Tests/TransientFaultHandling/DefaultHttpErrorDetectionStrategyTests.cs deleted file mode 100644 index 43e63aa2b638..000000000000 --- a/src/Common/Common.Tests/TransientFaultHandling/DefaultHttpErrorDetectionStrategyTests.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Net; -using Xunit; -using Xunit.Extensions; -using Hyak.Common.TransientFaultHandling; - -namespace Microsoft.Azure.Common.Test.TransientFaultHandling -{ - /// - /// Implements general test cases for http error detections. - /// - public class DefaultHttpErrorDetectionStrategyTests - { - [Theory] - [InlineData(HttpStatusCode.InternalServerError)] - [InlineData(HttpStatusCode.RequestTimeout)] - [InlineData(HttpStatusCode.BadGateway)] - public void ResponseCodeIsConsideredTransient(HttpStatusCode code) - { - var strategy = new DefaultHttpErrorDetectionStrategy(); - Assert.True(strategy.IsTransient(new HttpRequestExceptionWithStatus { StatusCode = code })); - } - - [Theory] - [InlineData(HttpStatusCode.NotImplemented)] - [InlineData(HttpStatusCode.HttpVersionNotSupported)] - public void ResponseCodeIsNotConsideredTransient(HttpStatusCode code) - { - var strategy = new DefaultHttpErrorDetectionStrategy(); - Assert.False(strategy.IsTransient(new HttpRequestExceptionWithStatus { StatusCode = code })); - } - - [Fact] - public void BadExceptionIsNotConsideredTransient() - { - var strategy = new DefaultHttpErrorDetectionStrategy(); - Assert.False(strategy.IsTransient(new InvalidOperationException())); - } - } -} diff --git a/src/Common/Common.Tests/TransientFaultHandling/GeneralRetryPolicyTests.cs b/src/Common/Common.Tests/TransientFaultHandling/GeneralRetryPolicyTests.cs deleted file mode 100644 index 71bd982ec161..000000000000 --- a/src/Common/Common.Tests/TransientFaultHandling/GeneralRetryPolicyTests.cs +++ /dev/null @@ -1,144 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using Xunit; -using Hyak.Common.TransientFaultHandling; - -namespace Microsoft.Azure.Common.Test.TransientFaultHandling -{ - /// - /// Implements general test cases for retry policies. - /// - public class GeneralRetryPolicyTests - { - [Fact] - public void TestNegativeRetryCount() - { - try - { - // First, instantiate a policy directly bypassing the configuration data validation. - var retryPolicy = new RetryPolicy(-1); - Assert.True(false, "When the RetryCount is negative, the retry policy should throw an exception."); - } - catch (ArgumentOutOfRangeException ex) - { - Assert.Equal("retryCount", ex.ParamName); - } - } - - [Fact] - public void TestNegativeRetryInterval() - { - try - { - // First, instantiate a policy directly bypassing the configuration data validation. - var retryPolicy = new RetryPolicy(3, TimeSpan.FromMilliseconds(-2)); - Assert.True(false, "When the RetryInterval is negative, the retry policy should throw an exception."); - } - catch (ArgumentOutOfRangeException ex) - { - Assert.Equal("retryInterval", ex.ParamName); - } - } - - [Fact] - public void TestNegativeMinBackoff() - { - try - { - // First, instantiate a policy directly bypassing the configuration data validation. - new RetryPolicy(3, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(100)); - Assert.True(false, "When the MinBackoff is negative, the retry policy should throw an exception."); - } - catch (ArgumentOutOfRangeException ex) - { - Assert.Equal("minBackoff", ex.ParamName); - } - } - - [Fact] - public void TestNegativeMaxBackoff() - { - try - { - // First, instantiate a policy directly bypassing the configuration data validation. - new RetryPolicy(3, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(-2), TimeSpan.FromMilliseconds(100)); - Assert.True(false, "When the MaxBackoff is negative, the retry policy should throw an exception."); - } - catch (ArgumentOutOfRangeException ex) - { - Assert.Equal("maxBackoff", ex.ParamName); - } - } - - [Fact] - public void TestNegativeDeltaBackoff() - { - try - { - // First, instantiate a policy directly bypassing the configuration data validation. - new RetryPolicy(3, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(-1)); - Assert.True(false, "When the DeltaBackoff is negative, the retry policy should throw an exception."); - } - catch (ArgumentOutOfRangeException ex) - { - Assert.Equal("deltaBackoff", ex.ParamName); - } - } - - [Fact] - public void TestMinBackoffGreaterThanMax() - { - try - { - // First, instantiate a policy directly bypassing the configuration data validation. - new RetryPolicy(3, TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100)); - Assert.True(false, "When the MinBackoff greater than MaxBackoff, the retry policy should throw an exception."); - } - catch (ArgumentOutOfRangeException ex) - { - Assert.Equal("minBackoff", ex.ParamName); - } - } - - internal static void TestRetryPolicy(RetryPolicy retryPolicy, out int retryCount, out TimeSpan totalDelay) - { - int callbackCount = 0; - double totalDelayInMs = 0; - - retryPolicy.Retrying += (sender, args) => - { - callbackCount++; - totalDelayInMs += args.Delay.TotalMilliseconds; - }; - - try - { - retryPolicy.ExecuteAction(() => - { - throw new TimeoutException("Forced Exception"); - }); - } - catch (TimeoutException ex) - { - Assert.Equal("Forced Exception", ex.Message); - } - - retryCount = callbackCount; - totalDelay = TimeSpan.FromMilliseconds(totalDelayInMs); - } - } -} diff --git a/src/Common/Common.Tests/packages.config b/src/Common/Common.Tests/packages.config deleted file mode 100644 index bd6c1dca8f23..000000000000 --- a/src/Common/Common.Tests/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Common.sln b/src/Common/Common.sln deleted file mode 100644 index 47ab2214daa0..000000000000 --- a/src/Common/Common.sln +++ /dev/null @@ -1,89 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{868850B4-1073-41A1-ABA8-A3B465880148}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{856A1D19-C3BF-439A-BEBF-E822A332BC12}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.NetFramework", "Common.NetFramework\Common.NetFramework.csproj", "{14529261-9F9F-4D2F-80D5-B26677F51E8B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configuration", "Configuration\Configuration.csproj", "{8FF949EE-73BD-48BF-ABDF-A6711E573FDF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Tests", "Common.Tests\Common.Tests.csproj", "{CB18ACEB-2825-4884-91FA-05C31AC779FE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configuration.Tests", "Configuration.Tests\Configuration.Tests.csproj", "{0645E75E-9C0B-47EE-B5A2-239286E1DED9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Net40-Debug|Any CPU = Net40-Debug|Any CPU - Net40-Release|Any CPU = Net40-Release|Any CPU - Net45-Debug|Any CPU = Net45-Debug|Any CPU - Net45-Release|Any CPU = Net45-Release|Any CPU - Portable-Debug|Any CPU = Portable-Debug|Any CPU - Portable-Release|Any CPU = Portable-Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net40-Debug|Any CPU.ActiveCfg = Net40-Debug|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net40-Debug|Any CPU.Build.0 = Net40-Debug|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net40-Release|Any CPU.ActiveCfg = Net40-Release|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net40-Release|Any CPU.Build.0 = Net40-Release|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net40-Debug|Any CPU.ActiveCfg = Net40-Debug|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net40-Debug|Any CPU.Build.0 = Net40-Debug|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net40-Release|Any CPU.ActiveCfg = Net40-Release|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net40-Release|Any CPU.Build.0 = Net40-Release|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {14529261-9F9F-4D2F-80D5-B26677F51E8B}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Net40-Debug|Any CPU.ActiveCfg = Net40-Debug|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Net40-Debug|Any CPU.Build.0 = Net40-Debug|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Net40-Release|Any CPU.ActiveCfg = Net40-Release|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Net40-Release|Any CPU.Build.0 = Net40-Release|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Net40-Debug|Any CPU.ActiveCfg = Net40-Debug|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Net40-Release|Any CPU.ActiveCfg = Net40-Release|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {CB18ACEB-2825-4884-91FA-05C31AC779FE}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Net40-Debug|Any CPU.ActiveCfg = Net40-Debug|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Net40-Debug|Any CPU.Build.0 = Net40-Debug|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Net40-Release|Any CPU.ActiveCfg = Net40-Release|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Net40-Release|Any CPU.Build.0 = Net40-Release|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {0645E75E-9C0B-47EE-B5A2-239286E1DED9}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {856A1D19-C3BF-439A-BEBF-E822A332BC12} = {868850B4-1073-41A1-ABA8-A3B465880148} - {14529261-9F9F-4D2F-80D5-B26677F51E8B} = {868850B4-1073-41A1-ABA8-A3B465880148} - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF} = {868850B4-1073-41A1-ABA8-A3B465880148} - {CB18ACEB-2825-4884-91FA-05C31AC779FE} = {7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB} - {0645E75E-9C0B-47EE-B5A2-239286E1DED9} = {7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB} - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = WindowsAzureLibraries.vsmdi - EndGlobalSection -EndGlobal diff --git a/src/Common/Common/Common.csproj b/src/Common/Common/Common.csproj deleted file mode 100644 index e1fdc3e7ef60..000000000000 --- a/src/Common/Common/Common.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - - AnyCPU - {856A1D19-C3BF-439A-BEBF-E822A332BC12} - Properties - Microsoft.Azure.Common - Microsoft.Azure.Common - Library - true - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - $(LibraryNugetPackageFolder)\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - - - - - - \ No newline at end of file diff --git a/src/Common/Common/Credentials/SubscriptionCloudCredentials.cs b/src/Common/Common/Credentials/SubscriptionCloudCredentials.cs deleted file mode 100644 index e636d407e278..000000000000 --- a/src/Common/Common/Credentials/SubscriptionCloudCredentials.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 Hyak.Common; - -namespace Microsoft.Azure -{ - /// - /// Base class for credentials associated with a particular subscription. - /// - public abstract class SubscriptionCloudCredentials - : CloudCredentials - { - /// - /// Gets subscription ID which uniquely identifies Microsoft Azure - /// subscription. The subscription ID forms part of the URI for - /// every call that you make to the Service Management API. - /// - public abstract string SubscriptionId { get; } - } -} diff --git a/src/Common/Common/Credentials/TokenCloudCredentials.cs b/src/Common/Common/Credentials/TokenCloudCredentials.cs deleted file mode 100644 index 26b4e2669d76..000000000000 --- a/src/Common/Common/Credentials/TokenCloudCredentials.cs +++ /dev/null @@ -1,136 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading; -using System.Threading.Tasks; -using Hyak.Common.Internals; - -namespace Microsoft.Azure -{ - /// - /// Class for token based credentials associated with a particular subscription. - /// - public class TokenCloudCredentials : SubscriptionCloudCredentials - { - // The Microsoft Azure Subscription ID. - private readonly string _subscriptionId = null; - - /// - /// Gets subscription ID which uniquely identifies Microsoft Azure - /// subscription. The subscription ID forms part of the URI for - /// every call that you make to the Service Management API. - /// - public override string SubscriptionId - { - get { return _subscriptionId; } - } - - /// - /// Gets or sets secure token used to authenticate against Microsoft Azure API. - /// No anonymous requests are allowed. - /// - public string Token { get; set; } - - /// - /// Initializes a new instance of the - /// class with subscription ID. - /// - /// The Subscription ID. - /// Valid JSON Web Token (JWT). - public TokenCloudCredentials(string subscriptionId, string token) - { - if (string.IsNullOrEmpty(subscriptionId)) - { - throw new ArgumentNullException("subscriptionId"); - } - else if (string.IsNullOrEmpty(token)) - { - throw new ArgumentNullException("token"); - } - - _subscriptionId = subscriptionId; - Token = token; - } - - /// - /// Initializes a new instance of the - /// class without subscription ID. - /// - /// Valid JSON Web Token (JWT). - public TokenCloudCredentials(string token) - { - if (string.IsNullOrEmpty(token)) - { - throw new ArgumentNullException("token"); - } - - Token = token; - } - - /// - /// Attempt to create token credentials from a collection of - /// settings. - /// - /// The settings to use. - /// - /// TokenCloudCredentials is created, null otherwise. - /// - [Obsolete("Deprecated method. Use public constructor instead.")] - public static TokenCloudCredentials Create(IDictionary settings) - { - if (settings == null) - { - throw new ArgumentNullException("settings"); - } - - if (!settings.ContainsKey("token")) - { - return null; - } - - if (settings.ContainsKey("SubscriptionId")) - { - return new TokenCloudCredentials(settings["SubscriptionId"].ToString(), settings["token"].ToString()); - } - else - { - return new TokenCloudCredentials(settings["token"].ToString()); - } - } - - /// - /// Apply the credentials to the HTTP request. - /// - /// The HTTP request. - /// Cancellation token. - /// - /// Task that will complete when processing has completed. - /// - public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - if (request == null) - { - throw new ArgumentNullException("request"); - } - - request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Token); - return base.ProcessHttpRequestAsync(request, cancellationToken); - } - } -} diff --git a/src/Common/Common/Handlers/ClientRequestTrackingHandler.cs b/src/Common/Common/Handlers/ClientRequestTrackingHandler.cs deleted file mode 100644 index dc5156d103be..000000000000 --- a/src/Common/Common/Handlers/ClientRequestTrackingHandler.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Net.Http; -using System.Threading; - -namespace Microsoft.Azure -{ - public class ClientRequestTrackingHandler - : MessageProcessingHandler - { - public string TrackingId { get; private set; } - - public ClientRequestTrackingHandler(string trackingId) - : base() - { - TrackingId = trackingId; - } - - protected override HttpRequestMessage ProcessRequest(HttpRequestMessage request, CancellationToken cancellationToken) - { - request.Headers.Add("client-tracking-id", TrackingId); - return request; - } - - protected override HttpResponseMessage ProcessResponse(HttpResponseMessage response, CancellationToken cancellationToken) - { - response.Headers.Add("client-tracking-id", TrackingId); - return response; - } - } -} diff --git a/src/Common/Common/Microsoft.Azure.Common.Dependencies.nuget.proj b/src/Common/Common/Microsoft.Azure.Common.Dependencies.nuget.proj deleted file mode 100644 index 882c5a7dc807..000000000000 --- a/src/Common/Common/Microsoft.Azure.Common.Dependencies.nuget.proj +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - 1.0.0 - true - - $(MSBuildThisFileDirectory) - - - \ No newline at end of file diff --git a/src/Common/Common/Microsoft.Azure.Common.Dependencies.nuspec b/src/Common/Common/Microsoft.Azure.Common.Dependencies.nuspec deleted file mode 100644 index 12677ac632de..000000000000 --- a/src/Common/Common/Microsoft.Azure.Common.Dependencies.nuspec +++ /dev/null @@ -1,45 +0,0 @@ - - - - Microsoft.Azure.Common.Dependencies - Microsoft Azure Common Library Dependencies - $version$ - Microsoft - azure-sdk, Microsoft - http://aka.ms/windowsazureapache2 - https://github.com/Azure/azure-sdk-for-net - http://go.microsoft.com/fwlink/?LinkID=288890 - false - Provides popular portable components for a common HTTP pipeline and JSON parsing. This package is included as a dependency to other libraries such as the Microsoft Azure Management Libraries and should not be directly added to your project. - Provides popular portable components for a common HTTP pipeline and JSON parsing. This package is included as a dependency to other libraries such as the Microsoft Azure Management Libraries and should not be directly added to your project. - Copyright © Microsoft Corporation - - azureofficial windowsazureofficial - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Common/Common/Microsoft.Azure.Common.nuget.proj b/src/Common/Common/Microsoft.Azure.Common.nuget.proj deleted file mode 100644 index ab1d123aaab4..000000000000 --- a/src/Common/Common/Microsoft.Azure.Common.nuget.proj +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - 2.1.0 - - $(MSBuildThisFileDirectory) - - - \ No newline at end of file diff --git a/src/Common/Common/Microsoft.Azure.Common.nuspec b/src/Common/Common/Microsoft.Azure.Common.nuspec deleted file mode 100644 index 7e90c2ea33f3..000000000000 --- a/src/Common/Common/Microsoft.Azure.Common.nuspec +++ /dev/null @@ -1,65 +0,0 @@ - - - - Microsoft.Azure.Common - Microsoft Azure Common Library - $version$ - Microsoft - azure-sdk, Microsoft - http://aka.ms/windowsazureapache2 - https://github.com/Azure/azure-sdk-for-net - http://go.microsoft.com/fwlink/?LinkID=288890 - true - Provides infrastructure for common error handling, tracing, configuration, and HTTP/REST-based pipeline manipulation. The package also exposes the CloudContext type, which enables centralized discovery of available Microsoft Azure libraries. - Provides infrastructure for common error handling, tracing, configuration, and HTTP/REST-based pipeline manipulation. The package also exposes the CloudContext type, which enables centralized discovery of available Microsoft Azure libraries. - -.NET Framework Recommended during Preview: -At this time, applications looking to use the Microsoft Azure Management Libraries should use the .NET Framework. Management operations require the X509Certificate2 type that is not present in the Portable Class Library API surface area. The Common.NetFramework library exposes this functionality. Looking to the future, we are enabling PCL early: Microsoft Azure Active Directory integration enables token-based authentication. Coupled with appropriate platform-specific libraries, in the future more platforms will light up with support for managing Microsoft Azure services. - -Supported Portable Library Platforms: -- .NET Framework 4.5, 4.5.1 -- .NET for Windows Store apps -- Windows Phone 8, 8.1 -- Silverlight 5 -- Portable Class Libraries - Copyright © Microsoft Corporation - Microsoft "Microsoft Azure" Azure cloud REST HTTP client core common azureofficial windowsazureofficial - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Common/Common/Models/AzureOperationResponse.cs b/src/Common/Common/Models/AzureOperationResponse.cs deleted file mode 100644 index 803354bf5d30..000000000000 --- a/src/Common/Common/Models/AzureOperationResponse.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 Hyak.Common; - -namespace Microsoft.Azure -{ - /// - /// A standard service response including an HTTP status code and request - /// ID. - /// - public class AzureOperationResponse : HttpOperationResponse - { - /// - /// Gets or sets the value that uniquely identifies a request - /// made against the service. - /// - public string RequestId { get; set; } - } -} \ No newline at end of file diff --git a/src/Common/Common/Models/OperationStatus.cs b/src/Common/Common/Models/OperationStatus.cs deleted file mode 100644 index 1bef7673cce1..000000000000 --- a/src/Common/Common/Models/OperationStatus.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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. -// - -namespace Microsoft.Azure -{ - /// - /// The status of the asynchronous request. - /// - public enum OperationStatus - { - /// - /// The asynchronous request is in progress. - /// - InProgress, - - /// - /// The asynchronous request succeeded. - /// - Succeeded, - - /// - /// The asynchronous request failed. - /// - Failed - } -} diff --git a/src/Common/Common/Models/OperationStatusResponse.cs b/src/Common/Common/Models/OperationStatusResponse.cs deleted file mode 100644 index 9d661ba8d1e7..000000000000 --- a/src/Common/Common/Models/OperationStatusResponse.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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 System.Net; - -namespace Microsoft.Azure -{ - /// - /// The response body contains the status of the specified - /// asynchronous operation, indicating whether it has succeeded, is i - /// progress, or has failed. Note that this status is distinct from the - /// HTTP status code returned for the Get Operation Status operation - /// itself. If the asynchronous operation succeeded, the response body - /// includes the HTTP status code for the successful request. If the - /// asynchronous operation failed, the response body includes the HTTP - /// status code for the failed request, and also includes error - /// information regarding the failure. - /// - public class OperationStatusResponse : AzureOperationResponse - { - private OperationStatusResponse.ErrorDetails _error; - - /// - /// If the asynchronous operation failed, the response body includes - /// the HTTP status code for the failed request, and also includes - /// error information regarding the failure. - /// - public OperationStatusResponse.ErrorDetails Error - { - get { return this._error; } - set { this._error = value; } - } - - private HttpStatusCode _httpStatusCode; - - /// - /// The HTTP status code for the asynchronous request. - /// - public HttpStatusCode HttpStatusCode - { - get { return this._httpStatusCode; } - set { this._httpStatusCode = value; } - } - - private string _id; - - /// - /// The request ID of the asynchronous request. This value is returned - /// in the x-ms-request-id response header of the asynchronous request. - /// - public string Id - { - get { return this._id; } - set { this._id = value; } - } - - private OperationStatus _status; - - /// - /// The status of the asynchronous request. - /// - public OperationStatus Status - { - get { return this._status; } - set { this._status = value; } - } - - /// - /// If the asynchronous operation failed, the response body includes - /// the HTTP status code for the failed request, and also includes - /// error information regarding the failure. - /// - public partial class ErrorDetails - { - private string _code; - - /// - /// The management service error code returned if the asynchronous - /// request failed. - /// - public string Code - { - get { return this._code; } - set { this._code = value; } - } - - private string _message; - - /// - /// The management service error message returned if the - /// asynchronous request failed. - /// - public string Message - { - get { return this._message; } - set { this._message = value; } - } - - /// - /// Initializes a new instance of the ErrorDetails class. - /// - public ErrorDetails() - { - } - } - } -} diff --git a/src/Common/Common/Models/ResourceBase.cs b/src/Common/Common/Models/ResourceBase.cs deleted file mode 100644 index 5876b50fea86..000000000000 --- a/src/Common/Common/Models/ResourceBase.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using Hyak.Common; - -namespace Microsoft.Azure -{ - /// - /// Resource information. - /// - public partial class ResourceBase - { - private string _location; - - /// - /// Required. Gets or sets the location of the resource. - /// - public string Location - { - get { return this._location; } - set { this._location = value; } - } - - private IDictionary _tags; - - /// - /// Optional. Gets or sets the tags attached to the resource. - /// - public IDictionary Tags - { - get { return this._tags; } - set { this._tags = value; } - } - - /// - /// Initializes a new instance of the ResourceBase class. - /// - public ResourceBase() - { - this.Tags = new LazyDictionary(); - } - - /// - /// Initializes a new instance of the ResourceBase class with required - /// arguments. - /// - public ResourceBase(string location) - : this() - { - if (location == null) - { - throw new ArgumentNullException("location"); - } - this.Location = location; - } - } -} diff --git a/src/Common/Common/Models/ResourceBaseExtended.cs b/src/Common/Common/Models/ResourceBaseExtended.cs deleted file mode 100644 index c01a1c1845ea..000000000000 --- a/src/Common/Common/Models/ResourceBaseExtended.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; - -namespace Microsoft.Azure -{ - /// - /// Resource information with extended details. - /// - public partial class ResourceBaseExtended : ResourceBase - { - private string _id; - - /// - /// Optional. Gets or sets the ID of the resource. - /// - public string Id - { - get { return this._id; } - set { this._id = value; } - } - - private string _name; - - /// - /// Optional. Gets or sets the name of the resource. - /// - public string Name - { - get { return this._name; } - set { this._name = value; } - } - - private string _type; - - /// - /// Optional. Gets or sets the type of the resource. - /// - public string Type - { - get { return this._type; } - set { this._type = value; } - } - - /// - /// Initializes a new instance of the ResourceBaseExtended class. - /// - public ResourceBaseExtended() - { - } - - /// - /// Initializes a new instance of the ResourceBaseExtended class with - /// required arguments. - /// - public ResourceBaseExtended(string location) - : this() - { - if (location == null) - { - throw new ArgumentNullException("location"); - } - this.Location = location; - } - } -} diff --git a/src/Common/Common/Models/ResourceIdentity.cs b/src/Common/Common/Models/ResourceIdentity.cs deleted file mode 100644 index 9e2d18550165..000000000000 --- a/src/Common/Common/Models/ResourceIdentity.cs +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// - -namespace Microsoft.Azure -{ - /// - /// Resource identity. - /// - public partial class ResourceIdentity - { - private string _parentResourcePath; - - /// - /// Optional. Gets or sets parent resource path (optional). - /// - public string ParentResourcePath - { - get { return this._parentResourcePath; } - set { this._parentResourcePath = value; } - } - - private string _resourceName; - - /// - /// Required. Gets or sets resource name. - /// - public string ResourceName - { - get { return this._resourceName; } - set { this._resourceName = value; } - } - - private string _resourceProviderApiVersion; - - /// - /// Required. Gets or sets API version of the resource provider. - /// - public string ResourceProviderApiVersion - { - get { return this._resourceProviderApiVersion; } - set { this._resourceProviderApiVersion = value; } - } - - private string _resourceProviderNamespace; - - /// - /// Required. Gets or sets namespace of the resource provider. - /// - public string ResourceProviderNamespace - { - get { return this._resourceProviderNamespace; } - set { this._resourceProviderNamespace = value; } - } - - private string _resourceType; - - /// - /// Required. Gets or sets resource type. - /// - public string ResourceType - { - get { return this._resourceType; } - set { this._resourceType = value; } - } - - /// - /// Initializes a new instance of the ResourceIdentity class. - /// - public ResourceIdentity() - { - } - - /// - /// Initializes a new instance of the ResourceIdentity class. - /// - public ResourceIdentity(string name, string resourceType, string apiVersion) - { - ResourceName = name; - ResourceProviderNamespace = GetProviderFromResourceType(resourceType); - ResourceType = GetTypeFromResourceType(resourceType); - ResourceProviderApiVersion = apiVersion; - } - - /// - /// Returns provider string from resource type. - /// - /// Resource type. - /// Provider - public static string GetProviderFromResourceType(string resourceType) - { - if (resourceType == null) - { - return null; - } - - int indexOfSlash = resourceType.IndexOf('/'); - if (indexOfSlash < 0) - { - return string.Empty; - } - else - { - return resourceType.Substring(0, indexOfSlash); - } - } - - /// - /// Returns type string from resource type. - /// - /// Resource type. - /// Type - public static string GetTypeFromResourceType(string resourceType) - { - if (resourceType == null) - { - return null; - } - - int lastIndexOfSlash = resourceType.LastIndexOf('/'); - if (lastIndexOfSlash < 0) - { - return string.Empty; - } - else - { - return resourceType.Substring(lastIndexOfSlash + 1); - } - } - } -} diff --git a/src/Common/Common/OData/FilterParameterAttribute.cs b/src/Common/Common/OData/FilterParameterAttribute.cs deleted file mode 100644 index a01fef1a0328..000000000000 --- a/src/Common/Common/OData/FilterParameterAttribute.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; - -namespace Microsoft.Azure.Common.OData -{ - /// - /// Parameter attribute used with OData filters. - /// - public class FilterParameterAttribute : Attribute - { - /// - /// Property name to use in the filter. - /// - public string Name { get; set; } - - /// - /// Format of the value. - /// - public string Format { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// Property name to use in the filter. - public FilterParameterAttribute(string name) - { - Name = name; - } - - /// - /// Initializes a new instance of the class. - /// - /// Property name to use in the filter. - /// Format of the value. - public FilterParameterAttribute(string name, string format) - { - Name = name; - Format = format; - } - } -} diff --git a/src/Common/Common/OData/FilterString.cs b/src/Common/Common/OData/FilterString.cs deleted file mode 100644 index e3374e9b76ea..000000000000 --- a/src/Common/Common/OData/FilterString.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Linq.Expressions; - -namespace Microsoft.Azure.Common.OData -{ - /// - /// Handles OData filter generation. - /// - public class FilterString - { - /// - /// Generates an OData filter from a specified Linq expression. - /// - /// Filter type - /// Entity to use for filter generation - /// - public static string Generate(Expression> filter) - { - UrlExpressionVisitor visitor = new UrlExpressionVisitor(); - visitor.Visit(filter); - return visitor.ToString(); - } - } -} diff --git a/src/Common/Common/OData/UrlExpressionVisitor.cs b/src/Common/Common/OData/UrlExpressionVisitor.cs deleted file mode 100644 index 5ea7818ed7b0..000000000000 --- a/src/Common/Common/OData/UrlExpressionVisitor.cs +++ /dev/null @@ -1,359 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Text; - -namespace Microsoft.Azure.Common.OData -{ - /// - /// Expression visitor class that generates OData style $filter parameter. - /// - public class UrlExpressionVisitor : ExpressionVisitor - { - private const string DefaultDateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ"; - private StringBuilder _generatedUrl = new StringBuilder(); - private PropertyInfo _currentProperty; - - /// - /// Visits binary expression like ==, &&, >, etc. - /// - /// Node to visit. - /// Original node. - protected override Expression VisitBinary(BinaryExpression node) - { - this.Visit(node.Left); - - _generatedUrl.Append(" " + GetUrlName(node.NodeType) + " "); - - this.Visit(node.Right); - - _currentProperty = null; - - return node; - } - - /// - /// Visits binary expression !foo. - /// - /// Node to visit. - /// Original node. - protected override Expression VisitUnary(UnaryExpression node) - { - if (node.NodeType == ExpressionType.Not) - { - throw new NotSupportedException( - "Unary expressions are not supported. Please use binary expressions (e.g. Property == false) instead."); - } - else - { - return base.VisitUnary(node); - } - } - - /// - /// Visits conditional expression foo == true ? bar : fee. Throws NotSupportedException. - /// - /// Node to visit. - /// Throws NotSupportedException. - protected override Expression VisitConditional(ConditionalExpression node) - { - throw new NotSupportedException( - "Conditional sub-expressions are not supported."); - } - - /// - /// Visits new object expression like new DateTime(). - /// - /// Node to visit. - /// Original node. - protected override Expression VisitNew(NewExpression node) - { - var newObject = node.Constructor.Invoke(node.Arguments.Select(a => ((ConstantExpression)a).Value).ToArray()); - PrintConstant(newObject); - - return node; - } - - /// - /// Visits constants like 'a' or 123. - /// - /// Node to visit. - /// Original node. - protected override Expression VisitConstant(ConstantExpression node) - { - PrintConstant(node.Value); - return node; - } - - /// - /// Visits object members like p.Foo or dateTime.Hour. - /// - /// Node to visit. - /// Original node. - protected override Expression VisitMember(MemberExpression node) - { - // Assumes that left side expression parameters are properties like p.Foo - if (node.Expression.NodeType == ExpressionType.Parameter) - { - var nodeMemberProperty = node.Member as PropertyInfo; - if (nodeMemberProperty != null) - { - _currentProperty = nodeMemberProperty; - _generatedUrl.Append(GetPropertyName(nodeMemberProperty)); - } - else - { - throw new NotSupportedException("Only properties are supported as parameters."); - } - } - else - { - // This fork is executed when right side of the expression is not a constant - - object val = null; - if (node.Member is PropertyInfo || node.Member is FieldInfo) - { - val = Expression.Lambda(node).Compile().DynamicInvoke(); - } - else - { - throw new NotSupportedException("Not supported expression: " + node.Member.DeclaringType); - } - PrintConstant(val); - } - - return node; - } - - /// - /// Visits method calls like Contains, StartsWith, etc. Methods that are not supported will throw an exception. - /// - /// Node to visit. - /// Original node. - protected override Expression VisitMethodCall(MethodCallExpression node) - { - if (node.Method.Name == "Contains" && - (node.Arguments.Count == 2 || - node.Arguments.Count == 1)) - { - Expression leftSide = node.Object; - Expression rightSide = node.Arguments[0]; - if (node.Arguments.Count == 2) - { - leftSide = node.Arguments[0]; - rightSide = node.Arguments[1]; - } - Visit(leftSide); - _generatedUrl.Append("/any(c: c eq "); - Visit(rightSide); - _generatedUrl.Append(")"); - return node; - } - else if (node.Method.Name == "StartsWith" && - (node.Arguments.Count == 2 || - node.Arguments.Count == 1)) - { - Expression leftSide = node.Object; - Expression rightSide = node.Arguments[0]; - if (node.Arguments.Count == 2) - { - leftSide = node.Arguments[0]; - rightSide = node.Arguments[1]; - } - - _generatedUrl.Append("startswith("); - Visit(leftSide); - _generatedUrl.Append(", "); - Visit(rightSide); - _generatedUrl.Append(") eq true"); - return node; - } - else if (node.Method.Name == "EndsWith" && - (node.Arguments.Count == 2 || - node.Arguments.Count == 1)) - { - Expression leftSide = node.Object; - Expression rightSide = node.Arguments[0]; - if (node.Arguments.Count == 2) - { - leftSide = node.Arguments[0]; - rightSide = node.Arguments[1]; - } - - _generatedUrl.Append("endswith("); - Visit(leftSide); - _generatedUrl.Append(", "); - Visit(rightSide); - _generatedUrl.Append(") eq true"); - return node; - } - else - { - throw new NotSupportedException("Method call " + node.Method.Name + " is not supported."); - } - } - - /// - /// Appends 'eq true' to Boolean unary operators. - /// - private void closeUnaryBooleanOperator() - { - if (_currentProperty != null) - { - if (_currentProperty.PropertyType == typeof (bool)) - { - _generatedUrl.Append(" eq true"); - _currentProperty = null; - } - } - } - - /// - /// Helper method to print constant. - /// - /// Object to print. - private void PrintConstant(object val) - { - if (val == null) - { - _generatedUrl.Append("null"); - } - else - { - var format = GetPropertyFormat(_currentProperty); - if (val is DateTime) - { - if (string.IsNullOrEmpty(format)) - { - format = DefaultDateTimeFormat; - } - val = ((DateTime) val).ToUniversalTime(); - } - - string formattedString; - if (!string.IsNullOrEmpty(format)) - { - formattedString = string.Format("{0:" + format + "}", val); - } - else - { - formattedString = string.Format("{0}", val); - } - - if (val is int || - val is bool || - val is long || - val is short) - { - _generatedUrl.Append(formattedString.ToLowerInvariant()); - } - else - { - _generatedUrl.AppendFormat("'{0}'", formattedString); - } - } - } - - /// - /// Helper method to generate property name. - /// - /// Property to examine. - /// Property name or value specified in the FilterParameterAttribute. - private string GetPropertyName(PropertyInfo property) - { - if (property == null) - { - return string.Empty; - } - foreach (var attribute in property.GetCustomAttributes(true)) - { - var parameterAttribute = attribute as FilterParameterAttribute; - if (parameterAttribute != null && !string.IsNullOrEmpty(parameterAttribute.Name)) - { - return parameterAttribute.Name; - } - } - return property.Name; - } - - /// - /// Helper method to retrieve format from the FilterParameterAttribute. - /// - /// Property to examine. - /// Format from FilterParameterAttribute or null. - private string GetPropertyFormat(PropertyInfo property) - { - if (property == null) - { - return string.Empty; - } - else - { - foreach (var attribute in property.GetCustomAttributes(true)) - { - var parameterAttribute = attribute as FilterParameterAttribute; - if (parameterAttribute != null && !string.IsNullOrEmpty(parameterAttribute.Name)) - { - return parameterAttribute.Format; - } - } - return string.Empty; - } - } - - public override string ToString() - { - closeUnaryBooleanOperator(); - return _generatedUrl.ToString(); - } - - private string GetUrlName(ExpressionType exprType) - { - switch (exprType) - { - case ExpressionType.GreaterThan: - return "gt"; - case ExpressionType.GreaterThanOrEqual: - return "ge"; - case ExpressionType.LessThan: - return "lt"; - case ExpressionType.LessThanOrEqual: - return "le"; - case ExpressionType.And: - case ExpressionType.AndAlso: - // Reset current property - closeUnaryBooleanOperator(); - _currentProperty = null; - return "and"; - case ExpressionType.Or: - case ExpressionType.OrElse: - // Reset current property - closeUnaryBooleanOperator(); - _currentProperty = null; - return "or"; - case ExpressionType.Equal: - return "eq"; - case ExpressionType.NotEqual: - return "ne"; - default: - throw new System.NotSupportedException("Cannot get name for: " + exprType.ToString()); - } - } - } -} diff --git a/src/Common/Common/Properties/AssemblyAdditionalInfo.cs b/src/Common/Common/Properties/AssemblyAdditionalInfo.cs deleted file mode 100644 index ce12c6e59f55..000000000000 --- a/src/Common/Common/Properties/AssemblyAdditionalInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Reflection; -using System.Resources; - -[assembly: AssemblyTitle("Microsoft Azure Common Library")] -[assembly: AssemblyDescription("Provides infrastructure for common error handling, tracing, configuration, and HTTP/REST-based pipeline manipulation. The package also exposes the CloudContext type, which enables centralized discovery of available Microsoft Azure libraries.")] - -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Azure .NET SDK")] -[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] diff --git a/src/Common/Common/Properties/AssemblyInfo.cs b/src/Common/Common/Properties/AssemblyInfo.cs deleted file mode 100644 index f830ccaf3743..000000000000 --- a/src/Common/Common/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System.Reflection; - -//This file is shared with Common.NetFramework to provide consistent file version. -//Do not put in extra assembly metadatas here; rather put them in AssemblyAdditionalInfo.cs. -//Also merge AssemblyAdditionalInfo.cs into the file once we delete the Common.NetFramework. -[assembly: AssemblyFileVersion("2.1.0.0")] -[assembly: AssemblyVersion("2.0.0.0")] diff --git a/src/Common/Common/Properties/Resources.Designer.cs b/src/Common/Common/Properties/Resources.Designer.cs deleted file mode 100644 index 1206668530ba..000000000000 --- a/src/Common/Common/Properties/Resources.Designer.cs +++ /dev/null @@ -1,235 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Azure.Common.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Common.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Value cannot be empty. - ///Parameter name: {0}. - /// - internal static string ArgumentCannotBeEmpty { - get { - return ResourceManager.GetString("ArgumentCannotBeEmpty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The specified argument {0} cannot be greater than its ceiling value of {1}.. - /// - internal static string ArgumentCannotBeGreaterThanBaseline { - get { - return ResourceManager.GetString("ArgumentCannotBeGreaterThanBaseline", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The specified argument {0} cannot be initialized with a negative value.. - /// - internal static string ArgumentCannotBeNegative { - get { - return ResourceManager.GetString("ArgumentCannotBeNegative", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to convert parameter {0} value '{1}' to type {2}.. - /// - internal static string ConfigurationHelper_CreateCouldNotConvertException { - get { - return ResourceManager.GetString("ConfigurationHelper_CreateCouldNotConvertException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {3} Failed to create {0} from connection settings {1} = "{2}".. - /// - internal static string ConfigurationHelper_CreateFromSettings_CreateSettingsFailedException { - get { - return ResourceManager.GetString("ConfigurationHelper_CreateFromSettings_CreateSettingsFailedException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No connection settings found for type {0}. Enable tracing for more information.. - /// - internal static string ConfigurationHelper_CreateFromSettings_NoConnectionSettingsFound { - get { - return ResourceManager.GetString("ConfigurationHelper_CreateFromSettings_NoConnectionSettingsFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No credentials of type '{0}' could be initialized from the provided settings.. - /// - internal static string ConfigurationHelper_GetCredentials_NotFound { - get { - return ResourceManager.GetString("ConfigurationHelper_GetCredentials_NotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Parameter {0} is required.. - /// - internal static string ConfigurationHelper_GetParameter_NotFound { - get { - return ResourceManager.GetString("ConfigurationHelper_GetParameter_NotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Default retry strategy for technology {0}, named '{1}', is not defined.. - /// - internal static string DefaultRetryStrategyMappingNotFound { - get { - return ResourceManager.GetString("DefaultRetryStrategyMappingNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Default retry strategy for technology {0} was not not defined, and there is no overall default strategy.. - /// - internal static string DefaultRetryStrategyNotFound { - get { - return ResourceManager.GetString("DefaultRetryStrategyNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Retry handler is not present in the HttpClient handler stack.. - /// - internal static string ExceptionRetryHandlerMissing { - get { - return ResourceManager.GetString("ExceptionRetryHandlerMissing", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The RetryManager is already set.. - /// - internal static string ExceptionRetryManagerAlreadySet { - get { - return ResourceManager.GetString("ExceptionRetryManagerAlreadySet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The default RetryManager has not been set. Set it by invoking the RetryManager.SetDefault static method, or if you are using declarative configuration, you can invoke the RetryPolicyFactory.CreateDefault() method to automatically create the retry manager from the configuration file.. - /// - internal static string ExceptionRetryManagerNotSet { - get { - return ResourceManager.GetString("ExceptionRetryManagerNotSet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Response status code indicates server error: {0} ({1}).. - /// - internal static string ResponseStatusCodeError { - get { - return ResourceManager.GetString("ResponseStatusCodeError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The action has exceeded its defined retry limit.. - /// - internal static string RetryLimitExceeded { - get { - return ResourceManager.GetString("RetryLimitExceeded", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The retry strategy with name '{0}' cannot be found.. - /// - internal static string RetryStrategyNotFound { - get { - return ResourceManager.GetString("RetryStrategyNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The specified string argument {0} must not be empty.. - /// - internal static string StringCannotBeEmpty { - get { - return ResourceManager.GetString("StringCannotBeEmpty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The specified argument '{0}' cannot return a null task when invoked.. - /// - internal static string TaskCannotBeNull { - get { - return ResourceManager.GetString("TaskCannotBeNull", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The specified argument '{0}' must return a scheduled task (also known as "hot" task) when invoked.. - /// - internal static string TaskMustBeScheduled { - get { - return ResourceManager.GetString("TaskMustBeScheduled", resourceCulture); - } - } - } -} diff --git a/src/Common/Common/Properties/Resources.resx b/src/Common/Common/Properties/Resources.resx deleted file mode 100644 index 6a12b83eded4..000000000000 --- a/src/Common/Common/Properties/Resources.resx +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Value cannot be empty. -Parameter name: {0} - - - The specified argument {0} cannot be greater than its ceiling value of {1}. - - - The specified argument {0} cannot be initialized with a negative value. - - - Failed to convert parameter {0} value '{1}' to type {2}. - - - {3} Failed to create {0} from connection settings {1} = "{2}". - - - No connection settings found for type {0}. Enable tracing for more information. - - - No credentials of type '{0}' could be initialized from the provided settings. - - - Parameter {0} is required. - - - Default retry strategy for technology {0}, named '{1}', is not defined. - - - Default retry strategy for technology {0} was not not defined, and there is no overall default strategy. - - - Retry handler is not present in the HttpClient handler stack. - - - The RetryManager is already set. - - - The default RetryManager has not been set. Set it by invoking the RetryManager.SetDefault static method, or if you are using declarative configuration, you can invoke the RetryPolicyFactory.CreateDefault() method to automatically create the retry manager from the configuration file. - - - Response status code indicates server error: {0} ({1}). - - - The action has exceeded its defined retry limit. - - - The retry strategy with name '{0}' cannot be found. - - - The specified string argument {0} must not be empty. - - - The specified argument '{0}' cannot return a null task when invoked. - - - The specified argument '{0}' must return a scheduled task (also known as "hot" task) when invoked. - - \ No newline at end of file diff --git a/src/Common/Common/Settings.SourceAnalysis b/src/Common/Common/Settings.SourceAnalysis deleted file mode 100644 index 2e1b08cea646..000000000000 --- a/src/Common/Common/Settings.SourceAnalysis +++ /dev/null @@ -1,196 +0,0 @@ - - - NoMerge - - dq - dq-lit - eq - esc-dq - esc-eq - esc-sq - sq - sq-lit - ws - - - - - - - - True - - - - - True - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - Microsoft - [###LICENSE_NAME###] - True - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - - as - do - id - if - in - is - my - no - on - to - ui - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/src/Common/Common/packages.config b/src/Common/Common/packages.config deleted file mode 100644 index 8e40a5f5f1a7..000000000000 --- a/src/Common/Common/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Configuration.ScenarioTest.WebRole.csproj b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Configuration.ScenarioTest.WebRole.csproj deleted file mode 100644 index 70c79670eae1..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Configuration.ScenarioTest.WebRole.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Debug - AnyCPU - - - 2.0 - {F154C605-94C7-4EA6-B4AC-355DADCE5567} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Configuration.ScenarioTest.WebRole - Configuration.ScenarioTest.WebRole - true - - - - - true - - - - - - True - - - False - - - - - - - - - - - - - - - - - - - - - Web.config - - - Web.config - - - - - - - - - - - - {8ff949ee-73bd-48bf-abdf-a6711e573fdf} - Configuration - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Properties/AssemblyInfo.cs b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Properties/AssemblyInfo.cs deleted file mode 100644 index aacb9009cccb..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Configuration.ScenarioTest.WebRole")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Configuration.ScenarioTest.WebRole")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4a41cbae-444f-4927-8658-0cf1a691ff75")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Debug.config b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Debug.config deleted file mode 100644 index 2e302f9f9548..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Release.config b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Release.config deleted file mode 100644 index c35844462ba8..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.config b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.config deleted file mode 100644 index 36d4e4880d10..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/Web.config +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/WebRole.cs b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/WebRole.cs deleted file mode 100644 index 23b5a4a02bf8..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/WebRole.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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 System; -using Microsoft.WindowsAzure.ServiceRuntime; -using Microsoft.Azure; - -namespace Configuration.ScenarioTest.WebRole -{ - public class WebRole : RoleEntryPoint - { - public override bool OnStart() - { - // For information on handling configuration changes - // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. - - string expected = "UseDevelopmentStorage=true"; - string actual = CloudConfigurationManager.GetSetting("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"); - if (actual != expected) - { - throw new Exception(string.Format("Test failed. Expected '{0}' and actual '{1}'", expected, actual)); - } - - return base.OnStart(); - } - } -} diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/packages.config b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/packages.config deleted file mode 100644 index 21d46065a595..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRole/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRoleContent/diagnostics.wadcfg b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRoleContent/diagnostics.wadcfg deleted file mode 100644 index 74a9c23127c7..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.WebRoleContent/diagnostics.wadcfg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.ccproj b/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.ccproj deleted file mode 100644 index f966d55fb030..000000000000 --- a/src/Common/Configuration.ScenarioTest/Configuration.ScenarioTest.ccproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - - Debug - AnyCPU - 2.4 - 8f8eec2a-d840-48cd-9aab-575d9ef5f06d - Library - Properties - Configuration.ScenarioTest - Configuration.ScenarioTest - True - Configuration.ScenarioTest - true - - - - - - - - - - Configuration.ScenarioTest.WebRole - {f154c605-94c7-4ea6-b4ac-355dadce5567} - True - Web - Configuration.ScenarioTest.WebRole - True - - - - - - - - Content - - - - - 10.0 - $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.4\ - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/ServiceConfiguration.Cloud.cscfg b/src/Common/Configuration.ScenarioTest/ServiceConfiguration.Cloud.cscfg deleted file mode 100644 index 1c6c6393cdef..000000000000 --- a/src/Common/Configuration.ScenarioTest/ServiceConfiguration.Cloud.cscfg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/ServiceConfiguration.Local.cscfg b/src/Common/Configuration.ScenarioTest/ServiceConfiguration.Local.cscfg deleted file mode 100644 index 1c6c6393cdef..000000000000 --- a/src/Common/Configuration.ScenarioTest/ServiceConfiguration.Local.cscfg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/ServiceDefinition.csdef b/src/Common/Configuration.ScenarioTest/ServiceDefinition.csdef deleted file mode 100644 index 2558c47b489b..000000000000 --- a/src/Common/Configuration.ScenarioTest/ServiceDefinition.csdef +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.ScenarioTest/packages.config b/src/Common/Configuration.ScenarioTest/packages.config deleted file mode 100644 index 8ca1618b6444..000000000000 --- a/src/Common/Configuration.ScenarioTest/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.Tests/CloudConfigurationManagerTest.cs b/src/Common/Configuration.Tests/CloudConfigurationManagerTest.cs deleted file mode 100644 index b84fb583ffdb..000000000000 --- a/src/Common/Configuration.Tests/CloudConfigurationManagerTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright 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.Azure; -using Xunit; -namespace Microsoft.WindowsAzure.Configuration.Test -{ - public class CloudConfigurationManagerTest - { - [Fact] - public void TestGetSettingWithNonExistingSettings() - { - string key = "my settings"; - - string actual = CloudConfigurationManager.GetSetting(key); - - Assert.Null(actual); - } - } -} diff --git a/src/Common/Configuration.Tests/Configuration.Tests.csproj b/src/Common/Configuration.Tests/Configuration.Tests.csproj deleted file mode 100644 index b323f438a24b..000000000000 --- a/src/Common/Configuration.Tests/Configuration.Tests.csproj +++ /dev/null @@ -1,44 +0,0 @@ - - - - AnyCPU - - 2.0 - {0645E75E-9C0B-47EE-B5A2-239286E1DED9} - Library - Properties - Microsoft.WindowsAzure.Configuration.Test - Microsoft.WindowsAzure.Configuration.Tests - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - true - - - - - - 3.5 - - - $(LibraryNugetPackageFolder)\xunit.1.9.2\lib\net20\xunit.dll - - - - - - - - - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF} - Microsoft.WindowsAzure.Configuration - - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration.Tests/Properties/AssemblyInfo.cs b/src/Common/Configuration.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index d8bcd1bb3c73..000000000000 --- a/src/Common/Configuration.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright 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 System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Microsoft.WindowsAzure.Configuration.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Microsoft.WindowsAzure.Configuration.Test")] -[assembly: AssemblyCopyright("Copyright © Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d879d3ae-87b5-48fa-8e09-ee675a76f10f")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] diff --git a/src/Common/Configuration.Tests/packages.config b/src/Common/Configuration.Tests/packages.config deleted file mode 100644 index c0fba12101e5..000000000000 --- a/src/Common/Configuration.Tests/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration/AzureApplicationSettings.cs b/src/Common/Configuration/AzureApplicationSettings.cs deleted file mode 100644 index 904dded8219f..000000000000 --- a/src/Common/Configuration/AzureApplicationSettings.cs +++ /dev/null @@ -1,234 +0,0 @@ -// -// Copyright 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 System; -using System.Configuration; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.IO; -using System.Reflection; - -[assembly: CLSCompliant(true)] -namespace Microsoft.Azure -{ - /// - /// Microsoft Azure settings. - /// - internal class AzureApplicationSettings - { - private const string RoleEnvironmentTypeName = "Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment"; - private const string RoleEnvironmentExceptionTypeName = "Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentException"; - private const string IsAvailablePropertyName = "IsAvailable"; - private const string GetSettingValueMethodName = "GetConfigurationSettingValue"; - - // Keep this array sorted by the version in the descendant order. - private readonly string[] knownAssemblyNames = new string[] - { - "Microsoft.WindowsAzure.ServiceRuntime, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL" - }; - - private Type _roleEnvironmentExceptionType; // Exception thrown for missing settings. - private MethodInfo _getServiceSettingMethod; // Method for getting values from the service configuration. - - /// - /// Initializes the settings. - /// - internal AzureApplicationSettings() - { - // Find out if the code is running in the cloud service context. - Assembly assembly = GetServiceRuntimeAssembly(); - if (assembly != null) - { - Type roleEnvironmentType = assembly.GetType(RoleEnvironmentTypeName, false); - _roleEnvironmentExceptionType = assembly.GetType(RoleEnvironmentExceptionTypeName, false); - if (roleEnvironmentType != null) - { - PropertyInfo isAvailableProperty = roleEnvironmentType.GetProperty(IsAvailablePropertyName); - bool isAvailable; - - try - { - isAvailable = isAvailableProperty != null && (bool)isAvailableProperty.GetValue(null, new object[] { }); - string message = string.Format(CultureInfo.InvariantCulture, "Loaded \"{0}\"", assembly.FullName); - - if (isAvailable) - { - Trace.WriteLine(message); - } - } - catch (TargetInvocationException e) - { - // Running service runtime code from an application targeting .Net 4.0 results - // in a type initialization exception unless application's configuration file - // explicitly enables v2 runtime activation policy. In this case we should fall - // back to the web.config/app.config file. - if (!(e.InnerException is TypeInitializationException)) - { - throw; - } - isAvailable = false; - } - - if (isAvailable) - { - _getServiceSettingMethod = roleEnvironmentType.GetMethod(GetSettingValueMethodName, - BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod); - } - } - } - } - - /// - /// Checks whether the given exception represents an exception throws - /// for a missing setting. - /// - /// Exception - /// True for the missing setting exception. - private bool IsMissingSettingException(Exception e) - { - if (e == null) - { - return false; - } - Type type = e.GetType(); - - return object.ReferenceEquals(type, _roleEnvironmentExceptionType) - || type.IsSubclassOf(_roleEnvironmentExceptionType); - } - - /// - /// Gets a setting with the given name. - /// - /// Setting name. - /// Setting value or null if such setting does not exist. - internal string GetSetting(string name) - { - Debug.Assert(!string.IsNullOrEmpty(name)); - - string value = null; - - value = GetValue("ServiceRuntime", name, GetServiceRuntimeSetting); - if (value == null) - { - value = GetValue("ConfigurationManager", name, n => ConfigurationManager.AppSettings[n]); - } - - return value; - } - - /// - /// Gets setting's value from the given provider. - /// - /// Provider name. - /// Setting name - /// Method to obtain given setting. - /// Setting value, or null if not found. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Necessary for robust handling withing the configuration module.")] - private static string GetValue(string providerName, string settingName, Func getValue) - { - string value = getValue(settingName); - string message; - - if (value != null) - { - message = "PASS"; - } - else - { - message = "FAIL"; - } - - message = string.Format(CultureInfo.InvariantCulture, "Getting \"{0}\" from {1}: {2}.", settingName, providerName, message); - - try - { - Trace.WriteLine(message); - } - catch (Exception) - { - // Ommit writing the trace message, running outside of dev fabric. - } - - return value; - } - - /// - /// Gets a configuration setting from the service runtime. - /// - /// Setting name. - /// Setting value or null if not found. - private string GetServiceRuntimeSetting(string name) - { - Debug.Assert(!string.IsNullOrEmpty(name)); - - string value = null; - - if (_getServiceSettingMethod != null) - { - try - { - value = (string)_getServiceSettingMethod.Invoke(null, new object[] { name }); - } - catch (TargetInvocationException e) - { - if (!IsMissingSettingException(e.InnerException)) - { - throw; - } - } - } - return value; - } - - /// - /// Loads and returns the latest available version of the service - /// runtime assembly. - /// - /// Loaded assembly, if any. - [SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFrom", - Justification= "The ServiceRuntime.dll has to be loaded at runtime so calling Assembly.LoadFrom method is essential to do the loading")] - private Assembly GetServiceRuntimeAssembly() - { - Assembly assembly = null; - - foreach (string assemblyName in knownAssemblyNames) - { - string assemblyPath = NativeMethods.GetAssemblyPath(assemblyName); - - try - { - if (!string.IsNullOrEmpty(assemblyPath)) - { - assembly = Assembly.LoadFrom(assemblyPath); - } - } - catch (Exception e) - { - // The following exceptions are ignored for enabling configuration manager to proceed - // and load the configuration from application settings instead of using ServiceRuntime. - if (!(e is FileNotFoundException || - e is FileLoadException || - e is BadImageFormatException)) - { - throw; - } - } - } - - return assembly; - } - } -} diff --git a/src/Common/Configuration/CloudConfigurationManager.cs b/src/Common/Configuration/CloudConfigurationManager.cs deleted file mode 100644 index 7f5441674a9b..000000000000 --- a/src/Common/Configuration/CloudConfigurationManager.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright 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 System; -using System.Globalization; -using Microsoft.WindowsAzure; - -namespace Microsoft.Azure -{ - /// - /// Configuration manager for accessing Microsoft Azure settings. - /// - public static class CloudConfigurationManager - { - private static object _lock = new object(); - private static AzureApplicationSettings _appSettings; - - /// - /// Gets a setting with the given name. - /// - /// Setting name. - /// Setting value or null if not found. - public static string GetSetting(string name) - { - if (name == null) - { - throw new ArgumentNullException("name"); - } - else if (name.Length == 0) - { - string message = string.Format(CultureInfo.CurrentUICulture, Resources.ErrorArgumentEmptyString, "name"); - throw new ArgumentException(message); - } - - return AppSettings.GetSetting(name); - } - - /// - /// Gets application settings. - /// - internal static AzureApplicationSettings AppSettings - { - get - { - if (_appSettings == null) - { - lock (_lock) - { - if (_appSettings == null) - { - _appSettings = new AzureApplicationSettings(); - } - } - } - - return _appSettings; - } - } - } -} diff --git a/src/Common/Configuration/Configuration.csproj b/src/Common/Configuration/Configuration.csproj deleted file mode 100644 index 02677ce0bc02..000000000000 --- a/src/Common/Configuration/Configuration.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - - AnyCPU - 8.0.30703 - 2.0 - {8FF949EE-73BD-48BF-ABDF-A6711E573FDF} - Library - Properties - Microsoft.WindowsAzure - Microsoft.WindowsAzure.Configuration - 512 - - - - - - - - - - True - True - Resources.resx - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration/GlobalSuppressions.cs b/src/Common/Configuration/GlobalSuppressions.cs deleted file mode 100644 index c47a6086bac6..000000000000 --- a/src/Common/Configuration/GlobalSuppressions.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// -// 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. -// - -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Code Analysis results, point to "Suppress Message", and click -// "In Suppression File". -// You do not need to add suppressions to this file manually. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")] \ No newline at end of file diff --git a/src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuget.proj b/src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuget.proj deleted file mode 100644 index e6de39be5379..000000000000 --- a/src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuget.proj +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - 3.1.0 - - $(MSBuildThisFileDirectory) - - - \ No newline at end of file diff --git a/src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuspec b/src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuspec deleted file mode 100644 index 77616af8a81a..000000000000 --- a/src/Common/Configuration/Microsoft.WindowsAzure.ConfigurationManager.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - Microsoft.WindowsAzure.ConfigurationManager - Microsoft Azure Configuration Manager - $version$ - Microsoft - azure-sdk, Microsoft - http://aka.ms/windowsazureapache2 - http://go.microsoft.com/fwlink/?linkid=252450 - http://go.microsoft.com/fwlink/?LinkID=288890 - true - Microsoft Azure Configuration Manager provides a unified API to load configuration settings regardless of where the application is hosted - whether on-premises or in a Cloud Service. - Microsoft Azure Configuration Manager provides a unified API to load configuration settings regardless of where the application is hosted - whether on-premises or in a Cloud Service. - Microsoft "Microsoft Azure" Configuration "Configuration Manager" cloud azureofficial windowsazureofficial - - - - - - - - - - - - diff --git a/src/Common/Configuration/NativeMethods.cs b/src/Common/Configuration/NativeMethods.cs deleted file mode 100644 index 58f2fefeabd1..000000000000 --- a/src/Common/Configuration/NativeMethods.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -// Copyright 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 System; -using System.Runtime.InteropServices; - -namespace Microsoft.Azure -{ - static internal class NativeMethods - { - const int AssemblyPathMax = 1024; - - [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e707dcde-d1cd-11d2-bab9-00c04f8eceae")] - private interface IAssemblyCache - { - void Reserved0(); - - [PreserveSig] - int QueryAssemblyInfo(int flags, [MarshalAs(UnmanagedType.LPWStr)] string assemblyName, ref AssemblyInfo assemblyInfo); - } - - [StructLayout(LayoutKind.Sequential)] - private struct AssemblyInfo - { - public int cbAssemblyInfo; - - public int assemblyFlags; - - public long assemblySizeInKB; - - [MarshalAs(UnmanagedType.LPWStr)] - public string currentAssemblyPath; - - public int cchBuffer; // size of path buffer. - } - - [DllImport("fusion.dll")] - private static extern int CreateAssemblyCache(out IAssemblyCache ppAsmCache, int reserved); - - /// - /// Gets an assembly path from the GAC given a partial name. - /// - /// An assembly partial name. May not be null. - /// - /// The assembly path if found; otherwise null; - /// - public static string GetAssemblyPath(string name) - { - if (name == null) - throw new ArgumentNullException("name"); - - string finalName = name; - AssemblyInfo aInfo = new AssemblyInfo(); - aInfo.cchBuffer = AssemblyPathMax; - aInfo.currentAssemblyPath = new String('\0', aInfo.cchBuffer); - - IAssemblyCache ac; - int hr = CreateAssemblyCache(out ac, 0); - if (hr >= 0) - { - hr = ac.QueryAssemblyInfo(0, finalName, ref aInfo); - if (hr < 0) - return null; - } - - return aInfo.currentAssemblyPath; - } - } -} diff --git a/src/Common/Configuration/Properties/AssemblyInfo.cs b/src/Common/Configuration/Properties/AssemblyInfo.cs deleted file mode 100644 index 31ca72b5326c..000000000000 --- a/src/Common/Configuration/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright 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 System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -[assembly: AssemblyTitle("Microsoft.WindowsAzure.Configuration")] -[assembly: AssemblyDescription("Configuration API for Microsoft Azure services.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft Corporation")] -[assembly: AssemblyProduct("Microsoft.WindowsAzure.Configuration")] -[assembly: AssemblyCopyright("Copyright © Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("3a4d8eda-db18-4c6f-9f84-4576bb255f30")] - -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.1.0.0")] -[assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/src/Common/Configuration/Properties/Resources.Designer.cs b/src/Common/Configuration/Properties/Resources.Designer.cs deleted file mode 100644 index 5cc4b4df12f7..000000000000 --- a/src/Common/Configuration/Properties/Resources.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17929 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.WindowsAzure { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WindowsAzure.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Argument "{0}" cannot be an empty string.. - /// - internal static string ErrorArgumentEmptyString { - get { - return ResourceManager.GetString("ErrorArgumentEmptyString", resourceCulture); - } - } - } -} diff --git a/src/Common/Configuration/Properties/Resources.resx b/src/Common/Configuration/Properties/Resources.resx deleted file mode 100644 index 1c5233bd732d..000000000000 --- a/src/Common/Configuration/Properties/Resources.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Argument "{0}" cannot be an empty string. - - \ No newline at end of file diff --git a/src/Common/Configuration/Settings.SourceAnalysis b/src/Common/Configuration/Settings.SourceAnalysis deleted file mode 100644 index 23ae9543b4d8..000000000000 --- a/src/Common/Configuration/Settings.SourceAnalysis +++ /dev/null @@ -1,185 +0,0 @@ - - - NoMerge - - - - - - - True - - - - - True - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - Microsoft - [###LICENSE_NAME###] - True - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - - as - do - id - if - in - is - my - no - on - to - ui - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - - - - False - - - - - False - - - - - False - - - - - False - - - - - False - - - - - - - \ No newline at end of file diff --git a/src/Common/Configuration/packages.config b/src/Common/Configuration/packages.config deleted file mode 100644 index 21d46065a595..000000000000 --- a/src/Common/Configuration/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Common/NuGet.Config b/src/Common/NuGet.Config deleted file mode 100644 index 2de911013532..000000000000 --- a/src/Common/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/ResourceManagement/Insights/Insights/Customizations/Shoebox/ShoeboxClient.cs b/src/ResourceManagement/Insights/Insights/Customizations/Shoebox/ShoeboxClient.cs index 1b6b1a525d8e..88592a507d90 100644 --- a/src/ResourceManagement/Insights/Insights/Customizations/Shoebox/ShoeboxClient.cs +++ b/src/ResourceManagement/Insights/Insights/Customizations/Shoebox/ShoeboxClient.cs @@ -248,7 +248,7 @@ private static MetricValue ResolveMetricEntity(DynamicTableEntity entity) Dictionary otherProperties = new Dictionary(); MetricValue metricValue = new MetricValue() { - Timestamp = entity["TIMESTAMP"].DateTime ?? entity.Timestamp.UtcDateTime + Timestamp = entity["TIMESTAMP"].DateTimeOffsetValue != null ? entity["TIMESTAMP"].DateTimeOffsetValue.Value.DateTime : entity.Timestamp.UtcDateTime }; foreach (string key in entity.Properties.Keys) From c4ca6579a6c3df9499a80c85cd0b91bd60236631 Mon Sep 17 00:00:00 2001 From: Amar Zavery Date: Wed, 25 Nov 2015 16:40:13 -0800 Subject: [PATCH 3/3] fix restoring nuget packages --- build.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/build.proj b/build.proj index a6d74a3e8b5c..7882a21d25e7 100644 --- a/build.proj +++ b/build.proj @@ -251,6 +251,7 @@ -PackagesDirectory $(LibraryNugetPackageFolder) +