Mule Munit测试用例不适用于APIKit路由器流

时间:2015-02-18 05:05:16

标签: unit-testing mule

我为通过APIKit路由器生成的流创建了Munit测试用例。但是在运行测试套件时,我得到了以下异常:

Exception in thread "main" java.lang.RuntimeException: org.mule.api.lifecycle.LifecycleException: null
    at org.mule.munit.runner.mule.MunitSuiteRunner.<init>(MunitSuiteRunner.java:48)
    at org.mule.munit.runner.remote.MunitRemoteRunner.run(MunitRemoteRunner.java:40)
    at org.mule.munit.runner.remote.MunitRemoteRunner.main(MunitRemoteRunner.java:143)
Caused by: org.mule.api.lifecycle.LifecycleException: null
    at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:153)
    at org.mule.construct.FlowConstructLifecycleManager.fireStartPhase(FlowConstructLifecycleManager.java:92)
    at org.mule.construct.AbstractFlowConstruct.start(AbstractFlowConstruct.java:136)
    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.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237)
    at org.mule.lifecycle.RegistryLifecycleManager$RegistryLifecycleCallback.onTransition(RegistryLifecycleManager.java:273)
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:152)
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:123)
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:76)
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:136)
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91)
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87)
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69)
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61)
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:278)
    at org.mule.munit.runner.MuleContextManager.startMule(MuleContextManager.java:68)
    at org.mule.munit.runner.MuleContextManager.startMule(MuleContextManager.java:63)
    at org.mule.munit.runner.mule.MunitSuiteRunner.<init>(MunitSuiteRunner.java:40)

任何人都可以解决这个问题吗?提前谢谢。

1 个答案:

答案 0 :(得分:9)

你可以尝试添加像mock-connectors,mock-inbounds这样的属性

<munit:config doc:name="Munit configuration"/>配置

下面的

是在munit配置xml文件中修改的munit:config标签。

<munit:config doc:name="Munit configuration" mock-connectors="false" mock-inbounds="false"/>