Mule WireMock Module

A Mule extension that provides WireMock Server functionality

License

License

Categories

Categories

Wire Data Data Structures
GroupId

GroupId

com.ms3-inc.mule
ArtifactId

ArtifactId

mule-wiremock-module
Last Version

Last Version

0.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

Mule WireMock Module
A Mule extension that provides WireMock Server functionality
Project URL

Project URL

https://github.com/MS3Inc/mule-wiremock-module
Source Code Management

Source Code Management

https://github.com/MS3Inc/mule-wiremock-module

Download mule-wiremock-module

How to add to project

<!-- https://jarcasting.com/artifacts/com.ms3-inc.mule/mule-wiremock-module/ -->
<dependency>
    <groupId>com.ms3-inc.mule</groupId>
    <artifactId>mule-wiremock-module</artifactId>
    <version>0.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.ms3-inc.mule/mule-wiremock-module/
implementation 'com.ms3-inc.mule:mule-wiremock-module:0.5.0'
// https://jarcasting.com/artifacts/com.ms3-inc.mule/mule-wiremock-module/
implementation ("com.ms3-inc.mule:mule-wiremock-module:0.5.0")
'com.ms3-inc.mule:mule-wiremock-module:jar:0.5.0'
<dependency org="com.ms3-inc.mule" name="mule-wiremock-module" rev="0.5.0">
  <artifact name="mule-wiremock-module" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ms3-inc.mule', module='mule-wiremock-module', version='0.5.0')
)
libraryDependencies += "com.ms3-inc.mule" % "mule-wiremock-module" % "0.5.0"
[com.ms3-inc.mule/mule-wiremock-module "0.5.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.tomakehurst : wiremock-jre8 jar 2.25.1

provided (11)

Group / Artifact Type Version
org.mule.runtime : mule-extensions-api jar 1.2.1
org.mule.runtime : mule-api jar 1.2.1
org.mule.runtime : mule-core jar 4.2.1
org.mule.runtime : mule-module-extensions-spring-support jar 4.2.1
org.mule.runtime : mule-extension-ast-loader jar 1.1.0
org.mule.runtime : mule-metadata-model-xml jar 1.2.1
org.mule.runtime : mule-metadata-model-java jar 1.2.1
org.mule.runtime : mule-metadata-model-json jar 1.2.1
org.mule.runtime : mule-module-service jar 4.2.1
org.mule.services » mule-service-weave jar 2.2.1
org.mule.runtime » mule-module-javaee jar 4.2.1

test (12)

Group / Artifact Type Version
org.mule.tests.plugin : mule-tests-component-plugin jar 4.2.0
org.mule.tests : mule-tests-functional jar 4.2.0
org.mule.tests : mule-tests-runner jar 4.2.0
org.mule.tests : mule-tests-unit jar 4.2.0
org.apache.httpcomponents : fluent-hc jar 4.5.3
org.mule.runtime : mule-module-extensions-support test-jar 4.2.1
org.mule.connectors : mule-http-connector jar 1.5.9
org.mule.connectors : mule-http-connector test-jar 1.5.9
org.mule.connectors : mule-sockets-connector jar 1.1.2
org.mule.services : mule-service-scheduler jar 1.2.3
org.mule.services : mule-service-http jar 1.4.7
org.mule.services : mule-service-http test-jar 1.4.7

Project Modules

There are no modules declared in this project.

Mule WireMock Module

When writing integration software for distributed systems the most critical part to test is the interaction between those systems. Obviously this makes integration tests vital. Traditionally we would test against live systems, but having a local instance of an upstream system or a dedicated test instance can be expensive and/or difficult to coordinate its state between tests.

Instead we can opt to verify the interactions against test doubles, also known as narrow integration tests. WireMock is a simulator for HTTP-based APIs that allows us to spin up a HTTP server and configure stubbed responses for particular requests.

With the Mule WireMock Module we can spin up an in-process HTTP Server and run our integration tests against it. WireMock gives us a couple of advantages over MUnit's 'Mock When' processor:

  1. We're actually sending requests over the wire so we get the confidence that HTTP Requester configuration and subsequent processors are correct.
  2. WireMock supports conditional responses based on scenarios, this way we can more easily test behavior that changes the external system's state as it executes.
  3. With an actual HTTP Server serving requests it's simpler to implement your application if the real services are not yet available or it's difficult to control their state.

Resources worth checking out:

WireMock Key Features

  • HTTP response stubbing, matchable on URL, header and body content patterns
  • Request verification
  • Fault injection
  • Stateful behaviour simulation
  • Configurable response delays

Full documentation can be found at wiremock.org

Using the connector

Add this dependency to your application pom.xml

<dependency>
    <groupId>com.ms3-inc.mule</groupId>
    <artifactId>mule-wiremock-module</artifactId>
    <version>0.5.0</version>
    <classifier>mule-plugin</classifier>
</dependency>

See the module's own MUnit integration test for a complete and commented example on how to use the connector.

For more details on verifying requests and stubbing responses, see WireMock Stubbing, WireMock Verifying, and WireMock RequestMatching

com.ms3-inc.mule

MS3 Inc

Mountain State Software Solutions

Versions

Version
0.5.0
0.4.6
0.4.5