Skip to content

Commit d9faa38

Browse files
authored
Add ability to do not specify port while running in legacy mode (#326)
1 parent e3e516b commit d9faa38

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

src/main/java/com/saucelabs/ci/sauceconnect/AbstractSauceTunnelManager.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,35 @@ public Process openConnection(
515515
return openConnection(username, apiKey, dataCenter, apiPort, sauceConnectJar, options, printStream, verboseLogging, sauceConnectPath, false);
516516
}
517517

518+
@Override
519+
public Process openConnection(
520+
String username,
521+
String apiKey,
522+
DataCenter dataCenter,
523+
File sauceConnectJar,
524+
String options,
525+
PrintStream printStream,
526+
Boolean verboseLogging,
527+
String sauceConnectPath,
528+
boolean legacy) throws IOException {
529+
return openConnection(username, apiKey, dataCenter, findFreePort(), sauceConnectJar, options, printStream, verboseLogging, sauceConnectPath, legacy);
530+
}
531+
532+
@Override
533+
public Process openConnection(
534+
String username,
535+
String apiKey,
536+
DataCenter dataCenter,
537+
File sauceConnectJar,
538+
String options,
539+
Logger logger,
540+
PrintStream printStream,
541+
Boolean verboseLogging,
542+
String sauceConnectPath,
543+
boolean legacy) throws IOException {
544+
return openConnection(username, apiKey, dataCenter, findFreePort(), sauceConnectJar, options, logger, printStream, verboseLogging, sauceConnectPath, legacy);
545+
}
546+
518547
@Override
519548
public Process openConnection(
520549
String username,

src/main/java/com/saucelabs/ci/sauceconnect/SauceTunnelManager.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,68 @@ Process openConnection(
270270
String sauceConnectPath,
271271
boolean legacy)
272272
throws IOException;
273+
274+
/**
275+
* Creates a new process to run Sauce Connect.
276+
*
277+
* @param username the name of the Sauce OnDemand user
278+
* @param apiKey the API Key for the Sauce OnDemand user
279+
* @param dataCenter the Sauce Labs Data Center
280+
* @param sauceConnectJar the Jar file containing Sauce Connect. If null, then we attempt to find
281+
* Sauce Connect from the classpath (only used by SauceConnectTwoManager)
282+
* @param options the command line options to pass to Sauce Connect
283+
* @param printStream A print stream in which to redirect the output from Sauce Connect to. Can be
284+
* null
285+
* @param verboseLogging indicates whether verbose logging should be output
286+
* @param sauceConnectPath if defined, Sauce Connect will be launched from the specified path and
287+
* won't be extracted from the jar file
288+
* @param legacy command line options are using SC4 CLI
289+
* @return a {@link Process} instance which represents the Sauce Connect instance
290+
* @throws IOException thrown if an error occurs launching Sauce Connect
291+
*/
292+
@Deprecated
293+
Process openConnection(
294+
String username,
295+
String apiKey,
296+
DataCenter dataCenter,
297+
File sauceConnectJar,
298+
String options,
299+
PrintStream printStream,
300+
Boolean verboseLogging,
301+
String sauceConnectPath,
302+
boolean legacy)
303+
throws IOException;
304+
305+
/**
306+
* Creates a new process to run Sauce Connect.
307+
*
308+
* @param username the name of the Sauce OnDemand user
309+
* @param apiKey the API Key for the Sauce OnDemand user
310+
* @param dataCenter the Sauce Labs Data Center
311+
* @param sauceConnectJar the Jar file containing Sauce Connect. If null, then we attempt to find
312+
* Sauce Connect from the classpath (only used by SauceConnectTwoManager)
313+
* @param options the command line options to pass to Sauce Connect
314+
* @param logger used for logging
315+
* @param printStream A print stream in which to redirect the output from Sauce Connect to. Can be
316+
* null
317+
* @param verboseLogging indicates whether verbose logging should be output
318+
* @param sauceConnectPath if defined, Sauce Connect will be launched from the specified path and
319+
* won't be extracted from the jar file
320+
* @param legacy command line options are using SC4 CLI
321+
* @return a {@link Process} instance which represents the Sauce Connect instance
322+
* @throws IOException thrown if an error occurs launching Sauce Connect
323+
*/
324+
@Deprecated
325+
Process openConnection(
326+
String username,
327+
String apiKey,
328+
DataCenter dataCenter,
329+
File sauceConnectJar,
330+
String options,
331+
Logger logger,
332+
PrintStream printStream,
333+
Boolean verboseLogging,
334+
String sauceConnectPath,
335+
boolean legacy)
336+
throws IOException;
273337
}

0 commit comments

Comments
 (0)