コード例 #1
0
ファイル: Root_t.py プロジェクト: zhiwenuil/WMCore
    def testInstanceInUrl(self):
        config = self.getBaseConfiguration()
        config.SecurityModule.dangerously_insecure = True
        server = Root(config)
        # Add our test page
        config.UnitTests.instances = ['foo', 'bar', 'baz/zoink']
        active = config.UnitTests.views.section_('active')
        active.section_('test')
        active.test.object = 'WMCore_t.WebTools_t.InstanceTestPage'
        active.test.section_('database')
        instances = active.test.database.section_('instances')
        foo = instances.section_('foo')
        bar = instances.section_('bar')
        baz = instances.section_('baz/zoink')
        foo.connectUrl = 'sqlite:///foo'
        bar.connectUrl = 'sqlite:///bar'
        baz.connectUrl = 'sqlite:///baz/zoink'
        server.start(blocking=False)

        #http://localhost:8080/unittests/bar/test/database
        for instance in config.UnitTests.instances:
            url = 'http://localhost:8080/unittests/%s/test' % instance
            html = urllib2.urlopen(url).read()
            self.assertEquals(html, instance)
            url = '%s/database' % url
            html = urllib2.urlopen(url).read()
            self.assertEquals(html, instances.section_(instance).connectUrl)
        server.stop()
コード例 #2
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testLongHandConfigurables(self):
        """
        Test that the following configuration variables work:

        engine      Controls the "application engine", including autoreload.
                    These can only be declared in the global config.
        hooks       Declares additional request-processing functions.
        log         Configures the logging for each application. These can only
                    be declared in the global or / config.
        request         Adds attributes to each Request.
        response        Adds attributes to each Response.
        server      Controls the default HTTP server via cherrypy.server. These
                    can only be declared in the global config.
        tools       Runs and configures additional request-processing packages.
        wsgi        Adds WSGI middleware to an Application's "pipeline". These
                    can only be declared in the app's root config ("/").
        checker         Controls the "checker", which looks for common errors in app
                    state (including config) when the engine starts. Global config only.

        (from http://docs.cherrypy.org/dev/intro/concepts/config.html)
        """
        config = self.getBaseConfiguration()

        server = Root(config)
        server.start(blocking=False)
        server.stop()
コード例 #3
0
ファイル: RESTBaseUnitTest.py プロジェクト: zhiwenuil/WMCore
class RESTBaseUnitTest(unittest.TestCase):
    
    def setUp(self):
        # default set
        self.schemaModules = []
        self.initialize()
        if self.schemaModules:
            self.testInit = TestInitCouchApp(__file__)
            self.testInit.setLogging() # logLevel = logging.SQLDEBUG
            self.testInit.setDatabaseConnection(self.config.getDBUrl())
            self.testInit.setSchema(customModules = self.schemaModules,
                                    useDefault = False)
        
        self.rt = Root(self.config)
        self.rt.start(blocking=False)
        
    def tearDown(self):
        self.rt.stop()
        if self.schemaModules:
            self.testInit.clearDatabase()
        self.config = None
        
    
    def initialize(self):
        """
        i.e.
        
        self.config = DefaultConfig('WMCore.WebTools.RESTModel')
        self.config.setDBUrl("sqlite://")
        self.schemaModules = ["WMCore.ThreadPool", WMCore.WMBS"]
        """
        
        message = "initialize method has to be implemented, self.restModel, self.schemaModules needs to be set"
        raise NotImplementedError, message
コード例 #4
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testShortHandChangePort(self):
        """
        Change the port the server runs on short hand
        """
        test_port = 8010

        config = self.getBaseConfiguration()
        # Set the port to a non-standard one
        config.Webtools.port = test_port

        server = Root(config)
        server.start(blocking=False)
        self.assertEqual(cpconfig['server.socket_port'], test_port)
        server.stop()
コード例 #5
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testShortHandProxyBase(self):
        """
        Check that changing the proxy_base via the short hand config variable
        does actually change the proxy base
        """
        test_proxy_base = '/unit_test'

        config = self.getBaseConfiguration()
        # Set the proxy base with a short hand cfg variable
        config.Webtools.proxy_base = test_proxy_base
        server = Root(config)

        server.start(blocking=False)
        self.assertEqual(cpconfig['tools.proxy.base'], test_proxy_base)
        server.stop()
コード例 #6
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testLongHandProxyBase(self):
        """
        Check that changing the proxy base via tools.proxy.base
        does actually change the proxy base
        """
        test_proxy_base = '/unit_test'

        config = self.getBaseConfiguration()
        config.Webtools.section_('tools')
        config.Webtools.tools.section_('proxy')
        config.Webtools.tools.proxy.base = test_proxy_base
        config.Webtools.tools.proxy.on = True
        server = Root(config)

        server.start(blocking=False)
        self.assertEqual(cpconfig['tools.proxy.base'], test_proxy_base)
        server.stop()
コード例 #7
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testFakeLongHandConfigurables(self):
        """
        Test that a made up long hand configurable is ignored
        """
        config = self.getBaseConfiguration()
        # The following should be ignored by the configure step
        config.Webtools.section_('foo')
        config.Webtools.foo.bar = 'baz'
        config.Webtools.section_('stuff')
        config.Webtools.stuff = 'things'

        server = Root(config)
        server.start(blocking=False)

        self.assertFalse('foo' in cpconfig.keys(), 'non-standard configurable passed to server')
        self.assertFalse('stuff' in cpconfig.keys(), 'non-standard configurable passed to server')

        server.stop()
コード例 #8
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testShortHandPortOverride(self):
        """
        Change the port the server runs on long hand, then over ride
        it with the short hand equivalent
        """
        test_port = 8010

        config = self.getBaseConfiguration()
        # Set the port the long handed way
        config.Webtools.section_('server')
        config.Webtools.server.socket_port = test_port - 1
        # then override
        config.Webtools.port = test_port

        server = Root(config)
        server.start(blocking=False)
        self.assertEqual(cpconfig['server.socket_port'], test_port)
        server.stop()
コード例 #9
0
ファイル: HTTPFrontEnd.py プロジェクト: tsarangi/WMCore
    def start(self):
        """
        _startComponent_

        Start up the cherrypy service for this component

        """
        root = Root(self.config)
        root.configureCherryPy()
        root.loadPages()
        root.makeIndex()
        cherrypy.engine.start()
        cherrypy.engine.block()
コード例 #10
0
    def testMissingRequiredConfigParams(self):
        """
        All applications should define:
        ['admin', 'description', 'title']
        """
        config = self.getBaseConfiguration()

        config.UnitTests.__delattr__('admin')
        server = Root(config)
        self.assertRaises(AssertionError, server.start, blocking=False)

        config.UnitTests.admin = "Mr Unit Test"
        config.UnitTests.__delattr__('description')
        server = Root(config)
        self.assertRaises(AssertionError, server.start, blocking=False)

        config.UnitTests.description = "Dummy server for unit tests"
        config.UnitTests.__delattr__('title')
        server = Root(config)
        self.assertRaises(AssertionError, server.start, blocking=False)
コード例 #11
0
class RESTBaseUnitTest(unittest.TestCase):

    def setUp(self, initRoot = True):
        # default set
        self.schemaModules = []

        self.initialize()
        if self.schemaModules:
            import warnings
            warnings.warn("use RESTAndCouchUnitTest instead", DeprecationWarning)
            from WMQuality.TestInitCouchApp import TestInitCouchApp
            self.testInit = TestInitCouchApp(__file__)
            self.testInit.setLogging() # logLevel = logging.SQLDEBUG
            self.testInit.setDatabaseConnection()
            self.testInit.setSchema(customModules = self.schemaModules,
                                    useDefault = False)
            # Now pull the dbURL from the factory
            # I prefer this method because the factory has better error handling
            # Also because then you know everything is the same
            myThread = threading.currentThread()
            self.config.setDBUrl(myThread.dbFactory.dburl)

        logging.info("This is our config: %s" % self.config)

        self.initRoot = initRoot
        if initRoot:
            self.rt = Root(self.config, testName=self._testMethodName)
            try:
                self.rt.start(blocking=False)
            except RuntimeError, e:
                # there appears to be worker threads from a previous test
                # hanging out. Try to slay them so that we can keep going
                print "Failed to load cherrypy with exception: %s\n" % e
                print "The threads are: \n%s\n" % threading.enumerate()
                print "The previous test was %s\n" % self.rt.getLastTest()
                print traceback.format_exc()
                self.rt.stop()
                raise e

        return
コード例 #12
0
    def testLongHandConfigurables(self):
        """
        Test that the following configuration variables work:

        engine      Controls the "application engine", including autoreload.
                    These can only be declared in the global config.
        hooks       Declares additional request-processing functions.
        log         Configures the logging for each application. These can only
                    be declared in the global or / config.
        request         Adds attributes to each Request.
        response        Adds attributes to each Response.
        server      Controls the default HTTP server via cherrypy.server. These
                    can only be declared in the global config.
        tools       Runs and configures additional request-processing packages.
        wsgi        Adds WSGI middleware to an Application's "pipeline". These
                    can only be declared in the app's root config ("/").
        checker         Controls the "checker", which looks for common errors in app
                    state (including config) when the engine starts. Global config only.

        (from http://docs.cherrypy.org/dev/intro/concepts/config.html)
        """
        config = self.getBaseConfiguration()

        server = Root(config)
        server.start(blocking=False)
        server.stop()
コード例 #13
0
ファイル: RESTBaseUnitTest.py プロジェクト: zhiwenuil/WMCore
 def setUp(self):
     # default set
     self.schemaModules = []
     self.initialize()
     if self.schemaModules:
         self.testInit = TestInitCouchApp(__file__)
         self.testInit.setLogging() # logLevel = logging.SQLDEBUG
         self.testInit.setDatabaseConnection(self.config.getDBUrl())
         self.testInit.setSchema(customModules = self.schemaModules,
                                 useDefault = False)
     
     self.rt = Root(self.config)
     self.rt.start(blocking=False)
コード例 #14
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
 def testSecuritySetting(self):
     testRole = "TestRole"
     testGroup = "TestGroup"
     testSite = "TestSite"
     config = self.getBaseConfiguration()
     config.SecurityModule.dangerously_insecure = False
     # not real keyfile but for the test.
     # file will be deleted automaticall when garbage collected.
     tempFile = NamedTemporaryFile()
     config.SecurityModule.key_file = tempFile.name
     config.SecurityModule.section_("default")
     config.SecurityModule.default.role = testRole
     config.SecurityModule.default.group = testGroup
     config.SecurityModule.default.site = testSite
     config.Webtools.environment = "production"
     server = Root(config)
     server.start(blocking=False)
     self.assertEqual(cpconfig['tools.secmodv2.on'], True)
     self.assertEqual(cpconfig['tools.secmodv2.role'], testRole)
     self.assertEqual(cpconfig['tools.secmodv2.group'], testGroup)
     self.assertEqual(cpconfig['tools.secmodv2.site'], testSite)
     server.stop()
コード例 #15
0
ファイル: Root_t.py プロジェクト: BrunoCoimbra/WMCore
    def testInstanceInUrl(self):
        config = self.getBaseConfiguration()
        config.SecurityModule.dangerously_insecure = True
        server = Root(config)
        # Add our test page
        config.UnitTests.instances = ['foo', 'bar', 'baz/zoink']
        active = config.UnitTests.views.section_('active')
        active.section_('test')
        active.test.object = 'WMCore_t.WebTools_t.InstanceTestPage'
        active.test.section_('database')
        db_instances = active.test.database.section_('instances')
        foo = db_instances.section_('foo')
        bar = db_instances.section_('bar')
        baz = db_instances.section_('baz/zoink')
        foo.connectUrl = 'sqlite:///foo'
        bar.connectUrl = 'sqlite:///bar'
        baz.connectUrl = 'sqlite:///baz/zoink'
        active.test.section_('security')
        security_instances = active.test.security.section_('instances')
        sec_foo = security_instances.section_('foo')
        sec_bar = security_instances.section_('bar')
        sec_baz = security_instances.section_('baz/zoink')
        sec_foo.sec_params = 'test_foo'
        sec_bar.sec_params = 'test_bar'
        sec_baz.sec_params = 'test_baz'

        server.start(blocking=False)

        for instance in config.UnitTests.instances:
            url = 'http://127.0.0.1:%s/unittests/%s/test' % (cpconfig['server.socket_port'], instance)
            html = urllib2.urlopen(url).read()
            self.assertEqual(html, instance)
            db_url = '%s/database' % url
            html = urllib2.urlopen(db_url).read()
            self.assertEqual(html, db_instances.section_(instance).connectUrl)
            sec_url = '%s/security' % url
            html = urllib2.urlopen(sec_url).read()
            self.assertEqual(html, security_instances.section_(instance).sec_params)
        server.stop()
コード例 #16
0
ファイル: HTTPFrontEnd.py プロジェクト: stuartw/WMCore
    def start(self):
        """
        _startComponent_

        Start up the cherrypy service for this component

        """
        root = Root(self.config)
        root.configureCherryPy()
        root.loadPages()
        root.makeIndex()
        cherrypy.engine.start()
        cherrypy.engine.block()
コード例 #17
0
    def testShortHandChangePort(self):
        """
        Change the port the server runs on short hand
        """
        test_port = 8010

        config = self.getBaseConfiguration()
        # Set the port to a non-standard one
        config.Webtools.port = test_port

        server = Root(config)
        server.start(blocking=False)
        self.assertEquals(cpconfig['server.socket_port'], test_port)
        server.stop()
コード例 #18
0
    def testShortHandProxyBase(self):
        """
        Check that changing the proxy_base via the short hand config variable
        does actually change the proxy base
        """
        test_proxy_base = '/unit_test'

        config = self.getBaseConfiguration()
        # Set the proxy base with a short hand cfg variable
        config.Webtools.proxy_base = test_proxy_base
        server = Root(config)

        server.start(blocking=False)
        self.assertEquals(cpconfig['tools.proxy.base'], test_proxy_base)
        server.stop()
コード例 #19
0
    def testLongHandProxyBase(self):
        """
        Check that changing the proxy base via tools.proxy.base
        does actually change the proxy base
        """
        test_proxy_base = '/unit_test'

        config = self.getBaseConfiguration()
        config.Webtools.section_('tools')
        config.Webtools.tools.section_('proxy')
        config.Webtools.tools.proxy.base = test_proxy_base
        config.Webtools.tools.proxy.on = True
        server = Root(config)

        server.start(blocking=False)
        self.assertEquals(cpconfig['tools.proxy.base'], test_proxy_base)
        server.stop()
コード例 #20
0
    def testShortHandPortOverride(self):
        """
        Change the port the server runs on long hand, then over ride
        it with the short hand equivalent
        """
        test_port = 8010

        config = self.getBaseConfiguration()
        # Set the port the long handed way
        config.Webtools.section_('server')
        config.Webtools.server.socket_port = test_port - 1
        # then override
        config.Webtools.port = test_port

        server = Root(config)
        server.start(blocking=False)
        self.assertEquals(cpconfig['server.socket_port'], test_port)
        server.stop()
コード例 #21
0
ファイル: Root_t.py プロジェクト: scarletnorberg/WMCore
    def testFakeLongHandConfigurables(self):
        """
        Test that a made up long hand configurable is ignored
        """
        config = self.getBaseConfiguration()
        # The following should be ignored by the configure step
        config.Webtools.section_('foo')
        config.Webtools.foo.bar = 'baz'
        config.Webtools.section_('stuff')
        config.Webtools.stuff = 'things'

        server = Root(config)
        server.start(blocking=False)

        self.assertFalse('foo' in cpconfig.keys(), 'non-standard configurable passed to server')
        self.assertFalse('stuff' in cpconfig.keys(), 'non-standard configurable passed to server')

        server.stop()
コード例 #22
0
    def testInstanceInUrl(self):
        config = self.getBaseConfiguration()
        config.SecurityModule.dangerously_insecure = True
        server = Root(config)
        # Add our test page
        config.UnitTests.instances = ['foo', 'bar', 'baz/zoink']
        active = config.UnitTests.views.section_('active')
        active.section_('test')
        active.test.object = 'WMCore_t.WebTools_t.InstanceTestPage'
        active.test.section_('database')
        db_instances = active.test.database.section_('instances')
        foo = db_instances.section_('foo')
        bar = db_instances.section_('bar')
        baz = db_instances.section_('baz/zoink')
        foo.connectUrl = 'sqlite:///foo'
        bar.connectUrl = 'sqlite:///bar'
        baz.connectUrl = 'sqlite:///baz/zoink'
        active.test.section_('security')
        security_instances = active.test.security.section_('instances')
        sec_foo = security_instances.section_('foo')
        sec_bar = security_instances.section_('bar')
        sec_baz = security_instances.section_('baz/zoink')
        sec_foo.sec_params = 'test_foo'
        sec_bar.sec_params = 'test_bar'
        sec_baz.sec_params = 'test_baz'

        server.start(blocking=False)

        for instance in config.UnitTests.instances:
            url = 'http://127.0.0.1:%s/unittests/%s/test' % (
                cpconfig['server.socket_port'], instance)
            html = urllib2.urlopen(url).read()
            self.assertEquals(html, instance)
            db_url = '%s/database' % url
            html = urllib2.urlopen(db_url).read()
            self.assertEquals(html, db_instances.section_(instance).connectUrl)
            sec_url = '%s/security' % url
            html = urllib2.urlopen(sec_url).read()
            self.assertEquals(html,
                              security_instances.section_(instance).sec_params)
        server.stop()
コード例 #23
0
 def testSecuritySetting(self):
     testRole = "TestRole"
     testGroup = "TestGroup"
     testSite = "TestSite"
     config = self.getBaseConfiguration()
     config.SecurityModule.dangerously_insecure = False
     # not real keyfile but for the test.
     # file will be deleted automaticall when garbage collected.
     tempFile = NamedTemporaryFile()
     config.SecurityModule.key_file = tempFile.name
     config.SecurityModule.section_("default")
     config.SecurityModule.default.role = testRole
     config.SecurityModule.default.group = testGroup
     config.SecurityModule.default.site = testSite
     config.Webtools.environment = "production"
     server = Root(config)
     server.start(blocking=False)
     self.assertEquals(cpconfig['tools.secmodv2.on'], True)
     self.assertEquals(cpconfig['tools.secmodv2.role'], testRole)
     self.assertEquals(cpconfig['tools.secmodv2.group'], testGroup)
     self.assertEquals(cpconfig['tools.secmodv2.site'], testSite)
     server.stop()
コード例 #24
0
class RESTBaseUnitTest(unittest.TestCase):

    def setUp(self, initRoot = True):
        # default set
        self.schemaModules = []

        self.initialize()
        if self.schemaModules:
            import warnings
            warnings.warn("use RESTAndCouchUnitTest instead", DeprecationWarning)
            from WMQuality.TestInitCouchApp import TestInitCouchApp
            self.testInit = TestInitCouchApp(__file__)
            self.testInit.setLogging() # logLevel = logging.SQLDEBUG
            self.testInit.setDatabaseConnection( destroyAllDatabase = True )
            self.testInit.setSchema(customModules = self.schemaModules,
                                    useDefault = False)
            # Now pull the dbURL from the factory
            # I prefer this method because the factory has better error handling
            # Also because then you know everything is the same
            myThread = threading.currentThread()
            self.config.setDBUrl(myThread.dbFactory.dburl)

        logging.info("This is our config: %s" % self.config)

        self.initRoot = initRoot
        if initRoot:
            self.rt = Root(self.config, testName=self._testMethodName)
            try:
                self.rt.start(blocking=False)
            except RuntimeError as e:
                # there appears to be worker threads from a previous test
                # hanging out. Try to slay them so that we can keep going
                print "Failed to load cherrypy with exception: %s\n" % e
                print "The threads are: \n%s\n" % threading.enumerate()
                print "The previous test was %s\n" % self.rt.getLastTest()
                print traceback.format_exc()
                self.rt.stop()
                raise e

        return

    def tearDown(self):
        if self.initRoot:
            self.rt.stop()
            self.rt.setLastTest()
            # there was a ton of racy failures in REST tools because of
            # how much global state cherrypy has. this resets it

            # Also, it sucks I had to copy/paste this from
            # https://bitbucket.org/cherrypy/cherrypy/src/9720342ad159/cherrypy/__init__.py
            # but reload() doesn't have the right semantics

            cherrybus.bus = cherrybus.Bus()
            cherrypy.engine = cherrybus.bus
            cherrypy.engine.timeout_monitor = cherrypy._TimeoutMonitor(cherrypy.engine)
            cherrypy.engine.timeout_monitor.subscribe()

            cherrypy.engine.autoreload = cherrypy.process.plugins.Autoreloader(cherrypy.engine)
            cherrypy.engine.autoreload.subscribe()

            cherrypy.engine.thread_manager = cherrypy.process.plugins.ThreadManager(cherrypy.engine)
            cherrypy.engine.thread_manager.subscribe()

            cherrypy.engine.signal_handler = cherrypy.process.plugins.SignalHandler(cherrypy.engine)
            cherrypy.engine.subscribe('log', cherrypy._buslog)

            from cherrypy import _cpserver
            cherrypy.server = _cpserver.Server()
            cherrypy.server.subscribe()
            cherrypy.checker = cherrypy._cpchecker.Checker()
            cherrypy.engine.subscribe('start', cherrypy.checker)

        if self.schemaModules:
            self.testInit.clearDatabase()
        self.config = None
        return

    def initialize(self):
        """
        i.e.

        self.config = DefaultConfig('WMCore.WebTools.RESTModel')
        self.config.setDBUrl('sqlite://')
        self.schemaModules = ['WMCore.ThreadPool', 'WMCore.WMBS']
        """

        message = "initialize method has to be implemented, self.restModel, self.schemaModules needs to be set"
        raise NotImplementedError, message
コード例 #25
0
class RESTBaseUnitTest(unittest.TestCase):
    def setUp(self, initRoot=True):
        # default set
        self.schemaModules = []

        self.initialize()
        if self.schemaModules:
            import warnings
            warnings.warn("use RESTAndCouchUnitTest instead",
                          DeprecationWarning)
            from WMQuality.TestInitCouchApp import TestInitCouchApp
            self.testInit = TestInitCouchApp(__file__)
            self.testInit.setLogging()  # logLevel = logging.SQLDEBUG
            self.testInit.setDatabaseConnection(destroyAllDatabase=True)
            self.testInit.setSchema(customModules=self.schemaModules,
                                    useDefault=False)
            # Now pull the dbURL from the factory
            # I prefer this method because the factory has better error handling
            # Also because then you know everything is the same
            myThread = threading.currentThread()
            self.config.setDBUrl(myThread.dbFactory.dburl)

        logging.info("This is our config: %s" % self.config)

        self.initRoot = initRoot
        if initRoot:
            self.rt = Root(self.config, testName=self._testMethodName)
            try:
                self.rt.start(blocking=False)
            except RuntimeError as e:
                # there appears to be worker threads from a previous test
                # hanging out. Try to slay them so that we can keep going
                print("Failed to load cherrypy with exception: %s\n" % e)
                print("The threads are: \n%s\n" % threading.enumerate())
                print("The previous test was %s\n" % self.rt.getLastTest())
                print(traceback.format_exc())
                self.rt.stop()
                raise e

        return

    def tearDown(self):
        if self.initRoot:
            self.rt.stop()
            self.rt.setLastTest()
            # there was a ton of racy failures in REST tools because of
            # how much global state cherrypy has. this resets it

            # Also, it sucks I had to copy/paste this from
            # https://bitbucket.org/cherrypy/cherrypy/src/9720342ad159/cherrypy/__init__.py
            # but reload() doesn't have the right semantics

            cherrybus.bus = cherrybus.Bus()
            cherrypy.engine = cherrybus.bus
            cherrypy.engine.timeout_monitor = cherrypy._TimeoutMonitor(
                cherrypy.engine)
            cherrypy.engine.timeout_monitor.subscribe()

            cherrypy.engine.autoreload = cherrypy.process.plugins.Autoreloader(
                cherrypy.engine)
            cherrypy.engine.autoreload.subscribe()

            cherrypy.engine.thread_manager = cherrypy.process.plugins.ThreadManager(
                cherrypy.engine)
            cherrypy.engine.thread_manager.subscribe()

            cherrypy.engine.signal_handler = cherrypy.process.plugins.SignalHandler(
                cherrypy.engine)
            cherrypy.engine.subscribe('log', cherrypy._buslog)

            from cherrypy import _cpserver
            cherrypy.server = _cpserver.Server()
            cherrypy.server.subscribe()
            cherrypy.checker = cherrypy._cpchecker.Checker()
            cherrypy.engine.subscribe('start', cherrypy.checker)

        if self.schemaModules:
            self.testInit.clearDatabase()
        self.config = None
        return

    def initialize(self):
        """
        i.e.

        self.config = DefaultConfig('WMCore.WebTools.RESTModel')
        self.config.setDBUrl('sqlite://')
        self.schemaModules = ['WMCore.ThreadPool', 'WMCore.WMBS']
        """

        message = "initialize method has to be implemented, self.restModel, self.schemaModules needs to be set"
        raise NotImplementedError(message)