def checkForURIReadiness(self, uri):
        """
        Called to see if the given uri is available for the viewpoint
        to load.

        The test for availability depends on the viewpoint config

        If the URI is present I.E. we go a get and get 200 back
        then it is considered as available.

        :param uri: this is the resource to check if its available.

        :returns: True if the URI is responding to get requests,
        otherwise False.

        """
        if self.test_method == 'connect':
            hp = urlparse.urlsplit(uri).netloc.split(':')
            host = hp[0]
            if len(hp) < 2:
                port = 80
            else:
                port = int(hp[1])

            return net.wait_for_service(host, port, retries=1)

        else:
            return net.wait_for_ready(uri, retries=1)
    def checkForURIReadiness(self, uri):
        """
        Called to see if the given uri is available for the viewpoint
        to load.

        The test for availability depends on the viewpoint config

        If the URI is present I.E. we go a get and get 200 back
        then it is considered as available.

        :param uri: this is the resource to check if its available.

        :returns: True if the URI is responding to get requests,
        otherwise False.

        """
        if self.test_method == 'connect':
            hp = urlparse.urlsplit(uri).netloc.split(':')
            host = hp[0]
            if len(hp) < 2:
                port = 80
            else:
                port = int(hp[1])

            return net.wait_for_service(host, port, retries=1)

        else:
            return net.wait_for_ready(uri, retries=1)
    def waitForReady(self, retries=0, retry_period=5.0):
        """Called to wait until the viewpoint interface is ready on the host and port.

        retries: (default: 0)
           The number of attempts before giving up on
           connecting to the browser.

           If this is 0 then we will wait forever for
           the browser to appear.

        retry_period: (default: 5.0)
           The amount of seconds to wait before the next
           connection attempt.

        returned:

            True: success
            Failed: failed to connect after maximum retries.

        """
        return wait_for_service(self.interface, int(self.port), retries, retry_period)
示例#4
0
    def waitForReady(self, retries=0, retry_period=5.0):
        """Called to wait until the viewpoint interface is ready on the host and port.

        retries: (default: 0)
           The number of attempts before giving up on
           connecting to the browser.

           If this is 0 then we will wait forever for
           the browser to appear.

        retry_period: (default: 5.0)
           The amount of seconds to wait before the next
           connection attempt.

        returned:

            True: success
            Failed: failed to connect after maximum retries.

        """
        return wait_for_service(self.interface, int(self.port), retries,
                                retry_period)