Adding more "routes" to WPT

We are in the middle of deploying tests for Web Annotation Model and Web
Annotation Protocol specs.  They are in CR.  As part of this, we have
developed a backend Web Annotation Protocol server so that client
implementations can exercise themselves against it (and thereby demonstrate
feature support and interoperability).

The Annotation Protocol is sort-of RESTful.  Given a root URI, various HTTP
verbs will perform various annotation operations on the annotation
collection at that URI.

Within WPT, the best way to implement this is as a route:  ("*",
"annotation-protocol/client/annotations/*",
"annotation-protocol/client/server.py"), or better yet a collection of
routes - one for each verb.

But I cannot believe that this is the last time some aspect of WPT will
need to add an actual route (instead of just having a Python script as a
target).  So, here is my question:  is it reasonable to extend the WPT
route mechanism so that a test suite can declaratively add a route to the
system?

My simplistic concept for this is that, for a given request path, if there
is a file "path.route", then the system would use the route(s) defined in
that file to process the request.  So, if there were a path
"annotation-protocol/client/annotations/lala" and a verb of POST, and a
file "annotation-protocol/client/annotations.route" with contents like:

("*", "*", "server.py")


then server.py would get invoked as a PythonScriptHandler and the request
path and verb would inform the script what needs to be done.  It's main
method would get called with the request and response parameters, and it
would internally dispatch the request and return the response.

Thoughts?  Unfortunately this has a fairly short fuse.  We are already in
CR and these tests need to get into the field ASAP :/

-- 
Shane McCarron
Projects Manager, Spec-Ops

Received on Saturday, 13 August 2016 02:13:23 UTC