<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
    xmlns:file="http://www.mulesource.org/schema/mule/file/2.0"
    xmlns:test="http://www.mulesource.org/schema/mule/test/2.0"
    xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.0"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
       http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
       http://www.mulesource.org/schema/mule/file/2.0 http://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd
       http://www.mulesource.org/schema/mule/test/2.0 http://www.mulesource.org/schema/mule/test/2.0/mule-test.xsd
       http://www.mulesource.org/schema/mule/xml/2.0 http://www.mulesource.org/schema/mule/xml/2.0/mule-xml.xsd">

    <configuration defaultSynchronousEventTimeout="1001"/>

    <vm:connector name="vmConnector1"/>
    <vm:connector name="vmConnector2"/>
    <test:connector name="testConnector1"/>
    <!-- need second connector as "create connector" no longer supported
         and we want same uri to be used twice on inbound  -->
    <test:connector name="testConnector2"/>

    <file:file-to-string-transformer name="ObjectToFileMessage"/>
    <xm:object-to-xml-transformer name="ObjectToXml"/>
    <xm:xml-to-object-transformer name="XmlToObject"/>

    <endpoint name="server1" address="tcp://localhost:45431" />
    <endpoint name="server2" address="tcp://localhost:45432" />
    <endpoint name="server3" address="tcp://localhost:45433" />
    <endpoint name="testEndpoint" address="vm://another.queue" connector-ref="vmConnector1" transformer-refs="ObjectToXml" />
    <endpoint name="testEndpoint2" address="vm://yet.another.queue" connector-ref="vmConnector1" transformer-refs="ObjectToXml" />

    <model name="main">
        
        <!-- Test sendEndpoint and receive endpoint as URIs where the test connector will be
            used from the above config and the stdio connector will be create dymanically
        -->
        <service name="TestComponent1">
            <inbound>
                <inbound-endpoint address="test://localhost/test.queue" connector-ref="testConnector1" />
            </inbound>
            <component class="org.mule.tck.testmodels.services.TestComponent"/>
            <outbound>
                <outbound-pass-through-router>
                    <outbound-endpoint address="stdio://System.out" />
                </outbound-pass-through-router>
            </outbound>
        </service>

        <service name="TestComponent2">
            <inbound>
                <inbound-endpoint address="test://localhost/test.queue" connector-ref="testConnector2" transformer-refs="XmlToObject" />
            </inbound>
            <component class="org.mule.tck.testmodels.services.TestComponent"/>
        </service>

        <!-- Test uri endpoints for send and receive and Uri endpoints on the outbound router -->
        <service name="TestComponent3">
            <inbound>
                <inbound-endpoint ref="testEndpoint"/>
            </inbound>
            <component class="org.mule.tck.testmodels.services.TestComponent"/>
            <outbound>
                <filtering-router>
                    <outbound-endpoint name="tcp1" address="tcp://localhost:60201"/>
                </filtering-router>
                <multicasting-router>
                    <outbound-endpoint address="udp://localhost:56731" />
                    <outbound-endpoint address="test://test.queue2" connector-ref="testConnector1"/>
                </multicasting-router>
            </outbound>
        </service>

        <!-- test Uri receiver endpoint specifying a provider with endpoint overrriden and
             test outbound router config combining endpoints -->
        <service name="TestComponent4">
            <inbound>
                <!-- this didn't make sense? -->
                <!-- inbound-endpoint address="vm://queue4" connector-ref="testConnector1" / -->
                <inbound-endpoint address="vm://queue4"  connector-ref="vmConnector2" transformer-refs="ObjectToXml"/>
            </inbound>
            <component class="org.mule.tck.testmodels.services.TestComponent"/>
            <outbound>
                <filtering-router>
                    <outbound-endpoint address="udp://localhost:56731" />
                    <outbound-endpoint ref="testEndpoint2" />
                </filtering-router>
            </outbound>
        </service>

        <service name="TestComponent5">
            <inbound>
                <inbound-endpoint address="vm://some.queue" connector-ref="vmConnector2" />
            </inbound>
            <component class="org.mule.tck.testmodels.services.TestComponent"/>
            <outbound>
                <filtering-router>
                    <outbound-endpoint ref="server1" />
                    <outbound-endpoint ref="server2" />
                </filtering-router>
            </outbound>
        </service>

        <service name="TestComponent6">
            <component class="org.mule.tck.testmodels.services.TestComponent"/>
            <outbound>
                <filtering-router>
                    <outbound-endpoint ref="server3" />
                </filtering-router>
            </outbound>
        </service>

    </model>

</mule>
