Search in sources :

Example 11 with AeshDelegatingShell

use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.

the class RollingUpgradeDynamicStoreCliIT method doRollingUpgrade.

@Override
protected void doRollingUpgrade(RestClient client) {
    try (AeshTestConnection terminal = new AeshTestConnection()) {
        CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
        connectToCluster(terminal, target);
        terminal.assertContains("//containers/default]>");
        terminal.clear();
        terminal.send("migrate cluster synchronize --cache=" + CACHE_NAME);
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Example 12 with AeshDelegatingShell

use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.

the class ManagedConnectionOperations method testDataSourceCLI.

@Test
public void testDataSourceCLI() {
    try (AeshTestConnection terminal = new AeshTestConnection()) {
        CLI.main(new AeshDelegatingShell(terminal), new String[] {}, new Properties());
        terminal.send("connect " + SERVERS.getTestServer().getDriver().getServerAddress(0).getHostAddress() + ":11222");
        terminal.assertContains("//containers/default]>");
        terminal.clear();
        terminal.send("server datasource ls");
        terminal.assertContains(database.getType());
        terminal.clear();
        terminal.send("server datasource test " + database.getType());
        terminal.assertContains("ISPN012502: Connection to data source '" + database.getType() + "' successful");
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection) Properties(java.util.Properties) Test(org.junit.Test)

Example 13 with AeshDelegatingShell

use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.

the class CLI method interactive.

private CommandResult interactive(Shell shell) {
    // We now start an interactive CLI
    CommandRegistry commandRegistry = initializeCommands();
    context.setRegistry(commandRegistry);
    CliAliasManager aliasManager;
    try {
        aliasManager = new CliAliasManager(context.getConfigPath().resolve("aliases").toFile(), true, commandRegistry);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    SettingsBuilder settings = SettingsBuilder.builder();
    settings.enableAlias(true).aliasManager(aliasManager).historyFile(context.getConfigPath().resolve("history").toFile()).outputStream(System.out).outputStreamError(System.err).inputStream(System.in).commandActivatorProvider(new ContextAwareCommandActivatorProvider(context)).commandInvocationProvider(new ContextAwareCommandInvocationProvider(context)).commandNotFoundHandler(new CliCommandNotFoundHandler()).completerInvocationProvider(new ContextAwareCompleterInvocationProvider(context)).commandRegistry(commandRegistry).aeshContext(context).quitHandler(new ContextAwareQuitHandler(context));
    if (shell instanceof AeshDelegatingShell) {
        settings.connection(((AeshDelegatingShell) shell).getConnection());
    }
    ReadlineConsole console = new ReadlineConsole(settings.build());
    context.setConsole(console);
    try {
        console.start();
        return CommandResult.SUCCESS;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : SettingsBuilder(org.aesh.command.settings.SettingsBuilder) CommandRegistry(org.aesh.command.registry.CommandRegistry) CliAliasManager(org.infinispan.cli.impl.CliAliasManager) AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) ReadlineConsole(org.aesh.readline.ReadlineConsole) ContextAwareQuitHandler(org.infinispan.cli.impl.ContextAwareQuitHandler) IOException(java.io.IOException) CliCommandNotFoundHandler(org.infinispan.cli.impl.CliCommandNotFoundHandler) ContextAwareCompleterInvocationProvider(org.infinispan.cli.completers.ContextAwareCompleterInvocationProvider) ContextAwareCommandActivatorProvider(org.infinispan.cli.activators.ContextAwareCommandActivatorProvider) ContextAwareCommandInvocationProvider(org.infinispan.cli.impl.ContextAwareCommandInvocationProvider)

Example 14 with AeshDelegatingShell

use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.

the class RollingUpgradeCliIT method doRollingUpgrade.

protected void doRollingUpgrade(RestClient client) {
    try (AeshTestConnection terminal = new AeshTestConnection()) {
        CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
        terminal.send("connect " + target.driver.getServerAddress(0).getHostAddress() + ":" + target.getSinglePort(0));
        terminal.assertContains("//containers/default]>");
        terminal.clear();
        terminal.send("migrate cluster synchronize --cache=" + CACHE_NAME);
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Example 15 with AeshDelegatingShell

use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.

the class RollingUpgradeDynamicStoreCliIT method disconnectSource.

@Override
protected void disconnectSource(RestClient client) {
    try (AeshTestConnection terminal = new AeshTestConnection()) {
        CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
        connectToCluster(terminal, target);
        terminal.assertContains("//containers/default]>");
        terminal.clear();
        terminal.send("migrate cluster disconnect --cache=" + CACHE_NAME);
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Aggregations

AeshDelegatingShell (org.infinispan.cli.impl.AeshDelegatingShell)19 AeshTestConnection (org.infinispan.server.test.core.AeshTestConnection)18 Test (org.junit.Test)9 IOException (java.io.IOException)2 Properties (java.util.Properties)2 File (java.io.File)1 CommandRegistry (org.aesh.command.registry.CommandRegistry)1 SettingsBuilder (org.aesh.command.settings.SettingsBuilder)1 ReadlineConsole (org.aesh.readline.ReadlineConsole)1 ContextAwareCommandActivatorProvider (org.infinispan.cli.activators.ContextAwareCommandActivatorProvider)1 ContextAwareCompleterInvocationProvider (org.infinispan.cli.completers.ContextAwareCompleterInvocationProvider)1 CliAliasManager (org.infinispan.cli.impl.CliAliasManager)1 CliCommandNotFoundHandler (org.infinispan.cli.impl.CliCommandNotFoundHandler)1 ContextAwareCommandInvocationProvider (org.infinispan.cli.impl.ContextAwareCommandInvocationProvider)1 ContextAwareQuitHandler (org.infinispan.cli.impl.ContextAwareQuitHandler)1