Today I would like to share my own experience with building test sandbox for Axis 2 Web Services. Primarily, I tried to avoid any external dependencies (such as database, servers, etc.). Test sandbox should be fully reproducible and isolated.
Application architecture looks like in picture below. ![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhudje4CBpyBSH2pPvJl2I7gI5Wb7EHT7-1JYNh6iTJv_c1CPQiJG4qijrqVXWMd67TK8vofO8EdJej4rPzNZqepwGbfWaezMgM2XhPKcDT5w_iqAHNk9gdnr88iWzh75G2XkFRVMA1tGmq/s320/Architecture.png)
So, our test sandbox should have:
- HTTP Server (and Servlet container) -> Jetty
- Database (in memory) -> HSQLDB
The flow to start up test sandbox looks like:
- Configure HSQLDB data source and JNDI
- Configure Hibernate
- Configure Web Services for Jetty
- Run Jetty
- Export database schema (Hibernate)
- Prepare test dataset (DbUnit)
- Run test(s) (Java or Groovy)
Also, using AspectJ weaver, we can reconfigure Hibernate with HSQLDB data source on the fly. It looks a little bit complicated but completely feasible. So, from theory to code ... (next post)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhudje4CBpyBSH2pPvJl2I7gI5Wb7EHT7-1JYNh6iTJv_c1CPQiJG4qijrqVXWMd67TK8vofO8EdJej4rPzNZqepwGbfWaezMgM2XhPKcDT5w_iqAHNk9gdnr88iWzh75G2XkFRVMA1tGmq/s320/Architecture.png)
So, our test sandbox should have:
- HTTP Server (and Servlet container) -> Jetty
- Database (in memory) -> HSQLDB
The flow to start up test sandbox looks like:
- Configure HSQLDB data source and JNDI
- Configure Hibernate
- Configure Web Services for Jetty
- Run Jetty
- Export database schema (Hibernate)
- Prepare test dataset (DbUnit)
- Run test(s) (Java or Groovy)
Also, using AspectJ weaver, we can reconfigure Hibernate with HSQLDB data source on the fly. It looks a little bit complicated but completely feasible. So, from theory to code ... (next post)
No comments:
Post a Comment