数据初始化的SQL分类型,以支持对远程的真实数据库执行functional test
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user