Friday, January 28, 2011

Thursday, January 27, 2011

Periodic Task and Watchdog - Reusable and Testable Versions

In my previous post, I presented a simple utility for a periodically executing task and a watchdog to make sure it runs forever. Now I'll refactor that prototype code to make things generic and reusable.

Schedule a Periodic Task with a Watchdog

This demonstrates a simple mechanism to start up a thread that executes some task periodically, with a watchdog to ensure it keeps running. It is assumed that the periodic task involves some kind of I/O or remote communication that can result in an exception. The watchdog is needed because the java.util.concurrent class used for the task will not proceed with subsequent executions after one of its executions encounters an exception.

Friday, January 14, 2011

Test Your CXF REST Service by Examining Application Object State

While I've previously described using CXF to unit test a REST service, it's a limited technique since the object returned from the HTTP request is a response string - and any assertions you could make against that string are going to be brittle, since it relies on the decisions around how the encoding (XML or JSON) is done. What we really want is a more object-oriented mechanism for testing against application object state...which means you need a REST client that calls the service and can then look at the returned application object, as opposed to a Response object.

Monday, January 10, 2011

Portfolio Entry #1: Massage Business in Erie, Colorado

Tempo Software and Consulting (my LLC) happily announces the publishing of its first website, for my client running a massage therapy business in Erie, Colorado. Please have a look - comments and feedback are invited.

And if in fact you live in the Boulder County area, Aimee is a very gifted therapist who has taken care of my aches and pains for many years. Should you be looking for a massage therapist, I would very sincerely recommend her.

Full disclosure: Aimee is my wife, but I submit that my endorsement remains objective - since she was my massage therapist of choice for many years before we even started dating. And, yes, I billed her at a discounted rate.

Her business is Hands On Harmony Massage. Enjoy.

Thursday, January 6, 2011

Versioning XML and JSON Models in a CXF REST Service

Following up on my previous post around how simple it was to add JSON support to my CXF-based REST I'll add versioning support to my XML-annotated model and see what happens.

Tuesday, January 4, 2011

Add JSON Support to your REST Service

Continuing from my previous post about a standalone unit-test mechanism for your RESTful service, now I'll add JSON support to that service, which already gives you XML. This turns out to be a pretty simple thing - all we need is:

  1. Tell the RESTful service to produce both XML and JSON
  2. Add the runtime dependency you'll need 
  3. Add some tests to confirm things

Unit Test Your REST Service

Here's an approach for unit-testing your RESTful service.