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>
<groupId>fr.bigeon</groupId>
<artifactId>gclc</artifactId>
<version>1.3.6</version>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>fr.bigeon</groupId>

View File

@ -128,6 +128,21 @@ public class ConsoleRunnableTest {
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

View File

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

View File

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