Unit testing with Mule ESB 3.4 Enterprise Edition

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.

About Pascal Alma

Pascal is a senior IT consultant and has been working in IT since 1997. He is monitoring the latest development in new technologies (Mobile, Cloud, Big Data) closely and particularly interested in Java open source tool stacks, cloud related technologies like AWS and mobile development like building iOS apps with Swift. Specialties: Java/JEE/Spring Amazon AWS API/REST Big Data Continuous Delivery Swift/iOS
This entry was posted in Mule3 and tagged , . Bookmark the permalink.