Permalink
Browse files

Merge pull request #403 from WindowsAzure/dev

Bringing master to dev
  • Loading branch information...
2 parents c87ff50 + 36a448f commit 72e49ec9e58c731bdd6bdaee027ec6fdbd813e1f @christav christav committed Jan 16, 2014
Showing with 722 additions and 12 deletions.
  1. +4 −0 .gitignore
  2. +20 −9 WindowsAzureLibraries.sln
  3. +2 −0 packages/repositories.config
  4. +13 −0 src/Common.Test/TokenCloudCredentialsTest.cs
  5. +101 −0 src/Common.WindowsStore.Test/Common.WindowsStore.Test.csproj
  6. BIN src/Common.WindowsStore.Test/Images/UnitTestLogo.png
  7. BIN src/Common.WindowsStore.Test/Images/UnitTestSmallLogo.png
  8. BIN src/Common.WindowsStore.Test/Images/UnitTestSplashScreen.png
  9. BIN src/Common.WindowsStore.Test/Images/UnitTestStoreLogo.png
  10. +32 −0 src/Common.WindowsStore.Test/Package.appxmanifest
  11. +31 −0 src/Common.WindowsStore.Test/Properties/AssemblyInfo.cs
  12. +78 −0 src/Common.WindowsStore.Test/StoreAppTest.cs
  13. +7 −0 src/Common.WindowsStore.Test/packages.config
  14. +85 −0 src/Common.WindowsStore/CertificateCloudCredentials.cs
  15. +64 −0 src/Common.WindowsStore/Common.WindowsStore.csproj
  16. +39 −0 src/Common.WindowsStore/Platform/CertificateCloudCredentialsProvider.cs
  17. +67 −0 src/Common.WindowsStore/Platform/CloudConfigurationProvider.cs
  18. +43 −0 src/Common.WindowsStore/Platform/CryptographyProvider.cs
  19. +31 −0 src/Common.WindowsStore/Platform/HttpTransportHandlerProvider.cs
  20. +34 −0 src/Common.WindowsStore/Properties/AssemblyInfo.cs
  21. +7 −0 src/Common.WindowsStore/packages.config
  22. +24 −2 src/Common/Credentials/TokenCloudCredentials.cs
  23. +1 −1 src/Common/Microsoft.WindowsAzure.Common.nuget.proj
  24. +11 −0 src/Common/Microsoft.WindowsAzure.Common.nuspec
  25. +8 −0 src/library.props
  26. +1 −0 src/library.targets
  27. +1 −0 src/references.props
  28. +18 −0 src/references.windows8.props
View
@@ -103,6 +103,10 @@ Generated_Code #added for RIA/Silverlight projects
# Build tasks
tools/*.dll
+# Sensitive files
+*.keys
+*.pfx
+
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
View
@@ -1,8 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.21005.1
-MinimumVisualStudioVersion = 10.0.40219.1
+# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{868850B4-1073-41A1-ABA8-A3B465880148}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "src\Common\Common.csproj", "{856A1D19-C3BF-439A-BEBF-E822A332BC12}"
@@ -46,8 +44,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monitoring", "src\Monitorin
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "git", "git", "{EAC2DE24-42C6-4B7F-ACAB-73C0E113FC40}"
ProjectSection(SolutionItems) = preProject
- ..\.gitignore = ..\.gitignore
- ..\README.md = ..\README.md
+ .gitignore = .gitignore
+ README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "product", "product", "{CECF3E21-0555-4C3C-B736-547D95A6E434}"
@@ -74,7 +72,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WindowsAzure.Conf
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaServicesManagement", "src\MediaServicesManagement\MediaServicesManagement.csproj", "{25DCF6F0-7972-4387-8810-0370B92B4135}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.WindowsStore", "src\Common.WindowsStore\Common.WindowsStore.csproj", "{65C1AFA4-9F6A-4105-B28C-AA1B95C17494}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.WindowsStore.Test", "src\Common.WindowsStore.Test\Common.WindowsStore.Test.csproj", "{6B9F0F97-9B59-4623-BF3E-AE0026FB083D}"
+EndProject
Global
+ GlobalSection(TestCaseManagementSettings) = postSolution
+ CategoryFile = WindowsAzureLibraries.vsmdi
+ EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@@ -156,6 +161,14 @@ Global
{25DCF6F0-7972-4387-8810-0370B92B4135}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25DCF6F0-7972-4387-8810-0370B92B4135}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25DCF6F0-7972-4387-8810-0370B92B4135}.Release|Any CPU.Build.0 = Release|Any CPU
+ {65C1AFA4-9F6A-4105-B28C-AA1B95C17494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {65C1AFA4-9F6A-4105-B28C-AA1B95C17494}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {65C1AFA4-9F6A-4105-B28C-AA1B95C17494}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {65C1AFA4-9F6A-4105-B28C-AA1B95C17494}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6B9F0F97-9B59-4623-BF3E-AE0026FB083D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6B9F0F97-9B59-4623-BF3E-AE0026FB083D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {6B9F0F97-9B59-4623-BF3E-AE0026FB083D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6B9F0F97-9B59-4623-BF3E-AE0026FB083D}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -177,12 +190,10 @@ Global
{50B0A8CE-D290-4EB7-8C6C-16EAAB75225E} = {868850B4-1073-41A1-ABA8-A3B465880148}
{2EFD6648-39B4-476A-B302-8BC236F5F1B8} = {868850B4-1073-41A1-ABA8-A3B465880148}
{25DCF6F0-7972-4387-8810-0370B92B4135} = {868850B4-1073-41A1-ABA8-A3B465880148}
+ {65C1AFA4-9F6A-4105-B28C-AA1B95C17494} = {868850B4-1073-41A1-ABA8-A3B465880148}
{B2FAA0E6-2643-4011-8CFE-BA28BDFFC7E7} = {7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB}
{CB18ACEB-2825-4884-91FA-05C31AC779FE} = {7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB}
{0645E75E-9C0B-47EE-B5A2-239286E1DED9} = {7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB}
- EndGlobalSection
-EndGlobal
- GlobalSection(TestCaseManagementSettings) = postSolution
- CategoryFile = WindowsAzureLibraries.vsmdi
+ {6B9F0F97-9B59-4623-BF3E-AE0026FB083D} = {7C044DD1-F76B-49A7-A8DF-A5DEEE748EBB}
EndGlobalSection
EndGlobal
@@ -5,6 +5,8 @@
<repository path="..\src\Common.Tracing.Etw\packages.config" />
<repository path="..\src\Common.Tracing.Log4Net\packages.config" />
<repository path="..\src\Common.Tracing.Test\packages.config" />
+ <repository path="..\src\Common.WindowsStoreApp.Test\packages.config" />
+ <repository path="..\src\Common.WindowsStoreApp\packages.config" />
<repository path="..\src\Common\packages.config" />
<repository path="..\src\ComputeManagement\packages.config" />
<repository path="..\src\Management\packages.config" />
@@ -34,6 +34,19 @@ public void TokenCloudCredentialAddsHeader()
}
[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");
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <WindowsAzureLibraryProfileSet>windows8</WindowsAzureLibraryProfileSet>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{6B9F0F97-9B59-4623-BF3E-AE0026FB083D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Microsoft.WindowsAzure.Common.WindowsStoreApp.Test</RootNamespace>
+ <AssemblyName>Microsoft.WindowsAzure.Common.WindowsStore.Test</AssemblyName>
+ <DefaultLanguage>en-US</DefaultLanguage>
+ <PackageCertificateKeyFile>Common.WindowsStore.Test_TemporaryKey.pfx</PackageCertificateKeyFile>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <PackageCertificateThumbprint>549C71001B8A198132D590A6461209A8C87B3FFA</PackageCertificateThumbprint>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <Import Project="..\library.props" />
+ <PropertyGroup>
+ <AppXPackage>True</AppXPackage>
+ <AppxPackageIncludePrivateSymbols>true</AppxPackageIncludePrivateSymbols>
+ </PropertyGroup>
+ <ItemGroup>
+ <!--A reference to the entire .Net Framework and Windows SDK are automatically included-->
+ <SDKReference Include="MSTestFramework, Version=11.0" />
+ <SDKReference Include="TestPlatform, Version=11.0" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="StoreAppTest.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <AppxManifest Include="Package.appxmanifest">
+ <SubType>Designer</SubType>
+ </AppxManifest>
+ <Content Include="certificate.keys" Condition="Exists('certificate.keys')">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <None Include="Common.WindowsStore.Test_TemporaryKey.pfx" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Images\UnitTestLogo.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Images\UnitTestSmallLogo.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Images\UnitTestSplashScreen.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Images\UnitTestStoreLogo.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Common.WindowsStore\Common.WindowsStore.csproj">
+ <Project>{65c1afa4-9f6a-4105-b28c-aa1b95c17494}</Project>
+ <Name>Common.WindowsStore</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Common\Common.csproj">
+ <Project>{856a1d19-c3bf-439a-bebf-e822a332bc12}</Project>
+ <Name>Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Management\Management.csproj">
+ <Project>{2b6d304f-5dc0-4052-a8ab-80e53c291e5f}</Project>
+ <Name>Management</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
+ <VisualStudioVersion>11.0</VisualStudioVersion>
+ </PropertyGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
+ <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
+ <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
+ <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
+ <Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
+ </Target>
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+ <Import Project="$(ProjectDir)\..\library.targets" />
+</Project>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
+ <Identity Name="4533976f-e2b8-4a36-858f-6682b238697c" Publisher="CN=destanko" Version="1.0.0.0" />
+ <Properties>
+ <DisplayName>Common.WindowsStoreApp.Test</DisplayName>
+ <PublisherDisplayName>Microsoft</PublisherDisplayName>
+ <Logo>Images\UnitTestStoreLogo.png</Logo>
+ <Description>Common.WindowsStoreApp.Test</Description>
+ </Properties>
+ <Prerequisites>
+ <OSMinVersion>6.2.1</OSMinVersion>
+ <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
+ </Prerequisites>
+ <Resources>
+ <Resource Language="x-generate" />
+ </Resources>
+ <Applications>
+ <Application Id="vstest.executionengine.App" Executable="vstest.executionengine.appcontainer.exe" EntryPoint="vstest.executionengine.App">
+ <VisualElements DisplayName="NoUIEntryPoints" Logo="Images\UnitTestLogo.png" SmallLogo="Images\UnitTestSmallLogo.png" Description="vstest.executionengine.App" ForegroundText="light" BackgroundColor="#0084FF">
+ <SplashScreen Image="Images\UnitTestSplashScreen.png" />
+ </VisualElements>
+ </Application>
+ <Application Id="vstest.executionengine.x86.App" Executable="vstest.executionengine.appcontainer.x86.exe" EntryPoint="vstest.executionengine.x86.App">
+ <VisualElements DisplayName="NoUIEntryPoints" Logo="Images\UnitTestLogo.png" SmallLogo="Images\UnitTestSmallLogo.png" Description="vstest.executionengine.x86.App" ForegroundText="light" BackgroundColor="#0084FF">
+ <SplashScreen Image="Images\UnitTestSplashScreen.png" />
+ </VisualElements>
+ </Application>
+ </Applications>
+ <Capabilities>
+ <Capability Name="internetClient" />
+ </Capabilities>
+</Package>
@@ -0,0 +1,31 @@
+//
+// 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("Windows Azure Windows Store App Common Library Tests")]
+[assembly: AssemblyDescription("Tests for the Windows Azure Windows Store App Common Library.")]
+
+[assembly: AssemblyVersion("0.9.0.0")]
+[assembly: AssemblyFileVersion("0.9.0.0")]
+
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Windows Azure .NET SDK")]
+[assembly: AssemblyCopyright("Copyright © Microsoft Corporation")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
@@ -0,0 +1,78 @@
+//
+// 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.Threading.Tasks;
+using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
+using Microsoft.WindowsAzure.Management;
+using Windows.Security.Cryptography.Certificates;
+using Windows.Storage;
+
+namespace Microsoft.WindowsAzure.Common.WindowsStoreApp.Test
+{
+ [TestClass]
+ public class StoreAppTest
+ {
+ private static string _certificateString;
+ private static string _subscription;
+ private static string _certificatePassword;
+
+ [TestInitialize]
+ public void Setup()
+ {
+ GetCertificate().Wait();
+ }
+
+ [TestMethod]
+ public void ManagementClientReturnsLocationList()
+ {
+ // Import certificate
+ CertificateEnrollmentManager.ImportPfxDataAsync(_certificateString, _certificatePassword, ExportOption.NotExportable,
+ KeyProtectionLevel.NoConsent, InstallOptions.None,
+ "test").AsTask().Wait();
+
+ var credentials = new CertificateCloudCredentials(_subscription);
+ var client = new ManagementClient(credentials);
+ var result = client.Locations.List();
+
+ Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
+ Assert.IsTrue(result.Locations.Count > 0);
+ }
+
+ private static async Task GetCertificate()
+ {
+ const string path = "certificate.keys";
+ var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
+ var file = await folder.GetFileAsync(path);
+ var lines = await FileIO.ReadLinesAsync(file);
+ foreach (var line in lines)
+ {
+ if (line.StartsWith("TEST_CERTIFICATE="))
+ {
+ _certificateString = line.Substring("TEST_CERTIFICATE=".Length);
+ }
+ if (line.StartsWith("TEST_CERTIFICATE_PASSWORD="))
+ {
+ _certificatePassword = line.Substring("TEST_CERTIFICATE_PASSWORD=".Length);
+ }
+ if (line.StartsWith("TEST_SUBSCRIPTION="))
+ {
+ _subscription = line.Substring("TEST_SUBSCRIPTION=".Length);
+ }
+ }
+ }
+ }
+}
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.Bcl" version="1.1.6" targetFramework="win" />
+ <package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="win" />
+ <package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="win" />
+ <package id="Microsoft.Net.Http" version="2.2.18" targetFramework="win" />
+</packages>
Oops, something went wrong.

0 comments on commit 72e49ec

Please sign in to comment.