mdg-stub

Build Status Download

This repository contains stub of the MDG service. It accepts file transfer requests and allows to run and test services relying on integration with MDG (e.g. file-transmission)

Functionality

The service accepts file transfer a format supported by MDG.

The service has one endpoint: http://localhost:9576/mdg-stub/request which accepts POST requests with file transfers.

The format accepted by MDG is specified as a XML Schema in the following file: mdg-schema.xml.

Sample request document can be found here.

In case the request is valid it immediately returns 204. In case the request is invalid it return HTTP 400 error. The mock also allows to simulate erroneous behaviour of MDG. If properly prepared request is sent (see Mocking errors section), HTTP 500 error is returned.

Mocking errors

The mock allows to simulate errors returned by MDG. This can be done in two ways:

Specifying filename with desired error code

If the request refers to the file with a name that matches the pattern failXXX.YYY, where XXX is a desired HTTP status and YYY is any file extension, the stub will immediately return with XXX status.

Defining more complex failure scenarios by defining custom properties

TODO MDG stub allows to specify more complex interaction patterns by adding 'AVAILABILITY' properties. This needs to be documented

Running the service

The service can be run locally either directly or using service manager.

To run service locally you have to execute the following command:

sbt run

To run service using service manager you have to execute the following command:

sm --start MDG_STUB

In both cases the service will be accepting requests on the endpoint http://localhost:9576/mdg-stub/request

Related projects, useful links:

License

This code is open source software licensed under the Apache 2.0 License