Skip to content

Commit

Permalink
Merge pull request #2762 from bmaxwell/WFCORE-3239-master
Browse files Browse the repository at this point in the history
[WFCORE-3239] CLIWrapper does not allow for use in multinode tests
  • Loading branch information
bstansberry committed Sep 6, 2017
2 parents e7bb3d8 + 6447c28 commit f908f44
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ public CLIWrapper(boolean connect) throws Exception {
this(connect, null);
}

/**
* Creates new CLI wrapper using the host, port from the managementClient. If the connect parameter is set to true the CLI will connect to the server using
* <code>connect</code> command.
*
* @param connect indicates if the CLI should connect to server automatically.
* @throws Exception
*/
public CLIWrapper(String mgmtAddress, int mgmtPort, boolean connect) throws Exception {
this(connect, mgmtAddress, mgmtPort, null, -1);
}

/**
* Creates new CLI wrapper. If the connect parameter is set to true the CLI will connect to the server using
* <code>connect</code> command.
Expand Down Expand Up @@ -121,6 +132,34 @@ public CLIWrapper(boolean connect, String cliAddress, InputStream consoleInput,
Assert.assertTrue(sendConnect(cliAddress));
}

/**
* Creates new CLI wrapper. If the connect parameter is set to true the CLI will connect to the server using
* <code>connect</code> command.
*
* @param connect indicates if the CLI should connect to server automatically.
* @param cliAddress The cli address, if null the value of the {@code node0} property is used, and if that is absent {@code localhost} is used
* @param serverPort The cli port, if null the value of the {@code node0} property is used, and if that is absent {@code 9990} is used
* @param consoleInput input stream to use for sending to the CLI, or {@code null} if the standard input stream should be used
* @param connectionTimeout timeout of the CLI connection (in milliseconds)
*/
public CLIWrapper(boolean connect, String cliAddress, Integer serverPort, InputStream consoleInput, int connectionTimeout) throws CliInitializationException {

if(cliAddress == null)
cliAddress = TestSuiteEnvironment.getServerAddress();
if(serverPort == null)
serverPort = TestSuiteEnvironment.getServerPort();
consoleOut = new ByteArrayOutputStream();
System.setProperty("aesh.terminal","org.jboss.aesh.terminal.TestTerminal");
ctx = CLITestUtil.getCommandContext(
cliAddress, serverPort,
consoleInput, consoleOut, connectionTimeout);

if (!connect) {
return;
}
Assert.assertTrue(sendConnect());
}

public CommandContext getCommandContext() {
return ctx;
}
Expand Down

0 comments on commit f908f44

Please sign in to comment.