@Override public void start() throws Exception { ShellServer server = ShellServer.create(vertx); AtomicInteger ai = new AtomicInteger(0); server.shellHandler(shell -> {
/** * Create a new shell server with default options. * @param vertx the vertx * @param options the options * @return the created shell server */ public static io.vertx.rxjava.ext.shell.ShellServer create(io.vertx.rxjava.core.Vertx vertx, ShellServerOptions options) { io.vertx.rxjava.ext.shell.ShellServer ret = io.vertx.rxjava.ext.shell.ShellServer.newInstance(io.vertx.ext.shell.ShellServer.create(vertx.getDelegate(), options)); return ret; }
/** * Create a new shell server with specific options. * @param vertx the vertx * @return the created shell server */ public static io.vertx.rxjava.ext.shell.ShellServer create(io.vertx.rxjava.core.Vertx vertx) { io.vertx.rxjava.ext.shell.ShellServer ret = io.vertx.rxjava.ext.shell.ShellServer.newInstance(io.vertx.ext.shell.ShellServer.create(vertx.getDelegate())); return ret; }
/** * Create a new shell server with specific options. * @param vertx the vertx * @return the created shell server */ public static io.vertx.rxjava.ext.shell.ShellServer create(io.vertx.rxjava.core.Vertx vertx) { io.vertx.rxjava.ext.shell.ShellServer ret = io.vertx.rxjava.ext.shell.ShellServer.newInstance(io.vertx.ext.shell.ShellServer.create(vertx.getDelegate())); return ret; }
public ShellServiceImpl(Vertx vertx, ShellServiceOptions options) { this.vertx = vertx; this.options = options; this.server = ShellServer.create(vertx, new ShellServerOptions(options)); this.registry = CommandRegistry.getShared(vertx); }
/** * Create a new shell server with default options. * @param vertx the vertx * @param options the options * @return the created shell server */ public static io.vertx.rxjava.ext.shell.ShellServer create(io.vertx.rxjava.core.Vertx vertx, ShellServerOptions options) { io.vertx.rxjava.ext.shell.ShellServer ret = io.vertx.rxjava.ext.shell.ShellServer.newInstance(io.vertx.ext.shell.ShellServer.create(vertx.getDelegate(), options)); return ret; }
public static io.vertx.ext.shell.ShellServer create(io.vertx.ext.shell.ShellServer j_receiver, io.vertx.core.Vertx vertx, java.util.Map<String, Object> options) { return io.vertx.core.impl.ConversionHelper.fromObject(io.vertx.ext.shell.ShellServer.create(vertx, options != null ? new io.vertx.ext.shell.ShellServerOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null)); } }
@Before public void before() { vertx = Vertx.vertx(); commands = new TestCommands(vertx); server = ShellServer.create(vertx).registerCommandResolver(commands); }
@Before public void before(TestContext context) throws Exception { ctx = new AtomicReference<>(null); vertx = Vertx.vertx(); server = ShellServer.create(vertx) .registerCommandResolver(new BaseCommandPack(vertx)).listen(context.asyncAssertSuccess()); }
@Before public void before(TestContext context) throws Exception { vertx = Vertx.vertx(); server = ShellServer.create(vertx).registerCommandResolver(new BaseCommandPack(vertx)).listen(context.asyncAssertSuccess()); }
@Before public void before(TestContext context) { vertx = Vertx.vertx(); server = ShellServer.create(vertx); commands = new TestCommands(vertx); server. registerCommandResolver(CommandResolver.baseCommands(vertx)). registerCommandResolver(commands). listen(context.asyncAssertSuccess()); }
private void startShellServer(TestContext context, long sessionTimeout, long reaperInterval) { if (shellServer != null) { throw new IllegalStateException("Already started"); } Async latch = context.async(); shellServer = ShellServer.create(vertx, new ShellServerOptions().setSessionTimeout(sessionTimeout).setReaperInterval(reaperInterval)). registerTermServer(termServer). registerCommandResolver(registry). listen(context.asyncAssertSuccess(v -> latch.complete())); latch.awaitSuccess(20000); }
@Test public void testPrompt(TestContext context) { commands = new TestCommands(vertx); ShellServer server = ShellServer.create(vertx, new ShellServerOptions() .setWelcomeMessage("") .setSessionTimeout(100) .setReaperInterval(100)); server.shellHandler(shell -> shell.setPrompt(s -> "FOOPROMPT")); TestTermServer termServer = new TestTermServer(vertx); server.registerTermServer(termServer); server. registerCommandResolver(CommandResolver.baseCommands(vertx)). registerCommandResolver(commands). listen(context.asyncAssertSuccess()); TestTtyConnection conn = termServer.openConnection(); Async async = context.async(); commands.add(CommandBuilder.command("foo").processHandler(process -> { context.assertEquals(null, conn.checkWritten("FOOPROMPTfoo\n")); process.stdinHandler(cp -> { context.fail(); }); process.endHandler(v -> { async.complete(); } ); process.end(); })); conn.read("foo\r"); async.awaitSuccess(5000); }