Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Unit testing with Mule ESB 3.4 Enterprise Edition

DZone's Guide to

Unit testing with Mule ESB 3.4 Enterprise Edition

· DevOps Zone
Free Resource

The Nexus Suite is uniquely architected for a DevOps native world and creates value early in the development pipeline, provides precise contextual controls at every phase, and accelerates DevOps innovation with automation you can trust. Read how in this ebook.

There is a big chance that when you are using the Mule ESB EE as your ESB implementation and you are creating functional/unit tests you sooner or later will need a license on your test classpath to be able to run Mule in your unit tests. Luckily this isn’t very hard to accomplish. You can just take the license file that is generated when installing your license at the (standalone) server. You can find the license file on the server here: $MULE_HOME/conf/muleLicense.lic. Just copy it to your
‘$PROJECT_HOME/src/test/resources/’ folder so it an be accessed on the classpath.
Till so far fo the happy scenario. However after doing this I ran into the following exception

Caused by: java.lang.ClassNotFoundException: com.mulesource.licm.LicenseKeyException


This is quite scary since I am using Mule EE 3.4.1 and the package name ‘com.mulesource’ has been changed to ‘com.mulesoft’ since Mule v3.1 several years ago!

It appears that adding the following dependency fixes this:<dependency>

  <groupId>com.mulesoft.licm</groupId>
  <artifactId>licm</artifactId>
  <version>1.1.4</version>
</dependency>

And while we are on it I also added the following to solve another issue:<dependency>

  <groupId>xalan</groupId>
  <artifactId>xalan</artifactId>
  <version>2.7.1</version>
  <scope>provided</scope>
</dependency>

With these two dependencies I was able to run my test classes using the EE transports of Mule. Of course you have to make sure the licm.jar is available in the Maven Repo. I described here how to do that.

The DevOps Zone is brought to you in partnership with Sonatype Nexus.  See how the Nexus platform infuses precise open source component intelligence into the DevOps pipeline early, everywhere, and at scale. Read how in this ebook

Topics:

Published at DZone with permission of Pascal Alma. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}