Category Archives: Frameworks

Phase 1 – The application

Firstly we need an application…

Using Spring STS we can easily create a Spring MVC based project that we think will take over the world….

STS makes it incredibly easy to create a new web based Spring MVC application and the rest of the blog posts will be based upon a Spring MVC application.

The application provides one screen that allows a user to enter two numbers and adds the two numbers together providing the answer. Its ground breaking stuff I know!

To grab the application in its current form you can simply clone it using Git or if you haven’t used git before you can download phase 1 of the application as a zip file.

Phase 1 of the application has been tagged with ‘v1.0′ for those comfortable with git.

Assuming you are using STS and running tcServer or something similar like Tomcat on port 8080, once you have the application compiled and built the application should be able to run it by visiting:

http://localhost:8080/springciexample

In order to build that application we have to manually invoke our maven compile process with something like:

mvn clean compile war:war

That concludes phase 1 of the series in which we have met phase 1 of the seven phases of CI by having an application with no build server.

Next we need to bring in a build server

Moving to CI for a Spring application

I am incredibly lucky to work with a very talented team of developers that have a passion for adopting Software Development best practices.

One of the practices we have adopted is Test Driven Development (TDD). This means that our developers have quite an extensive suite of tests that test various layers and functionality of the product we work on at AdInsight

With the development team writing a lot of tests there soon becomes the need to facilitate the automation of those tests.

The automation should have a few goals:

  • Continuously build application upon new source control changes
  • Automate test invocation
  • Report test fails to dedicated developer(s)
  • Automatically build project
  • Optionally – Automatically deploy project

To achieve this a development team needs to adopt a process known as Continuous Integration (CI)

There is a general rule that a development team will go through 7 phases of achieving true CI.

  1. No Build Server
  2. Nightly Builds
  3. Nightly Builds and Basic Automated Tests
  4. Code coverage and Metrics
  5. More Serious Testing
  6. Automated Acceptance Tests and More Automated Deployment
  7. Continuous Deployment

I cannot take credit for the formulation of the steps above. They are extracted from the ‘Jenkins: Definitive Guide‘ and the corresponding article on Java.net

The next posts in this series will go through achieving most of those stages in the above cycle. They will outline how those stages can be achieved using Java and in particular a Spring based web application using the Maven build process.

The posts will assume that the reader is comfortable with Java, Maven and the Spring framework and for that reason wont go into too much detail on the code involved. They serve to provide an example of how you might architect an application for a transition to CI

On with phase 1 the application with no build server