GSoC - Arquillian Spring Integration
aslak Mar 23, 2012 6:23 AMExtend Arquillian to support Spring testing (beans and MVC controllers)
Ref Mail:
There are a two different parts to this task. I can explain the first part, and Marius is probably a better person to explain the second.
Currently, we can test Spring in a EE deployed application by doing all the context/bean lookups etc manually or via a Spring to CDI bridge, but Arquillian has a SPI which is called TestEnricher[1]. What this does is to open up for injections into the TestClass instance.
e.g.
public class TestClass {
@Autowired
private Bean bean;
@Test
public void ....
}
So our SpringTestEnricher should simply scan the given TestClass for 'supported' annotations and do the ApplicationContext lookups. (unless Spring has some concept of non contextual injection where you can simply say, inject what ever you know into this 'instance').
Then, there is the DeployableContianer[2] implementation for Spring, another Arquillian SPI that is responsible for starting/stopping/deploying/undeploying Containers and Deployments. We have implementations of this for JBossAS, GLassFish, Tomcat, Jetty, WebLogic, WebSphere, OpenWebBeans, OpenEJB and Weld++. What this should do in the Spring case is basically accept a ShrinkWrap[3] Archive and 'convert' that into a Spring ApplicationContext.
ShrinkWrap is a library for creating in memory representations of resources, classes etc. It gives you the option to isolate your test environment from the full client classpath your test is running in. Micro deployments as we like to call them. Test isolation level.
We welcome Jakub Narloch to the Arquillian Familiy!
The work will be based out of this repository, fork and enjoy: https://github.com/arquillian/arquillian-container-spring
The two current tasks are :
https://issues.jboss.org/browse/ARQ-301 - Create a Spring framework integration (for non-embedded containers)
https://issues.jboss.org/browse/ARQ-219 - Implement an embedded Spring container
Jakub, I tried to assign the tasks to you, but I couldn't find you in Jira. You might need to login before I can do that..
For now I think we can keep an open dialog/discussion in this thread. But we start new threads as needed..