Arquillian Spring Framework Extension 1.0.0.Beta3 Released

The Arquillian team is proud to announce the 1.0.0.Beta3 release of the Arquillian Spring Framework Extension component!

It has again been a while since that last Arquillian Spring extension release, but it’s finally here. This release focus mainly on further integration and compatibility with the Arquillian Universe

Upgraded to Arquillian Core 1.1.x

With Arquillian Core 1.1.0.Final came the new ShrinkWrap Resolver 2.0 APIs.

The Arquillian Spring Deployers have been updated to support the new ShrinkWrap Resolver 2.0 APIs and should now work with the latest and greatest from the Arquillian Universe.

Arquillian Persistence Extension support

In this release we’ve added a new module, arquillian-persistence-spring, which integrates Spring with the Arquillian Persistence Extension.

More specifically, it’s an implementation of the Persistence Extension DataSourceProvider SPI.

This integration allow you to configure the Persistence Extension to operate on a DataSource configured in your Spring applicationContext.

Configure your DataSource and TransactionManager in the applicationContext.xml file. For example;

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   ...
</bean>

<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  <property name="dataSource" ref="dataSource"/>
</bean>

Then setup your Test case using the Spring, Transaction and Persistence Extension annotations:

@RunWith(Arquillian.class)
@Transactional(manager = "txManager")
@SpringConfiguration("applicationContext.xml")
@DataSource("dataSource")
public class JpaEmployeeRepositoryTestCase {

...

    @Test
    @ShouldMatchDataSet(value = "employee.yml", excludeColumns = "id")
    public void testSave() {

        Employee employee = new Employee();
        employee.setName("Test employee");

        employeeRepository.save(employee);

        employee = new Employee();
        employee.setName("New employee");

        employeeRepository.save(employee);
    }

    @UsingDataSet("employee.yml")
    @Cleanup(strategy = CleanupStrategy.USED_TABLES_ONLY)
    public void testGetEmployees() throws Exception {

        List<Employee> result = employeeRepository.getEmployees();

        assertNotNull("Method returned null list as result.", result);
        assertEquals("Two employees were expected.", 2, result.size());
    }
}

Optionally you can configure the transaction manager reference and data source reference globally for the whole test suite via arquillian.xml

<arquillian>
   <extension qualifier="transaction">
      <property name="manager">txManager</property>
   </extension>
   <extension qualifier="persistence">
      <property name="defaultDataSource">dataSource</property>
   </extension>
</arquillian>

See the Persistence Extension Reference Docs for more ingo

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 Spring Framework Extension
Version 1.0.0.Beta3 view tag
Release date 2014-06-26
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-common jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-2.5 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-deployer-spring-3 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-container-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-inject jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-javaconfig jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-persistence-spring jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-2.5-int-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-service-integration-spring-3-int-tests jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-spring jar javadoc pom

Release notes and resolved issues 0

Thanks to the following list of contributors: Aslak Knutsen, Tommy Tynjä, Jakub Narloch, Andrew Lee Rubinger