Hash validation of service responses
This page describes the use of the hash validation tool for service testing.
Contents
1. Introduction
It is hard to test binary responses to services for correctness automatically. Imaging a map as a response to a WMS GetMap request, in different stylings. One way to work around this is to once manually verify that a given request yields the correct response, make a md5 hash of the response and then verify the md5 hash when testing automatically.
2. The tool
There is a simple tool in the test module, called the HashValidator that can be used for this purpose. The command line usage works like this:
`java -cp ... org.deegree.test.services.hash.HashValidator http://localhost:8080/myservice/services the/dir/with/the/files/as/explained/below/ and/possibly/more/of/these/`
The validator sends request to the service for all files in the given directory (non-recursively) as follows:
for a file file.ext, if there is no file.md5, no request is sent
for a file file.ext, if the first line starts with <?xml, it is sent as a POST request, with content-type text/xml
for a file file.ext, if the first line does not start with <?xml, a GET request with the file's first line as query string is sent
if a request was sent, the response is md5 hashed, and compared with the one in file.md5. If it fails, an appropriate warning is output.