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 DevOps Zone is brought to you in partnership with Sonatype Nexus. The Nexus Suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

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. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:

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

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}