Skip to content

Commit

Permalink
Merge pull request #6 from dbones/master
Browse files Browse the repository at this point in the history
Continued dev on 0.3.x
  • Loading branch information
dbones committed Oct 14, 2013
2 parents aebf88f + 8c40269 commit c8ad1a3
Show file tree
Hide file tree
Showing 73 changed files with 11,299 additions and 67 deletions.
5 changes: 3 additions & 2 deletions nuspec/boxes.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<id>Boxes.Integration</id>
<version>0.0.0</version>
<title>Boxes Integration</title>
<authors>David Rundle</authors>
<authors>Boxes Contrib Team</authors>
<owners>dbones.co.uk</owners>
<iconUrl>http://docs.dbones.co.uk/GetFile.aspx?File=/boxes/logo/boxeslogo.jpg</iconUrl>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/boxes-project</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Boxes.Integration utilises Boxes.Core to provide an API to integrate with an IoC container.</description>
<summary>Boxes.Integration utilises Boxes.Core to provide an API to integrate with an IoC container.</summary>
<copyright>Copyright 2012 - 2013 dbones.co.uk (David Rundle)</copyright>
<copyright>Copyright 2012 - 2013 dbones.co.uk</copyright>
<language>es-US</language>
<tags>Composition Plugin Module Modular Package Bundle Isolated ioc di inversionofcontrol dependencyinjection</tags>
<dependencies>
Expand Down
8 changes: 8 additions & 0 deletions nuspec/changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
0.3.x
==============
Support for other IoC container
Trust manager
External modules can override Boxes Intergration internals
Build Foundation for Tenancy


0.2.x
==============
updated to support 0.2 versions of Core and Integration projects
Expand Down
2 changes: 1 addition & 1 deletion nuspec/license.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2012 - 2013 dbones.co.uk (David Rundle)
Copyright 2012 - 2013 dbones.co.uk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
75 changes: 75 additions & 0 deletions src/Boxes.Integration.Test/Boxes.Integration.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?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>
<ProjectGuid>{356B6CFA-EFEA-43DA-83DD-C2093F3818DD}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Boxes.Integration.Test</RootNamespace>
<AssemblyName>Boxes.Integration.Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Boxes.Core">
<HintPath>..\..\lib\Boxes.Core.dll</HintPath>
</Reference>
<Reference Include="Boxes.Test.Core">
<HintPath>..\..\lib\Boxes.Test.Core.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
</Reference>
<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="ContainerSetupBaseTests.cs" />
<Compile Include="TopologicalProcessOrderTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Boxes.Integration\Boxes.Integration.csproj">
<Project>{4d3cc463-a3c6-4569-bc00-a5c5d5a2ddd2}</Project>
<Name>Boxes.Integration</Name>
</ProjectReference>
</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>
54 changes: 54 additions & 0 deletions src/Boxes.Integration.Test/ContainerSetupBaseTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2012 - 2013 dbones.co.uk
//
// 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 Boxes.Integration.Test
{
using System;
using System.Data;
using System.Linq;
using Boxes.Test;
using Boxes.Test.Infrastructure;
using Setup;
using NUnit.Framework;
using Setup.Registrations;

public interface ILifeStyle {}

public class Singleton : ILifeStyle {}

public class Configure {}

public class Register : RegisterBase<Type, Configure>
{
}

public class RegisterBaseTests : TestBase<IRegister<Type, Configure>>
{
[Test]
public void Simple_setup()
{
Action(() =>
{
var reg = new Register()
.LifeStyle(typeof(Singleton))
.Where(x => typeof(IDbCommand).IsAssignableFrom(x))
.AssociateWith(Contracts.SelfOnly);

return new Context<IRegister<Type, Configure>>(reg);
});


}

}
}
49 changes: 49 additions & 0 deletions src/Boxes.Integration.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2012 - 2013 dbones.co.uk
//
// 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;

// 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("Boxes.Integration.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Boxes.Integration.Test")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[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("9eff756e-0d54-4911-873a-124c5faf4581")]

// 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")]
61 changes: 61 additions & 0 deletions src/Boxes.Integration.Test/TopologicalProcessOrderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2012 - 2013 dbones.co.uk
//
// 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 Boxes.Integration.Test
{
using Boxes.Test;
using Boxes.Test.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using Process;
using NUnit.Framework;

public class TopologicalProcessOrderTests : TestBase<TopologicalProcessOrder>
{
[Test]
public void Order_dependencies()
{
Arrange(() =>
{
Func<IEnumerable<string>, IEnumerable<Module>> createModules =
titles => titles.Select(title => new Module(title, new Version(1, 0)));

Func<string, IEnumerable<string>, IEnumerable<string>, Package> createPackage =
(title, exports, imports) =>
{
var manifest = new Manifest(title, new Version(1, 0), "title", createModules(exports),
createModules(imports));
var package = new Package(manifest, title);
return package;
};

dynamic ctx = new Context<TopologicalProcessOrder>(new TopologicalProcessOrder());
ctx.PackagesToSort = new List<Package>()
{
createPackage("package1", new[] {"a1"}, new string[] {}),
createPackage("package3", new[] {"a3"}, new[] {"a1", "a2"}),
createPackage("package2", new[] {"a2"}, new[] {"a1"}),
createPackage("package4", new[] {"a4"}, new[] {"a3"}),
};
return ctx;
});
Action(ctx => ((dynamic) ctx).Result = ctx.Sut.Arrange(((dynamic) ctx).PackagesToSort));
Assert(ctx => ((dynamic) ctx).Result[0].Name == "package1");
Assert(ctx => ((dynamic) ctx).Result[1].Name == "package2");
Assert(ctx => ((dynamic) ctx).Result[2].Name == "package3");
Assert(ctx => ((dynamic) ctx).Result[3].Name == "package4");
Execute();
}
}
}
4 changes: 4 additions & 0 deletions src/Boxes.Integration.Test/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.0.12054" targetFramework="net40" />
</packages>
9 changes: 9 additions & 0 deletions src/Boxes.Integration.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxes.Integration", "Boxes.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0733A87B-C669-461C-A0FE-A9BF85F841B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxes.Integration.Test", "Boxes.Integration.Test\Boxes.Integration.Test.csproj", "{356B6CFA-EFEA-43DA-83DD-C2093F3818DD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,8 +17,15 @@ Global
{4D3CC463-A3C6-4569-BC00-A5C5D5A2DDD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D3CC463-A3C6-4569-BC00-A5C5D5A2DDD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D3CC463-A3C6-4569-BC00-A5C5D5A2DDD2}.Release|Any CPU.Build.0 = Release|Any CPU
{356B6CFA-EFEA-43DA-83DD-C2093F3818DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{356B6CFA-EFEA-43DA-83DD-C2093F3818DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{356B6CFA-EFEA-43DA-83DD-C2093F3818DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{356B6CFA-EFEA-43DA-83DD-C2093F3818DD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{356B6CFA-EFEA-43DA-83DD-C2093F3818DD} = {0733A87B-C669-461C-A0FE-A9BF85F841B2}
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion src/Boxes.Integration.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#xD;
See the License for the specific language governing permissions and&#xD;
limitations under the License.</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=03daaf07_002D7807_002D40ac_002D9b3c_002D8f2d1187954b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Protected" Description="instance_field_protected"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=69141fd4_002D2b87_002D46ce_002Da422_002D27e4927fc622/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Protected" Description="static_field_protected"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=69141fd4_002D2b87_002D46ce_002Da422_002D27e4927fc622/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Protected" Description="static_field_protected"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>
16 changes: 13 additions & 3 deletions src/Boxes.Integration/BoxesWrapperBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 - 2013 dbones.co.uk (David Rundle)
// Copyright 2012 - 2013 dbones.co.uk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@ namespace Boxes.Integration
using InternalIoc;
using Loading;
using Process;
using Setup;
using Tasks;
using Trust;

Expand All @@ -29,7 +30,7 @@ namespace Boxes.Integration
/// <typeparam name="TContainer">the type of the container, this will be used to resolve the instances</typeparam>
/// <remarks>
/// do not remove the TContainer this is used with the extension methods and with the other classes in the system</remarks>
public abstract class BoxesWrapperBase<TBuilder, TContainer> : IBoxesWrapper<TBuilder>
public abstract class BoxesWrapperBase<TBuilder, TContainer> : IBoxesWrapper<TBuilder, TContainer>
{
//TODO: look at disabling registrations (controllable in a module)
//http://ayende.com/blog/2792/introducing-monorail-hotswap
Expand Down Expand Up @@ -60,18 +61,27 @@ protected BoxesWrapperBase()
{
_internalContainer = new InternalInternalContainer();
PackageRegistry = new PackageRegistry();
_extensionRunner = new TaskRunner<Package>(new ExtendBoxesTask(_internalContainer));
_loaderFactory = new LoaderFactory();

//setup the internal IoC
_internalContainer.Add<PackageRegistry, PackageRegistry>();
_internalContainer.setInstance(typeof(PackageRegistry), PackageRegistry);

_internalContainer.Add<IProcessOrder, TopologicalProcessOrder>();
_internalContainer.Add(typeof(IIocSetup<>), typeof(IocSetup<>));
_internalContainer.Add<ITrustManager, TrustManager>();

_internalContainer.Add<LoaderFactory, LoaderFactory>();
_internalContainer.setInstance(typeof(LoaderFactory), _loaderFactory);

//this is a default impl, it could be overriden in a module by another interface/impl
_internalContainer.Add(typeof(IDefaultContainerSetup<>), typeof(DefaultContainerSetup<>));


Initialize(_internalContainer);

_extensionRunner = new TaskRunner<Package>(new ExtendBoxesTask(_internalContainer));

}

public PackageRegistry PackageRegistry { get; private set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Boxes.Integration/Exceptions/CreateLoaderException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 - 2013 dbones.co.uk (David Rundle)
// Copyright 2012 - 2013 dbones.co.uk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/Boxes.Integration/Exceptions/FailedTrustException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 - 2013 dbones.co.uk (David Rundle)
// Copyright 2012 - 2013 dbones.co.uk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 - 2013 dbones.co.uk (David Rundle)
// Copyright 2012 - 2013 dbones.co.uk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/Boxes.Integration/ExtensionManifest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 - 2013 dbones.co.uk (David Rundle)
// Copyright 2012 - 2013 dbones.co.uk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit c8ad1a3

Please sign in to comment.