数据初始化的SQL分类型,以支持对远程的真实数据库执行functional test
This commit is contained in:
@@ -664,7 +664,6 @@
|
||||
<profile>
|
||||
<id>refresh-db</id>
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -676,7 +675,7 @@
|
||||
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}" onerror="continue" encoding="${project.build.sourceEncoding}">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
<transaction src="src/main/resources/sql/h2/schema.sql"/>
|
||||
<transaction src="src/test/resources/data/import-data.sql"/>
|
||||
<transaction src="src/test/resources/data/h2/import-data.sql"/>
|
||||
</sql>
|
||||
</target>
|
||||
</configuration>
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
<!-- 初始化数据表结构 -->
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
|
||||
<jdbc:script location="classpath:sql/h2/schema.sql" />
|
||||
<jdbc:script location="classpath:sql/${db.type}/schema.sql" />
|
||||
</jdbc:initialize-database>
|
||||
</beans>
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
<!-- 初始化数据表结构 与默认数据-->
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
|
||||
<jdbc:script location="classpath:sql/h2/schema.sql" />
|
||||
<jdbc:script location="classpath:data/import-data.sql" encoding="UTF-8"/>
|
||||
<jdbc:script location="classpath:data/h2/import-data.sql" encoding="UTF-8"/>
|
||||
</jdbc:initialize-database>
|
||||
</beans>
|
||||
</beans>
|
||||
+3
-1
@@ -87,6 +87,8 @@ public class BaseFunctionalTestCase {
|
||||
* 载入测试数据.
|
||||
*/
|
||||
protected static void reloadSampleData() throws Exception {
|
||||
DataFixtures.executeScript(dataSource, "classpath:data/cleanup-data.sql", "classpath:data/import-data.sql");
|
||||
String dbType = propertiesLoader.getProperty("db.type", "h2");
|
||||
DataFixtures.executeScript(dataSource, "classpath:data/" + dbType + "cleanup-data.sql", "classpath:data/"
|
||||
+ dbType + "import-data.sql");
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ embeddedForLocal=true
|
||||
selenium.driver=firefox
|
||||
|
||||
#(optional)override jdbc url for functional test
|
||||
db.type=h2
|
||||
jdbc.driver=org.h2.Driver
|
||||
jdbc.url=jdbc:h2:file:~/.h2/quickstart-test;AUTO_SERVER=TRUE
|
||||
jdbc.username=sa
|
||||
|
||||
@@ -548,7 +548,7 @@
|
||||
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}" onerror="continue" encoding="${project.build.sourceEncoding}">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
<transaction src="src/main/resources/sql/h2/schema.sql"/>
|
||||
<transaction src="src/test/resources/data/import-data.sql"/>
|
||||
<transaction src="src/test/resources/data/h2/import-data.sql"/>
|
||||
</sql>
|
||||
<sql driver="${quartz.jdbc.driver}" url="${quartz.jdbc.url}" userid="${quartz.jdbc.username}" password="${quartz.jdbc.password}" encoding="${project.build.sourceEncoding}"
|
||||
src="src/main/resources/sql/h2/quartz.sql" onerror="continue">
|
||||
|
||||
@@ -153,11 +153,11 @@
|
||||
|
||||
<!-- 初始化数据结构 -->
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
|
||||
<jdbc:script location="classpath:sql/h2/schema.sql" />
|
||||
<jdbc:script location="classpath:sql/${db.type}/schema.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<jdbc:initialize-database data-source="quartzDataSource" ignore-failures="ALL">
|
||||
<jdbc:script location="classpath:sql/h2/quartz.sql" />
|
||||
<jdbc:script location="classpath:sql/${db.type}/quartz.sql" />
|
||||
</jdbc:initialize-database>
|
||||
</beans>
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
<!-- 初始化数据结构与默认数据 -->
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
|
||||
<jdbc:script location="classpath:sql/h2/schema.sql" />
|
||||
<jdbc:script location="classpath:data/import-data.sql" encoding="UTF-8" />
|
||||
<jdbc:script location="classpath:data/h2/import-data.sql" encoding="UTF-8" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<jdbc:initialize-database data-source="quartzDataSource" ignore-failures="ALL">
|
||||
|
||||
+3
-1
@@ -81,6 +81,8 @@ public class BaseFunctionalTestCase {
|
||||
* 载入默认数据.
|
||||
*/
|
||||
protected static void reloadSampleData() throws Exception {
|
||||
DataFixtures.executeScript(dataSource, "classpath:data/cleanup-data.sql", "classpath:data/import-data.sql");
|
||||
String dbType = propertiesLoader.getProperty("db.type", "h2");
|
||||
DataFixtures.executeScript(dataSource, "classpath:data/" + dbType + "cleanup-data.sql", "classpath:data/"
|
||||
+ dbType + "import-data.sql");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ embeddedForLocal=true
|
||||
selenium.driver=firefox
|
||||
|
||||
#(optional)override jdbc url for functional test
|
||||
db.type=h2
|
||||
jdbc.driver=org.h2.Driver
|
||||
jdbc.url=jdbc:h2:file:~/.h2/showcase4-test;AUTO_SERVER=TRUE
|
||||
jdbc.username=sa
|
||||
|
||||
Reference in New Issue
Block a user