Reddwarf-Test-With-XmlLint

It is possible to change the HTTP client to capture the HTTP request and response bodies, save them as files, and run XmlLint to make sure the XML is well formed.

Here's an example test configuration file which will do so: {   "include-files": ["localhost.test.conf"], "reddwarf_client_cls": "reddwarf.tests.util.client.XmlLintClient", "xml_temp_file":"lastclient-body.xml", "xmllint_bin": "/usr/bin/xmllint" }

There are some issues which preclude this from running in Tox normally with every run.

First, the path to xmllint is required as shown by the "xmllint_bin" config value. This program would need to be installed somehow by Tox to be make the local testing process simple.

Additionally, for the best results, "xml_temp_file" is used as the path of a temporary file to create which contains the lastest request or response body (piping the xml body to xmllint directly leads to inconsistent behavior and quirky results).

Validating an XSD File

One additional, but not mandatory, test config value is "xml_xsd" which if present will become an argument following "--schema" which is sent to xml lint.

While this is difficult to set up for Tox, it would be relatively simple to use in the VM gated tests guided by Reddwarf Integration.

Obstacles to putting this into VM runs

A few obstacles stand in the way of running this in RDI, however:


 * If an invalid version is requested, the Reddwarf API currently returns a body of text which does not parse to an XML element (or a JSON body for that matter) which (rightfully) causes the test to fail when xmllint verification is turned on: https://bugs.launchpad.net/reddwarf/+bug/1174960


 * There is as of yet no agreed upon XSD schema for Reddwarf.

If you'd like to test currently, simply install xmllint, and then change the contents of the file "etc/tests/xml.localhost.test.conf' to the sample file presented above. After that (assuming tox has been run once) run the following: $ .tox/py27/bin/python run_tests.py --test-config=etc/tests/xml.localhost.test.conf