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