Extend Arquillian to support Spring testing (beans and MVC controllers)
Jakub Narloch
Short description: Arquillian provides an extensible testing platform that can be used for testing any type of Java-based component. The initial focus for Arquillian was testing Java EE components, such as CDI beans, EJBs and JPA. However, Arquillian provides all the infrastructure and hooks necessary to make it an ideal testing platform for Spring applications. So the main of this project would be introducing suport for Spring testing.
Student
Jakub Narloch (jmnarloch@gmail.com)
Contact
You can contact me anytime by email (jmnarloch@gmail.com). Currently I live and study in Warsaw (Poland), but from time to time I go for weekends to Szczecin, which is my home town.
Personal
I’m studding computer science at the Faculty of Electronics and Information Technology which is part of Warsaw University of Technology. This is my last and final year and I’will be defending my thesis in june or september (it depends on various things). My thesis is titled “Selected SOA application security issues” as part of which I had made an application that mediates between the service client and service provider and allows to configure the message level security for service endpoints. I had previously graduated three and a half year studies of computer science at Szczecin University of Technology with engineer's degree.
I am planning and most likely be able to work for up to 20 hours a week during the first phase of development till 30 of June. During the vacation I’m willing to increase that time. I can work at flexible hours, but in the beginning I will be most likely able to work during afternoon starting from 5 PM (UTC +1).
As for my expectations about the project, I am hoping to gain some new experience. Although, I had chosen a project that is based on technologies and libraries that I am already familiar with.
Experience
During my quite short live I had gained various experience:
I had been working from July 2008 till January 2010 as Junior Enterprise Application Developer in BLStream Ltd. During that time I had been working in two projects: first one was connected with developing and supporting internal systems for a one o the largest telecommunications companies in Poland. The systems were all based on JEE hosted on Weblogic Servers. The project used variety of different frameworks like: Struts, Spring, JMS and Hibernate. I had also got opportunity to gain experience in working with web services created with help of Spring-WS (which enforces use of contract first approach), that way I gained good knowledge of XML and XML related technologies like: XSD, WSDL, SOAP.
After a year I have been moved to other project. I had been developing a .NET desktop application for Zumtobel, it’s an Austrian company providing light solutions. The application has been completed and released as ecoCALC. I was responsible for creating part of the core functionality both with user interface. Unfortunately the beginning of 2010 brought even stronger recessions, at least in this part of world.
During 2010 and 2011 I had participated in component development contests hosted by TopCoder Inc. First, I had bean participating as contestant. Currently I am member of development review board and from time to time I am reviewing submissions made by other members. TopCoder give me quite unique experience, working with different technologies in very short time periods. It mostly required working individually, with some support from designer or client through project forums. I am still willing to participate in contests in future.
Link to my TopCoder profile: http://community.topcoder.com/tc?module=MemberProfile&cr=22686325
I had also participated in last year GSOC. I had been working with Werner Gutmann lead of Castor XML project on integrating the Spring OXM and current Castor release. The project ended with success with help from Arjen Poutsma on Spring side. The project wiki that I made last year quite well summarize what has been done during the project: http://docs.codehaus.org/display/CASTOR/Better+integration+of+Castor+XML+and+Spring+OXM
Beginning from August 2011 I had begun working as .NET developer at K2 WebSystems and I'm still employed there. Currently I work 30 hours a week.
Application
I had already begun discussing the idea with project mentors: Aslak Knutsen and Marius Bogoevici which has been documented by this forum thread: https://community.jboss.org/thread/197356?start=15&tstart=0.
The main aim of this project would be to introduce a Spring support for Arguilian. Currently testing Spring applications isn’t supported directly, although there is a possibility to use it through CDI bridge.
The project could be divided into at least 3 smaller tasks, which involve:
- Implementing a Spring test enricher – which could be used for testing the application on e.g. remote servers. https://issues.jboss.org/browse/ARQ-301
- Implementing Spring support for embedded https://issues.jboss.org/browse/ARQ-219.
- Testing Spring MVC controllers – this task requires to implement an API that allows for testing the MVC controllers in similar manner as currently the JSFUnit extension in Arquilian does.
During the two weeks preceding the application deadline I had begun working on the test enricher and I manage to implement a working prototype which can be found here: https://github.com/jmnarloch/arquillian-container-spring.
In simple scenario it allows to run a “Spring – enabled” test by simply placing proper Spring application xml file in archive class path like in fallowing example:
No other configuration is needed and thanks to Arquillian plugable architecture, developer only needs to add proper dependency into his maven project. The prototype does not fulfill all the requirements but gives a good starting point for farther work.
The fallowing example has one major limitations, customizing Spring initialization in above solution is imposible. So the next idea would be to introduce a annotations that could be used in other to infrom Arquillian where to look for Spring configuration. That could be achived by adding a @SpringConfiguration annation that could look like fallowing
Timeline
I would divide the project into couple seperated iterations, each iteration could last for about two weeks. I assume that after each stage there will be created a required piece of code meeting the requirements specified by mentors fallowed by unit tests and some documentation in form i.e wiki page:
- In the begging I would extend the prototype and properly test in other to fullfilll the task (ARQ-301)
- The next step would be to correctly test it by preparing unit test that would be used as a both demonstration of usage of the component and would also prove that it is working as expected. The test could check many different scenerios like for example EJB, JMS usage through Spring.
- The next part would be to implement or modify the existing solution and enable running the test within an embedded container
- Final one or two iterations, would be dedicated preparing a solution for testing MVC controlers that are running within container.
- The last stage would including creating proper documentation and or extension wiki.
- arquillian-spring-inject
- arquillian-spring-javaconfig
- arquillian-spring-jsr330
- arquillian-spring-jdbc
- arquillian-spring-jpa
- arquillian-spring-hibernate
- arquillian-spring-ejb
- arquillian-spring-jms
