Exemple #1
0
    def setUp(self):
        import collective.taskqueue
        xmlconfig.file('configure.zcml',
                       collective.taskqueue,
                       context=self['configurationContext'])

        # Configure
        config = getConfiguration()
        config.product_config = {'collective.taskqueue': {'queue': self.queue}}
        taskqueue.reset()

        # Define logging request handler to replace ZPublisher
        def logging_handler(app, request, response):
            logger.info(request.getURL() + request.get("PATH_INFO"))
            response.stdout.write('HTTP/1.1 204\r\n')
            response.stdout.close()

        # Define ZPublisher-based request handler to be used with zserver
        def zserver_handler(app, request, response):
            from ZPublisher import publish_module
            publish_module(app, request=request, response=response)

        # Create TaskQueueServer
        from collective.taskqueue.server import TaskQueueServer
        if not self.zserver_enabled:
            self['server'] = TaskQueueServer(queue=self.queue,
                                             handler=logging_handler)
        else:
            self['server'] = TaskQueueServer(queue=self.queue,
                                             handler=zserver_handler,
                                             concurrent_limit=0)
    def setUp(self):
        import collective.taskqueue
        xmlconfig.file('configure.zcml', collective.taskqueue,
                       context=self['configurationContext'])

        # Configure
        config = getConfiguration()
        config.product_config = {'collective.taskqueue': {'queue': self.queue}}
        taskqueue.reset()

        # Define logging request handler to replace ZPublisher
        def logging_handler(app, request, response):
            logger.info(request.getURL() + request.get("PATH_INFO"))
            response.stdout.write('HTTP/1.1 204\r\n')
            response.stdout.close()

        # Define ZPublisher-based request handler to be used with zserver
        def zserver_handler(app, request, response):
            from ZPublisher import publish_module
            publish_module(app, request=request, response=response)

        # Create TaskQueueServer
        from collective.taskqueue.server import TaskQueueServer
        if not self.zserver_enabled:
            self['server'] = TaskQueueServer(queue=self.queue,
                                             handler=logging_handler)
        else:
            self['server'] = TaskQueueServer(queue=self.queue,
                                             handler=zserver_handler,
                                             concurrent_limit=0)
Exemple #3
0
 def testTearDown(self):
     taskqueue.reset()
 def testTearDown(self):
     taskqueue.reset()