use of com.iwave.ext.command.CommandOutput in project coprhd-controller by CoprHD.
the class ListIQNsCommandTest method setup.
@BeforeClass
public static synchronized void setup() {
CommandOutput commandOutput = new CommandOutput(output, null, 0);
iqnCommand = createMockBuilder(ListIQNsCommand.class).withConstructor().addMockedMethod("getOutput").createMock();
EasyMock.expect(iqnCommand.getOutput()).andReturn(commandOutput).anyTimes();
EasyMock.replay(iqnCommand);
}
use of com.iwave.ext.command.CommandOutput in project coprhd-controller by CoprHD.
the class ListMountpointsCommandTest method setup.
@BeforeClass
public static synchronized void setup() {
CommandOutput commandOutput = new CommandOutput(OUTPUT, null, 0);
command = createMockBuilder(ListMountPointsCommand.class).withConstructor().addMockedMethod("getOutput").createMock();
EasyMock.expect(command.getOutput()).andReturn(commandOutput).anyTimes();
EasyMock.replay(command);
}
use of com.iwave.ext.command.CommandOutput in project coprhd-controller by CoprHD.
the class WindowsSystemWinRM method executeCommand.
public CommandOutput executeCommand(String commandLine) throws WinRMException {
WinRS winrs = new WinRS(target);
debug("Running: %s", commandLine);
CommandOutput output = winrs.executeCommandLine(commandLine);
if (output.getExitValue() != 0) {
debug("Exit Value: %d", output.getExitValue());
}
if (StringUtils.isNotBlank(output.getStdout())) {
debug("STDOUT: \n%s", output.getStdout());
}
if (StringUtils.isNotBlank(output.getStderr())) {
debug("STDERR: \n%s", output.getStderr());
}
return output;
}
use of com.iwave.ext.command.CommandOutput in project coprhd-controller by CoprHD.
the class WindowsSystemWinRM method diskPart.
public String diskPart(List<String> commands) throws WinRMException {
StrBuilder sb = new StrBuilder();
sb.append("(");
for (int i = 0; i < commands.size(); i++) {
sb.appendSeparator(" && ", i);
sb.append("echo ").append(commands.get(i));
}
sb.append(" && echo EXIT) | (CHCP 437 & DISKPART)");
CommandOutput output = executeCommand(sb.toString());
String error = WindowsUtils.getDiskPartError(output);
if (StringUtils.isNotBlank(error)) {
error("DiskPart Error: %s", error);
throw new WinRMException(String.format("DiskPart Error: %s", error));
}
return output.getStdout();
}
use of com.iwave.ext.command.CommandOutput in project coprhd-controller by CoprHD.
the class WinRS method execute.
public CommandOutput execute(String command, String... arguments) throws WinRMException {
String shellId = createShell();
try {
String commandId = submitCommand(shellId, command, arguments);
CommandOutput output = receiveOutput(shellId, commandId);
if (LOG.isDebugEnabled()) {
LOG.debug("EXIT CODE: " + output.getExitValue());
LOG.debug("STDOUT: " + output.getStdout());
LOG.debug("STDERR: " + output.getStderr());
}
return output;
} finally {
deleteShell(shellId);
}
}
Aggregations