Example #1
0
    def setUp(self):
        registry.GLOBAL_REGISTRY.clear()
        self.original_methods_path = util.METHODS_PATH
        self.original_lab_class = parser.LAB_CLASS
        self.original_core_class = parser.CORE_CLASS
       
        clients.ACCEPTABLE_EXC_TYPES = clients.ACCEPTABLE_EXC_TYPES + ('test.','__main__.')
        parser.LAB_CLASS = FakeLaboratoryServer.__module__ + '.' + FakeLaboratoryServer.__name__
        parser.CORE_CLASS = FakeCoreServer.__module__ + '.' + FakeCoreServer.__name__
        util.METHODS_PATH = CommunicationsTest.__module__

        lab_port1 = ports.new()
        lab_port2 = ports.new()
        
        self.core_addr = gen.CoordAddress.translate('core:core@main_host')
        self.lab_addr1 = gen.CoordAddress.translate('lab:core@main_host')
        self.lab_addr2 = gen.CoordAddress.translate('lab1:lab@main_host')
        self.lab_addr3 = gen.CoordAddress.translate('lab2:lab@main_host')

        config_str = sample_configuration % { 'PORT1' : lab_port1, 'PORT2' : lab_port2 }
        self.global_config = gen.loads(config_str)

        process1 = self.global_config.load_process('main_host', 'core')
        process2 = self.global_config.load_process('main_host', 'lab')

        self.processes = [ process1, process2 ]
Example #2
0
    def _start_weblab(self):
        """
        Starts the instance and blocks while it is alive.
        It may take a while to actually start. You can check whether it is ready to
        process requests through is_ready.

        Meant to be called from the spawned thread.
        :return:
        """

        # Load the configuration of the weblab instance that we have set up for just this test.
        self.global_config = load_dir("test/deployments/selenium_tests")

        # Override the port so that we can start & close it fast enough.
        port = ports.new()
        self.core_server_url = "http://127.0.0.1:{0}/weblab/".format(port)
        # TODO: The following two lines to modify the port currently do not work.
        # But they should.
        self.global_config["myhost"]["myprocess"]["mycore"].config_values["core_facade_port"] = port
        self.global_config["myhost"]["myprocess"]["mycore"].config_values["core_server_url"] = self.core_server_url

        # Start the weblab instance. The dont-start flag is set to False, so this call
        # WILL BLOCK and start the HTTP server.
        self.handler = self.global_config.load_process("myhost", "myprocess")
        """ type : voodoo.gen.handler.ProcessHandler """
Example #3
0
    def _start_weblab(self):
        """
        Starts the instance and blocks while it is alive.
        It may take a while to actually start. You can check whether it is ready to
        process requests through is_ready.

        Meant to be called from the spawned thread.
        :return:
        """

        # Load the configuration of the weblab instance that we have set up for just this test.
        self.global_config = load_dir('test/deployments/selenium_tests')

        # Override the port so that we can start & close it fast enough.
        port = ports.new()
        self.core_server_url = 'http://127.0.0.1:{0}/weblab/'.format(port)
        # TODO: The following two lines to modify the port currently do not work.
        # But they should.
        self.global_config['myhost']['myprocess']['mycore'].config_values['core_facade_port'] = port
        self.global_config['myhost']['myprocess']['mycore'].config_values[
            'core_server_url'] = self.core_server_url

        # Start the weblab instance. The dont-start flag is set to False, so this call
        # WILL BLOCK and start the HTTP server.
        self.handler = self.global_config.load_process('myhost', 'myprocess')
        """ type : voodoo.gen.handler.ProcessHandler """