def setUp(self):
        # Clean the global registry of servers
        GLOBAL_REGISTRY.clear()

        CONSUMER_CONFIG_PATH = self.FEDERATED_DEPLOYMENTS + '/consumer/'
        PROVIDER1_CONFIG_PATH = self.FEDERATED_DEPLOYMENTS + '/provider1/'
        PROVIDER2_CONFIG_PATH = self.FEDERATED_DEPLOYMENTS + '/provider2/'

        self.consumer_handler = load_dir(CONSUMER_CONFIG_PATH).load_process(
            'consumer_machine', 'main_instance')
        self.provider1_handler = load_dir(PROVIDER1_CONFIG_PATH).load_process(
            'provider1_machine', 'main_instance')
        self.provider2_handler = load_dir(PROVIDER2_CONFIG_PATH).load_process(
            'provider2_machine', 'main_instance')

        self.consumer_client = WebLabDeustoClient(
            "http://127.0.0.1:%s/weblab/" % 18345)

        self.provider1_client = WebLabDeustoClient(
            "http://127.0.0.1:%s/weblab/" % 28345)

        self.provider2_client = WebLabDeustoClient(
            "http://127.0.0.1:%s/weblab/" % 38345)

        # dummy1: deployed in consumer, provider1, provider2
        self.dummy1 = ExperimentId("dummy1", "Dummy experiments")
        # dummy2: deployed in consumer
        self.dummy2 = ExperimentId("dummy2", "Dummy experiments")
        # dummy3: deployed in provider1 as "dummy3_with_other_name"
        self.dummy3 = ExperimentId("dummy3", "Dummy experiments")
        # dummy4: deployed in provider2
        self.dummy4 = ExperimentId("dummy4", "Dummy experiments")
    def setUp(self):
        # Clean the global registry of servers
        GLOBAL_REGISTRY.clear()

        CONSUMER_CONFIG_PATH  = self.FEDERATED_DEPLOYMENTS + '/consumer/'
        PROVIDER1_CONFIG_PATH = self.FEDERATED_DEPLOYMENTS + '/provider1/'
        PROVIDER2_CONFIG_PATH = self.FEDERATED_DEPLOYMENTS + '/provider2/'

        self.consumer_handler  = load_dir(CONSUMER_CONFIG_PATH).load_process('consumer_machine', 'main_instance' )
        self.provider1_handler = load_dir(PROVIDER1_CONFIG_PATH).load_process('provider1_machine', 'main_instance' )
        self.provider2_handler = load_dir(PROVIDER2_CONFIG_PATH).load_process('provider2_machine', 'main_instance' )
        
        self.consumer_client  = WebLabDeustoClient("http://127.0.0.1:%s/weblab/" % 18345)

        self.provider1_client  = WebLabDeustoClient("http://127.0.0.1:%s/weblab/" % 28345)

        self.provider2_client  = WebLabDeustoClient("http://127.0.0.1:%s/weblab/" % 38345)

        # dummy1: deployed in consumer, provider1, provider2
        self.dummy1 = ExperimentId("dummy1", "Dummy experiments")
        # dummy2: deployed in consumer
        self.dummy2 = ExperimentId("dummy2", "Dummy experiments")
        # dummy3: deployed in provider1 as "dummy3_with_other_name"
        self.dummy3 = ExperimentId("dummy3", "Dummy experiments")
        # dummy4: deployed in provider2
        self.dummy4 = ExperimentId("dummy4", "Dummy experiments")
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        """
        Prepares the test by creating a new weblab instance from a for-testing configuration.
        The instance is configured *not* to start a flask server, but to allow Flask test methods
        instead.
        :return:
        """

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

        # Start the weblab instance. Because we have activated the dont-start flag it won't actually
        # start listening on the port, but let us use the Flask test methods instead.
        self.handler = self.global_config.load_process('myhost', 'myprocess')

        self.core_server = GLOBAL_REGISTRY['mycore:myprocess@myhost']

        self.app = self.core_server.app.test_client()
        """ :type: flask.testing.FlaskClient """

        # Login.
        rv = self.app.post('weblab/login', data=dict(username='******', password='******'))
        self.assertEqual(rv.status_code, 302, "Login POST for any / password does not return 302")

        # Clear REDIS.
        # TODO: These tests should probably start their own redis instance to avoid side-effects.
        compiserv._redis.delete("compiserv::jobs::20+abcdef")
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        """
        Prepares the test by creating a new weblab instance from a for-testing configuration.
        The instance is configured *not* to start a flask server, but to allow Flask test methods
        instead.
        :return:
        """

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

        # Start the weblab instance. Because we have activated the dont-start flag it won't actually
        # start listening on the port, but let us use the Flask test methods instead.
        self.handler = self.global_config.load_process('myhost', 'myprocess')

        self.core_server = GLOBAL_REGISTRY['mycore:myprocess@myhost']

        self.app = self.core_server.app.test_client()
        """ :type: flask.testing.FlaskClient """

        # Login.
        rv = self.app.post('weblab/login',
                           data=dict(username='******', password='******'))
        self.assertEqual(rv.status_code, 302,
                         "Login POST for any / password does not return 302")
Esempio n. 5
0
    def stop(self):
        """
        Signals weblab to stop. This will not happen immediately.
        :return:
        """
        if self.handler is not None:
            self.handler.stop()

        GLOBAL_REGISTRY.clear()
Esempio n. 6
0
    def stop(self):
        """
        Signals weblab to stop. This will not happen immediately.
        :return:
        """
        if self.handler is not None:
            self.handler.stop()

        GLOBAL_REGISTRY.clear()
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        self.global_config = load_dir(self.DEPLOYMENT_DIR)

        self.process_handlers = []
        for process in self.PROCESSES:
            process_handler = self.global_config.load_process('myhost', process)
            self.process_handlers.append(process_handler)

        self.core_server       = GLOBAL_REGISTRY[self.CORE_ADDRESS]
        self.experiment_dummy1 = GLOBAL_REGISTRY[self.EXPERIMENT_DUMMY1]
        self.experiment_dummy2 = GLOBAL_REGISTRY[self.EXPERIMENT_DUMMY2]

        self.core_config = self.core_server.config

        self.client = WebLabDeustoClient('http://localhost:%s/weblab/' % self.core_config[configuration_doc.CORE_FACADE_PORT])
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        self.global_config = load_dir(self.DEPLOYMENT_DIR)

        self.process_handlers = []
        for process in self.PROCESSES:
            process_handler = self.global_config.load_process(
                'myhost', process)
            self.process_handlers.append(process_handler)

        self.core_server = GLOBAL_REGISTRY[self.CORE_ADDRESS]
        self.experiment_dummy1 = GLOBAL_REGISTRY[self.EXPERIMENT_DUMMY1]
        self.experiment_dummy2 = GLOBAL_REGISTRY[self.EXPERIMENT_DUMMY2]

        self.core_config = self.core_server.config

        self.client = WebLabDeustoClient(
            'http://localhost:%s/weblab/' %
            self.core_config[configuration_doc.CORE_FACADE_PORT])
Esempio n. 9
0
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        """
        Prepares the test by creating a new weblab instance from a for-testing configuration.
        The instance is configured *not* to start a flask server, but to allow Flask test methods
        instead.
        :return:
        """

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

        # Start the weblab instance. Because we have activated the dont-start flag it won't actually
        # start listening on the port, but let us use the Flask test methods instead.
        self.handler = self.global_config.load_process('myhost', 'myprocess')

        self.core_server = GLOBAL_REGISTRY['mycore:myprocess@myhost']

        self.app = self.core_server.app.test_client()
        """ :type: flask.testing.FlaskClient """
Esempio n. 10
0
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        """
        Prepares the test by creating a new weblab instance from a for-testing configuration.
        The instance is configured *not* to start a flask server, but to allow Flask test methods
        instead.
        :return:
        """

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

        # Start the weblab instance. Because we have activated the dont-start flag it won't actually
        # start listening on the port, but let us use the Flask test methods instead.
        self.handler = self.global_config.load_process('myhost', 'myprocess')

        self.core_server = GLOBAL_REGISTRY['mycore:myprocess@myhost']

        self.app = self.core_server.app.test_client()
        """ :type: flask.testing.FlaskClient """
Esempio n. 11
0
def get_server(server = None):
    local_servers, instances, machines = servers(all=True)
    if not server:
        return local_servers

    if server not in local_servers:
        print "Error: %s not in %s" % (server, local_servers)
        return local_servers

    from voodoo.gen.registry import GLOBAL_REGISTRY
    server = GLOBAL_REGISTRY.get('%s:%s@%s' % (server, list(instances)[0], list(machines)[0]))
    return server
Esempio n. 12
0
def get_server(server=None):
    local_servers, instances, machines = servers(all=True)
    if not server:
        return local_servers

    if server not in local_servers:
        print("Error: %s not in %s" % (server, local_servers))
        return local_servers

    from voodoo.gen.registry import GLOBAL_REGISTRY
    server = GLOBAL_REGISTRY.get(
        '%s:%s@%s' % (server, list(instances)[0], list(machines)[0]))
    return server
Esempio n. 13
0
    def setUp(self):
        GLOBAL_REGISTRY.clear()
        """
        Prepares the test by creating a new weblab instance from a for-testing configuration.
        The instance is configured *not* to start a flask server, but to allow Flask test methods
        instead.
        :return:
        """

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

        # Start the weblab instance. Because we have activated the dont-start flag it won't actually
        # start listening on the port, but let us use the Flask test methods instead.
        self.handler = self.global_config.load_process("myhost", "myprocess")

        self.core_server = GLOBAL_REGISTRY["mycore:myprocess@myhost"]

        self.app = self.core_server.app.test_client()
        """ :type: flask.testing.FlaskClient """

        # Login.
        rv = self.app.post("weblab/login", data=dict(username="******", password="******"))
        self.assertEqual(rv.status_code, 302, "Login POST for any / password does not return 302")
Esempio n. 14
0
def servers(all=False):
    from voodoo.gen.registry import GLOBAL_REGISTRY
    all_components = []
    hosts = set()
    processes = set()
    for key in GLOBAL_REGISTRY.keys():
        matches = regex.match(key)
        if matches:
            component, process, host = matches.groups()

            all_components.append(component)
            processes.add(process)
            hosts.add(host)

    if all:
        return all_components, processes, hosts

    return all_components
Esempio n. 15
0
def servers(all = False):
    from voodoo.gen.registry import GLOBAL_REGISTRY
    all_components = []
    hosts = set()
    processes = set()
    for key in GLOBAL_REGISTRY.keys():
        matches = regex.match(key)
        if matches:
            component, process, host = matches.groups()

            all_components.append(component)
            processes.add(process)
            hosts.add(host)

    if all:
        return all_components, processes, hosts
    
    return all_components
Esempio n. 16
0
    def tearDown(self):
        GLOBAL_REGISTRY.clear()

        for process_handler in self.process_handlers:
            process_handler.stop()
    def tearDown(self):
        GLOBAL_REGISTRY.clear()

        for process_handler in self.process_handlers:
            process_handler.stop()