Citrus 框架的文件端点

File Endpoint for Citrus Framework

我目前正在考虑将 Citrus 用于我们的集成测试,但是我们的集成软件在其他方面使用了文件消息 - 文件被写入入站文件夹,被拾取并处理,这导致新的文件消息被写入出站文件夹或数据写入 SQL.

我想知道 Citrus 是否可以将具有特定负载的文件写入入站文件夹,然后监控文件是否出现在 SQL [=23= 中的特定出站文件夹 and/or 中].

示例测试用例:

file()
  .folder(todoInboundFolder)
  .write()
  .payload(new ClassPathResource("templates/todo.xml"));

file()
  .folder(todoOutboundFolder)
  .read()
  .validate("/t:todo/t:correlationId", "${todocorrelationId}")
  .validate("/t:todo/t:title", "${todoName}");

query(todoDataSource)
  .statement("select count(*) as cnt from todo_entries where correlationid = '${todocorrelationId}'")
  .validate("cnt", "1");

另外 - 有没有办法指定超时以等待 file/SQL 条目出现?

Citrus 中还没有直接实现文件端点。有一个功能请求,但由于不活动而关闭 https://github.com/citrusframework/citrus/issues/151

您可以通过使用简单的 Apache Camel 路由进行文件传输来解决此问题。 Citrus 能够调用 Camel 路线并非常轻松地使用其结果。在此处阅读更多相关信息 https://citrusframework.org/citrus/reference/2.8.0/html/index.html#apache-camel

这将是目前可以提供帮助的解决方法。除此之外,您可以重新打开或为该问题做出贡献。