def test_reload_file(self):
     ls = LaunchServicer()
     path = interpret_path(
         "$(find fkie_node_manager_daemon)/tests/resources/description_example.launch"
     )
     response = ls.ReloadLaunch(lmsg.LaunchFile(path=path), DummyContext())
     self.assertEqual(
         response.status.code,
         lmsg.ReturnStatus.StatusType.Value('FILE_NOT_FOUND'),
         "wrong status code on reload of not loaded file, result: %d, expected: %d, reported error: %s"
         % (response.status.code,
            lmsg.ReturnStatus.StatusType.Value('FILE_NOT_FOUND'),
            response.status.error_msg))
     response = ls.LoadLaunch(
         lmsg.LoadLaunchRequest(package='fkie_node_manager_daemon',
                                launch='description_example.launch',
                                path=path), DummyContext())
     self.assertEqual(
         response.status.code, lmsg.ReturnStatus.StatusType.Value('OK'),
         "wrong status code on successful load, result: %d, expected: %d, reported error: %s"
         % (response.status.code, lmsg.ReturnStatus.StatusType.Value('OK'),
            response.status.error_msg))
     response = ls.ReloadLaunch(lmsg.LaunchFile(path=path), DummyContext())
     self.assertEqual(
         response.status.code, lmsg.ReturnStatus.StatusType.Value('OK'),
         "wrong status code on reload of already loaded file, result: %d, expected: %d, reported error: %s"
         % (response.status.code, lmsg.ReturnStatus.StatusType.Value('OK'),
            response.status.error_msg))
Пример #2
0
 def get_mtimes(self, path):
     '''
     :return: tuple with launch file, modification time and dictionary of included files and their modification times.
     :rtype: str, double {str: double}
     '''
     request = lmsg.LaunchFile(path=path, masteruri='')
     response = self.lm_stub.GetMtime(request, timeout=settings.GRPC_TIMEOUT)
     return response.path, response.mtime, response.included_files
Пример #3
0
 def unload_launch(self, path, masteruri=''):
     '''
     '''
     request = lmsg.LaunchFile(path=path, masteruri=masteruri)
     response = self.lm_stub.UnloadLaunch(request, timeout=settings.GRPC_TIMEOUT)
     if response.status.code != OK:
         if response.status.code == FILE_NOT_FOUND:
             raise exceptions.ResourceNotFound(path, response.status.error_msg)
         else:
             raise exceptions.RemoteException(response.status.code, response.status.error_msg)
     return response.path[0]
Пример #4
0
 def reload_launch(self, path, masteruri=''):
     '''
     :return: tuple with launch file, list of changed node after reload launch
     :rtype: str, [str]
     '''
     request = lmsg.LaunchFile(path=path, masteruri=masteruri)
     response = self.lm_stub.ReloadLaunch(request, timeout=settings.GRPC_TIMEOUT)
     if response.status.code != OK:
         if response.status.code == FILE_NOT_FOUND:
             raise exceptions.ResourceNotFound(path, response.status.error_msg)
         else:
             raise exceptions.RemoteException(response.status.code, response.status.error_msg)
     return response.path, response.changed_nodes