Beispiel #1
0
    def check_elems_presistence(self, info):
        """Helper method to test the elements persistence. The actions are:
            - creation of controller and element
            - restart Pool
            - check if element persist

        :param info: information about controller (type, library, class)
        :type info: tuple<str>
        """
        # Create controller
        self.do_element_cleanup = False
        sar_type, lib, cls = info
        base_name = "ctrl_persistent_" + cls
        self.ctrl_name = get_free_alias(PyTango.Database(), base_name)
        self.pool.CreateController([sar_type, lib, cls, self.ctrl_name])

        # Create element
        base_name = "elem_persistent_" + cls
        self.elem_name = get_free_alias(PyTango.Database(), base_name)
        axis = 1
        self.pool.CreateElement([sar_type, self.ctrl_name, str(axis),
                                 self.elem_name])
        # Restart Pool
        self._starter.stopDs(hard_kill=True)
        self._starter.startDs()
        # Check if the element exists
        try:
            obj = PyTango.DeviceProxy(self.elem_name)
            # the element is persistent, cleanup is necessary
            self.do_element_cleanup = True
        except:
            obj = None
        msg = 'The element "%s" does not exist after restarting the Pool' %\
            (self.elem_name)
        self.assertIsNotNone(obj, msg)
Beispiel #2
0
 def setUp(self):
     """Create dummy motor controller and dummy motor element
     """
     super(ReadMotorPositionOutsideLim, self).setUp()
     sar_type = 'Motor'
     lib = 'DummyMotorController'
     cls = 'DummyMotorController'
     self.ctrl_name = get_free_alias(PyTango.Database(), "readposctrl")
     self.pool.CreateController([sar_type, lib, cls, self.ctrl_name])
     self.elem_name = get_free_alias(PyTango.Database(), "mot_test")
     axis = 1
     self.pool.CreateElement([sar_type, self.ctrl_name, str(axis),
                              self.elem_name])
     self.elem = PyTango.DeviceProxy(self.elem_name)
     self.elem.DefinePosition(0)
Beispiel #3
0
 def setUp(self):
     """Create dummy motor controller and dummy motor element
     """
     super(ReadMotorPositionOutsideLim, self).setUp()
     sar_type = 'Motor'
     lib = 'DummyMotorController'
     cls = 'DummyMotorController'
     self.ctrl_name = get_free_alias(PyTango.Database(), "readposctrl")
     self.pool.CreateController([sar_type, lib, cls, self.ctrl_name])
     self.elem_name = get_free_alias(PyTango.Database(), "mot_test")
     axis = 1
     self.pool.CreateElement(
         [sar_type, self.ctrl_name,
          str(axis), self.elem_name])
     self.elem = PyTango.DeviceProxy(self.elem_name)
     self.elem.DefinePosition(0)
Beispiel #4
0
 def setUp(self):
     """Create dummy motor controller and dummy motor element
     """
     super(ReadMotorPositionOutsideLim, self).setUp()
     cls = "DummyMotorController"
     self.ctrl_name = get_free_alias(PyTango.Database(), "readposctrl")
     props = ()
     ctrl = self.pool.createController(cls, self.ctrl_name, *props)
     # Add extra timeout of 3 seconds.
     if ctrl is None:
         elements_info = self.pool.getElementsInfo()
         ctrl = self.pool._wait_for_element_in_container(elements_info, self.ctrl_name, timeout=3)
     self.elem_name = get_free_alias(PyTango.Database(), "mot_test")
     elem_axis = 1
     self.elem = self.pool.createElement(self.elem_name, ctrl, elem_axis)
     self.elem.DefinePosition(0)
Beispiel #5
0
 class BuiltinElementCreationTest(ElementCreationTestCase,
                                  unittest.TestCase):
     alias = get_free_alias(PyTango.Database(), "mot_test")
     controller_infos = [('DummyMotorController',
                          'unittest',
                          (),
                          [(alias, 1)])
                         ]
Beispiel #6
0
 def setUp(self):
     """Create dummy motor controller and dummy motor element
     """
     super(ReadMotorPositionOutsideLim, self).setUp()
     cls = 'DummyMotorController'
     self.ctrl_name = get_free_alias(PyTango.Database(), "readposctrl")
     props = ()
     ctrl = self.pool.createController(cls, self.ctrl_name, *props)
     #Add extra timeout of 3 seconds.
     if ctrl is None:
         elements_info = self.pool.getElementsInfo()
         ctrl = self.pool._wait_for_element_in_container(elements_info,
                                                         self.ctrl_name,
                                                         timeout=3)
     self.elem_name = get_free_alias(PyTango.Database(), "mot_test")
     elem_axis = 1
     self.elem = self.pool.createElement(self.elem_name, ctrl, elem_axis)
     self.elem.DefinePosition(0)
    def check_elems_presistence(self, info):
        """Helper method to test the elements persistence. The actions are:
            - creation of controller and element
            - restart Pool
            - check if element persist

        :param info: information about controller (type, library, class)
        :type info: tuple<str>
        """
        # Create controller
        self.do_element_cleanup = False
        sar_type, lib, cls = info
        base_name = "ctrl_persistent_" + cls
        self.ctrl_name = get_free_alias(PyTango.Database(), base_name)
        self.pool.CreateController([sar_type, lib, cls, self.ctrl_name])

        # Create element
        base_name = "elem_persistent_" + cls
        self.elem_name = get_free_alias(PyTango.Database(), base_name)
        axis = 1
        self.pool.CreateElement(
            [sar_type, self.ctrl_name,
             str(axis), self.elem_name])
        # Restart Pool
        self._starter.stopDs(hard_kill=True)
        self._starter.startDs()
        # Check if the element exists
        try:
            obj = PyTango.DeviceProxy(self.elem_name)
            # the element is persistent, cleanup is necessary
            self.do_element_cleanup = True
        except:
            obj = None
        msg = 'The element "%s" does not exist after restarting the Pool' %\
            (self.elem_name)
        self.assertIsNotNone(obj, msg)