Arquillian Persistence Extension 1.0.0.Alpha4 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Alpha4 release of the Arquillian Persistence Extension component!

It’s been a while since the Alpha3 release. After three long months, we’re excited to announce Alpha 4 with a lot of improvements and enhancements suggested by our great community. Best of all, we finally have complete documentation in the reference guide!

I would especially like to thank Michael Brill for nailing down DBUnit clean up strategies, Pål Oliver Kristiansen and Jarek Gilewski for suggesting customization of DBUnit behaviour and Juergen Zimmermann for spotting a bug with transactional support. Last, but not least, many thanks to all who actively discussed the roadmap for next releases. There is plenty of great stuff on the way! Thank you very much for your feedback!

Some of the highlights in this release

Custom SQL scripts for cleanup
You can now use custom SQL scripts to clean your database before or after the test. For this purpose use the @CleanupUsingScript annotation and specify SQL files which have to be executed.
More flexible custom SQL scripts execution
We’ve removed the @UsingScript annotation and replaced it with the @ApplyScriptBefore and @ApplyScriptAfter annotations.
DBUnit insert strategies

You can tell DBUnit how it should insert your data. The following strategies are available:

  • INSERT – Performs insert of the data defined in provided data sets. This is the default strategy.
  • CLEAN_INSERT – Performs insert of the data defined in provided data sets, after removal of all data present in the tables referred in provided files.
  • REFRESH – During this operation, existing rows are updated and new ones are inserted. Entries already existing in the database which are not defined in the provided data set are not affected.
  • UPDATE – This strategy updates existing rows using data provided in the datasets. If the dataset contains a row which is not present in the database (identified by its primary key) then an exception is thrown.
DBUnit cleanup modes

You can specify when and how you would like your database to be cleaned. By default, your database is erased entirely before each test. If you want to control this behavior, use the @Cleanup annotation for this purpose. The following modes are currently supported:

  • STRICT – Cleans the entire database. This strategy might require turning off database constraints (e.g. referential integrity).
  • USED_ROWS_ONLY – Deletes only those entries that are defined in the datasets used for seeding.
  • USED_TABLES_ONLY – Deletes only those tables that are referenced in datasets.

You can also specify when you would like to invoke the cleanup procedure. For instance:

@Cleanup(phase = TestExecutionPhase.AFTER, strategy = CleanupStrategy.USED_ROWS_ONLY)

You can invoke cleanup BEFORE or AFTER the test. You can also disable cleanup by using TestExecutionPhase.NONE.

Column filtering for data set matching
@ShouldMatchDatSet has been enhanced with columnsToExclude list, where you can specify which columns shouldn’t be used for database content verification.
Nullable columns
For XML, JSON and YAML you can now set arbitary columns to null using [null] placeholder.
Separated configuration for core and (enhanced) DBUnit specific features

We provide configuration for all DBUnit properties and features as of Alpha 4! Moreover there is a split for core properties (such as default data source or JNDI of UserTransaction) and DBUnit related settings, as the example below illustrates:

<extension qualifier="persistence">
    <property name="defaultDataSource">java:app/datasources/mssql_ds</property>
    <property name="userTransactionJndi">java:jboss/UserTransaction</property>
    <property name="initStatement">scripts/mssql-identity-insert-on.sql</property>
    <property name="cleanupStatement">scripts/mssql-identity-insert-off.sql</property>
          <extension qualifier=“persistence-dbunit”>
<property name=“datatypeFactory”>org.dbunit.ext.mssql.MsSqlDataTypeFactory</property>
<property name=“useIdentityInsert”>true</property>

For complete list, please refer to the reference guide.

We look forward to hearing your feedback about this release in the community forums!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian Persistence Extension
Version 1.0.0.Alpha4 view tag
Release date 2012-04-12
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-persistence-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-persistence-impl jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-persistence-integration-tests jar javadoc pom

Release notes and resolved issues 21

  • ARQ-755 - Introduce annotation based db cleanup configuration
  • ARQ-756 - Improve error messages
  • ARQ-805 - Convert test method names from camel to underscore
  • ARQ-859 - Cleanup configuration - move dbunit related settings to its own configuration.
Feature Request
  • ARQ-718 - Customization for DBUnit
  • ARQ-719 - Enable column sensing for FlatXmlDataSet
  • ARQ-720 - Enable nulls for FlatXmlDataSet
  • ARQ-764 - Using DBUnit with IDENTITY or auto-increment columns
  • ARQ-777 - Should be possible to run custom scripts before and after test
  • ARQ-804 - Should be able to clean database using custom SQL script
  • ARQ-869 - Move JavaDoc from Field level to Method level for Configuration objects
  • ARQ-721 - Compilation error in older version of JDK 6
  • ARQ-723 - TransactionalWrapper.afterTest() ignores SessionContext.setRollbackOnly()
  • ARQ-751 - Empty YML file is causing error whereas it should be simply skipped
  • ARQ-752 - Persistence extension is failing to enrich archive when there is no dataset defined
  • ARQ-765 - Update ShrinkWrap Descriptors dependency
  • ARQ-757 - Document extension in confluence.
  • ARQ-771 - Global DBUnit configuration should be exposed in arquillian.xml
  • ARQ-772 - Introduce column filtering for data set matching
  • ARQ-806 - Should provide cleanup strategies to control what needs to be removed for the given test

Thanks to the following list of contributors: Bartosz Majsak, Aslak Knutsen