Skip to content

Commit

Permalink
Make InboundAgentRule.AgentArguments into a record
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Aug 29, 2024
1 parent f18f14e commit e9bab56
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions src/main/java/org/jvnet/hudson/test/InboundAgentRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public final class InboundAgentRule extends ExternalResource {
* The options used to (re)start an inbound agent.
*/
public static final class Options implements Serializable {
// TODO Java 14+ use records

@CheckForNull private String name;

Expand Down Expand Up @@ -433,40 +432,14 @@ public boolean isAlive(String name) {
procs.clear();
}

public static class AgentArguments implements Serializable {
/**
* URL to the agent JNLP file.
*/
@NonNull
private final String agentJnlpUrl;
/**
* A reference to the agent jar
*/
@NonNull
private final File agentJar;
/**
* The secret the agent should use to connect.
*/
@NonNull
private final String secret;
/**
* The number of nodes in the Jenkins instance where the agent is running.
*/
private final int numberOfNodes;
/**
* Additional command line arguments to pass to the agent.
*/
@NonNull
private final List<String> commandLineArgs;

public AgentArguments(@NonNull String agentJnlpUrl, @NonNull File agentJar, @NonNull String secret, int numberOfNodes, @NonNull List<String> commandLineArgs) {
this.agentJnlpUrl = agentJnlpUrl;
this.agentJar = agentJar;
this.secret = secret;
this.numberOfNodes = numberOfNodes;
this.commandLineArgs = commandLineArgs;
}
}
/**
* @param agentJnlpUrl URL to the agent JNLP file.
* @param agentJar A reference to the agent jar
* @param secret The secret the agent should use to connect.
* @param numberOfNodes The number of nodes in the Jenkins instance where the agent is running.
* @param commandLineArgs Additional command line arguments to pass to the agent.
*/
public record AgentArguments(@NonNull String agentJnlpUrl, @NonNull File agentJar, @NonNull String secret, int numberOfNodes, @NonNull List<String> commandLineArgs) implements Serializable {}

private static AgentArguments getAgentArguments(JenkinsRule r, String name) throws IOException {
Node node = r.jenkins.getNode(name);
Expand Down

0 comments on commit e9bab56

Please sign in to comment.