如何在Mule MUnit java测试属性withValue中使用正则表达式
我有一个java Munit测试,我在其中验证调用,如下所示:如何在Mule MUnit java测试属性withValue中使用正则表达式,java,regex,mule,munit,Java,Regex,Mule,Munit,我有一个java Munit测试,我在其中验证调用,如下所示: verifyCallOfMessageProcessor("outbound-endpoint") .ofNamespace("file") .withAttributes(attribute("path").withValue("/data/local/"), attribute("outputPattern").withValue("vendor_customer_*"))
verifyCallOfMessageProcessor("outbound-endpoint")
.ofNamespace("file")
.withAttributes(attribute("path").withValue("/data/local/"),
attribute("outputPattern").withValue("vendor_customer_*"))
.times(1)
;
此代码段应测试以下Mule代码:
如何在AttributeOutPattern.withValuevendor\u customer_*中使用正则表达式表示属性值从vendor\u customer开始_
我将MUnit 3.5与Mule 3.4.2一起使用,属性值不支持正则表达式。 您需要准确地输入值。请看: 作为旁注,请注意MUnit不支持测试Mule 3.4
HTH您能建议我如何在这种情况下为属性OutputPattern设置精确值吗?您遇到的问题是,日期太精细了,毫秒级,我认为这符合一些业务逻辑。所以在这种情况下,你无能为力。您可以使文件名的变量部分仅为日期,但这可能不是一个选项。另一方面,如果已经在使用路径属性,则可能不需要添加新属性。
<file:outbound-endpoint path="${root.drive}"
outputPattern="vendor_customer_#[server.dateTime.format('YYYY_MM_dd_hh_mm_ss.sss')].csv" />