Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding some more details about how to actually use Janus.

  • Loading branch information...
commit 1591333a783d29b8424053b93a12eed994b5b33f 1 parent 8599129
@gga authored
Showing with 52 additions and 0 deletions.
  1. +52 −0 README.md
View
52 README.md
@@ -21,3 +21,55 @@ consuming applications. Executing the contract in one mode would test
the service; executing it in another mode would create an
out-of-process mock server. As soon as the client team writes the
contracts, they would get immediate value out of it.
+
+## Getting Started
+
+Janus currently only verifies services against contracts, it can't yet
+use those contracts to create mock services. To verify a service
+against a contract, create a contract like so:
+
+ (service
+ "Service name"
+
+ (contract "contract name"
+ (method <one of :get, :post, :put or :delete>)
+ (url "full, absolute URL to the service")
+ (header "header name" "header value")
+ (body <:xml, :json or :string>
+ <Clojure data structure that will be serialized as above>)
+
+ (should-have :path "json path" :matching <regex>)
+ (should-have :path "json path" :of-type <:string, :array, :object or :number>)
+ (should-have :path "json path" :equal-to <value>)
+ )
+ )
+
+Save that in a file with the suffix `.jns` and then run it with janus.
+
+ java -jar janus-0.0.2.jar --verify file.jns
+
+A janus contract file is a Clojure data structure, and it is not
+interpreted as code. This means you can't include Clojure code in
+there. If you need any code, then create a directory called `support`
+in the same directory as you run janus, any file with a `.clj` suffix
+in that directory will be loaded and executed.
+
+You can use that file to start and stop any services that you may
+need.
+
+### Json Path
+
+janus will automatically deserialize JSON responses received from
+services into Clojure data structures. Hence, to verify the structure
+of the document, Json Path is used to identify parts of the
+document. It's actually a pretty powerful language, though not quite
+as powerful as XML.
+
+For more info, have a look at the
+[Json Path](http://github.com/gga/json-path) implementation that janus
+uses.
+
+## Limitations
+
+* janus only support Json response documents.
+* No ability to mock services based on a contract.
Please sign in to comment.
Something went wrong with that request. Please try again.