【发布时间】:2014-08-14 07:56:39
【问题描述】:
我有一个 Camel 集成流程。在某一时刻,有客户端创建,如下配置:
<routeContext id="clientCreation" xmlns="http://camel.apache.org/schema/spring">
<route customId="true" id="clientCreationRouter">
<from uri="direct:client-creation-start" customId="true" id="Client-Creation-Initiator"/>
<bean ref="clientCreationService" method="constructClientDto" />
<bean ref="clientCreationService" method="populateClientRequestMessage" />
<bean ref="clientCreationService" method="saveClientDetails" />
<bean ref="clientCreationService" method="createClientCreationFixedLengthMessage" />
<setHeader headerName="flow-status" customId="true" id="Client-Creation-Update-Header">
<simple>CLIENT_CREATED</simple>
</setHeader>
</route>
</routeContext>
ConstructClientDto 有 FlowInfo 对象作为输入。
createClientCreationFixedLengthMessage 有一个String 作为输出。我想测试这部分流程。基本上,我想提供一个 FlowInfo 对象,该对象已准备好进行客户端创建,然后根据最后提供的结果查看这部分集成是否成功。
到目前为止,这是我尝试过的:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration (locations={"/META-INF/spring/data-extractor.xml",
"/META-INF/spring/data-splitter.xml",
"/META-INF/spring/client-creation.xml"})
public class ClientCreationFlowTest extends CamelTestSupport{
@Produce (uri = "direct:client-creation-start")
protected ProducerTemplate template;
@EndpointInject(uri = "mock:result")
protected MockEndpoint resultEndpoint;
@Autowired
FlowRepository repository;
@Test
public void testClientCreation () throws Exception {
FlowInfo flowInfo = repository.findById("1234");
template.sendBody(resultEndpoint, flowInfo);
}
}
当我运行测试用例时,我得到了成功。但是当我调试它时,它似乎并没有通过ClientCreationService 运行。我对骆驼很陌生,任务很关键。任何帮助,将不胜感激。
【问题讨论】:
标签: junit apache-camel integration-testing