Search in sources :

Example 11 with AeshTestConnection

use of org.infinispan.server.test.core.AeshTestConnection 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 12 with AeshTestConnection

use of org.infinispan.server.test.core.AeshTestConnection 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 13 with AeshTestConnection

use of org.infinispan.server.test.core.AeshTestConnection 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 14 with AeshTestConnection

use of org.infinispan.server.test.core.AeshTestConnection 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 15 with AeshTestConnection

use of org.infinispan.server.test.core.AeshTestConnection 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

AeshTestConnection (org.infinispan.server.test.core.AeshTestConnection)23 AeshDelegatingShell (org.infinispan.cli.impl.AeshDelegatingShell)19 Test (org.junit.Test)14 File (java.io.File)3 Path (java.nio.file.Path)3 Properties (java.util.Properties)3 ZipFile (java.util.zip.ZipFile)2 IOException (java.io.IOException)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 Config (org.aesh.terminal.utils.Config)1 CLI (org.infinispan.cli.commands.CLI)1 CommonsTestingUtil (org.infinispan.commons.test.CommonsTestingUtil)1 Util (org.infinispan.commons.util.Util)1 BackupConfiguration (org.infinispan.configuration.cache.BackupConfiguration)1 CacheMode (org.infinispan.configuration.cache.CacheMode)1