3
我正在尝试为Spring集成流程编写Junits,并且我为通道(直接通道)定义了一个桥接,以便检查该消息。由于该频道不是发布订阅频道,该网桥不会收到该消息。我不想将该频道修改为以Junit为目的的发布订阅频道。除了使其成为发布订阅频道之外,还有其他方法吗?春季集成Junit桥接测试通道的直接通道
<integration:channel id="processResponseChannel1" />
<integration:channel id="processResponseChannel2" />
<integration:channel id="processResponseChannel3" />
<integration:channel id="processResponseChannel4" />
<integration:service-activator
input-channel="processResponseChannel1"
output-channel="processResponseChannel2"
ref="processResponseActivator1"/>
<integration:service-activator
input-channel="processResponseChannel2"
output-channel="processResponseChannel3"
ref="processResponseActivator2"/>
<integration:service-activator
input-channel="processResponseChannel3"
output-channel="processResponseChannel4"
ref="processResponseActivator3"/>
我想在我的junit中检索processResponseChannel2中的消息并对该消息执行一些断言。
<integration:bridge input-channel="processResponseChannel2"
output-channel="testChannel"/>
<integration:channel id="testChannel">
<integration:queue/>
</integration:channel>
JUnit中,我使用testChannel.receive(5000)来检索信息,但测试用例失败。 我不想让processResponseChannel2作为发布订阅来使测试类工作。是否有任何其他方式来检索通道processResponseChannel2中的消息。
谢谢Artem。这对我有效。 –