Your Feedback
Marion wrote: I am a sea lover. Seems to be an interesting cruise. david martin Abrahams would love to travel on it.


YV&C Current Issue


YV&C Recommended Yacht Charter Links

ESB Testing Strategies with Mule
Will it break anything?

To be able to do anything useful, an ESB must be configured with all sorts of parameters, from endpoint connection URIs to message transformation scripts to content-based routing definitions. Moreover, ESBs like Mule can host custom components, which will process messages and perform user-specific actions on them.

Deploying a new version of an ESB configuration raises the question of whether it will break anything. How can we build confidence that everything will be just fine? If unit testing did it for standard software development, what can it do in the realm of the ESB? Since ESBs are becoming increasingly familiar in corporate IT, getting concrete answers is of interest to more and more people.

This article details the testing strategies I employ for Mule ESB-driven projects, which I think contain elements that could be generalized to other platforms. I am certain that readers will have strategies of their own and I welcome their comments. I am also convinced that ESB vendors have their own approaches, sometimes generic, often proprietary, and that they are worth following if you use their tool. This article does not cover the subject of SOA testing strategies, which is already thoroughly discussed in the industry.

Level One: Unit Testing - Components and Transformers
Whether they are compiled or scripted, components can easily be unit tested. Provided they have been correctly initialized, unit testing them amounts to receiving an expected response for a known input. Correctly initializing a component consists of calling its lifecycle methods, if any, for compiled ones or establishing the correct environment context for scripted ones. Some components are more complex in the sense that they can be aware of the event context in which they process a message payload or need to connect to other end points. Mule's ESB functional test library (mule-tests-functional-xyz.jar) offers a variety of helpers, mostly in the form of subclasses of JUnit TestCase to establish test event context or temporary end points, which let us test this kind of component thoroughly. For example, here is an example for testing an event-aware component:

import org.mule.impl.RequestContext;
import org.mule.tck.AbstractMuleTestCase;
public class EventAwareComponentTestCase extends AbstractMuleTestCase {
protected static final String TEST_PAYLOAD = "test.foo.payload";
public EventAwareComponentTestCase() {
super();
}
@Override
protected void doSetUp() throws Exception {
RequestContext.setEvent(getTestEvent(TEST_PAYLOAD));
}
@Override
protected void doTearDown() throws Exception {
RequestContext.setEvent(null);
}
}

Transformers are very similar to components as far as testing is concerned. For the ones that are unaware of their ESB context, unit testing is straightforward; for others, Mule testing tools will come in handy. Note that at this level, it is the transformer that is tested and not how well its configuration makes the expected transformation on a particular message (this is discussed later).

About David Dossot
David Dossot has worked as a software engineer and architect for more than 14 years. He is a co-author of Mule in Action and is the project despot of the JCR Transport and a member of the Mule Community Committee. He is the project lead of NxBRE, an open source business rules engine for the .NET platform (selected for O'Reilly's Windows Developer Power Tools). He is also a judge for the Jolt Product Excellence Awards and has written several articles for SD Magazine. He holds a Production Systems Engineering Diploma from ESSTIN.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Subscribe to the World's Most Powerful Newsletters !
Receive Breaking Yacht Charters News as it Happens...
Yacht Charter Newsletter
Jet Charter Newsletter
 
SuperYacht Newsletter
SuperYacht Conference
Your E-Mail: 
State: 
Zip Code: 




Type the characters you see in this picture (lower case):   


YV&C Recommended Yacht Charter Links

Latest YV&C Stories
Books are now open for Crystal Cruises' 16th annual, 110-day 2011 World Cruise. Fares for the "Grand Exotic Expedition" World Cruise aboard Crystal Serenity are now available online, along with Full World Cruise and segment itinerary details, and attractive promotional and savings info...
A JetBlue Embraer ERJ-190, registration N279JB performing flight B6-904 from Chicago O'Hare, IL to New York JFK, NY (USA) with 64 passengers and 4 crew, was on final visual approach to JFK's runway 31R descending through 2000 feet, when the crew reported they needed to abort the approa...
I met someone! See, I never liked caramel--to me it was always a chocolate wannabe that just wasn't cool enough to have cocoa in it. And then two days ago, at a little paradise called the Whole Foods chocolate aisle, I finally met a caramel I kind of like. Really, really like. I bought...
So, the first week "on the air" went very well. Not an easy week, but remarkable good. We rapidly increase our midstock and microstock collection of royalty free images and this keeps our hands busy all the time. The infrastructure we choose for www.pixamba.com is extremely versatile a...
The number of submissions grows daily, hope it will keep going this way. The MIN upload size went down from 6 MP to 4 MP, thus helping our contributors to submit many stock illustrations that were prepared for other stock agencies at smaller sizes. We also have found and fixed a few si...
I am very excited to show you up some initial results of our hard work for quite a long time. Pixamba.com opens it doors for the contributors and image buyers. You are warmly welcome to join us and start selling your photos and illustrations with Pixamba. We offer high resolution stock...


YV&C Recommended Yacht Charter Links