Use a connection data pool when running tests
It cuts 40 seconds or around from the tests running time.
This commit is contained in:
parent
bf1f10f4d7
commit
3713198a93
5 changed files with 37 additions and 6 deletions
|
|
@ -32,6 +32,11 @@
|
|||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<!-- datasource for testing -->
|
||||
<dependency>
|
||||
<groupId>com.jolbox</groupId>
|
||||
<artifactId>bonecp</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
|
|||
|
|
@ -7,10 +7,17 @@
|
|||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<bean id="dataSourceReal"
|
||||
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"
|
||||
p:driverClass="${jdbcDriver.className}" p:jdbcUrl="${testDataSource.url}"
|
||||
p:username="${testDataSource.user}" p:password="${testDataSource.password}"
|
||||
p:maxConnectionsPerPartition="10"
|
||||
p:minConnectionsPerPartition="4"
|
||||
p:partitionCount="3"/>
|
||||
|
||||
<bean id="dataSource"
|
||||
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
|
||||
p:driverClassName="${jdbcDriver.className}" p:url="${testDataSource.url}"
|
||||
p:username="${testDataSource.user}" p:password="${testDataSource.password}" />
|
||||
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"
|
||||
p:targetDataSource-ref="dataSourceReal" />
|
||||
|
||||
<!-- Hibernate Session Factory. -->
|
||||
<bean id="sessionFactory"
|
||||
|
|
|
|||
|
|
@ -427,6 +427,11 @@
|
|||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<!-- datasource for testing -->
|
||||
<dependency>
|
||||
<groupId>com.jolbox</groupId>
|
||||
<artifactId>bonecp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
|
|
|
|||
|
|
@ -7,10 +7,17 @@
|
|||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<bean id="dataSourceReal"
|
||||
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"
|
||||
p:driverClass="${jdbcDriver.className}" p:jdbcUrl="${testDataSource.url}"
|
||||
p:username="${testDataSource.user}" p:password="${testDataSource.password}"
|
||||
p:maxConnectionsPerPartition="10"
|
||||
p:minConnectionsPerPartition="4"
|
||||
p:partitionCount="3"/>
|
||||
|
||||
<bean id="dataSource"
|
||||
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
|
||||
p:driverClassName="${jdbcDriver.className}" p:url="${testDataSource.url}"
|
||||
p:username="${testDataSource.user}" p:password="${testDataSource.password}" />
|
||||
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"
|
||||
p:targetDataSource-ref="dataSourceReal" />
|
||||
|
||||
|
||||
<!-- Hibernate Session Factory. -->
|
||||
|
|
|
|||
7
pom.xml
7
pom.xml
|
|
@ -263,6 +263,13 @@
|
|||
<version>4.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- datasource for testing -->
|
||||
<dependency>
|
||||
<groupId>com.jolbox</groupId>
|
||||
<artifactId>bonecp</artifactId>
|
||||
<version>0.7.1.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Easy mock -->
|
||||
<dependency>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue