Class RemoteAgent
java.lang.Object
com.atlassian.bamboo.testutils.agent.RemoteAgent
- All Implemented Interfaces:
Closeable
,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.-
Constructor Summary
ConstructorDescriptionRemoteAgent
(boolean tearDownLocalAgents) RemoteAgent
(BambooEnvironmentData bambooEnvironmentData) RemoteAgent
(BambooEnvironmentData bambooEnvironmentData, boolean tearDownLocalAgents, String ephemeralFor) RemoteAgent
(BambooEnvironmentData bambooEnvironmentData, boolean tearDownLocalAgents, String ephemeralFor, boolean tryToReuseAgent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Get remote agent installation directoryGet remote agent home directorylong
Get remote agent idRestarts the agent.void
setLogsFolderName
(@Nullable String logsFolderName) Set log folder name.Start remote agent if it's not started yetStops the remote agentStart remote agent only for boostrap update
-
Constructor Details
-
RemoteAgent
- Throws:
Exception
-
RemoteAgent
- Throws:
Exception
-
RemoteAgent
- Throws:
Exception
-
RemoteAgent
public RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean tearDownLocalAgents, String ephemeralFor) throws Exception - Throws:
Exception
-
RemoteAgent
public RemoteAgent(BambooEnvironmentData bambooEnvironmentData, boolean tearDownLocalAgents, String ephemeralFor, boolean tryToReuseAgent) throws Exception - Throws:
Exception
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
startAgent
Start remote agent if it's not started yet- Returns:
- this
- Throws:
Exception
-
updateBootstrap
Start remote agent only for boostrap update- Returns:
- this
- Throws:
Exception
-
stopAgent
Stops the remote agent- Returns:
- this
- Throws:
Exception
-
restartAgent
Restarts the agent. Does not wait for the agent to fully come up.- Returns:
- this
- Throws:
Exception
-
setLogsFolderName
Set log folder name. Used only ifREMOTE_AGENT_LOGS_DIRECTORY
system property is not empty.- Parameters:
logsFolderName
-
-
getAgentHomeDirectory
Get remote agent home directory -
getAgentExecutionDirectory
Get remote agent installation directory -
getAgentId
public long getAgentId()Get remote agent id
-