custom-agent 在 munit 测试中不 运行
custom-agent not running in munit test
我有一个自定义代理,我正在尝试通过创建一个简单的流程并调用该代理来测试自定义代理的代码,但由于某些原因,Munit 在 运行是我的流程。这是自定义代理 xml:
<custom-agent name="createQueueAgent"
class="my.company.package.QueueManageAgent">
<spring:property name="queueName" value="queueName" />
<spring:property name="dataSource" ref="dataSource" />
</custom-agent>
<flow name="dummyFlow">
<logger message="this is a flow" level="INFO"/>
</flow>
下面是我调用它的方式(在扩展 Functional MUnit Suite 的 class 中)
this.runFlow("dummyFlow",testEvent(""));
流得到 运行,但代理从未初始化。如果我只是 运行 它在 mule 中,这很好用。我在这里错过了什么?我是运行ning Munit/Mule 3.6(单位是3.6.0-BETA1-SNAPSHOT
您可以对自定义代理进行单元测试 class 但不能对其进行 Munit。代理是在您进行 Munit 测试时不可用的服务。
正如您从 mule 文档中了解到的那样
"An agent is a service that is associated with or used by Mule ESB but is not a Mule-managed component. Agents have the same lifecycle as the Mule instance they are registered with, so you can initialize and destroy resources when the Mule instance starts or is disposed."
我有一个自定义代理,我正在尝试通过创建一个简单的流程并调用该代理来测试自定义代理的代码,但由于某些原因,Munit 在 运行是我的流程。这是自定义代理 xml:
<custom-agent name="createQueueAgent"
class="my.company.package.QueueManageAgent">
<spring:property name="queueName" value="queueName" />
<spring:property name="dataSource" ref="dataSource" />
</custom-agent>
<flow name="dummyFlow">
<logger message="this is a flow" level="INFO"/>
</flow>
下面是我调用它的方式(在扩展 Functional MUnit Suite 的 class 中)
this.runFlow("dummyFlow",testEvent(""));
流得到 运行,但代理从未初始化。如果我只是 运行 它在 mule 中,这很好用。我在这里错过了什么?我是运行ning Munit/Mule 3.6(单位是3.6.0-BETA1-SNAPSHOT
您可以对自定义代理进行单元测试 class 但不能对其进行 Munit。代理是在您进行 Munit 测试时不可用的服务。
正如您从 mule 文档中了解到的那样
"An agent is a service that is associated with or used by Mule ESB but is not a Mule-managed component. Agents have the same lifecycle as the Mule instance they are registered with, so you can initialize and destroy resources when the Mule instance starts or is disposed."