Class RemoteAgent

  • All Implemented Interfaces:
    AutoCloseable

    public class RemoteAgent
    extends Object
    implements AutoCloseable
    Class to start and set up remote agent. To be used in tests. Assumption is it will be created with constructor and later closed with close(). Usually one can use @see RemoteAgentRule. Alternatively it can be created in try-with-resources block or handled manually. Watch out as it does some unexpected things like removing all local agents from the server.
    • Method Detail

      • startAgent

        public void startAgent()
                        throws Exception
        Start remote agent if it's not started yet
        Throws:
        Exception
      • stopAgent

        public void stopAgent()
                       throws Exception
        Stops the remote agent
        Throws:
        Exception
      • restartAgent

        public void restartAgent()
                          throws Exception
        Restarts the agent. Does not wait for the agent to fully come up.
        Throws:
        Exception
      • setLogsFolderName

        public void setLogsFolderName​(@Nullable
                                      @Nullable String logsFolderName)
        Set log folder name. Used only if REMOTE_AGENT_LOGS_DIRECTORY system property is not empty.
        Parameters:
        logsFolderName -
      • getAgentHomeDirectory

        public File getAgentHomeDirectory()
        Get remote agent home directory
      • getAgentExecutionDirectory

        public File getAgentExecutionDirectory()
        Get remote agent installation directory
      • getAgentId

        public long getAgentId()
        Get remote agent id