Infinispan Arquillian Container 1.1.0.Alpha1 released
Dear Infinispan users, a new version of Infinispan Arquillian Container has been released into JBoss Maven Repository as maven artifacts. The previous version was announced by http://blog.infinispan.org/2012/09/infinispan-arquillian-container-100cr1.html The blog post contains information related to setup of JBoss Maven Repository, including its address as well as address of the Infinispan Arquillian Container itself.
Maybe we should now call the project Infinispan Arquillian extension rather than Infinispan Arquillian Container because, since version 5.3, Infinispan Server has been based on JBoss Application Server 7 and the submodule called infinispan-arquillian-container could be removed.
As a result, the configuration of Arquillian with respect to Infinispan Server was simplified.
Now there’s only one way to compose the arquillian.xml file:
The property ispnHome no longer exists. The path to the Infinispan Server is now specified via jbossHome. The serverConfig attribute then specifies the correct configuration file for the server.
In order to run tests with Infinispan Arquillian extension, one should use the following dependencies: org.jboss.as:jboss-as-arquillian-container-managed:jar:7.2.0.Final:test org.infinispan.arquillian.container:infinispan-arquillian-impl:jar:1.1.0.Alpha1:test
Now that we’ve configured the server to run in our tests, it’s time to introduce a few enhancements which will help you write tests more effectively.
You can still inject the reference to a running Infinispan Server by annotating an instance variable of type RemoteInfinispanServer with @InfinispanResource.
When there are more Infinispan servers to be injected, you can now use the following snippet instead of injecting each server independently:
Then you can retrieve individual servers by calling .getServer(name) on the servers variable. The name must correspond to an existing container definition within arquillian.xml. The results of this call will be of type RemoteInfinispanServer.
So far users were forced to start the Infinispan Server either before the whole test suite (mode="suite") or before each class separately (mode="class"). The annotation WithRunningServer enables users to automatically start the server before a test method and stop it after the method. Example:
Note that in this case containers should be marked as mode="manual" in arquillian.xml file so that Infinispan Arquillian extension can handle lifecycle of these servers by itself.
When @WithRunningServer annotation is placed on a class, the server(s) will be started before the first method call in the test class, and stopped when JUnit @AfterClass event is triggered.
Tags: testing announcement