SPRNET-1124

-added direct support for specifying a collection of IResource instances to configure the container
-introduced various ApplicationContextArgs classes to encapsulate ever-expanding constructor params for ApplicationContexts
-revise constructors chaining to fall over to ApplicationContextArgs-based constructors.
-move codifation of differnt ApplicationContext 'defaults' (caseSensitive, Refresh, etc.) from ApplicationContext constructors into ApplicationContextArgs classes
This commit is contained in:
sbohlen
2010-07-28 15:02:31 +00:00
parent ce275c9a25
commit 617adb53d6
15 changed files with 558 additions and 261 deletions

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace Spring.Context.Support
{
[TestFixture]
public class XmlApplicationContentArgsTests
{
[Test]
public void Default_CaseSensitivity_isTrue()
{
XmlApplicationContextArgs args = new XmlApplicationContextArgs();
Assert.True(args.CaseSensitive);
}
[Test]
public void Default_AutoRefresh_isTrue()
{
XmlApplicationContextArgs args = new XmlApplicationContextArgs();
Assert.True(args.Refresh);
}
}
}

View File

@@ -74,15 +74,15 @@ namespace Spring.Core.IO
[Test]
public void ThrowsIoExceptionIfConfigSectionDoesNotExist()
{
IResource res = new ConfigSectionResource("DOES NOT EXIST");
IResource res = new ConfigSectionResource(Guid.NewGuid().ToString());
try
{
Stream istm = res.InputStream;
Assert.Fail();
Assert.Fail("Did not receive expected IOException!");
}
catch(IOException ioex)
{
Console.WriteLine(ioex);
catch(IOException)
{
}
}
}

View File

@@ -217,6 +217,7 @@
<Compile Include="Context\Support\TypeAliasesSectionHandlerTests.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Context\Support\XmlApplicationContentArgsTests.cs" />
<Compile Include="Context\Support\XmlApplicationContextTests.cs">
<SubType>Code</SubType>
</Compile>

View File

@@ -61,6 +61,11 @@ namespace Spring.Transaction.Config
{
get { return null; }
}
protected override IResource[] ConfigurationResources
{
get { return null; }
}
}
private const string APPCTXCFG_PROLOG = @"<?xml version='1.0' encoding='utf-8' ?>";

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace Spring.Context.Support
{
[TestFixture]
public class WebApplicationContextArgsTests
{
[Test]
public void Default_CaseSensitivity_isFalse()
{
WebApplicationContextArgs args = new WebApplicationContextArgs();
Assert.False(args.CaseSensitive);
}
}
}

View File

@@ -91,6 +91,7 @@
</Compile>
<Compile Include="Caching\AspNetCacheTests.cs" />
<Compile Include="Context\Support\HttpApplicationConfigurerTests.cs" />
<Compile Include="Context\Support\WebApplicationContextArgsTests.cs" />
<Compile Include="Context\Support\WebApplicationContextTests.cs" />
<Compile Include="Core\IO\WebResourceTests.cs" />
<Compile Include="Data\Spring\Objects\Factory\Support\TestForm.aspx.cs">