2016-10-13 36 views
0

我有數百個用arquillian-persistence-extension編寫的測試用例。這些測試運行在野蠻管理的容器上,它們使用由wildfly提供的默認H2數據庫。並正在執行測試時,我得到噸警告的那樣:如何在arquillian持久性擴展上設置IDataTypeFactory

WARN [org.dbunit.dataset.AbstractTableMetaData] (default task-1) Potential 
problem found: 
The configured data type factory 'class 
org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the 
current database 'H2' (e.g. some datatypes may not be supported properly). 
In rare cases you might see this message because the list of supported database 
products is incomplete (list=[derby]). If so please request a java-class update 
via the forums.If you are using your own IDataTypeFactory extending 
DefaultDataTypeFactory, 
ensure that you override getValidDbProducts() to specify the 
supported database products. 

所以我有警告本身列出的一些選項,但它是一個有點問題要做到這一點,因爲我不想提供不需要的DbUnit依賴關係,只想在其上使用APE。

所以我的問題是有什麼簡單的方法來定義默認的H2 TypeFactory(這已經在野蠻),或者一些只是禁用這些警告(但不影響其他人)?

回答

0

只需添加以下到您的arquillian.xml

<extension qualifier="persistence-dbunit"> <property name="datatypeFactory"> org.dbunit.ext.h2.H2DataTypeFactory </property> </extension>

+0

添加此屬性導致錯誤: –

+0

產生的原因:java.lang.IllegalArgumentException異常:無法轉換值 org.dbunit.ext.h2。 H2DataTypeFactory ]添加到類[org.dbunit.dataset.datatype.IDataTypeFactory]。 \t在org.jboss.arquillian.persistence.core.configuration.ConfigurationTypeConverter.convert(ConfigurationTypeConverter.java:194) \t在org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createConfiguration(ConfigurationImporter.java:149) \t ... 52更多 引起:java.lang.ClassNotFoundException: org.dbunit.ext.h2.H2DataTypeFactory –

+0

這可能是類加載問題。你能否檢查你的類路徑中是否沒有兩個不同版本的dbunit? –