FlywayTestExecutionListener instead.public class FlywayTestExecutionListener extends FlywayTestExecutionListener
FlywayTest up and
running
If the annotation FlywayTest used on class level a clean , init ,
migrate cycle is done during class load.
If the annotation FlywayTest used on test method level a clean , init
, migrate cycle is done before test execution.
Important if the annotation FlywayTest are used the system properties
for jdbc.url, jdbc.driver,
jdbc.username, and jdbc.password should be set.
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="dbc.properties"/>
<property name="ignoreResourceNotFound" value="true"/>
</bean>
<bean id="flyway" class="org.flywaydb.core.Flyway" depends-on="data.source.id">
<property name="dataSource" ref="data.source.id"/>
<property name="locations" value="oracle"/>
</bean>
<!-- H2 Setup
-Djdbc.driver=org.h2.Driver
-Djdbc.url=jdbc:h2:./db/testCaseDb
-Djdbc.username=OC_MORE_TEST
-Djdbc.password=OC_MORE_TEST
-->
<bean id="dataSourceRef" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>$jdbc.driver</value></property>
<property name="url"><value>$jdbc.url</value></property>
<property name="username"><value>$jdbc.username</value></property>
<property name="password"><value>$jdbc.password</value></property>
</bean>
If this setup is used exist the possibility to run test again different
database such as H2 or Oracle.
Usage inside the test class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/context/simple_applicationContext.xml"})
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class,
FlywayTestExecutionListener.class})
@FlywayTest
public class SimpleLoadTest
Notes:
FlywayTest wont work at class level.FlywayTest more than one time in test
classes than do not use parallel execution in surefire plugin.
With this option you will setup your database in more than one thread
parallel!| Constructor and Description |
|---|
FlywayTestExecutionListener()
Deprecated.
|
afterTestClass, afterTestMethod, beforeTestClass, beforeTestExecution, beforeTestMethod, getLogger, getOrder, prepareTestInstance, setOrderCopyright © 2019. All rights reserved.