class RemoteLibrary:

    def __init__(self, name, uri):
        self.name = name
        self._uri = uri
        self._open_connection()
        self._keywords = None

    def _open_connection(self):
        self._remote_lib = RobotRemoteLibrary(self._uri)

    def get_keyword_names(self):
        if self._keywords is None:
            self._keywords = list(self._remote_lib.getKeywordNames())
        return self._keywords

    def has_keyword(self, name):
        return name in self._keywords

    def run_keyword(self, name, args):
        try:
            self._remote_lib.ping()
        except RemoteAccessException:
            print "*DEBUG* Reconnecting"
            self._open_connection()
        return self._remote_lib.runKeyword(name, args)
class RemoteLibrary:
    def __init__(self,
                 uri='rmi://localhost:1099/jvmConnector',
                 timeout="30 seconds"):
        self.uri = uri
        self.timeout = timeout
        self.open_connection()

    def open_connection(self):
        start_time = time.time()
        timeout = timestr_to_secs(self.timeout)
        while time.time() - start_time < timeout:
            try:
                self.remote_lib = RobotRemoteLibrary(self.uri)
                return
            except (BeanCreationException, RemoteConnectFailureException):
                time.sleep(2)
        message = "Could not get connection to '%s' in '%s'!"
        raise RuntimeError(message % (self.uri, self.timeout))

    def get_keyword_names(self):
        return list(self.remote_lib.getKeywordNames())

    def run_keyword(self, name, args):
        try:
            return self.remote_lib.runKeyword(name, args)
        except RemoteConnectFailureException:
            print '*DEBUG* Reconnecting to remote library.'
            self.open_connection()
            return self.remote_lib.runKeyword(name, args)
class RemoteLibrary:
    def __init__(self, name, uri):
        self.name = name
        self._uri = uri
        self._open_connection()
        self._keywords = None

    def _open_connection(self):
        self._remote_lib = RobotRemoteLibrary(self._uri)

    def get_keyword_names(self):
        if self._keywords is None:
            self._keywords = list(self._remote_lib.getKeywordNames())
        return self._keywords

    def has_keyword(self, name):
        return name in self._keywords

    def run_keyword(self, name, args):
        try:
            self._remote_lib.ping()
        except RemoteAccessException:
            print "*DEBUG* Reconnecting"
            self._open_connection()
        return self._remote_lib.runKeyword(name, args)
class RemoteLibrary:

    def __init__(self, uri='rmi://localhost:1099/jvmConnector', 
                 timeout="60 seconds"):
        self.uri = uri
        self.timeout = timeout
        self.open_connection()

    def open_connection(self):
        start_time = time.time()
        timeout = timestr_to_secs(self.timeout)
        while time.time() - start_time < timeout:
            try:
                self.remote_lib = RobotRemoteLibrary(self.uri)
                return
            except (BeanCreationException, RemoteConnectFailureException):
                time.sleep(2)
        message = "Could not get connection to '%s' in '%s'!" 
        raise RuntimeError(message %(self.uri, self.timeout))
        
    def get_keyword_names(self):
        return list(self.remote_lib.getKeywordNames())

    def run_keyword(self, name, args):
        try:
            return self.remote_lib.runKeyword(name, args)
        except RemoteConnectFailureException:
            print '*DEBUG* Reconnecting to remote library.' 
            self.open_connection()
            return self.remote_lib.runKeyword(name, args)
 def open_connection(self):
     start_time = time.time()
     timeout = timestr_to_secs(self.timeout)
     while time.time() - start_time < timeout:
         try:
             self.remote_lib = RobotRemoteLibrary(self.uri)
             return
         except (BeanCreationException, RemoteConnectFailureException):
             time.sleep(2)
     message = "Could not get connection to '%s' in '%s'!"
     raise RuntimeError(message % (self.uri, self.timeout))
 def __init__(self, host='localhost', port='1099',
              timeout=120, retry_interval=5):
     self.host = host
     self.port = port
     start_time = time.time()
     timeout = int(timeout)
     retry_interval = int(retry_interval)
     while(True):
         try:
             RobotRemoteLibrary.__init__(self, host, port)
             break
         except:
             time.sleep(retry_interval)
             if time.time() - start_time >= timeout:
                 raise
Ejemplo n.º 7
0
 def __init__(self,
              host='localhost',
              port='1099',
              timeout=120,
              retry_interval=5):
     self.host = host
     self.port = port
     start_time = time.time()
     timeout = int(timeout)
     retry_interval = int(retry_interval)
     while (True):
         try:
             RobotRemoteLibrary.__init__(self, host, port)
             break
         except:
             time.sleep(retry_interval)
             if time.time() - start_time >= timeout:
                 raise
class RemoteLibrary:
    def __init__(self, uri):
        self.uri = uri
        self._open_connection()

    def _open_connection(self):
        self.remote_lib = RobotRemoteLibrary(self.uri)

    def get_keyword_names(self):
        return list(self.remote_lib.getKeywordNames())

    def run_keyword(self, name, args):
        try:
            return self.remote_lib.runKeyword(name, args)
        except RemoteAccessException:
            print '*DEBUG* Reconnecting to remote library.'
            self._open_connection()
            return self.remote_lib.runKeyword(name, args)
class RemoteLibrary:

    def __init__(self, uri):
        self.uri = uri
        self._open_connection()

    def _open_connection(self):
        self.remote_lib = RobotRemoteLibrary(self.uri)
        
    def get_keyword_names(self):
        return list(self.remote_lib.getKeywordNames())

    def run_keyword(self, name, args):
        try:
            return self.remote_lib.runKeyword(name, args)
        except RemoteAccessException:
            print '*DEBUG* Reconnecting to remote library.' 
            self._open_connection()
            return self.remote_lib.runKeyword(name, args)
 def open_connection(self):
     start_time = time.time()
     timeout = timestr_to_secs(self.timeout)
     while time.time() - start_time < timeout:
         try:
             self.remote_lib = RobotRemoteLibrary(self.uri)
             return
         except (BeanCreationException, RemoteConnectFailureException):
             time.sleep(2)
     message = "Could not get connection to '%s' in '%s'!" 
     raise RuntimeError(message %(self.uri, self.timeout))
 def _open_connection(self):
     self._remote_lib = RobotRemoteLibrary(self._uri)
 def _open_connection(self):
     self._remote_lib = RobotRemoteLibrary(self._uri)