Update to last version of gclc

Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
Emmanuel Bigeon 2017-08-19 16:35:06 -04:00
parent b5f1463864
commit 0feb069878
4 changed files with 36 additions and 15 deletions

View File

@ -81,7 +81,7 @@ of Emmanuel Bigeon. -->
<dependency> <dependency>
<groupId>fr.bigeon</groupId> <groupId>fr.bigeon</groupId>
<artifactId>gclc</artifactId> <artifactId>gclc</artifactId>
<version>1.3.6</version> <version>1.5.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>fr.bigeon</groupId> <groupId>fr.bigeon</groupId>

View File

@ -128,6 +128,21 @@ public class ConsoleRunnableTest {
public void interruptPrompt() { public void interruptPrompt() {
// //
} }
/* (non-Javadoc)
* @see fr.bigeon.gclc.manager.ConsoleManager#prompt(long) */
@Override
public String prompt(long timeout) throws IOException {
return prompt();
}
/* (non-Javadoc)
* @see fr.bigeon.gclc.manager.ConsoleManager#prompt(java.lang.String,
* long) */
@Override
public String prompt(String message, long timeout) throws IOException {
return prompt(message);
}
} }
/** Test method for /** Test method for

View File

@ -47,20 +47,22 @@ import fr.bigeon.gclc.manager.ConsoleManager;
/** A test-purpose application /** A test-purpose application
* *
* @author Emmanuel Bigeon */ * @author Emmanuel Bigeon */
public class ConsoleTestApplication extends ConsoleApplication { public class ConsoleTestApplication {
/** Exit command */ /** Exit command */
public static final String EXIT = "exit"; //$NON-NLS-1$ public static final String EXIT = "exit"; //$NON-NLS-1$
/** @param manager the manager */ /** @param manager the manager */
@SuppressWarnings("nls") @SuppressWarnings("nls")
public ConsoleTestApplication(final ConsoleManager manager) { public static ConsoleApplication create(final ConsoleManager manager) {
super(manager, "Welcome to the test application. Type help or test.",
"See you");
try { try {
add(new ExitCommand(EXIT, this)); ConsoleApplication application = new ConsoleApplication(manager,
add(new HelpExecutor("help", manager, this.getRoot())); "Welcome to the test application. Type help or test.",
add(new Command("test") { "See you");
application.add(new ExitCommand(EXIT, application));
application.add(
new HelpExecutor("help", manager, application.root));
application.add(new Command("test") {
@Override @Override
public String tip() { public String tip() {
@ -77,7 +79,7 @@ public class ConsoleTestApplication extends ConsoleApplication {
} }
} }
}); });
add(new Command("long") { application.add(new Command("long") {
@Override @Override
public String tip() { public String tip() {
@ -95,8 +97,10 @@ public class ConsoleTestApplication extends ConsoleApplication {
} }
} }
}); });
return application;
} catch (final InvalidCommandName e) { } catch (final InvalidCommandName e) {
e.printStackTrace(); e.printStackTrace();
} }
return null;
} }
} }

View File

@ -37,6 +37,8 @@ package fr.bigeon.gclc.socket;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import fr.bigeon.gclc.ConsoleApplication;
/** A test server /** A test server
* *
* @author Emmanuel Bigeon */ * @author Emmanuel Bigeon */
@ -68,8 +70,8 @@ public class TestServer {
if (SHELL == null) { if (SHELL == null) {
SHELL = new SocketConsoleApplicationShell(3300, "close", SHELL = new SocketConsoleApplicationShell(3300, "close",
ConsoleTestApplication.EXIT, Charset.forName("UTF-8")); ConsoleTestApplication.EXIT, Charset.forName("UTF-8"));
final ConsoleTestApplication app = new ConsoleTestApplication( final ConsoleApplication app = ConsoleTestApplication
SHELL.getConsoleManager()); .create(SHELL.getConsoleManager());
SHELL.setApplication(app); SHELL.setApplication(app);
} }
return SHELL; return SHELL;
@ -79,8 +81,8 @@ public class TestServer {
if (SHELL == null) { if (SHELL == null) {
SHELL = new SocketConsoleApplicationShell(3300, autoClose, SHELL = new SocketConsoleApplicationShell(3300, autoClose,
ConsoleTestApplication.EXIT, Charset.forName("UTF-8")); ConsoleTestApplication.EXIT, Charset.forName("UTF-8"));
final ConsoleTestApplication app = new ConsoleTestApplication( final ConsoleApplication app = ConsoleTestApplication
SHELL.getConsoleManager()); .create(SHELL.getConsoleManager());
SHELL.setApplication(app); SHELL.setApplication(app);
server = null; server = null;
} }
@ -91,8 +93,8 @@ public class TestServer {
if (SHELL == null) { if (SHELL == null) {
SHELL = new SocketConsoleApplicationShell(3300, closeConnection, SHELL = new SocketConsoleApplicationShell(3300, closeConnection,
ConsoleTestApplication.EXIT, Charset.forName("UTF-8")); ConsoleTestApplication.EXIT, Charset.forName("UTF-8"));
final ConsoleTestApplication app = new ConsoleTestApplication( final ConsoleApplication app = ConsoleTestApplication
SHELL.getConsoleManager()); .create(SHELL.getConsoleManager());
SHELL.setApplication(app); SHELL.setApplication(app);
server = null; server = null;
} }