Oracle Data source configuration in MULE
<p>I've created a project using the apikit-with-munit example project.</p>

<p>I mavenized my project and now have 1 app file called api.xml and 1 api-test-suite.xml file. I'm trying to add a db reference in my test and I'm coming across the following error when launching my tests <strong>when launching the test from Maven only.</strong> </p>

<p>When launching my tests from Anypoint Studio, My MUnit works fine.</p>

<p><strong>I dont't know what is wrong with my config... I suspect my problem is related to my namespaces Can someone point out what I'm doing wrong?</strong> </p>

<pre><code>Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.1.0:test (test) on project testing-apikit-with-munit_1.3.3-1: 
Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.1.0:test failed: org.mule.api.config.ConfigurationException: 
Configuration problem: Failed to import bean definitions from URL location [classpath:api.xml]
</code></pre>

<p><strong>[ERROR] Offending resource: URL [file:/C:/Workspaces/Coverage1/testing-apikit-with-munit_1.3.3-1/target/test-classes/api-test-suite.xml]; 
    nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 40 in XML document from class path resource [api.xml] is invalid; 
    nested exception is org.xml.sax.SAXParseException; lineNumber: 40; columnNumber: 101; cvc-complex-type.2.4.a: Invalid content was found starting with element 'db:oracle-config'.</strong> </p>

<pre><code> One of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean,   "http://www.springframework.org/schema/context":property-placeholder, 
"http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, 
"http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, 
"http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, 
"http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, 
"http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, 
"http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, 
"http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, 
"http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, 
"http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, 
"http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, 
"http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, 
"http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke, 
"http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, 
"http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected. (org.mule.api.lifecycle.InitialisationException)
</code></pre>

<p>my api.xml file:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;mule xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns="http://www.mulesoft.org/schema/mule/core" 
xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" 
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
xmlns:http="http://www.mulesoft.org/schema/mule/http" 
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd 
                    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd 
                    http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd 
                    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
                    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
                    http://www.mulesoft.org/schema/mule/apikit http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd 
                    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
                    http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"&gt;

 &lt;apikit:config consoleEnabled="true" consolePath="console" doc:name="Router" name="api-config" raml="api.raml"&gt;
    &lt;apikit:flow-mapping action="get" flow-ref="get:/munit:api-config" resource="/munit"/&gt;
    &lt;apikit:flow-mapping action="post" flow-ref="post:/munit:api-config" resource="/munit"/&gt;
    &lt;apikit:flow-mapping action="put" flow-ref="put:/munit:api-config" resource="/munit"/&gt;
    &lt;apikit:flow-mapping action="delete" flow-ref="delete:/munit:api-config" resource="/munit"/&gt;
&lt;/apikit:config&gt;

    &lt;!-- Configure the data source bean --&gt;
&lt;spring:beans&gt;
    &lt;spring:bean id="dbwebDataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
        &lt;spring:property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/&gt;
        &lt;spring:property name="url"             value="jdbc:oracle:thin:@server:1111:DB"/&gt;
        &lt;spring:property name="username"        value="xxxx"/&gt;
        &lt;spring:property name="password"         value="xxxx"/&gt;
        &lt;spring:property name="initialSize"     value="1"/&gt;
        &lt;spring:property name="maxActive"       value="3"/&gt;
    &lt;/spring:bean&gt;
&lt;/spring:beans&gt;

&lt;db:oracle-config name="dbweb" dataSource-ref="dbwebDataSource" doc:name="dbweb configuration"/&gt;

&lt;http:listener-config doc:name="HTTP Listener Configuration" host="0.0.0.0" name="HTTP_Listener_Configuration" port="9090"/&gt;

&lt;apikit:mapping-exception-strategy name="api-apiKitGlobalExceptionMapping"&gt;
    &lt;apikit:mapping statusCode="404"&gt;
        &lt;apikit:exception value="org.mule.module.apikit.exception.NotFoundException"/&gt;
        &lt;set-property doc:name="Property" propertyName="Content-Type" value="application/json"/&gt;
        &lt;set-payload doc:name="Set Payload" value="{ &amp;quot;message&amp;quot;: &amp;quot;Resource not found&amp;quot; }"/&gt;
    &lt;/apikit:mapping&gt;
    &lt;apikit:mapping statusCode="405"&gt;
        &lt;apikit:exception value="org.mule.module.apikit.exception.MethodNotAllowedException"/&gt;
        &lt;set-property doc:name="Property" propertyName="Content-Type" value="application/json"/&gt;
        &lt;set-payload doc:name="Set Payload" value="{ &amp;quot;message&amp;quot;: &amp;quot;Method not allowed&amp;quot; }"/&gt;
    &lt;/apikit:mapping&gt;
    &lt;apikit:mapping statusCode="415"&gt;
        &lt;apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException"/&gt;
        &lt;set-property doc:name="Property" propertyName="Content-Type" value="application/json"/&gt;
        &lt;set-payload doc:name="Set Payload" value="{ &amp;quot;message&amp;quot;: &amp;quot;Unsupported media type&amp;quot; }"/&gt;
    &lt;/apikit:mapping&gt;
    &lt;apikit:mapping statusCode="406"&gt;
        &lt;apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException"/&gt;
        &lt;set-property doc:name="Property" propertyName="Content-Type" value="application/json"/&gt;
        &lt;set-payload doc:name="Set Payload" value="{ &amp;quot;message&amp;quot;: &amp;quot;Not acceptable&amp;quot; }"/&gt;
    &lt;/apikit:mapping&gt;
    &lt;apikit:mapping statusCode="400"&gt;
        &lt;apikit:exception value="org.mule.module.apikit.exception.BadRequestException"/&gt;
        &lt;set-property doc:name="Property" propertyName="Content-Type" value="application/json"/&gt;
        &lt;set-payload doc:name="Set Payload" value="{ &amp;quot;message&amp;quot;: &amp;quot;Bad request&amp;quot; }"/&gt;
    &lt;/apikit:mapping&gt;
&lt;/apikit:mapping-exception-strategy&gt;

&lt;flow name="api-main"&gt;
    &lt;http:listener config-ref="HTTP_Listener_Configuration" doc:name="HTTP" path="api/*"/&gt;

    &lt;apikit:router config-ref="api-config" doc:name="APIkit Router"/&gt;
    &lt;exception-strategy doc:name="Reference Exception Strategy" ref="api-apiKitGlobalExceptionMapping"/&gt;
&lt;/flow&gt;

&lt;flow name="put:/munit:api-config"&gt;
    &lt;set-payload doc:name="Set Payload" value="#['PUT RESPONSE']"/&gt;
&lt;/flow&gt;

&lt;flow name="delete:/munit:api-config"&gt;

    &lt;set-payload doc:name="Set Payload" value="#['DELETE RESPONSE']"/&gt;
&lt;/flow&gt;

&lt;flow name="post:/munit:api-config"&gt;

    &lt;set-payload doc:name="Set Payload" value="#['POST RESPONSE']"/&gt;
&lt;/flow&gt;

&lt;flow name="get:/munit:api-config"&gt;

    &lt;vm:inbound-endpoint exchange-pattern="request-response" path="serviceA" doc:name="Service A"/&gt;

    &lt;db:select config-ref="dbweb" doc:name="select items"&gt;
        &lt;db:parameterized-query&gt;&lt;![CDATA[${sql.dbweb.select.items}]]&gt;&lt;/db:parameterized-query&gt;
    &lt;/db:select&gt;
&lt;/flow&gt;
</code></pre>

<p></p>

<p>my api-test-suite.xml file:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
  xmlns="http://www.mulesoft.org/schema/mule/core" 
  xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
  xmlns:munit="http://www.mulesoft.org/schema/mule/munit" 
  xmlns:spring="http://www.springframework.org/schema/beans" 
  xmlns:core="http://www.mulesoft.org/schema/mule/core" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
                      http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
                      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
                      http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd"&gt;

&lt;munit:config doc:name="Munit configuration" mock-connectors="false" mock-inbounds="false"/&gt;
&lt;spring:beans&gt;
    &lt;spring:import resource="classpath:api.xml"/&gt;
&lt;/spring:beans&gt;
&lt;http:request-config name="HTTP_Request_Configuration" host="localhost" port="9090" basePath="api" doc:name="HTTP Request Configuration"&gt;
&lt;/http:request-config&gt;

&lt;munit:test name="api-test-get" description="Test"&gt;
    &lt;munit:set payload="#['']" doc:name="Set Message"/&gt;
    &lt;http:request config-ref="HTTP_Request_Configuration" path="/munit" method="GET" doc:name="HTTP"/&gt;
    &lt;object-to-string-transformer doc:name="Object to String"/&gt;
    &lt;munit:assert-on-equals message="The HTTP Status code is not correct!" expectedValue="#[200]" actualValue="#[message.inboundProperties['http.status']]" doc:name="Assert Equals"/&gt;
    &lt;munit:assert-payload-equals message="The response payload is not correct!" expectedValue="&amp;quot;GET RESPONSE&amp;quot;" doc:name="Assert Payload"/&gt;
&lt;/munit:test&gt;

&lt;munit:test name="api-test-post" description="Test"&gt;
    &lt;munit:set payload="#['']" doc:name="Set Message"/&gt;
    &lt;http:request config-ref="HTTP_Request_Configuration" path="/munit" method="POST" doc:name="HTTP"/&gt;
    &lt;object-to-string-transformer doc:name="Object to String"/&gt;
    &lt;munit:assert-on-equals message="The HTTP Status code is not correct!" expectedValue="#[201]" actualValue="#[message.inboundProperties['http.status']]" doc:name="Assert Equals"/&gt;
    &lt;munit:assert-payload-equals message="The response payload is not correct!" expectedValue="&amp;quot;POST RESPONSE&amp;quot;" doc:name="Assert Payload"/&gt;
&lt;/munit:test&gt;

&lt;munit:test name="api-test-put" description="Test"&gt;
    &lt;munit:set payload="#['']" doc:name="Set Message"/&gt;
    &lt;http:request config-ref="HTTP_Request_Configuration" path="/munit" method="PUT" doc:name="HTTP"/&gt;
    &lt;object-to-string-transformer doc:name="Object to String"/&gt;
    &lt;munit:assert-on-equals message="The HTTP Status code is not correct!" expectedValue="#[201]" actualValue="#[message.inboundProperties['http.status']]" doc:name="Assert Equals"/&gt;
    &lt;munit:assert-payload-equals message="The response payload is not correct!" expectedValue="&amp;quot;PUT RESPONSE&amp;quot;" doc:name="Assert Payload"/&gt;
&lt;/munit:test&gt;

&lt;munit:test name="api-test-delete" description="Test"&gt;
    &lt;munit:set payload="#['']" doc:name="Set Message"/&gt;
    &lt;http:request config-ref="HTTP_Request_Configuration" path="/munit" method="DELETE" doc:name="HTTP"/&gt;
    &lt;object-to-string-transformer doc:name="Object to String"/&gt;
    &lt;munit:assert-on-equals message="The HTTP Status code is not correct!" expectedValue="#[200]" actualValue="#[message.inboundProperties['http.status']]" doc:name="Assert Equals"/&gt;
    &lt;munit:assert-payload-equals message="The response payload is not correct!" expectedValue="&amp;quot;DELETE RESPONSE&amp;quot;" doc:name="Assert Payload"/&gt;
&lt;/munit:test&gt;
</code></pre>

<p></p>