Example #1
0
def bs_register_services():
    """
    Register all the declared processes.
    """
    src = ServiceRegistryClient()
    for proc in base_process.processes.values():
        sd = ServiceDesc(name=proc['name'])
        res = yield src.register_service(sd)
Example #2
0
class ServiceRegistryTest(IonTestCase):
    """
    Testing client classes of service registry
    """
    @defer.inlineCallbacks
    def setUp(self):
        yield self._start_container()
        #self.sup = yield self._start_core_services()
        services = [{
            'name': 'serviceregistry1',
            'module': 'ion.services.coi.service_registry',
            'class': 'ServiceRegistryService'
        }]
        sup = yield self._spawn_processes(services)

        self.sup = sup
        self.src = ServiceRegistryClient(proc=sup)

    @defer.inlineCallbacks
    def tearDown(self):
        yield self._stop_container()

    @defer.inlineCallbacks
    def test_service_reg(self):

        # Register a service class object
        play_desc = yield self.src.register_service_definition(
            hello_service.HelloService)

        # create a reference to the description in the registry
        ref = play_desc.reference()

        # get the description back from its reference
        svc_desc = yield self.src.get_service_definition(ref)

        #print svc_desc

    @defer.inlineCallbacks
    def test_service_instance_reg(self):
        """
        """
        services = [
            {
                'name': 'hello1',
                'module': 'ion.play.hello_service',
                'class': 'HelloService'
            },
        ]
        # Create a process supervisor class
        sup = yield self._spawn_processes(services, sup=self.sup)

        # Register the service instance from the supervisors child_procs - Agument is a ProcessDesc object.
        # See base process!
        play_desc = yield self.src.register_service_instance(
            sup.child_procs[1])
    def test_service_reg(self):
        sd1 = ServiceDesc(name='svc1')

        c = ServiceRegistryClient(proc=self.sup)
        res1 = yield c.register_service(sd1)

        si1 = ServiceInstanceDesc(xname=self.sup.id.full, svc_name='svc1')
        ri1 = yield c.register_service_instance(si1)

        ri2 = yield c.get_service_instance_name('svc1')
        self.assertEqual(ri2, self.sup.id.full)
Example #4
0
    def setUp(self):
        yield self._start_container()
        #self.sup = yield self._start_core_services()
        services = [{
            'name': 'serviceregistry1',
            'module': 'ion.services.coi.service_registry',
            'class': 'ServiceRegistryService'
        }]
        sup = yield self._spawn_processes(services)

        self.sup = sup
        self.src = ServiceRegistryClient(proc=sup)
class ServiceRegistryTest(IonTestCase):
    """
    Testing client classes of service registry
    """
    @defer.inlineCallbacks
    def setUp(self):
        yield self._start_container()
        #self.sup = yield self._start_core_services()
        services = [
            {'name':'serviceregistry1','module':'ion.services.coi.service_registry','class':'ServiceRegistryService'}]
        sup = yield self._spawn_processes(services)

        self.sup = sup
        self.src = ServiceRegistryClient(proc=sup)


    @defer.inlineCallbacks
    def tearDown(self):
        yield self._stop_container()

    @defer.inlineCallbacks
    def test_service_reg(self):
        
        # Register a service class object
        play_desc = yield self.src.register_service_definition(hello_service.HelloService)
        
        # create a reference to the description in the registry
        ref = play_desc.reference()
        
        # get the description back from its reference
        svc_desc = yield self.src.get_service_definition(ref)
        
        #print svc_desc

    @defer.inlineCallbacks
    def test_service_instance_reg(self):
        """
        """        
        services = [
            {'name':'hello1','module':'ion.play.hello_service','class':'HelloService'},
        ]
        # Create a process supervisor class
        sup = yield self._spawn_processes(services, sup=self.sup)
        
        # Register the service instance from the supervisors child_procs - Agument is a ProcessDesc object.
        # See base process!
        play_desc = yield self.src.register_service_instance(sup.child_procs[1])
    def setUp(self):
        yield self._start_container()
        #self.sup = yield self._start_core_services()
        services = [
            {'name':'serviceregistry1','module':'ion.services.coi.service_registry','class':'ServiceRegistryService'}]
        sup = yield self._spawn_processes(services)

        self.sup = sup
        self.src = ServiceRegistryClient(proc=sup)