【发布时间】:2019-05-19 01:06:02
【问题描述】:
我已经使用 Spring Integration 构建了一个小型应用程序。我还为更多服务和其他类编写了一些 jUnit。 我已经为通道和端点配置使用了 XML 配置,我想知道是否可以测试特定通道的输入和输出。 有没有办法可以测试通道的输入和输出?..
更新
我正在尝试以下流程。我该怎么办?
<int:channel id="getPresciption" />
<int:channel id="respPrescription" />
<int:channel id="storePrcedureChannell" />
<int-http:inbound-gateway
request-channel="getPresciption" reply-channel="respPrescription"
supported-methods="GET" path="/getAllPresciption">
<int-http:request-mapping
consumes="application/json" produces="application/json" />
</int-http:inbound-gateway>
<int:service-activator
ref="prescriptionServiceActivator" method="buildPrescription"
input-channel="getPresciption" output-channel="storePrcedureChannell" />
<int:service-activator
ref="prescriptionServiceActivator" method="storePrescription"
input-channel="storePrcedureChannell"></int:service-activator>
那么我该如何编写测试上下文?
下面是通道流调用的方法。
public Message<List<Prescription>> buildPrescription() {
//Do some processing
}
public Message<List<Prescription>> storePrescription(Message<List<Prescription>> msg) {
//Do something and return the List.
}
【问题讨论】:
标签: spring spring-mvc junit spring-integration