Class DriverService

    • Field Summary

      Modifier and Type Field Description
      protected static java.time.Duration DEFAULT_TIMEOUT  
      protected CommandLine process
      A reference to the current child process.
    • Constructor Summary

      Modifier Constructor Description
      protected DriverService​( executable, int port, java.time.Duration timeout, java.util.List<java.lang.String> args, java.util.Map<java.lang.String,​java.lang.String> environment)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void checkExecutable​( exe)  
      void close()  
      protected static findExecutable​(java.lang.String exeName, java.lang.String exeProperty, java.lang.String exeDocs, java.lang.String exeDownload)  
      protected java.util.List<java.lang.String> getArgs()  
      protected java.util.Map<java.lang.String,​java.lang.String> getEnvironment()  
      protected getOutputStream()  
      protected java.time.Duration getTimeout() getUrl()  
      protected getUrl​(int port)  
      protected boolean hasShutdownEndpoint()  
      boolean isRunning()
      Checks whether the driver child process is currently running.
      void sendOutputTo​( outputStream)  
      void start()
      Starts this service if it is not already running.
      void stop()
      Stops this service if it is currently running.
      protected void waitUntilAvailable()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail


        protected static final java.time.Duration DEFAULT_TIMEOUT
      • process

        protected CommandLine process
        A reference to the current child process. Will be null whenever this service is not running. Protected by lock.
    • Constructor Detail

      • DriverService

        protected DriverService​( executable,
                                int port,
                                java.time.Duration timeout,
                                java.util.List<java.lang.String> args,
                                java.util.Map<java.lang.String,​java.lang.String> environment)
        executable - The driver executable.
        port - Which port to start the driver server on.
        timeout - Timeout waiting for driver server to start.
        args - The arguments to the launched server.
        environment - The environment for the launched server.
        Throws: - If an I/O error occurs.
    • Method Detail

      • findExecutable

        protected static findExecutable​(java.lang.String exeName,
                                                     java.lang.String exeProperty,
                                                     java.lang.String exeDocs,
                                                     java.lang.String exeDownload)
        exeName - Name of the executable file to look for in PATH
        exeProperty - Name of a system property that specifies the path to the executable file
        exeDocs - The link to the driver documentation page
        exeDownload - The link to the driver download page
        The driver executable as a File object
        java.lang.IllegalStateException - If the executable not found or cannot be executed
      • checkExecutable

        protected static void checkExecutable​( exe)
      • getArgs

        protected java.util.List<java.lang.String> getArgs()
      • getEnvironment

        protected java.util.Map<java.lang.String,​java.lang.String> getEnvironment()
      • getUrl

        protected getUrl​(int port)
      • getUrl

        public getUrl()
        The base URL for the managed driver server.
      • isRunning

        public boolean isRunning()
        Checks whether the driver child process is currently running.
        Whether the driver child process is still running.
      • start

        public void start()
        Starts this service if it is not already running. This method will block until the server has been fully started and is ready to handle commands.
        Throws: - If an error occurs while spawning the child process.
        See Also:
      • getTimeout

        protected java.time.Duration getTimeout()
      • waitUntilAvailable

        protected void waitUntilAvailable()
      • stop

        public void stop()
        Stops this service if it is currently running. This method will attempt to block until the server has been fully shutdown.
        See Also:
      • hasShutdownEndpoint

        protected boolean hasShutdownEndpoint()
      • sendOutputTo

        public void sendOutputTo​( outputStream)
      • getOutputStream

        protected getOutputStream()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface