Mulesoft do not provide an official docker images for the mule runtime.
The module will use by default the docker image mariocairone/mule-ee:latest.
As a dependency of your Maven project:
<dependency>
<groupId>com.mariocairone.mule</groupId>
<artifactId>testcontainers-mule</artifactId>
<version>1.0.0</version>
</dependency>You can also build the .jar file yourself, assuming you have Maven and JDK 1.8+ installed:
mvn clean installThe resulting .jar file will be located in the target/ folder.
You can also find SNAPSHOT builds of the latest and greatest changes to the master branch in the SonaType snapshots repository.
To add that snapshot repository to your Maven pom.xml use the following snippet:
<repositories>
<repository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>The example below shows how to use the module to create a mule container with a deployed application in a Junit test class.
package com.mariocairone.mule.testcontainers;
import org.junit.ClassRule;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testcontainers.containers.wait.strategy.Wait;
public class MuleServerContainerTest {
@ClassRule
public static final MuleServerContainer mule = new MuleServerContainer()
.withDeployedApplications("target", "myApp*.zip")
.withExposedPorts(8081)
.withMuleArg("mule.env", "test")
.withMuleLogFolder("target/logs")
.waitingFor(Wait.forHttp("/")
.forStatusCode(200);
private static Integer mulePort;
@BeforeClass
public static void init() {
mulePort = mule.getFirstMappedPort();
}
// Add your test
@Test
public void test() {
}
}