gpt4 book ai didi

java - 如何检查端点是否用于 munit 测试

转载 作者:行者123 更新时间:2023-11-28 20:42:42 25 4
gpt4 key购买 nike

我正在尝试编写一个 mule munit 测试(在 java 中)并且我想检查消息是否通过(或在这种情况下退出)特定的出站端点,因为流中存在路由并且消息可以根据条件通过不同的?

我的设置是实际使用 2 个不同的流文件,一个具有使用通用端点的流逻辑

<outbound-endpoint ref="out.endpoint" />

然后是另一个带有实际端点定义的流文件,例如

<vm:endpoint name="out.endpoint" path="out.path" />

下面的 java 代码有效

verifyCallOfMessageProcessor("outbound-endpoint").times(1);

但是我希望能够指定端点的具体名称。我尝试了以下但都没有用

verifyCallOfMessageProcessor("outbound-endpoint").withAttributes(attribute("name").withValue("out.endpoint")).times(1);
verifyCallOfMessageProcessor("outbound-endpoint").withAttributes(attribute("ref").withValue("out.endpoint")).times(1);
verifyCallOfMessageProcessor("endpoint").withAttributes(attribute("name").withValue("out.endpoint")).times(1);
verifyCallOfMessageProcessor("endpoint").withAttributes(attribute("ref").withValue("out.endpoint")).times(1);

所有这 4 个(对我来说有意义的)都失败了。有谁知道如何完成这个(最好通过 java,否则使用 xml)?

最佳答案

应该是这样的:

verifyCallOfMessageProcessor("outbound-endpoint").ofNamespace("vm").withAttributes(attribute("name").ofNamespace("doc").withValue("out.endpoint")).times(1);

检查属性名称是否具有命名空间“doc”。

关于java - 如何检查端点是否用于 munit 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26431501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com