Class RemoteAgent
- java.lang.Object
-
- com.atlassian.bamboo.testutils.agent.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 @seeRemoteAgentRule
. 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 Summary
Constructors Constructor Description RemoteAgent()
RemoteAgent(boolean tearDownLocalAgents)
RemoteAgent(BambooEnvironmentData bambooEnvironmentData)
RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean startImmediately)
RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean startImmediately, boolean tearDownLocalAgents, String ephemeralFor)
RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean startImmediately, boolean tearDownLocalAgents, String ephemeralFor, boolean tryToReuseAgent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
File
getAgentExecutionDirectory()
Get remote agent installation directoryFile
getAgentHomeDirectory()
Get remote agent home directorylong
getAgentId()
Get remote agent idvoid
restartAgent()
Restarts the agent.void
setLogsFolderName(@Nullable String logsFolderName)
Set log folder name.void
startAgent()
Start remote agent if it's not started yetvoid
stopAgent()
Stops the remote agent
-
-
-
Constructor Detail
-
RemoteAgent
public RemoteAgent(BambooEnvironmentData bambooEnvironmentData) throws Exception
- Throws:
Exception
-
RemoteAgent
public RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean startImmediately, boolean tearDownLocalAgents, String ephemeralFor) throws Exception
- Throws:
Exception
-
RemoteAgent
public RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean startImmediately, boolean tearDownLocalAgents, String ephemeralFor, boolean tryToReuseAgent) throws Exception
- Throws:
Exception
-
RemoteAgent
public RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean startImmediately) throws Exception
- Throws:
Exception
-
-
Method Detail
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
startAgent
public void startAgent() throws Exception
Start remote agent if it's not started yet- 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 ifREMOTE_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
-
-