Unit testing 发现以元素';开头的内容无效;石英:连接器';运行Mule单元测试时

Unit testing 发现以元素';开头的内容无效;石英:连接器';运行Mule单元测试时,unit-testing,mule,quartz-scheduler,Unit Testing,Mule,Quartz Scheduler,我正在尝试为使用石英连接器的Mule流编写一个单元测试。但是,我收到以下XML错误,说明Mule在运行单元测试时不知道如何解析“quartz connector”标记。但是,quartz-2.0.2.jar和quartz-1.8.5.jar都在我的类路径中,正如您在下面看到的,我已经将quartz添加到XML名称空间中,并将XSD添加到根标记中。我已经在很多论坛上搜索过了,包括这一个,但是我找不到解决我错误的方法。请告诉我我做错了什么。我使用MuleStudio 3.5.0和JDK1.7来运行这

我正在尝试为使用石英连接器的Mule流编写一个单元测试。但是,我收到以下XML错误,说明Mule在运行单元测试时不知道如何解析“quartz connector”标记。但是,quartz-2.0.2.jar和quartz-1.8.5.jar都在我的类路径中,正如您在下面看到的,我已经将quartz添加到XML名称空间中,并将XSD添加到根标记中。我已经在很多论坛上搜索过了,包括这一个,但是我找不到解决我错误的方法。请告诉我我做错了什么。我使用MuleStudio 3.5.0和JDK1.7来运行这个单元测试

错误

骡流


缺少JAR依赖项


与其手动添加JAR,不如使用Maven将Mule-Quartz传输JAR引入到您的项目中,这将带来它所需的所有依赖项。只需确保将传输范围限定为所提供的

是否添加了此依赖项:mule-transport-quartz-3.5.0-M4.jar?我这样做了,收到了以下错误:[05-12 18:42:07]WARN XmlBeanDefinitionReader[Thread-0]:忽略了XML验证警告org.XML.sax.saxpraseException;系统ID:;行号:17;栏目号:106;架构_引用。4:未能读取架构文档“”,因为1)找不到该文档;2) 文件无法读取;3) 文档的根元素不是。它是警告而不是错误。@DavidDossot Oops,真正的错误是:org.mule.api.config.ConfigurationException:从URL解析XML文档时出现意外异常;嵌套异常是java.lang.NoClassDefFoundError:org/quartz/SchedulerFactory(org.mule.api.lifecycle.InitializationException)谢谢!这和主要是Ale Sequeira添加mule-transport-quartz-3.5.0-M4.jar的响应解决了这个问题。
org.mule.api.config.ConfigurationException: Line 9 in XML document from URL [file:/C:/Users/smith/Development/MuleStudio_Workspace/funnel-mule-app/funnel-mule-app-batch/funnel-mule-app-batch-int/src/main/app/log_cleanup.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 89; cvc-complex-type.2.4.a: Invalid content was found starting with element 'quartz:connector'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "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-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-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":invoke, "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)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84)
    at org.mule.tck.junit4.AbstractMuleContextTestCase.createMuleContext(AbstractMuleContextTestCase.java:203)
    at org.mule.tck.junit4.AbstractMuleContextTestCase.setUpMuleContext(AbstractMuleContextTestCase.java:133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:46)
    at org.junit.internal.runners.statements.FailOnTimeout$1.run(FailOnTimeout.java:28)
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.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
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
    <quartz:connector name="TimeToStart2" validateConnections="true" doc:name="Quartz"/>    
    <flow name="cleanup_flow" doc:name="cleanup_flow">
        <quartz:inbound-endpoint name="LogCleanUpStart" jobName="LogCleanUp" cronExpression="${log.cleanup.cron.start}" repeatInterval="0" responseTimeout="10000" connector-ref="TimeToStart2" doc:name="Scheduler">
            <quartz:event-generator-job/>
        </quartz:inbound-endpoint>
        <set-variable variableName="#['failCounter']" value="#[0]" doc:name="Init Fail Counter"/>
        <logger message="Log Cleanup Started" level="INFO" doc:name="StartLogger"/>
        <flow-ref name="cleanup_for_loop_body" doc:name="cleanup_for_loop_body_ref"/>
    </flow> 
</mule>
import static com.jayway.restassured.RestAssured.expect;
import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp;
import static com.xebialabs.restito.builder.verify.VerifyHttp.verifyHttp;
import static com.xebialabs.restito.semantics.Action.status;
import static com.xebialabs.restito.semantics.Action.stringContent;
import static com.xebialabs.restito.semantics.Condition.method;
import static com.xebialabs.restito.semantics.Condition.post;
import static com.xebialabs.restito.semantics.Condition.delete;
import static com.xebialabs.restito.semantics.Condition.uri;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;


import org.glassfish.grizzly.http.Method;
import org.glassfish.grizzly.http.util.HttpStatus;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;

import org.mule.api.MuleMessage;
import org.mule.api.client.MuleClient;
import org.mule.tck.junit4.FunctionalTestCase;

import com.xebialabs.restito.server.StubServer;

public class LogCleanupTest extends FunctionalTestCase 
{

    private StubServer server;

    @Before
    public void start()
    {
        server = new StubServer().run();
    }

    @After
    public void stop()
    {
        server.stop();
    }

    @Override
    /**
     * Return the list of flow names that will be tested
     */
    protected String getConfigResources() 
    {
        String flowNames = "src/main/app/log_cleanup.xml, src/test/resources/batch_global_test_config_internal.xml";
        return flowNames;
    }

    /**
     * Make sure that a successful cleanup response does not increment the retry counter.
     */
    @Test
    public void testLCSuccessResponse() throws Exception
    {
        MuleClient client = muleContext.getClient();
        String logURL = "/api/log/cleanup/XYZ/";

        //When a Delete request is made to this Log URL, return an OK response.
        whenHttp(server).match(delete(logURL)).then(stringContent("String response"), status(HttpStatus.OK_200));

    }

}