如何处理 xml 使用正则表达式给出的文件路径以支持 Spring 的集成测试的多个环境?
How to handle xml file path given using regular expression to support multiple environment for Integration Testing by Spring?
我的 test-appContext.xml 文件中有以下配置以支持执行 spring 集成测试。
<bean id="cacheManagerConfig" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="file:/web/${websphere.env}/${websphere.Domain}/${websphere.Name}/myportal/config/ehcache.xml"/>
</bean>
我正在使用带有 spring 4 的 junit 4.12 进行 MVC 流程的集成测试。
如何在 spring 集成测试中处理 ehcache.xml 文件路径。
谢谢:)
我得到了解决方案,因为在 Liberty 服务器的情况下,表达式从系统 属性 的 jvm.options 文件中检索值,所以我在测试用例 class.[=11 中使用了以下代码=]
static {
System.setProperty("websphere.env", "test");
System.setProperty("websphere.Domain", "mytestdomain");
System.setProperty("websphere.Name", "mytestdomain");
}
它工作正常。
我的 test-appContext.xml 文件中有以下配置以支持执行 spring 集成测试。
<bean id="cacheManagerConfig" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="file:/web/${websphere.env}/${websphere.Domain}/${websphere.Name}/myportal/config/ehcache.xml"/>
</bean>
我正在使用带有 spring 4 的 junit 4.12 进行 MVC 流程的集成测试。
如何在 spring 集成测试中处理 ehcache.xml 文件路径。
谢谢:)
我得到了解决方案,因为在 Liberty 服务器的情况下,表达式从系统 属性 的 jvm.options 文件中检索值,所以我在测试用例 class.[=11 中使用了以下代码=]
static {
System.setProperty("websphere.env", "test");
System.setProperty("websphere.Domain", "mytestdomain");
System.setProperty("websphere.Name", "mytestdomain");
}
它工作正常。