Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<ProjectGuid>{374701E4-539A-459A-9A00-B04E51652997}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BatchModelGenerator</RootNamespace>
<AssemblyName>BatchModelGenerator</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchModelGenerator", "BatchModelGenerator.csproj", "{374701E4-539A-459A-9A00-B04E51652997}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{374701E4-539A-459A-9A00-B04E51652997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{374701E4-539A-459A-9A00-B04E51652997}.Debug|Any CPU.Build.0 = Debug|Any CPU
{374701E4-539A-459A-9A00-B04E51652997}.Release|Any CPU.ActiveCfg = Release|Any CPU
{374701E4-539A-459A-9A00-B04E51652997}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
450 changes: 450 additions & 0 deletions src/ResourceManager/Batch/BatchModelGenerator/Program.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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("BatchModelGenerator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BatchModelGenerator")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("02fd94d5-1897-4df1-9c0d-dd884c19f872")]

// 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("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
74 changes: 74 additions & 0 deletions src/ResourceManager/Batch/Commands.Batch.Test/BatchTestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Net;
using Microsoft.Azure.Batch.Protocol;
using Microsoft.Azure.Batch.Protocol.Entities;
using Microsoft.Azure.Management.Batch.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Xunit;

namespace Microsoft.Azure.Commands.Batch.Test
{
public static class BatchTestHelpers
{
/// <summary>
/// Builds an AccountResource object using the specified parameters
/// </summary>
public static AccountResource CreateAccountResource(string accountName, string resourceGroupName, Hashtable[] tags = null)
{
string tenantUrlEnding = "batch-test.windows-int.net";
Expand All @@ -39,9 +47,28 @@ public static AccountResource CreateAccountResource(string accountName, string r
{
resource.Tags = Microsoft.Azure.Commands.Batch.Helpers.CreateTagDictionary(tags, true);
}

return resource;
}

/// <summary>
/// Builds a BatchAccountContext object with the keys set for testing
/// </summary>
public static BatchAccountContext CreateBatchContextWithKeys()
{
AccountResource resource = CreateAccountResource("account", "resourceGroup");
BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource);
string dummyKey = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
SetProperty(context, "PrimaryAccountKey", dummyKey);
SetProperty(context, "SecondaryAccountKey", dummyKey);

return context;
}


/// <summary>
/// Verifies that two BatchAccountContext objects are equal
/// </summary>
public static void AssertBatchAccountContextsAreEqual(BatchAccountContext context1, BatchAccountContext context2)
{
if (context1 == null)
Expand All @@ -67,5 +94,52 @@ public static void AssertBatchAccountContextsAreEqual(BatchAccountContext contex
Assert.Equal<string>(context1.TagsTable, context2.TagsTable);
Assert.Equal<string>(context1.TaskTenantUrl, context2.TaskTenantUrl);
}

/// <summary>
/// Builds a GetWorkItemResponse object
/// </summary>
public static GetWorkItemResponse CreateGetWorkItemResponse(string workItemName)
{
GetWorkItemResponse response = new GetWorkItemResponse();
SetProperty(response, "StatusCode", HttpStatusCode.OK);

JobExecutionEnvironment jee = new JobExecutionEnvironment();

WorkItem workItem = new WorkItem(workItemName, jee);
SetProperty(response, "WorkItem", workItem);

return response;
}

/// <summary>
/// Builds a ListWorkItemsResponse object
/// </summary>
public static ListWorkItemsResponse CreateListWorkItemsResponse(IEnumerable<string> workItemNames)
{
ListWorkItemsResponse response = new ListWorkItemsResponse();
SetProperty(response, "StatusCode", HttpStatusCode.OK);

List<WorkItem> workItems = new List<WorkItem>();
JobExecutionEnvironment jee = new JobExecutionEnvironment();

foreach (string name in workItemNames)
{
workItems.Add(new WorkItem(name, jee));
}

SetProperty(response, "WorkItems", workItems);

return response;
}

/// <summary>
/// Uses Reflection to set a property value on an object. Can be used to bypass restricted set accessors.
/// </summary>
private static void SetProperty(object obj, string propertyName, object propertyValue)
{
Type t = obj.GetType();
PropertyInfo propInfo = t.GetProperty(propertyName);
propInfo.SetValue(obj, propertyValue);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>ea3ea393</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -38,6 +39,10 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Batch, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Azure.Batch.1.1.0\lib\net45\Microsoft.Azure.Batch.dll</HintPath>
</Reference>
<Reference Include="Hyak.Common">
<HintPath>..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -72,6 +77,12 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5486.28526-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
Expand All @@ -80,6 +91,17 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Configuration">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=2.1.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why such an old version of storage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Batch OM (in the Microsoft.Azure.Batch NuGet package) was built on the older version. There were breaking changes in the newest version of the storage library, so the owners of the Batch OM opted to stay on the older version for the time being.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh. There should be an issue filed to address the breaking changes there and move to something more current.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worse than this - I don't believe we can accept this without the OM upgrading to staorage 4.0. There will be confliucts with the other resources modules and too much possibility for regression

<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\WindowsAzure.Storage.2.1.0.4\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Testing, Version=1.0.5417.13285, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Hydra.SpecTestSupport.1.0.5417.13285-prerelease\lib\net45\Microsoft.WindowsAzure.Testing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
Expand All @@ -89,6 +111,8 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Services.Client" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll</HintPath>
Expand All @@ -104,9 +128,11 @@
<HintPath>..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="xunit">
<HintPath>..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Reference Include="System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Newtonsoft.Json">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand All @@ -124,6 +150,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScenarioTests\BatchAccountTests.cs" />
<Compile Include="ScenarioTests\BatchController.cs" />
<Compile Include="WorkItems\GetBatchWorkItemCommandTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="MSSharedLibKey.snk" />
Expand Down Expand Up @@ -179,6 +206,9 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Content Include="about.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Test;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Microsoft.Azure.Test;
using System;
using System.Linq;

Expand Down
Loading