raml-tester-proxy

Test if a request/response matches a given raml definition based on a standalone proxy.

License

License

GroupId

GroupId

guru.nidi.raml
ArtifactId

ArtifactId

raml-tester-proxy
Last Version

Last Version

0.8.12
Release Date

Release Date

Type

Type

jar
Description

Description

raml-tester-proxy
Test if a request/response matches a given raml definition based on a standalone proxy.
Project URL

Project URL

https://github.com/nidi3/raml-tester-proxy
Source Code Management

Source Code Management

https://github.com/nidi3/raml-tester-proxy

Download raml-tester-proxy

How to add to project

<!-- https://jarcasting.com/artifacts/guru.nidi.raml/raml-tester-proxy/ -->
<dependency>
    <groupId>guru.nidi.raml</groupId>
    <artifactId>raml-tester-proxy</artifactId>
    <version>0.8.12</version>
</dependency>
// https://jarcasting.com/artifacts/guru.nidi.raml/raml-tester-proxy/
implementation 'guru.nidi.raml:raml-tester-proxy:0.8.12'
// https://jarcasting.com/artifacts/guru.nidi.raml/raml-tester-proxy/
implementation ("guru.nidi.raml:raml-tester-proxy:0.8.12")
'guru.nidi.raml:raml-tester-proxy:jar:0.8.12'
<dependency org="guru.nidi.raml" name="raml-tester-proxy" rev="0.8.12">
  <artifact name="raml-tester-proxy" type="jar" />
</dependency>
@Grapes(
@Grab(group='guru.nidi.raml', module='raml-tester-proxy', version='0.8.12')
)
libraryDependencies += "guru.nidi.raml" % "raml-tester-proxy" % "0.8.12"
[guru.nidi.raml/raml-tester-proxy "0.8.12"]

Dependencies

compile (6)

Group / Artifact Type Version
guru.nidi.raml : raml-tester jar 0.8.9
org.slf4j : slf4j-simple jar 1.7.7
commons-cli : commons-cli jar 1.2
org.eclipse.jetty : jetty-server jar 9.2.14.v20151106
org.eclipse.jetty : jetty-servlet jar 9.2.14.v20151106
org.eclipse.jetty : jetty-proxy jar 9.2.14.v20151106

Project Modules

  • raml-tester-client
  • raml-tester-standalone

raml-tester-proxy Build Status

A standalone proxy/mock that tests if requests/responses are compliant with a given RAML.

To see all options, execute

java -jar raml-tester-standalone.jar

##Usage as proxy Example: If there is a service running at localhost:8080, start the proxy with

java -jar raml-tester-standalone.jar -t localhost:8080 -r <raml-file> -s.

and access the service using localhost:8099.

Every request or response that does not match the RAML definition will be logged.

##Run asynchronously If the proxy is started with the -a flag, it runs asynchronously. You can send commands to it the following way:

java -jar raml-tester-standalone.jar <command>

These commands are supported:

  • ping: Ping the proxy
  • stop: Stop the proxy
  • reload: Reload the RAML file
  • validate: Validate the RAML file
  • reports: Get the reports of the RAML violations
  • usage: Get information about usage of RAML elements

See also the RAML definition.

##Usage as Mock Instead of forwarding all requests to another server, the tool can also be used to return mock responses. (Which will also be verified against a RAML file.) Use the -m option instead of -t to run in mock mode:

java -jar raml-tester-standalone.jar -m mock-data -r <raml-file> -s.

The files in directory mock-data will be used as responses.

  • A request to localhost:8099/admin/user/ will be responded with any of the files mock-data/admin/user.{json|xml|txt}, if one exists.
  • Responses can be specialized by prepending the HTTP method: A GET request will first search for mock-data/admin/GET-user.json and then for the general mock-data/admin/user.json.
  • If a file named mock-data/admin/META-user.json exists, it is used to define response code and reponse headers. An example file looks like { "code": 202, "headers": {"X-meta": "get!"} }.
  • If no matching file for a request is found, RESPONSE.json is searched up the directory structure and used if found. mock-data/RESPONSE.json would be used whenever no exact matching file is found. The same is true for META- files.

##Usage from Javascript There is a special support for usage from javascript.

See raml-tester-js for details and raml-tester-uc-js for examples.

Versions

Version
0.8.12
0.8.11
0.8.10
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.0.4
0.0.3
0.0.2
0.0.1