extending HTTPRequest

Joan Picanyol i Puig <[email protected]>
Newsgroups gmane.comp.java.grinder.user
Message-ID <[email protected]>
Hi,

I'm trying to modify a test recorded with the TCPProxy & HTTP filter so
that all HTTP failures fail the tests.

I thought I'd be as easy as extending HTTPRequest to raise an Exception
and use it in the createRequest() method, but I'm getting a
net.grinder.script.NonInstrumentableTypeException: The Jython instrumenters do not support selective instrumenters

I've been unable to gather from
http://grinder.sourceforge.net/g3/instrumentation.html#Selective+instrumentation
what the correct approach would be. Any ideas?

For the record, I'm modifying the generated script with:

class MyHTTPRequest(HTTPRequest):
    def __init__(self, url):
        # super(MyHTTPRequest, self).__init__()
        HTTPRequest.__init__(self)

    def processResponse(self, response):
        if response.getStatusCode >= 400:
            log("KO %(status)s: %(msg)s" %
                {"status": response.getStatusCode(), "msg": response.getText()})
            raise Exception(response.getText())

def createRequest(test, url, headers=None):
    """Create an instrumented HTTPRequest."""
    # request = HTTPRequest(url=url)
    request = MyHTTPRequest(url=url)
    if headers: request.headers = headers
    test.record(request, HTTPRequest.getHttpMethodFilter())
    return request

And this is the exception I'm getting:

net.grinder.script.NonInstrumentableTypeException: The Jython instrumenters do not support selective instrumenters
        at net.grinder.scriptengine.jython.instrumentation.dcr.AbstractJythonDCRInstrumenter.disallowSelectiveFilter(AbstractJythonDCRInstrumenter.java:183) ~[grinder-core-3.11.jar:na]
        at net.grinder.scriptengine.jython.instrumentation.dcr.AbstractJythonDCRInstrumenter.instrument(AbstractJythonDCRInstrumenter.java:167) ~[grinder-core-3.11.jar:na]
        at net.grinder.scriptengine.AbstractDCRInstrumenter.instrument(AbstractDCRInstrumenter.java:93) ~[grinder-core-3.11.jar:na]
        at net.grinder.scriptengine.CompositeInstrumenter.instrument(CompositeInstrumenter.java:103) ~[grinder-core-3.11.jar:na]

tks
-- 
pica

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.