Search in sources :

Example 6 with AeshDelegatingShell

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

the class XSiteCliOperations method doWithTerminal.

private void doWithTerminal(Consumer<AeshTestConnection> consumer) {
    try (AeshTestConnection terminal = new AeshTestConnection()) {
        CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
        consumer.accept(terminal);
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Example 7 with AeshDelegatingShell

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

the class RollingUpgradeCliIT method disconnectSource.

protected void disconnectSource(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 disconnect --cache=" + CACHE_NAME);
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Example 8 with AeshDelegatingShell

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

the class RollingUpgradeDynamicStoreCliIT method assertSourceDisconnected.

@Override
protected void assertSourceDisconnected() {
    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 source-connection --cache=" + CACHE_NAME);
        terminal.assertContains("Not Found");
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Example 9 with AeshDelegatingShell

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

the class RollingUpgradeDynamicStoreCliIT method assertSourceConnected.

@Override
protected void assertSourceConnected() {
    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 source-connection --cache=" + CACHE_NAME);
        terminal.assertContains("remote-store");
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) AeshTestConnection(org.infinispan.server.test.core.AeshTestConnection)

Example 10 with AeshDelegatingShell

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

the class RollingUpgradeDynamicStoreCliIT method connectTargetCluster.

@Override
protected void connectTargetCluster() {
    try {
        String cfg = new String(Files.readAllBytes(dest), StandardCharsets.UTF_8);
        cfg = cfg.replace("127.0.0.1", source.driver.getServerAddress(0).getHostAddress());
        cfg = cfg.replace("11222", Integer.toString(source.getSinglePort(0)));
        Files.write(dest, cfg.getBytes(StandardCharsets.UTF_8), StandardOpenOption.TRUNCATE_EXISTING);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    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 connect --file=" + dest + " --cache=" + CACHE_NAME);
        terminal.clear();
        terminal.send("migrate cluster source-connection --cache=" + CACHE_NAME);
        terminal.assertContains("remote-store");
    }
}
Also used : AeshDelegatingShell(org.infinispan.cli.impl.AeshDelegatingShell) IOException(java.io.IOException) 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