use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.
the class CliBackupManagerIT method cli.
private AeshTestConnection cli(Cluster cluster) {
AeshTestConnection t = new AeshTestConnection();
CLI.main(new AeshDelegatingShell(t), new String[] {}, new Properties());
String host = cluster.driver.getServerAddress(0).getHostAddress();
int port = cluster.driver.getServerSocket(0, 11222).getPort();
t.send(String.format("connect %s:%d", host, port));
t.assertContains("//containers/default]>");
t.clear();
return t;
}
use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.
the class CliIT method testCliAuthorization.
@Test
public void testCliAuthorization() {
try (AeshTestConnection terminal = new AeshTestConnection()) {
CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
connect(terminal);
terminal.send("user roles ls");
terminal.assertContains("\"admin\"");
terminal.send("user roles create --permissions=ALL_WRITE wizard");
terminal.send("user roles create --permissions=ALL_READ cleric");
terminal.clear();
terminal.send("user roles ls");
terminal.assertContains("\"wizard\"");
terminal.assertContains("\"cleric\"");
terminal.send("user roles grant --roles=wizard,cleric,admin admin");
terminal.clear();
terminal.send("user roles ls admin");
terminal.assertContains("\"wizard\"");
terminal.assertContains("\"cleric\"");
terminal.send("user roles deny --roles=cleric admin");
terminal.clear();
terminal.send("user roles ls admin");
terminal.assertContains("\"wizard\"");
terminal.assertNotContains("\"cleric\"");
terminal.send("user roles remove wizard");
terminal.clear();
terminal.send("user roles ls");
terminal.assertContains("\"cleric\"");
terminal.assertNotContains("\"wizard\"");
}
}
use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.
the class CliIT method testCliCacheAvailability.
@Test
public void testCliCacheAvailability() {
try (AeshTestConnection terminal = new AeshTestConnection()) {
CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
connect(terminal);
terminal.send("availability " + CLUSTERED_LOCK_CACHE_NAME);
terminal.assertContains("AVAILABLE");
terminal.send("availability --mode=DEGRADED_MODE " + CLUSTERED_LOCK_CACHE_NAME);
terminal.send("availability " + CLUSTERED_LOCK_CACHE_NAME);
terminal.assertContains("DEGRADED_MODE");
terminal.send("availability --mode=AVAILABILITY " + CLUSTERED_LOCK_CACHE_NAME);
terminal.send("availability " + CLUSTERED_LOCK_CACHE_NAME);
terminal.assertContains("AVAILABLE");
}
}
use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.
the class CliIT method testCliTasks.
@Test
public void testCliTasks() {
try (AeshTestConnection terminal = new AeshTestConnection()) {
CLI.main(new AeshDelegatingShell(terminal), new String[] { "-c", connectionUrl() }, properties);
connect(terminal);
terminal.send("cd tasks");
terminal.send("ls");
terminal.assertContains("@@cache@names");
terminal.clear();
terminal.send("task exec @@cache@names");
terminal.assertContains("\"___script_cache\"");
terminal.clear();
File resource = getCliResource("hello.js");
terminal.send("task upload --file=" + resource.getPath() + " hello");
terminal.send("task exec hello -Pgreetee=world");
terminal.assertContains("\"Hello world\"");
}
}
use of org.infinispan.cli.impl.AeshDelegatingShell in project infinispan by infinispan.
the class CliIT method testCliUploadProtobufSchemas.
@Test
public void testCliUploadProtobufSchemas() {
try (AeshTestConnection terminal = new AeshTestConnection()) {
CLI.main(new AeshDelegatingShell(terminal), new String[] {}, properties);
// connect
connect(terminal);
// upload
terminal.send("schema upload --file=" + getCliResource("person.proto").getPath() + " person.proto");
terminal.assertContains("\"error\" : null");
terminal.clear();
terminal.send("cd /containers/default/schemas");
terminal.send("ls");
terminal.assertContains("person.proto");
terminal.clear();
terminal.send("schema ls");
terminal.assertContains("person.proto");
terminal.send("schema get person.proto");
terminal.assertContains("PhoneNumber");
terminal.send("schema remove person.proto");
terminal.clear();
terminal.send("schema ls");
terminal.assertContains("[]");
}
}
Aggregations