<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2002-2005 the original author or authors.

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.
-->
<configuration>

  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
    <section name="objects" type="Spring.Objects.Factory.Xml.ObjectFactorySectionHandler, Spring.Core" />
    
    <section name="DaoConfiguration" type="System.Configuration.NameValueSectionHandler"/>
    <section name="DatabaseConfiguration" type="System.Configuration.NameValueSectionHandler"/>

    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />      
    </sectionGroup>
    
    <sectionGroup name='spring'>
      <section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
      <section name='context' type='Spring.HookableContextHandler, Spring.Core.Tests'/>
      <section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
      <sectionGroup name="child">
        <section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
      </sectionGroup>
    </sectionGroup>

    <!-- need a second section for another independent test as CongfigurationSettings.GetConfig will -->
    <!-- not be called twice by .NET -->
    <sectionGroup name='spring2'>
      <section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
      <section name='context' type='Spring.Context.Support.ContextHandler, Spring.Core'/>
      <section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
      <sectionGroup name="child">
        <section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
      </sectionGroup>
      <sectionGroup name="grandchild">
        <section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Simple.NoOpLoggerFactoryAdapter, Common.Logging"/>
    </logging>
  </common>
  
  <spring>

    <parsers>
      <parser namespace="http://schemas.springframework.net/testobject" 
              type="Spring.Context.Support.TestObjectConfigParser, Spring.Core.Tests"
              schemaLocation="assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd"/>
    </parsers>

    <!-- parent context -->
    <context
			type='Spring.Context.Support.XmlApplicationContext, Spring.Core'
			name='Parent'>
      <resource uri='config://spring/objects'/>
      <!-- child context -->
      <context name='Child'>
        <resource uri='config://spring/child/objects'/>
      </context>
    </context>

    <!-- parent context's objects -->
    <objects xmlns='http://www.springframework.net' xmlns:to="http://schemas.springframework.net/testobject">
      <object id='Parent' type='Spring.Objects.TestObject,Spring.Core.Tests'>
        <property name='name' value='Parent'/>
      </object>
      <to:testobject>
        <to:age>12</to:age>
        <to:name>John</to:name>
      </to:testobject>
    </objects>


    <!-- child context's objects -->
    <child>
      <objects xmlns='http://www.springframework.net'>
        <object id='Child' type='Spring.Objects.TestObject,Spring.Core.Tests'>
          <property name='name' value='Child'/>
        </object>
      </objects>
    </child>
  </spring>

  <spring2>

    <!-- parent context -->
    <context
			type='Spring.Context.Support.XmlApplicationContext, Spring.Core'
			name='Parent'>
      <resource uri='config://spring2/objects'/>
      <!-- child context -->
      <context name='Child'>
        <resource uri='config://spring2/child/objects'/>
        <!-- grandchild context -->
        <context name='Grandchild'>
          <resource uri='config://spring2/grandchild/objects'/>
        </context>
      </context>
    </context>

    <!-- parent context's objects -->
    <objects xmlns='http://www.springframework.net'>
      <object id='Parent' type='Spring.Objects.TestObject,Spring.Core.Tests'>
        <property name='name' value='Parent'/>
      </object>
    </objects>

    <!-- child context's objects -->
    <child>
      <objects xmlns='http://www.springframework.net'>
        <object id='Child' type='Spring.Objects.TestObject, Spring.Core.Tests'>
          <property name='name' value='Child'/>
        </object>
      </objects>
    </child>

    <!-- grandchild context's objects -->
    <grandchild>
      <objects xmlns='http://www.springframework.net'>
        <object id='Grandchild' type='Spring.Objects.TestObject, Spring.Core.Tests'>
          <property name='name' value='Grandchild'/>
        </object>
      </objects>
    </grandchild>
  </spring2>

  <DaoConfiguration>
    <add key="maxResults" value="1000"/>
  </DaoConfiguration>

  <DatabaseConfiguration>
    <add key="connection.string" value="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb;User ID=Admin;Password=;"/>
  </DatabaseConfiguration>

  <connectionStrings>
    <add name="mySqlDataSource" connectionString="mySqlServerConnectionString"/>
    <add name="myOracleDataSource" connectionString="myOracleConnectionString" providerName="System.Data.OracleClient"/>
  </connectionStrings>
  
  <objects xmlns='http://www.springframework.net'>
    <object name="foo" type="Spring.Objects.TestObject, Spring.Core.Tests" />
    <object id="rod" type="Spring.Objects.TestObject, Spring.Core.Tests">
      <property name="name">
        <value>Rod</value>
      </property>
      <property name="age">
        <value>31</value>
      </property>
    </object>
    <object id="roderick" parent="rod">
      <property name="name">
        <value>Roderick</value>
      </property>
    </object>
    <object id="kerry" type="Spring.Objects.TestObject, Spring.Core.Tests">
      <property name="name">
        <value>Kerry</value>
      </property>
      <property name="age">
        <value>34</value>
      </property>
      <property name="spouse">
        <ref local="rod" />
      </property>
    </object>
    <object id="bootstrapObjectFactory" type="Spring.MockObjectFactory, Spring.Core.Tests"/>
    <object id="bootstrapNonObjectFactory" type="Spring.Objects.TestObject, Spring.Core.Tests"/>
  </objects>

  <log4net>
    <appender name="NullAppender" type="Spring.Objects.Factory.Xml.NullAppender, Spring.Core.Tests"/>
    <root>
      <level value="ALL" />
      <appender-ref ref="NullAppender" />
    </root>
  </log4net>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
        <bindingRedirect oldVersion="2.0.6.0" newVersion="2.1.4.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

</configuration>
