Unitils結合Dbdeploy管理測試資料庫

2021-08-29 13:09:44 字數 1370 閱讀 5976

unitils是單元測試的一組工具集,介紹見

dbdeploy是thoughtworks公司開發的資料庫工具,獲得jolt大獎。 

unitils有自己的乙個管理類似於dbdeploy的管理資料庫的module -- dbmaintainer,其要求的sql檔名稱格式如下所示,要求使用下劃線分隔

001_create_users_table.sql
dbdeploy要求的sql檔案格式使用空格分隔

1 create users table.sql
如果在專案中同時使用了dbdeploy和unitils(dbdeploy比dbmaintainer更強大,同時支援undo),由於兩種格式不匹配,就需要維護兩套sql檔案,比較麻煩。目前在dbdeploy中沒有發現可以配置檔名的方法,只能從unitils入手,檢視unitils的文件找到解決方法。

使用unitils時可以自定義scriptsource(獲取sql file source的乙個介面),在unitils.properties中加入

org.unitils.dbmaintainer.script.scriptsource.implclassname=com.andyao.unitils.dbdeployscriptsource
dbdeployscriptsource為

public class dbdeployscriptsource extends filescriptsource 

}if (!fileextensionsupported)

if (scriptfilespecification.i***cludefileswithoutindex())

string indexnrstr = stringutils.substringbefore(name, separator);

if (!stringutils.isnumeric(indexnrstr))

}return true;

}/**

* returns the version index of the given script file

** @param scriptfile the file containing a script

* @return the version of the script file

*/@override

protected long getindex(file scriptfile) catch (numberformatexception e)

} else

}}

這樣就可以同時使用dbdeploy和unitils,做到自動化維護測試資料庫。

Unitils 使用指南 翻譯 模組系統

1.1.1unitils模組 下面的嚮導檔案講述 unitils 的模組系統和所提供的模組。我們從解釋怎麼配置測試環境並將讓你的測試使用這些模組開始。子章節會深入的描述這些模組的功能。1.1.1.1 configuration 配置 對於任何乙個專案,unitils 需要一些配置。預設情況下,有三個...

結合php PHP與jQuery結合的功能

主要問題難點在於 獲取後台填充資料沒問題,但是當後台資料已失效,前台資料已獲取後,這種歷史遺留資料處理比較棘手,原來的資料填充和釋放只針對後台所有的資料,沒有把版本迭代後的狀態考慮進去,這裡的主要問題就是當使用者不重新整理頁面,還要解決後台傳輸的無效資料和有效資料的區分,不會在前台展現有效資料把無效...

mysql左右結合 結合左右加入mysql查詢

唯一可以做到的就是使用union.mysql不像mssql那樣支援full joinjust.select from tbl1 t1 left join tbl2 t2 on t1.col t2.col union select from tbl1 t1 right join tbl2 t2 on ...