Class RemoteAgent

java.lang.Object
com.atlassian.bamboo.testutils.agent.RemoteAgent
All Implemented Interfaces:
Closeable, AutoCloseable

public class RemoteAgent extends Object implements Closeable
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.
  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • startAgent

      public RemoteAgent startAgent() throws Exception
      Start remote agent if it's not started yet
      Returns:
      this
      Throws:
      Exception
    • updateBootstrap

      public RemoteAgent updateBootstrap() throws Exception
      Start remote agent only for boostrap update
      Returns:
      this
      Throws:
      Exception
    • stopAgent

      public RemoteAgent stopAgent() throws Exception
      Stops the remote agent
      Returns:
      this
      Throws:
      Exception
    • restartAgent

      public RemoteAgent restartAgent() throws Exception
      Restarts the agent. Does not wait for the agent to fully come up.
      Returns:
      this
      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