264.24. 覆盖 Camel test kit 中的属性
从 Camel 2.10 开始提供
使用 Camel 测试并使用 Properties 组件时,您可能需要提供直接从单元测试源代码中使用的属性。
现在,从 Camel 2.10 开始,作为 Camel test kits,如 CamelTestSupport 类提供了以下方法
-
useOverridePropertiesWithPropertiesComponent -
ignoreMissingLocationWithPropertiesComponent
例如,在单元测试类中,您可以覆盖 useOverridePropertiesWithPropertiesComponent 方法,并返回 java.util.Properties,其中包含应该首选使用的属性。
264.24.1. 从单元测试源内提供属性 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
这可以从任何 Camel Test kits 来完成,如 camel-test、camel-test-spring 和 camel-test-blueprint。
ignoreMissingLocationWithPropertiesComponent 可用于指示 Camel 忽略任何不可发现的位置,例如,在运行单元测试时,在无法访问属性位置的环境中。