【发布时间】:2011-07-28 09:34:48
【问题描述】:
在 Eclipse 中运行 JUnit 集成测试时,我在类路径中有两个 persistence.xml 文件——一个包含测试用例的配置,另一个包含生产环境。我需要找到一种方法从测试类路径中排除用于生产的 persistence.xml。
约束:我不允许使用 Maven 或 Ant,只能使用 Eclipse Helios SR1(带有 JUnit)。 JPA 2 持久性提供程序是 EclipseLink 2.2.0。由于我必须使用 ClearCase 7.0 作为 VCS,因此无法链接资源,例如 as described here。
这是粗略的项目结构:
project-datamodel (containing the Entity beans)
\- src/resources/META-INF/persistence.xml (for production; want to exclude it)
\- test/resources/META-INF/persistence.xml (for test)
project-service (containing the Session beans)
\- ejbModule
project-service-it (containing the JUnit integration tests for the Session beans)
\- test
【问题讨论】:
标签: eclipse unit-testing maven classpath persistence.xml