# The Grinder 3.4
# HTTP script recorded by TCPProxy at Apr 14, 2010 6:22:48 PM

from net.grinder.script import Test as StandardTest

import script_offset

def Test(number, description):
    # Adjust to the appropriate offset.
    return StandardTest(number + script_offset.get_offset(), description) #@UndefinedVariable

from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
from HTTPClient import NVPair
connectionDefaults = HTTPPluginControl.getConnectionDefaults()
connectionDefaults.setFollowRedirects(0)
httpUtilities = HTTPPluginControl.getHTTPUtilities()

import thread_data as td #@UnusedImport
import text_processor as tp #@UnusedImport
import pool_data as pd #@UnusedImport

# To use a proxy server, uncomment the next line and set the host and port.
# connectionDefaults.setProxyServer("localhost", 8001)

# These definitions at the top level of the file are evaluated once,
# when the worker process is started.

connectionDefaults.defaultHeaders = \
    [ NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322)'), ]

headers0= \
    [ NVPair('Accept', '*/*'),
        NVPair('Referer', 'http://10.1.3.16:8080/sustain/cms/calendar?format=monthly'), ]

headers1= \
    [ NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'),
        NVPair('Referer', 'http://10.1.3.16:8080/sustain/cms/calendar?format=monthly'), ]

headers2= \
    [ NVPair('Accept', '*/*'),
        NVPair('Referer', 'http://10.1.3.16:8080/sustain/cms/calendar'), ]

headers3= \
    [ NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'),
        NVPair('Referer', 'http://10.1.3.16:8080/sustain/cms/calendar'), ]

headers4= \
    [ NVPair('Referer', 'http://10.1.3.16:8080/sustain/cms/calendar'),
        NVPair('Accept', 'text/javascript, text/html, application/xml, text/xml, */*'), ]

url0 = grinder.getProperties().getProperty('ecourt.url', 'http://10.1.3.16:8080')

# Create an HTTPRequest for each request, then replace the
# reference to the HTTPRequest with an instrumented version.
# You can access the unadorned instance using request101.__target__.
request101 = HTTPRequest(url=url0, headers=headers0)
request101 = Test(101, 'GET ygtvlinklabel-hover-bg.png').wrap(request101)

request201 = HTTPRequest(url=url0, headers=headers1)
request201 = Test(201, 'GET calendar').wrap(request201)

request202 = HTTPRequest(url=url0, headers=headers2)
request202 = Test(202, 'GET close.gif').wrap(request202)

request203 = HTTPRequest(url=url0, headers=headers2)
request203 = Test(203, 'GET skin.css').wrap(request203)

request204 = HTTPRequest(url=url0, headers=headers2)
request204 = Test(204, 'GET base.css').wrap(request204)

request205 = HTTPRequest(url=url0, headers=headers2)
request205 = Test(205, 'GET tabbase.css').wrap(request205)

request206 = HTTPRequest(url=url0, headers=headers2)
request206 = Test(206, 'GET roundedCorners.png').wrap(request206)

request207 = HTTPRequest(url=url0, headers=headers2)
request207 = Test(207, 'GET roundedBorderNS.png').wrap(request207)

request208 = HTTPRequest(url=url0, headers=headers2)
request208 = Test(208, 'GET roundedBorderWE.png').wrap(request208)

request209 = HTTPRequest(url=url0, headers=headers2)
request209 = Test(209, 'GET shadowCorners.png').wrap(request209)

request210 = HTTPRequest(url=url0, headers=headers2)
request210 = Test(210, 'GET shadowNS.png').wrap(request210)

request211 = HTTPRequest(url=url0, headers=headers2)
request211 = Test(211, 'GET shadowWE.png').wrap(request211)

request212 = HTTPRequest(url=url0, headers=headers2)
request212 = Test(212, 'GET shadowC.png').wrap(request212)

request213 = HTTPRequest(url=url0, headers=headers2)
request213 = Test(213, 'GET main-background.jpg').wrap(request213)

request214 = HTTPRequest(url=url0, headers=headers2)
request214 = Test(214, 'GET topnav-icons.png').wrap(request214)

request215 = HTTPRequest(url=url0, headers=headers2)
request215 = Test(215, 'GET magnifier.png').wrap(request215)

request216 = HTTPRequest(url=url0, headers=headers2)
request216 = Test(216, 'GET eCourt-logo-small.png').wrap(request216)

request217 = HTTPRequest(url=url0, headers=headers2)
request217 = Test(217, 'GET corners.png').wrap(request217)

request218 = HTTPRequest(url=url0, headers=headers2)
request218 = Test(218, 'GET arrows-left.png').wrap(request218)

request219 = HTTPRequest(url=url0, headers=headers2)
request219 = Test(219, 'GET eCourt-logo-mini.png').wrap(request219)

request220 = HTTPRequest(url=url0, headers=headers2)
request220 = Test(220, 'GET leftnav_bg.png').wrap(request220)

request221 = HTTPRequest(url=url0, headers=headers2)
request221 = Test(221, 'GET arrows-right.png').wrap(request221)

request222 = HTTPRequest(url=url0, headers=headers2)
request222 = Test(222, 'GET tn.gif').wrap(request222)

request223 = HTTPRequest(url=url0, headers=headers2)
request223 = Test(223, 'GET tp.gif').wrap(request223)

request224 = HTTPRequest(url=url0, headers=headers2)
request224 = Test(224, 'GET ln.gif').wrap(request224)

request225 = HTTPRequest(url=url0, headers=headers2)
request225 = Test(225, 'GET img.gif').wrap(request225)

request226 = HTTPRequest(url=url0, headers=headers2)
request226 = Test(226, 'GET input_bg.gif').wrap(request226)

request227 = HTTPRequest(url=url0, headers=headers2)
request227 = Test(227, 'GET calendar-nav-arrows.png').wrap(request227)

request228 = HTTPRequest(url=url0, headers=headers2)
request228 = Test(228, 'GET ygtvlinklabel-hover-bg.png').wrap(request228)

request229 = HTTPRequest(url=url0, headers=headers2)
request229 = Test(229, 'GET header_bg_inverse.gif').wrap(request229)

request301 = HTTPRequest(url=url0, headers=headers3)
request301 = Test(301, 'POST calendar').wrap(request301)

request302 = HTTPRequest(url=url0, headers=headers2)
request302 = Test(302, 'GET icon-loading.gif').wrap(request302)

request303 = HTTPRequest(url=url0, headers=headers2)
request303 = Test(303, 'GET close.gif').wrap(request303)

request304 = HTTPRequest(url=url0, headers=headers2)
request304 = Test(304, 'GET skin.css').wrap(request304)

request305 = HTTPRequest(url=url0, headers=headers2)
request305 = Test(305, 'GET base.css').wrap(request305)

request306 = HTTPRequest(url=url0, headers=headers2)
request306 = Test(306, 'GET tabbase.css').wrap(request306)

request307 = HTTPRequest(url=url0, headers=headers2)
request307 = Test(307, 'GET roundedCorners.png').wrap(request307)

request308 = HTTPRequest(url=url0, headers=headers2)
request308 = Test(308, 'GET roundedBorderNS.png').wrap(request308)

request309 = HTTPRequest(url=url0, headers=headers2)
request309 = Test(309, 'GET roundedBorderWE.png').wrap(request309)

request310 = HTTPRequest(url=url0, headers=headers2)
request310 = Test(310, 'GET shadowCorners.png').wrap(request310)

request311 = HTTPRequest(url=url0, headers=headers2)
request311 = Test(311, 'GET shadowNS.png').wrap(request311)

request312 = HTTPRequest(url=url0, headers=headers2)
request312 = Test(312, 'GET shadowWE.png').wrap(request312)

request313 = HTTPRequest(url=url0, headers=headers2)
request313 = Test(313, 'GET shadowC.png').wrap(request313)

request314 = HTTPRequest(url=url0, headers=headers2)
request314 = Test(314, 'GET main-background.jpg').wrap(request314)

request315 = HTTPRequest(url=url0, headers=headers2)
request315 = Test(315, 'GET topnav-icons.png').wrap(request315)

request316 = HTTPRequest(url=url0, headers=headers2)
request316 = Test(316, 'GET magnifier.png').wrap(request316)

request317 = HTTPRequest(url=url0, headers=headers2)
request317 = Test(317, 'GET eCourt-logo-small.png').wrap(request317)

request318 = HTTPRequest(url=url0, headers=headers2)
request318 = Test(318, 'GET corners.png').wrap(request318)

request319 = HTTPRequest(url=url0, headers=headers2)
request319 = Test(319, 'GET arrows-left.png').wrap(request319)

request320 = HTTPRequest(url=url0, headers=headers2)
request320 = Test(320, 'GET eCourt-logo-mini.png').wrap(request320)

request321 = HTTPRequest(url=url0, headers=headers2)
request321 = Test(321, 'GET arrows-right.png').wrap(request321)

request322 = HTTPRequest(url=url0, headers=headers2)
request322 = Test(322, 'GET leftnav_bg.png').wrap(request322)

request323 = HTTPRequest(url=url0, headers=headers2)
request323 = Test(323, 'GET tn.gif').wrap(request323)

request324 = HTTPRequest(url=url0, headers=headers2)
request324 = Test(324, 'GET tp.gif').wrap(request324)

request325 = HTTPRequest(url=url0, headers=headers2)
request325 = Test(325, 'GET ln.gif').wrap(request325)

request326 = HTTPRequest(url=url0, headers=headers2)
request326 = Test(326, 'GET img.gif').wrap(request326)

request327 = HTTPRequest(url=url0, headers=headers2)
request327 = Test(327, 'GET input_bg.gif').wrap(request327)

request328 = HTTPRequest(url=url0, headers=headers2)
request328 = Test(328, 'GET tabbg.png').wrap(request328)

request329 = HTTPRequest(url=url0, headers=headers2)
request329 = Test(329, 'GET calendar-nav-arrows.png').wrap(request329)

request401 = HTTPRequest(url=url0, headers=headers4)
request401 = Test(401, 'POST calendar').wrap(request401)


class TestRunner:
    """A TestRunner instance is created for each worker thread."""

    # A method for each recorded page.
    def page1(self):
        """GET ygtvlinklabel-hover-bg.png (request 101)."""
        result = request101.GET('/sustain/assets/img/ygtvlinklabel-hover-bg.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"154-1271277684000\"'), ))
        tp.process_result()

        return result

    def page2(self):
        """GET calendar (requests 201-229)."""
        result = request201.GET('/sustain/cms/calendar')
        tp.process_result()
        # 3 different values for token_format found in response, using the first one.
        self.token_format = \
            httpUtilities.valueFromBodyURI('format') # 'monthly'
        self.token_orgapachestrutstaglibhtmlTOKEN = \
            httpUtilities.valueFromHiddenInput('org.apache.struts.taglib.html.TOKEN') # 'ad9d4f57c7bd568619dfd5eefc66d858'
        self.token_showOptions = \
            httpUtilities.valueFromHiddenInput('showOptions') # ''
        self.token_assignmentId = \
            httpUtilities.valueFromHiddenInput('assignmentId') # '0'
        self.token_locationId = \
            httpUtilities.valueFromHiddenInput('locationId') # '0'
        self.token_filterName = \
            httpUtilities.valueFromHiddenInput('filterName') # 'TimeSlotLocationFilter'
        self.token_updateId = \
            httpUtilities.valueFromHiddenInput('updateId') # 'dirLocationId'
        self.token_POSJSEmitted = \
            httpUtilities.valueFromHiddenInput('POSJSEmitted') # 'true'
        self.token_onClick = \
            httpUtilities.valueFromHiddenInput('onClick') # ''
        self.token_onClear = \
            httpUtilities.valueFromHiddenInput('onClear') # ''
        self.token_tagId = \
            httpUtilities.valueFromHiddenInput('tagId') # '1227847121048139'
        self.token_eventType = \
            httpUtilities.valueFromHiddenInput('eventType') # ''
        self.token_showWeekends = \
            httpUtilities.valueFromHiddenInput('showWeekends') # 'false'

        grinder.sleep(20)
        request202.GET('/sustain/common/images/close.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:40 GMT'),
                NVPair('If-None-Match', 'W/\"849-1271277700000\"'), ))
        tp.process_result()

        self.token_build = \
            '44855'
        request203.GET('/sustain/assets/skins/pacificScene/skin.css' +
            '?build=' +
            self.token_build, None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"764-1271277682000\"'), ))
        tp.process_result()

        request204.GET('/sustain/assets/css/base.css' +
            '?build=' +
            self.token_build, None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"109340-1271277682000\"'), ))
        tp.process_result()

        request205.GET('/sustain/common/css/tabs/tabbase.css' +
            '?build=' +
            self.token_build, None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:42 GMT'),
                NVPair('If-None-Match', 'W/\"729-1271277702000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request206.GET('/sustain/assets/img/roundedCorners.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"1092-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request207.GET('/sustain/assets/img/roundedBorderNS.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"2864-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request208.GET('/sustain/assets/img/roundedBorderWE.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"2898-1271277684000\"'), ))
        tp.process_result()

        request209.GET('/sustain/assets/img/shadowCorners.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"3037-1271277684000\"'), ))
        tp.process_result()

        request210.GET('/sustain/assets/img/shadowNS.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"3014-1271277684000\"'), ))
        tp.process_result()

        request211.GET('/sustain/assets/img/shadowWE.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"3091-1271277684000\"'), ))
        tp.process_result()

        request212.GET('/sustain/assets/img/shadowC.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"6735-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request213.GET('/sustain/assets/img/main-background.jpg', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"622-1271277684000\"'), ))
        tp.process_result()

        request214.GET('/sustain/assets/img/icons/topnav-icons.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"41101-1271277682000\"'), ))
        tp.process_result()

        request215.GET('/sustain/assets/img/magnifier.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"716-1271277684000\"'), ))
        tp.process_result()

        request216.GET('/sustain/assets/img/eCourt-logo-small.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"2846-1271277684000\"'), ))
        tp.process_result()

        request217.GET('/sustain/assets/skins/pacificScene/corners.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"660-1271277682000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request218.GET('/sustain/assets/img/arrows-left.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"350-1271277684000\"'), ))
        tp.process_result()

        request219.GET('/sustain/assets/img/eCourt-logo-mini.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"1347-1271277684000\"'), ))
        tp.process_result()

        request220.GET('/sustain/assets/img/leftnav_bg.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"163-1271277684000\"'), ))
        tp.process_result()

        request221.GET('/sustain/assets/img/arrows-right.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"348-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request222.GET('/sustain/assets/img/tn.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"504-1271277684000\"'), ))
        tp.process_result()

        request223.GET('/sustain/assets/img/tp.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"539-1271277684000\"'), ))
        tp.process_result()

        request224.GET('/sustain/assets/img/ln.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"142-1271277684000\"'), ))
        tp.process_result()

        request225.GET('/sustain/common/images/img.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:40 GMT'),
                NVPair('If-None-Match', 'W/\"379-1271277700000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request226.GET('/sustain/assets/img/input_bg.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"195-1271277684000\"'), ))
        tp.process_result()

        request227.GET('/sustain/assets/img/calendar-nav-arrows.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"273-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request228.GET('/sustain/assets/img/ygtvlinklabel-hover-bg.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"154-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request229.GET('/sustain/assets/img/header_bg_inverse.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"237-1271277684000\"'), ))
        tp.process_result()

        return result

    def page3(self):
        """POST calendar (requests 301-329)."""
        result = request301.POST('/sustain/cms/calendar',
            ( NVPair('org.apache.struts.taglib.html.TOKEN', self.token_orgapachestrutstaglibhtmlTOKEN),
                NVPair('showOptions', self.token_showOptions),
                NVPair('assignmentId', self.token_assignmentId),
                NVPair('name', ''),
                NVPair('groupRole', ''),
                NVPair('role', ''),
                NVPair('locationId', self.token_locationId),
                NVPair('filterName', self.token_filterName),
                NVPair('updateId', self.token_updateId),
                NVPair('POSJSEmitted', self.token_POSJSEmitted),
                NVPair('onClick', self.token_onClick),
                NVPair('onClear', self.token_onClear),
                NVPair('tagId', self.token_tagId),
                NVPair('name', ''),
                NVPair('orgType', ''),
                NVPair('caseType', ''),
                NVPair('eventType', self.token_eventType),
                NVPair('caseJurisdiction', ''),
                NVPair('day', '04/14/2010'),
                NVPair('conditionId', ''),
                NVPair('timeGroupBy', 'AM_PM'),
                NVPair('groupBy', 'JUDGE,LOCATION'),
                NVPair('showWeekends', self.token_showWeekends),
                NVPair('format', 'daily'), ),
            ( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
        tp.process_result()
        # 3 different values for token_format found in response; the first matched
        # the last known value of token_format - don't update the variable.
        self.token_tagId = \
            httpUtilities.valueFromHiddenInput('tagId') # '1227859590295779'
        self.token_timeGroupBy = \
            httpUtilities.valueFromHiddenInput('timeGroupBy') # 'TIME_SLOT'
        # 2 different values for token_eventGroupXml found in response, using the first one.
        self.token_eventGroupXml = \
            httpUtilities.valueFromHiddenInput('eventGroupXml') # '0'

        request302.GET('/sustain/assets/img/icon-loading.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"1737-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request303.GET('/sustain/common/images/close.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:40 GMT'),
                NVPair('If-None-Match', 'W/\"849-1271277700000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request304.GET('/sustain/assets/skins/pacificScene/skin.css' +
            '?build=' +
            self.token_build, None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"764-1271277682000\"'), ))
        tp.process_result()

        request305.GET('/sustain/assets/css/base.css' +
            '?build=' +
            self.token_build, None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"109340-1271277682000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request306.GET('/sustain/common/css/tabs/tabbase.css' +
            '?build=' +
            self.token_build, None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:42 GMT'),
                NVPair('If-None-Match', 'W/\"729-1271277702000\"'), ))
        tp.process_result()

        request307.GET('/sustain/assets/img/roundedCorners.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"1092-1271277684000\"'), ))
        tp.process_result()

        request308.GET('/sustain/assets/img/roundedBorderNS.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"2864-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request309.GET('/sustain/assets/img/roundedBorderWE.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"2898-1271277684000\"'), ))
        tp.process_result()

        request310.GET('/sustain/assets/img/shadowCorners.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"3037-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request311.GET('/sustain/assets/img/shadowNS.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"3014-1271277684000\"'), ))
        tp.process_result()

        request312.GET('/sustain/assets/img/shadowWE.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"3091-1271277684000\"'), ))
        tp.process_result()

        request313.GET('/sustain/assets/img/shadowC.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"6735-1271277684000\"'), ))
        tp.process_result()

        request314.GET('/sustain/assets/img/main-background.jpg', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"622-1271277684000\"'), ))
        tp.process_result()

        request315.GET('/sustain/assets/img/icons/topnav-icons.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"41101-1271277682000\"'), ))
        tp.process_result()

        request316.GET('/sustain/assets/img/magnifier.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"716-1271277684000\"'), ))
        tp.process_result()

        request317.GET('/sustain/assets/img/eCourt-logo-small.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"2846-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request318.GET('/sustain/assets/skins/pacificScene/corners.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:22 GMT'),
                NVPair('If-None-Match', 'W/\"660-1271277682000\"'), ))
        tp.process_result()

        request319.GET('/sustain/assets/img/arrows-left.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"350-1271277684000\"'), ))
        tp.process_result()

        request320.GET('/sustain/assets/img/eCourt-logo-mini.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"1347-1271277684000\"'), ))
        tp.process_result()

        request321.GET('/sustain/assets/img/arrows-right.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"348-1271277684000\"'), ))
        tp.process_result()

        request322.GET('/sustain/assets/img/leftnav_bg.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"163-1271277684000\"'), ))
        tp.process_result()

        request323.GET('/sustain/assets/img/tn.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"504-1271277684000\"'), ))
        tp.process_result()

        request324.GET('/sustain/assets/img/tp.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"539-1271277684000\"'), ))
        tp.process_result()

        grinder.sleep(20)
        request325.GET('/sustain/assets/img/ln.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"142-1271277684000\"'), ))
        tp.process_result()

        request326.GET('/sustain/common/images/img.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:40 GMT'),
                NVPair('If-None-Match', 'W/\"379-1271277700000\"'), ))
        tp.process_result()

        request327.GET('/sustain/assets/img/input_bg.gif', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"195-1271277684000\"'), ))
        tp.process_result()

        request328.GET('/assets/img/tabbg.png')
        tp.process_result()

        grinder.sleep(20)
        request329.GET('/sustain/assets/img/calendar-nav-arrows.png', None,
            ( NVPair('If-Modified-Since', 'Wed, 14 Apr 2010 20:41:24 GMT'),
                NVPair('If-None-Match', 'W/\"273-1271277684000\"'), ))
        tp.process_result()

        return result

    def page4(self):
        """POST calendar (request 401)."""
        self.token_dispatch = \
            'onShowEventGroup'
        result = request401.POST('/sustain/cms/calendar' +
            '?dispatch=' +
            self.token_dispatch,
            ( NVPair('xml', '''<com.sustain.calendar.group.ScheduledEventBucketList>\r
  <buckets>\r
    <com.sustain.calendar.group.StartTimeBucket>\r
      <eventGroupType>AM_PM</eventGroupType>\r
      <startDateWindowBegin class=\"sql-timestamp\">2010-04-14 09:00:00.0</startDateWindowBegin>\r
      <startDateWindowEnd class=\"sql-timestamp\">2010-04-14 09:00:00.0</startDateWindowEnd>\r
      <startDateWindowNum>0</startDateWindowNum>\r
    </com.sustain.calendar.group.StartTimeBucket>\r
    <com.sustain.calendar.group.CurrentJudgeBucket>\r
      <eventGroupType>JUDGE</eventGroupType>\r
      <roles class=\"set\">\r
        <string>JUD</string>\r
      </roles>\r
      <statuses class=\"set\">\r
        <string>CUR</string>\r
      </statuses>\r
      <notExist>true</notExist>\r
    </com.sustain.calendar.group.CurrentJudgeBucket>\r
    <com.sustain.calendar.group.LocationBucket>\r
      <eventGroupType>LOCATION</eventGroupType>\r
      <propertyPaths>\r
        <string>eventLocation.id</string>\r
        <string>eventLocation.locationName</string>\r
      </propertyPaths>\r
      <values>\r
        <null/>\r
        <null/>\r
      </values>\r
    </com.sustain.calendar.group.LocationBucket>\r
  </buckets>\r
  <count>1</count>\r
  <titleDelim> </titleDelim>\r
</com.sustain.calendar.group.ScheduledEventBucketList>'''), ),
            ( NVPair('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'), ))
        tp.process_result()
        self.token_caseId = \
            httpUtilities.valueFromBodyURI('caseId') # '3914617'

        return result

    def __call__(self):
        """This method is called for every run performed by the worker thread."""
        self.init_data = td.import_data(self.__module__)
        self.page1()      # GET ygtvlinklabel-hover-bg.png (request 101)

        grinder.sleep(20)
        self.page2()      # GET calendar (requests 201-229)

        grinder.sleep(20)
        self.page3()      # POST calendar (requests 301-329)

        grinder.sleep(20)
        self.page4()      # POST calendar (request 401)


def instrumentMethod(test, method_name, c=TestRunner):
    """Instrument a method with the given Test."""
    unadorned = getattr(c, method_name)
    import new
    method = new.instancemethod(test.wrap(unadorned), None, c)
    setattr(c, method_name, method)

# Replace each method with an instrumented version.
# You can call the unadorned method using self.page1.__target__().
instrumentMethod(Test(100, 'Page 1'), 'page1')
instrumentMethod(Test(200, 'Page 2'), 'page2')
instrumentMethod(Test(300, 'Page 3'), 'page3')
instrumentMethod(Test(400, 'Page 4'), 'page4')
