use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class OracleListTest method setUp.
@Before
public void setUp() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
setUpGeogig(cli);
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class GeoJsonExportTest method setUpInternal.
@Override
public void setUpInternal() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
cli.setGeogig(geogig);
// Add points
insertAndAdd(points1);
insertAndAdd(points2);
insertAndAdd(points3);
geogig.command(CommitOp.class).call();
// Add lines
insertAndAdd(lines1);
insertAndAdd(lines2);
insertAndAdd(lines3);
geogig.command(CommitOp.class).call();
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class GeoJsonImportTest method setUp.
@Before
public void setUp() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
setUpGeogig(cli);
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class OracleDescribeTest method testDescribeException.
@Test
public void testDescribeException() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
GeogigCLI mockCli = spy(new GeogigCLI(consoleReader));
setUpGeogig(mockCli);
when(mockCli.getConsole()).thenThrow(new MockitoException("Exception"));
OracleDescribe describeCommand = new OracleDescribe();
describeCommand.table = "table1";
describeCommand.dataStoreFactory = TestHelper.createTestFactory();
exception.expect(MockitoException.class);
describeCommand.run(mockCli);
}
use of jline.console.ConsoleReader in project Payara by payara.
the class LocalOSGiShellCommand method executeCommand.
@Override
protected int executeCommand() throws CommandException, CommandValidationException {
ConsoleReader reader = null;
if (cmd == null) {
throw new CommandException("Remote command 'osgi' is not available.");
}
// restore echo flag, saved in validate
programOpts.setEcho(echo);
try {
if (encoding != null) {
// see Configuration.getEncoding()...
System.setProperty("input.encoding", encoding);
}
String[] args = new String[] { REMOTE_COMMAND, "asadmin-osgi-shell" };
args = enhanceForTarget(args);
shellType = cmd.executeAndReturnOutput(args).trim();
if (file == null) {
System.out.println(strings.get("multimodeIntro"));
reader = new ConsoleReader(REMOTE_COMMAND, new FileInputStream(FileDescriptor.in), System.out, null);
} else {
printPrompt = false;
if (!file.canRead()) {
throw new CommandException("File: " + file + " can not be read");
}
OutputStream out = new OutputStream() {
@Override
public void write(int b) throws IOException {
return;
}
@Override
public void write(byte[] b) throws IOException {
return;
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
return;
}
};
reader = new ConsoleReader(REMOTE_COMMAND, new FileInputStream(file), out, null);
}
reader.setBellEnabled(false);
reader.addCompleter(getCommandCompleter());
return executeCommands(reader);
} catch (IOException e) {
throw new CommandException(e);
}
}
Aggregations