From: <sv...@ca...> - 2006-01-23 19:45:24
|
User: hammett Date: 2006/01/23 02:39 PM Added: /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/ ConfigXmlInterpreterTestCase.cs /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/ ConfigWithStatementsTestCase.cs /trunk/InversionOfControl/Castle.Windsor.Tests/XmlProcessor/ XmlProcessorTestCase.cs /trunk/InversionOfControl/Castle.Windsor.Tests/XmlProcessor/TestFiles/ AssemblyInclude1.xml, AssemblyInclude2.xml, AssemblyIncludeTestDisabled.xml, AssemblyIncludeTestResult.xml, ChooseStatement2Test.xml, ChooseStatement2TestResult.xml, ChooseStatementTest.xml, ChooseStatementTestResult.xml, ComplexPropertiesTest.xml, ComplexPropertiesTestResult.xml, DefineDebugTestDisabled.xml, DefineDebugTestResult.xml, DefineDefaultTestDisabled.xml, DefineDefaultTestResult.xml, IfStatementTest.xml, IfStatementTestResult.xml, InvalidElseWithFlag.xml, InvalidElsifWithNoFlag.xml, InvalidFlag.xml, InvalidIfWithNoFlag.xml, InvalidPropertiesMissing.xml, InvalidUnbalancedIfStatement.xml, MultiInclude2TestDisabled.xml, MultiInclude2TestResult.xml, MultiIncludeTestDisabled.xml, MultiIncludeTestResult.xml, PI-IfStatementTest.xml, PI-IfStatementTestResult.xml, Pi-ChooseStatement2Test.xml, Pi-ChooseStatement2TestResult.xml, Pi-ChooseStatementTest.xml, Pi-ChooseStatementTestResult.xml, Pi-ComplexChooseStatementTest.xml, Pi-ComplexChooseStatementTestResult.xml, Pi-ComplexDefineDefaultTestDisabled.xml, Pi-ComplexDefineDefaultTestResult.xml, Pi-DefineDebugTestDisabled.xml, Pi-DefineDebugTestResult.xml, Pi-DefineDefaultTestDisabled.xml, Pi-DefineDefaultTestResult.xml, PropertiesMissingSilentTest.xml, PropertiesMissingSilentTestResult.xml, PropertiesWithAttributesTest.xml, PropertiesWithAttributesTestResult.xml, SimpleInclude.xml, SimplePropertiesTest.xml, SimplePropertiesTestResult.xml, SimpleTest.xml, SimpleTestResult.xml, include1.xml, include2.xml /trunk/InversionOfControl/Castle.Windsor.Tests/XmlProcessor/TestFiles/RelativeTest/ Include1.xml, Include2.xml /trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ DefaultXmlProcessorEngine.cs, DefaultXmlProcessorNodeList.cs, IXmlNodeProcessor.cs, IXmlProcessorEngine.cs, IXmlProcessorNodeList.cs, XmlProcessor.cs, XmlProcessorException.cs /trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ElementProcessors/ AbstractStatementElementProcessor.cs, AbstractXmlNodeProcessor.cs, AttributesElementProcessor.cs, ChooseElementProcessor.cs, DefaultElementProcessor.cs, DefaultTextNodeProcessor.cs, DefineElementProcessor.cs, DefinedProcessingInstructionProcessor.cs, IfElementProcessor.cs, IfProcessingInstructionProcessor.cs, IncludeElementProcessor.cs, PropertiesElementProcessor.cs, UndefElementProcessor.cs, UndefProcessingInstructionProcessor.cs /trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ WindsorMonoRailSectionHandlerTestCase.cs /trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/ ComplexTest.xml, Pi-ComplexTest.xml, Properties.xml, SimpleTest.xml /trunk/MonoRail/Castle.MonoRail.WindsorExtension/ WindsorMonoRailSectionHandler.cs Removed: /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/ XmlInterpreterTestCase.cs /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/ XslProcessorTestCase.cs /trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/ XslContext.cs, XslProcessor.cs, XslProcessor.xslt Modified: /trunk/InversionOfControl/ Changes.txt /trunk/InversionOfControl/Castle.Windsor.Tests/ Castle.Windsor.Tests.csproj /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/ config_with_include_relative.xml, config_with_include_relative2.xml /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/Properties/ PropertiesTestCase.cs /trunk/InversionOfControl/Castle.Windsor/ Castle.Windsor.csproj /trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/ XmlInterpreter.cs /trunk/MonoRail/ Changes.txt /trunk/MonoRail/Castle.MonoRail.ActiveRecordSupport.Tests/ ARFetchTestCase.cs /trunk/MonoRail/Castle.MonoRail.Framework.Tests/ Castle.MonoRail.Framework.Tests.csproj /trunk/MonoRail/Castle.MonoRail.Framework/Configuration/ MonoRailSectionHandler.cs /trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ Castle.MonoRail.WindsorExtension.Tests.csproj /trunk/MonoRail/Castle.MonoRail.WindsorExtension/ Castle.MonoRail.WindsorExtension.csproj, default.build Log: Applied Ahmed's patch (see changes.txt for more information) File Changes: Directory: /trunk/MonoRail/Castle.MonoRail.ActiveRecordSupport.Tests/ ===================================================================== File [modified]: ARFetchTestCase.cs Delta lines: +2 -1 =================================================================== --- trunk/MonoRail/Castle.MonoRail.ActiveRecordSupport.Tests/ARFetchTestCase.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.ActiveRecordSupport.Tests/ARFetchTestCase.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -55,7 +55,8 @@ DoGet("ARFetchTest/SavePeople.rails", args); AssertSuccess(); - // TODO: Check why random results returned by the page + +// TODO: Check why random results returned by the page // AssertReplyContains("[1:Name 1:1]"); // AssertReplyContains("[2:Name 2:2]"); // AssertReplyContains("[0::0]"); Directory: /trunk/MonoRail/Castle.MonoRail.Framework.Tests/ =========================================================== File [modified]: Castle.MonoRail.Framework.Tests.csproj Delta lines: +1 -1 =================================================================== --- trunk/MonoRail/Castle.MonoRail.Framework.Tests/Castle.MonoRail.Framework.Tests.csproj 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.Framework.Tests/Castle.MonoRail.Framework.Tests.csproj 2006-01-23 19:39:22 UTC (rev 1620) @@ -36,7 +36,7 @@ NoStdLib = "false" NoWarn = "" Optimize = "false" - OutputPath = "..\bin\test\" + OutputPath = "..\bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" Directory: /trunk/MonoRail/Castle.MonoRail.WindsorExtension/ ============================================================ File [modified]: Castle.MonoRail.WindsorExtension.csproj Delta lines: +5 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension/Castle.MonoRail.WindsorExtension.csproj 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension/Castle.MonoRail.WindsorExtension.csproj 2006-01-23 19:39:22 UTC (rev 1620) @@ -143,6 +143,11 @@ BuildAction = "Compile" /> <File + RelPath = "WindsorMonoRailSectionHandler.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WindsorViewComponentFactory.cs" SubType = "Code" BuildAction = "Compile" File [added]: WindsorMonoRailSectionHandler.cs Delta lines: +37 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension/WindsorMonoRailSectionHandler.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension/WindsorMonoRailSectionHandler.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,37 @@ +// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ +// +// 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 Castle.MonoRail.WindsorExtension +{ + using System.Xml; + + using Castle.MonoRail.Framework.Configuration; + using Castle.Windsor.Configuration.Interpreters.XmlProcessor; + + public class WindsorMonoRailSectionHandler : MonoRailSectionHandler + { + public WindsorMonoRailSectionHandler() : base() + { + } + + public override object Create(object parent, object configContext, XmlNode section) + { + XmlProcessor processor = new XmlProcessor(); + + XmlNode result = processor.Process(section); + + return base.Create(parent, configContext, result); + } + } +} File [modified]: default.build Delta lines: +2 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension/default.build 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension/default.build 2006-01-23 19:39:22 UTC (rev 1620) @@ -63,10 +63,12 @@ </sources> <references> + <include name="${bin.dir}/Castle.MonoRail.Framework.dll" /> <include name="${nunit.framework.dll}" /> <include name="${bin.dir}/${assembly.name}" /> <include name="${bin.dir}/Castle.MonoRail.Framework.Tests.dll" /> <include name="${bin.dir}/Castle.MonoRail.TestSupport.dll" /> + <include name="${bin.dir}/Castle.Windsor.dll" /> </references> </csc> </target> Directory: /trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ ================================================================== File [modified]: Castle.MonoRail.WindsorExtension.Tests.csproj Delta lines: +26 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/Castle.MonoRail.WindsorExtension.Tests.csproj 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/Castle.MonoRail.WindsorExtension.Tests.csproj 2006-01-23 19:39:22 UTC (rev 1620) @@ -100,6 +100,11 @@ Project = "{E572DC59-2A96-482F-BE39-E938AB47EA9D}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "Castle.MonoRail.WindsorExtension" + Project = "{6C51A1E3-7F20-4696-BFD6-829134678341}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> <Files> @@ -118,6 +123,27 @@ SubType = "Code" BuildAction = "Compile" /> + <File + RelPath = "WindsorMonoRailSectionHandlerTestCase.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ConfigFiles\ComplexTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "ConfigFiles\Pi-ComplexTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "ConfigFiles\Properties.xml" + BuildAction = "Content" + /> + <File + RelPath = "ConfigFiles\SimpleTest.xml" + BuildAction = "Content" + /> </Include> </Files> </CSHARP> File [added]: WindsorMonoRailSectionHandlerTestCase.cs Delta lines: +89 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/WindsorMonoRailSectionHandlerTestCase.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/WindsorMonoRailSectionHandlerTestCase.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,89 @@ +// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ +// +// 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 Castle.MonoRail.WindsorExtension.Tests +{ + using System; + using System.IO; + using System.Xml; + + using Castle.MonoRail.Framework.Configuration; + + using NUnit.Framework; + + [TestFixture] + public class WindsorMonoRailSectionHandlerTestCase + { + String dir = "../Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/"; + + [Test] + public void SimpleTest() + { + MonoRailConfiguration config = GetConfig("SimpleTest.xml"); + + AssertCommon(config); + } + + [Test, Ignore("Does not work on .net 2")] + public void ComplexTest() + { + MonoRailConfiguration config = GetConfig("ComplexTest.xml"); + + AssertCommon(config); + Assert.AreEqual( "PhotosDemo", config.ControllerAssemblies[1] ); + } + + [Test, Ignore("Does not work on .net 2")] + public void PiComplexTest() + { + MonoRailConfiguration config = GetConfig("Pi-ComplexTest.xml"); + + AssertCommon(config); + Assert.AreEqual( "PhotosDemo", config.ControllerAssemblies[1] ); + } + + private static void AssertCommon( MonoRailConfiguration config ) + { + Assert.AreEqual( "castleproject.org", config.SmtpConfig.Host); + Assert.AreEqual( "secret", config.SmtpConfig.Password); + Assert.AreEqual( "JoeDoe", config.SmtpConfig.Username); + Assert.AreEqual( "Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine", config.CustomViewEngineType.FullName ); + Assert.AreEqual( "MoviesDemo", config.ControllerAssemblies[0] ); + + Assert.IsTrue( config.ViewsPhysicalPath.EndsWith("views") ); + } + + public MonoRailConfiguration GetConfig(string fileName) + { + WindsorMonoRailSectionHandler configHandler = new WindsorMonoRailSectionHandler(); + + XmlDocument configFile = GetXmlDocument(fileName); + + return configHandler.Create(null, null, configFile) as MonoRailConfiguration; + } + + public XmlDocument GetXmlDocument(string fileName) + { + XmlDocument doc = new XmlDocument(); + doc.Load(GetFullPath(fileName)); + + return doc; + } + + private string GetFullPath(String fileName) + { + return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir + fileName); + } + } +} Directory: /trunk/InversionOfControl/Castle.Windsor/ ==================================================== File [modified]: Castle.Windsor.csproj Delta lines: +95 -4 =================================================================== --- trunk/InversionOfControl/Castle.Windsor/Castle.Windsor.csproj 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor/Castle.Windsor.csproj 2006-01-23 19:39:22 UTC (rev 1620) @@ -198,20 +198,111 @@ BuildAction = "Compile" /> <File - RelPath = "Configuration\Interpreters\XslContext.cs" + RelPath = "Configuration\Interpreters\XmlProcessor\DefaultXmlProcessorEngine.cs" SubType = "Code" BuildAction = "Compile" /> <File - RelPath = "Configuration\Interpreters\XslProcessor.cs" + RelPath = "Configuration\Interpreters\XmlProcessor\DefaultXmlProcessorNodeList.cs" SubType = "Code" BuildAction = "Compile" /> <File - RelPath = "Configuration\Interpreters\XslProcessor.xslt" - BuildAction = "EmbeddedResource" + RelPath = "Configuration\Interpreters\XmlProcessor\IXmlNodeProcessor.cs" + SubType = "Code" + BuildAction = "Compile" /> <File + RelPath = "Configuration\Interpreters\XmlProcessor\IXmlProcessorEngine.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\IXmlProcessorNodeList.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\XmlProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\XmlProcessorException.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\AbstractStatementElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\AbstractXmlNodeProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\AttributesElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\ChooseElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\DefaultElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\DefaultTextNodeProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\DefinedProcessingInstructionProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\DefineElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\IfElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\IfProcessingInstructionProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\IncludeElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\PropertiesElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\UndefElementProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Configuration\Interpreters\XmlProcessor\ElementProcessors\UndefProcessingInstructionProcessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Installer\DefaultComponentInstaller.cs" SubType = "Code" BuildAction = "Compile" Directory: /trunk/InversionOfControl/Castle.Windsor.Tests/ ========================================================== File [modified]: Castle.Windsor.Tests.csproj Delta lines: +232 -15 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Castle.Windsor.Tests.csproj 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Castle.Windsor.Tests.csproj 2006-01-23 19:39:22 UTC (rev 1620) @@ -86,11 +86,6 @@ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference - Name = "Castle.MicroKernel" - Project = "{8C6AADEB-D099-4D2A-8F5B-4EBC12AC9159}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference Name = "Castle.Model" Project = "{6F052973-C8E0-41EB-BAAF-B052509B5597}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" @@ -106,6 +101,11 @@ AssemblyName = "Castle.DynamicProxy" HintPath = "..\bin\Castle.DynamicProxy.dll" /> + <Reference + Name = "Castle.MicroKernel" + Project = "{8C6AADEB-D099-4D2A-8F5B-4EBC12AC9159}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> <Files> @@ -247,15 +247,15 @@ BuildAction = "Compile" /> <File + RelPath = "Configuration\ConfigXmlInterpreterTestCase.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Configuration\sample_config.xml" BuildAction = "EmbeddedResource" /> <File - RelPath = "Configuration\XmlInterpreterTestCase.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Configuration2\config_with_choose_stmt.xml" BuildAction = "EmbeddedResource" /> @@ -292,6 +292,11 @@ BuildAction = "EmbeddedResource" /> <File + RelPath = "Configuration2\ConfigWithStatementsTestCase.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Configuration2\include1.xml" BuildAction = "EmbeddedResource" /> @@ -309,11 +314,6 @@ BuildAction = "EmbeddedResource" /> <File - RelPath = "Configuration2\XslProcessorTestCase.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Configuration2\Properties\config_with_missing_properties.xml" BuildAction = "Content" /> @@ -413,6 +413,223 @@ RelPath = "ModelBuilders\methodusage1.xml" BuildAction = "Content" /> + <File + RelPath = "XmlProcessor\XmlProcessorTestCase.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "XmlProcessor\TestFiles\AssemblyInclude1.xml" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "XmlProcessor\TestFiles\AssemblyInclude2.xml" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "XmlProcessor\TestFiles\AssemblyIncludeTestDisabled.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\AssemblyIncludeTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\ChooseStatement2Test.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\ChooseStatement2TestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\ChooseStatementTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\ChooseStatementTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\ComplexPropertiesTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\ComplexPropertiesTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\DefineDebugTestDisabled.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\DefineDebugTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\DefineDefaultTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\DefineDefaultTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\IfStatementTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\IfStatementTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\include1.xml" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "XmlProcessor\TestFiles\include2.xml" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "XmlProcessor\TestFiles\InvalidElseWithFlag.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\InvalidElsifWithNoFlag.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\InvalidFlag.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\InvalidIfWithNoFlag.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\InvalidPropertiesMissing.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\InvalidUnbalancedIfStatement.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\MultiInclude2Test.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\MultiInclude2TestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\MultiIncludeTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\MultiIncludeTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ChooseStatement2Test.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ChooseStatement2TestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ChooseStatementTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ChooseStatementTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ComplexChooseStatementTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ComplexChooseStatementTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ComplexDefineDefaultTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-ComplexDefineDefaultTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-DefineDebugTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-DefineDebugTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-DefineDefaultTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\Pi-DefineDefaultTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\PI-IfStatementTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\PI-IfStatementTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\PropertiesMissingSilentTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\PropertiesMissingSilentTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\PropertiesWithAttributesTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\PropertiesWithAttributesTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\SimpleInclude.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\SimplePropertiesTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\SimplePropertiesTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\SimpleTest.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\SimpleTestResult.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\RelativeTest\Include1.xml" + BuildAction = "Content" + /> + <File + RelPath = "XmlProcessor\TestFiles\RelativeTest\Include2.xml" + BuildAction = "Content" + /> </Include> </Files> </CSHARP> Directory: /trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/ ============================================================================== File [added]: ComplexTest.xml Delta lines: +13 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/ComplexTest.xml 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/ComplexTest.xml 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,13 @@ +<monoRail includeUri="file://..\Castle.MonoRail.WindsorExtension.Tests\ConfigFiles\properties.xml" + useWindsorIntegration="true" + customSession="Castle.MonoRail.Framework.Extensions.Session.CustomSessionExtension, Castle.MonoRail.Framework.Extensions.Session" + isWeb="true"> + #{smptSettings} + <controllers> + <assembly>MoviesDemo</assembly> + <if defined="USE_PHOTO_DEMO"> + <assembly>PhotosDemo</assembly> + </if> + </controllers> + #{viewEngineNode} +</monoRail> \ No newline at end of file File [added]: Pi-ComplexTest.xml Delta lines: +13 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/Pi-ComplexTest.xml 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/Pi-ComplexTest.xml 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,13 @@ +<monoRail includeUri="file://..\Castle.MonoRail.WindsorExtension.Tests\ConfigFiles\properties.xml" + useWindsorIntegration="true" + customSession="Castle.MonoRail.Framework.Extensions.Session.CustomSessionExtension, Castle.MonoRail.Framework.Extensions.Session" + isWeb="true"> + #{smptSettings} + <controllers> + <assembly>MoviesDemo</assembly> + <?if USE_PHOTO_DEMO?> + <assembly>PhotosDemo</assembly> + <?end?> + </controllers> + #{viewEngineNode} +</monoRail> \ No newline at end of file File [added]: Properties.xml Delta lines: +21 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/Properties.xml 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/Properties.xml 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<config> + <?define USE_PHOTO_DEMO?> + + <properties> + <smptSettings> + <attributes> + <smtpHost>castleproject.org</smtpHost> + <smtpUsername>JoeDoe</smtpUsername> + <smtpPassword>secret</smtpPassword> + </attributes> + </smptSettings> + + <viewEngineNode> + <viewEngine + viewPathRoot="views" + customEngine="Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine, Castle.MonoRail.Framework.Views.NVelocity" /> + </viewEngineNode> + </properties> + +</config> \ No newline at end of file File [added]: SimpleTest.xml Delta lines: +14 -0 =================================================================== --- trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/SimpleTest.xml 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.WindsorExtension.Tests/ConfigFiles/SimpleTest.xml 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,14 @@ +<monoRail + smtpHost="castleproject.org" + smtpUsername="JoeDoe" + smtpPassword="secret" + useWindsorIntegration="true" + customSession="Castle.MonoRail.Framework.Extensions.Session.CustomSessionExtension, Castle.MonoRail.Framework.Extensions.Session" + isWeb="true"> + <controllers> + <assembly>MoviesDemo</assembly> + </controllers> + <viewEngine + viewPathRoot="views" + customEngine="Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine, Castle.MonoRail.Framework.Views.NVelocity" /> +</monoRail> \ No newline at end of file Directory: /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/ ======================================================================== File [added]: ConfigXmlInterpreterTestCase.cs Delta lines: +132 -0 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/ConfigXmlInterpreterTestCase.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/ConfigXmlInterpreterTestCase.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,132 @@ +// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ +// +// 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 Castle.Windsor.Tests.Configuration +{ + using System; + using Castle.Windsor.Configuration.Interpreters.XmlProcessor; + using NUnit.Framework; + + using Castle.Model.Resource; + using Castle.Model.Configuration; + + using Castle.MicroKernel; + using Castle.MicroKernel.SubSystems.Configuration; + + using Castle.Windsor.Configuration.Interpreters; + + + /// <summary> + /// Summary description for XmlInterpreterTestCase. + /// </summary> + [TestFixture] + public class ConfigXmlInterpreterTestCase + { + [Test] + public void ProperDeserialization() + { + DefaultConfigurationStore store = new DefaultConfigurationStore(); + + XmlInterpreter interpreter = new XmlInterpreter("sample_config.xml"); + interpreter.ProcessResource(interpreter.Source, store); + + Assert.AreEqual(2, store.GetFacilities().Length); + Assert.AreEqual(2, store.GetComponents().Length); + + IConfiguration config = store.GetFacilityConfiguration("testidengine"); + IConfiguration childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value", childItem.Value); + + config = store.GetFacilityConfiguration("testidengine2"); + Assert.IsNotNull(config); + Assert.AreEqual("value within CDATA section", config.Value); + + config = store.GetComponentConfiguration("testidcomponent1"); + childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value1", childItem.Value); + + config = store.GetComponentConfiguration("testidcomponent2"); + childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value2", childItem.Value); + } + + [Test] + public void CorrectConfigurationMapping() + { + DefaultConfigurationStore store = new DefaultConfigurationStore(); + XmlInterpreter interpreter = new XmlInterpreter("sample_config.xml"); + interpreter.ProcessResource(interpreter.Source, store); + + WindsorContainer container = new WindsorContainer(store); + + container.AddFacility("testidengine", new DummyFacility()); + } + + [Test] + public void ProperManifestDeserialization() + { + DefaultConfigurationStore store = new DefaultConfigurationStore(); + XmlInterpreter interpreter = new XmlInterpreter( + new AssemblyResource("assembly://Castle.Windsor.Tests/Configuration/sample_config.xml")); + interpreter.ProcessResource(interpreter.Source, store); + + Assert.AreEqual(2, store.GetFacilities().Length); + Assert.AreEqual(2, store.GetComponents().Length); + + IConfiguration config = store.GetFacilityConfiguration("testidengine"); + IConfiguration childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value", childItem.Value); + + config = store.GetFacilityConfiguration("testidengine2"); + Assert.IsNotNull(config); + Assert.AreEqual("value within CDATA section", config.Value); + + config = store.GetComponentConfiguration("testidcomponent1"); + childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value1", childItem.Value); + + config = store.GetComponentConfiguration("testidcomponent2"); + childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value2", childItem.Value);; + } + + [Test] + [ExpectedException(typeof(ResourceException))] + public void MissingManifestResourceConfiguration() + { + new XmlInterpreter(new AssemblyResource("assembly://Castle.Windsor.Tests/missing_config.xml")); + } + } + + public class DummyFacility : IFacility + { + public void Init(IKernel kernel, IConfiguration facilityConfig) + { + Assert.IsNotNull(facilityConfig); + IConfiguration childItem = facilityConfig.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("value", childItem.Value); + } + + public void Terminate() + { + } + } +} File [removed]: XmlInterpreterTestCase.cs Delta lines: +0 -131 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/XmlInterpreterTestCase.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Configuration/XmlInterpreterTestCase.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -1,131 +0,0 @@ -// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ -// -// 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 Castle.Windsor.Tests.Configuration -{ - using System; - - using NUnit.Framework; - - using Castle.Model.Resource; - using Castle.Model.Configuration; - - using Castle.MicroKernel; - using Castle.MicroKernel.SubSystems.Configuration; - - using Castle.Windsor.Configuration.Interpreters; - - - /// <summary> - /// Summary description for XmlInterpreterTestCase. - /// </summary> - [TestFixture] - public class XmlInterpreterTestCase - { - [Test] - public void ProperDeserialization() - { - DefaultConfigurationStore store = new DefaultConfigurationStore(); - XmlInterpreter interpreter = new XmlInterpreter("sample_config.xml"); - interpreter.ProcessResource(interpreter.Source, store); - - Assert.AreEqual(2, store.GetFacilities().Length); - Assert.AreEqual(2, store.GetComponents().Length); - - IConfiguration config = store.GetFacilityConfiguration("testidengine"); - IConfiguration childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value", childItem.Value); - - config = store.GetFacilityConfiguration("testidengine2"); - Assert.IsNotNull(config); - Assert.AreEqual("value within CDATA section", config.Value); - - config = store.GetComponentConfiguration("testidcomponent1"); - childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value1", childItem.Value); - - config = store.GetComponentConfiguration("testidcomponent2"); - childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value2", childItem.Value); - } - - [Test] - public void CorrectConfigurationMapping() - { - DefaultConfigurationStore store = new DefaultConfigurationStore(); - XmlInterpreter interpreter = new XmlInterpreter("sample_config.xml"); - interpreter.ProcessResource(interpreter.Source, store); - - WindsorContainer container = new WindsorContainer(store); - - container.AddFacility("testidengine", new DummyFacility()); - } - - [Test] - public void ProperManifestDeserialization() - { - DefaultConfigurationStore store = new DefaultConfigurationStore(); - XmlInterpreter interpreter = new XmlInterpreter( - new AssemblyResource("assembly://Castle.Windsor.Tests/Configuration/sample_config.xml")); - interpreter.ProcessResource(interpreter.Source, store); - - Assert.AreEqual(2, store.GetFacilities().Length); - Assert.AreEqual(2, store.GetComponents().Length); - - IConfiguration config = store.GetFacilityConfiguration("testidengine"); - IConfiguration childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value", childItem.Value); - - config = store.GetFacilityConfiguration("testidengine2"); - Assert.IsNotNull(config); - Assert.AreEqual("value within CDATA section", config.Value); - - config = store.GetComponentConfiguration("testidcomponent1"); - childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value1", childItem.Value); - - config = store.GetComponentConfiguration("testidcomponent2"); - childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value2", childItem.Value);; - } - - [Test] - [ExpectedException(typeof(ResourceException))] - public void MissingManifestResourceConfiguration() - { - new XmlInterpreter(new AssemblyResource("assembly://Castle.Windsor.Tests/missing_config.xml")); - } - } - - public class DummyFacility : IFacility - { - public void Init(IKernel kernel, IConfiguration facilityConfig) - { - Assert.IsNotNull(facilityConfig); - IConfiguration childItem = facilityConfig.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("value", childItem.Value); - } - - public void Terminate() - { - } - } -} Directory: /trunk/MonoRail/Castle.MonoRail.Framework/Configuration/ =================================================================== File [modified]: MonoRailSectionHandler.cs Delta lines: +1 -2 =================================================================== --- trunk/MonoRail/Castle.MonoRail.Framework/Configuration/MonoRailSectionHandler.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/MonoRail/Castle.MonoRail.Framework/Configuration/MonoRailSectionHandler.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -19,7 +19,6 @@ using System.Configuration; using System.IO; using System.Xml; - using Castle.MonoRail.Framework; using Castle.MonoRail.Framework.Internal; @@ -47,7 +46,7 @@ #region IConfigurationSectionHandler implementation - public object Create(object parent, object configContext, XmlNode section) + public virtual object Create(object parent, object configContext, XmlNode section) { MonoRailConfiguration config = new MonoRailConfiguration(); Directory: /trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/ ========================================================================= File [added]: ConfigWithStatementsTestCase.cs Delta lines: +86 -0 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/ConfigWithStatementsTestCase.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/ConfigWithStatementsTestCase.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,86 @@ +// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ +// +// 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 Castle.Windsor.Tests.Configuration2 +{ + using System; + using System.IO; + + using NUnit.Framework; + + using Castle.Model.Configuration; + + using Castle.MicroKernel; + + [TestFixture] + public class ConfigWithStatementsTestCase + { + String dir = "../Castle.Windsor.Tests/Configuration2/"; + + private IWindsorContainer container; + + [Test] + public void SimpleIf() + { + String file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir + + "config_with_if_stmt.xml"); + + container = new WindsorContainer(file); + + IConfigurationStore store = container.Kernel.ConfigurationStore; + + Assert.AreEqual(4, store.GetComponents().Length); + + IConfiguration config = store.GetComponentConfiguration("debug"); + Assert.IsNotNull(config); + + IConfiguration childItem = config.Children["item"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("some value", childItem.Value); + + childItem = config.Children["item2"]; + Assert.IsNotNull(childItem); + Assert.AreEqual("some <&> value2", childItem.Value); + + config = store.GetComponentConfiguration("qa"); + Assert.IsNotNull(config); + + config = store.GetComponentConfiguration("default"); + Assert.IsNotNull(config); + + config = store.GetComponentConfiguration("notprod"); + Assert.IsNotNull(config); + } + + [Test] + public void SimpleChoose() + { + foreach(string flag in new string[]{ "debug", "prod", "qa", "default" } ) + { + String file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir + + "config_with_define_" + flag + ".xml"); + + container = new WindsorContainer(file); + + IConfigurationStore store = container.Kernel.ConfigurationStore; + + Assert.AreEqual(1, store.GetComponents().Length); + + IConfiguration config = store.GetComponentConfiguration(flag); + + Assert.IsNotNull(config); + } + } + } +} File [removed]: XslProcessorTestCase.cs Delta lines: +0 -86 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/XslProcessorTestCase.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/XslProcessorTestCase.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -1,86 +0,0 @@ -// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ -// -// 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 Castle.Windsor.Tests.Configuration2 -{ - using System; - using System.IO; - - using NUnit.Framework; - - using Castle.Model.Configuration; - - using Castle.MicroKernel; - - [TestFixture] - public class XslProcessorTestCase - { - String dir = "../Castle.Windsor.Tests/Configuration2/"; - - private IWindsorContainer container; - - [Test] - public void SimpleIf() - { - String file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir + - "config_with_if_stmt.xml"); - - container = new WindsorContainer(file); - - IConfigurationStore store = container.Kernel.ConfigurationStore; - - Assert.AreEqual(4, store.GetComponents().Length); - - IConfiguration config = store.GetComponentConfiguration("debug"); - Assert.IsNotNull(config); - - IConfiguration childItem = config.Children["item"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("some value", childItem.Value); - - childItem = config.Children["item2"]; - Assert.IsNotNull(childItem); - Assert.AreEqual("some <&> value2", childItem.Value); - - config = store.GetComponentConfiguration("qa"); - Assert.IsNotNull(config); - - config = store.GetComponentConfiguration("default"); - Assert.IsNotNull(config); - - config = store.GetComponentConfiguration("notprod"); - Assert.IsNotNull(config); - } - - [Test] - public void SimpleChoose() - { - foreach(string flag in new string[]{ "debug", "prod", "qa", "default" } ) - { - String file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir + - "config_with_define_" + flag + ".xml"); - - container = new WindsorContainer(file); - - IConfigurationStore store = container.Kernel.ConfigurationStore; - - Assert.AreEqual(1, store.GetComponents().Length); - - IConfiguration config = store.GetComponentConfiguration(flag); - - Assert.IsNotNull(config); - } - } - } -} File [modified]: config_with_include_relative.xml Delta lines: +1 -2 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/config_with_include_relative.xml 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/config_with_include_relative.xml 2006-01-23 19:39:22 UTC (rev 1620) @@ -1,6 +1,5 @@ -<configuration> +<configuration includeUri="file://RelativeTest/rel_include1.xml"> - <include uri="file://RelativeTest/rel_include1.xml"/> <include uri="file://RelativeTest/rel_include2.xml"/> </configuration> \ No newline at end of file File [modified]: config_with_include_relative2.xml Delta lines: +3 -3 =================================================================== --- trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/config_with_include_relative2.xml 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor.Tests/Configuration2/config_with_include_relative2.xml 2006-01-23 19:39:22 UTC (rev 1620) @@ -1,6 +1,6 @@ -<configuration> +<configuration includeUri="file://RelativeTest2/../RelativeTest/rel_include1.xml, file://RelativeTest2/../RelativeTest/rel_include2.xml"> - <include uri="file://RelativeTest2/../RelativeTest/rel_include1.xml"/> - <include uri="file://RelativeTest2/../RelativeTest/rel_include2.xml"/> +<!-- <include uri=""/> + <include uri=""/> --> </configuration> \ No newline at end of file Directory: /trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ElementProcessors/ ============================================================================================================== File [added]: AbstractStatementElementProcessor.cs Delta lines: +57 -0 =================================================================== --- trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ElementProcessors/AbstractStatementElementProcessor.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ElementProcessors/AbstractStatementElementProcessor.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,57 @@ +// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ +// +// 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 Castle.Windsor.Configuration.Interpreters.XmlProcessor.ElementProcessors +{ + using System; + using System.Xml; + + public abstract class AbstractStatementElementProcessor : AbstractXmlNodeProcessor + { + private static readonly String DefinedAttrName = "defined"; + private static readonly String NotDefinedAttrName = "not-defined"; + + public AbstractStatementElementProcessor() + { + } + + protected bool ProcessStatement(XmlElement element, IXmlProcessorEngine engine) + { + if (!element.HasAttribute(DefinedAttrName) && + !element.HasAttribute(NotDefinedAttrName)) + { + throw new XmlProcessorException("'if' elements expects a non empty defined or not-defined attribute"); + } + + if (element.HasAttribute(DefinedAttrName) && + element.HasAttribute(NotDefinedAttrName)) + { + throw new XmlProcessorException("'if' elements expects a non empty defined or not-defined attribute"); + } + + bool processContents = false; + + if (element.HasAttribute(DefinedAttrName)) + { + processContents = engine.HasFlag(element.GetAttribute(DefinedAttrName)); + } + else + { + processContents = !engine.HasFlag(element.GetAttribute(NotDefinedAttrName)); + } + + return processContents; + } + } +} \ No newline at end of file File [added]: AbstractXmlNodeProcessor.cs Delta lines: +155 -0 =================================================================== --- trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ElementProcessors/AbstractXmlNodeProcessor.cs 2006-01-23 17:07:44 UTC (rev 1619) +++ trunk/InversionOfControl/Castle.Windsor/Configuration/Interpreters/XmlProcessor/ElementProcessors/AbstractXmlNodeProcessor.cs 2006-01-23 19:39:22 UTC (rev 1620) @@ -0,0 +1,155 @@ +// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ +// +// 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 Castle.Windsor.Configuration.Interpreters.XmlProcessor.ElementProcessors +{ + using System; + using System.Xml; + + public abstract class AbstractXmlNodeProcessor : IXmlNodeProcessor + { + private static readonly XmlNodeType[] acceptNodes = new XmlNodeType[] {XmlNodeType.Element}; + + public AbstractXmlNodeProcessor() + { + } + + public abstract String Name { get; } + + protected virtual bool IgnoreNode(XmlNode node) + { + return node.NodeType == XmlNodeType.Comment || + node.NodeType == XmlNodeType.Entity || + node.NodeType == XmlNodeType.EntityReference; + } + + public virtual XmlNodeType[] AcceptNodeTypes + { + get { return acceptNodes; } + } + + /// <summary> + /// Accepts the specified node. + /// Check if node has the same name as the processor and the node.NodeType + /// is in the AcceptNodeTypes List + /// </summary> + /// <param name="node">The node.</param> + /// <returns></returns> + public virtual bool Accept(XmlNode node) + { + return node.Name == Name && Array.... [truncated message content] |