Your Feedback
Chris Fleck wrote: Congratulations on the successful launch of Ulitzer ! I was skeptical at first but the more I use and contribute to Ulitzer, the more I think you have...


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 is a software architect with Fiver Media, a company that provides services to a major international digital entertainment group. He is the project despot of the Mule JCR transport and project lead of NxBRE, a business rules engine for the .NET platform.

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
When we decided to sell our home last December we made the mistake of picking a realtor closest to our home, rather than doing a comprehensive research, interviews, reference checks. I thought I someone wants to see the house, they could just come and show it very conveniently. We lear...
Forty-five wine industry professionals from throughout the United States convened June 19th, 20th and 21st to taste, score and rank 4,274 wines from 1,195 wineries during the San Francisco International Wine Competition held at San Francisco's Hotel Nikko. In its 29th year, the San Fra...
Tobago has become a very popular tourist destination of Caribbean from all over the world. The island has variety of Tobago Vacation Rentals as a mode of accommodation to suit your tastes and budgets. It depends on what kind of environmental setting you want to enjoy within Tobago – th...
Saint Barthelemy, also known as Saint Barth, is one of the must see islands in the West Indies nowadays. The island has unique characteristics as of a real paradise which reflects its charming Swedish and French heritage that is why many European tourists and other foreign people are v...
I am officially adding you and your company to my June 30, 2009 clean up deadline. If you and the mayor do not clean up your town and your act, you should also hang yourself with shame. How can you dare to email me with a straight face? The gullets your firm is representing are directl...
I thank you very much for taking the time to bring to everyones attention the mess in Bodrum and the lack of action from the Mayor of Bodrum, Kocadon. I live in Chicago and have a summer/retirement home in Yalikavak and I have to admit I have been amazed at how much the Mayor of Bodrum...

YV&C Recommended Yacht Charter Links