Class InboundAgentExtension
java.lang.Object
org.jvnet.hudson.test.junit.jupiter.InboundAgentExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.Extension
public class InboundAgentExtension
extends Object
implements org.junit.jupiter.api.extension.AfterEachCallback
This is the JUnit Jupiter implementation of
InboundAgentFixture.
Usage:
@RegisterExtension
private final InboundAgentRule inboundAgent = InboundAgentExtension.newBuilder().build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final classThe options used to (re)start an inbound agent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterEach(org.junit.jupiter.api.extension.ExtensionContext context) hudson.model.SlavecreateAgent(JenkinsRule r, String name) Creates, attaches, and starts a new inbound agent.hudson.model.SlavecreateAgent(JenkinsRule r, InboundAgentExtension.Options options) Creates, attaches, and optionally starts a new inbound agent.voidcreateAgent(RealJenkinsExtension extension, String name) voidcreateAgent(RealJenkinsExtension extension, InboundAgentExtension.Options options) static String[]createAgentRJR(JenkinsRule r, InboundAgentExtension.Options options) getAgentArguments(JenkinsRule r, String name) booleanChecks whether an existing inbound agent process is currently running.voidstart(JenkinsRule r, String name) (Re-)starts an existing inbound agent.voidstart(JenkinsRule r, InboundAgentExtension.Options options) (Re-)starts an existing inbound agent.voidstart(InboundAgentExtension.AgentArguments agentArguments, InboundAgentExtension.Options options) voidstart(InboundAgentExtension.AgentArguments agentArguments, InboundAgentExtension.Options options, boolean stop) voidstart(RealJenkinsExtension r, InboundAgentExtension.Options options) (Re-)starts an existing inbound agent.voidstartOnly(RealJenkinsExtension extension, InboundAgentExtension.Options options) Starts an existing inbound agent without waiting for it to go online.voidStops an existing inbound agent.voidstop(JenkinsRule r, String name) Stop an existing inbound agent and wait for it to go offline.voidstop(RealJenkinsExtension rjr, String name) Stop an existing inbound agent and wait for it to go offline.static voidwaitForAgentOffline(JenkinsRule r, String name) static voidwaitForAgentOnline(JenkinsRule r, String name, Map<String, Level> loggers)
-
Constructor Details
-
InboundAgentExtension
public InboundAgentExtension()
-
-
Method Details
-
createAgent
public hudson.model.Slave createAgent(@NonNull JenkinsRule r, @CheckForNull String name) throws Exception Creates, attaches, and starts a new inbound agent.- Parameters:
name- an optionalSlave.getNodeName()- Throws:
Exception
-
createAgent
public hudson.model.Slave createAgent(@NonNull JenkinsRule r, InboundAgentExtension.Options options) throws Exception Creates, attaches, and optionally starts a new inbound agent.- Parameters:
options- the options- Throws:
Exception
-
createAgent
public void createAgent(@NonNull RealJenkinsExtension extension, @CheckForNull String name) throws Throwable - Throws:
Throwable
-
createAgent
public void createAgent(@NonNull RealJenkinsExtension extension, InboundAgentExtension.Options options) throws Throwable - Throws:
Throwable
-
start
(Re-)starts an existing inbound agent.- Throws:
Exception
-
start
(Re-)starts an existing inbound agent.- Throws:
Exception
-
start
public void start(@NonNull RealJenkinsExtension r, InboundAgentExtension.Options options) throws Throwable (Re-)starts an existing inbound agent.- Throws:
Throwable
-
start
public void start(InboundAgentExtension.AgentArguments agentArguments, InboundAgentExtension.Options options) throws Exception - Throws:
Exception
-
start
public void start(InboundAgentExtension.AgentArguments agentArguments, InboundAgentExtension.Options options, boolean stop) throws IOException - Throws:
IOException
-
startOnly
public void startOnly(@NonNull RealJenkinsExtension extension, InboundAgentExtension.Options options) throws Throwable Starts an existing inbound agent without waiting for it to go online.- Throws:
Throwable
-
stop
Stop an existing inbound agent and wait for it to go offline.- Throws:
InterruptedException
-
stop
Stop an existing inbound agent and wait for it to go offline.- Throws:
Throwable
-
stop
Stops an existing inbound agent. You need only call this to simulate an agent crash, followed bystart(org.jvnet.hudson.test.JenkinsRule, java.lang.String). -
isAlive
Checks whether an existing inbound agent process is currently running. (This is distinct from whether Jenkins considers the computer to be connected.) -
afterEach
public void afterEach(@NonNull org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
getAgentArguments
public static InboundAgentExtension.AgentArguments getAgentArguments(JenkinsRule r, String name) throws IOException - Throws:
IOException
-
waitForAgentOnline
public static void waitForAgentOnline(JenkinsRule r, String name, Map<String, Level> loggers) throws Exception- Throws:
Exception
-
waitForAgentOffline
- Throws:
InterruptedException
-
createAgentRJR
public static String[] createAgentRJR(JenkinsRule r, InboundAgentExtension.Options options) throws Throwable - Throws:
Throwable
-