2016-10-13 50 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? –