我需要进行集成测试,以检查将多线程持久化到Oracle中。我们在应用程序中使用openjpa,因此我决定使用openjpa-maven-plugin进行测试。
我试图准备一些配置文件进行测试
<profiles>
<profile>
<id>integration-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>${openjpa.version}</version>
<configuration>
<sqlAction>build</sqlAction>
<sqlFile>/src/test/resources/sql/insert.sql</sqlFile>
<connectionDriverName>org.apache.commons.dbcp.BasicDataSource</connectionDriverName>
<connectionProperties>
driverClass=oracle.jdbc.OracleDriver,
jdbc.url=jdbc:oracle:thin:@server-test-ora:1521/bacl,
user=user,
password=root,
minPoolSize=5,
acquireRetryAttempts=3,
maxPoolSize=20
</connectionProperties>
<includes>**/entities/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>test enhancer</id>
<phase>process-test-classes</phase>
<goals>
<goal>test-enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpa.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
但是实际上,我不知道我需要做什么以及如何进行测试。如何让EntityManager尝试执行我的insert.sql
INSERT INTO USER (NAME,SURNAME,DATE) VALUES ('NAME','SURNAME',to_date('2018-12-08 17:21:03', 'yyyy-mm-dd hh24:mi:ss'));
我需要什么它正在尝试进行一些并发测试。我有很多东西,但是没有任何数据库,现在我需要测试连接或inMemoryOracle。
所以我的问题是 如何从插件获取EntityManager(是否需要创建任何context.xml吗?)