如何在 arquillian 持久性扩展上设置 IDataTypeFactory

How to set IDataTypeFactory on arquillian persistence extension

我有数百个测试用例,它们是用 arquillian-persistence-extension 编写的。此测试在 wildfly 管理的容器上进行 运行,它们使用由 wildfly 提供的默认 H2 数据库。当执行测试时,我会收到大量这样的警告:

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(已经在 wildfly 中)或者一些只是禁用那些警告(但不影响其他警告)?

只需将以下内容添加到您的 arquillian.xml:

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