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.
Developing tests with Infinispan Server
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:
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.
RemoteInfinispanServersYou 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.
WithRunningServerSo 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.
IPv6 supportInfinispan Arquillian extension can now work with Infinispan Server running on IPv6 as it can correctly connect to the server via JMX.
Testing embedded Infinispan
Running tests with plain Infinispan libraries instead of Infinispan Server has not changed since the last release. Read more about it in the previous blog post.
Thanks to Michal Linhard and Vitalii Chepeliuk who helped move the project one step further.