use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class PatchHelpTestCase method testCLICommands.
@Test
public void testCLICommands() throws Exception {
CommandContextImpl ctx = (CommandContextImpl) CommandContextFactory.getInstance().newCommandContext();
AeshCommands commands = ctx.getAeshCommands();
CommandContainer<CLICommandInvocation> container = commands.getRegistry().getCommand("patch", "patch");
HelpSupport.checkCommand(null, container.getParser());
for (CommandLineParser<CLICommandInvocation> child : container.getParser().getAllChildParsers()) {
HelpSupport.checkCommand(container.getParser(), child);
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class NonExistingPathComparisonTestCase method testEqualsBoot.
@Test
public void testEqualsBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut);
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle(this.getAddPropertyReq("\"false\""));
assertEquals("false", runIf(ctx, "==", "&&", "\"false\""));
assertEquals("true", runIf(ctx, "==", "||", "\"false\""));
} finally {
ctx.handleSafe(this.getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class NonExistingPathComparisonTestCase method testNotLessThanBoot.
@Test
public void testNotLessThanBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut);
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle(this.getAddPropertyReq("\"5\""));
assertEquals("5", runIf(ctx, ">=", "&&", "\"5\""));
assertEquals("true", runIf(ctx, ">=", "||", "\"5\""));
} finally {
ctx.handleSafe(this.getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class NonExistingPathComparisonTestCase method testLessThanBoot.
@Test
public void testLessThanBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut);
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle(this.getAddPropertyReq("\"5\""));
assertEquals("5", runIf(ctx, "<", "&&", "\"7\""));
assertEquals("true", runIf(ctx, "<", "||", "\"7\""));
} finally {
ctx.handleSafe(this.getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BatchesInIfElseTestCase method testElseBatchBoot.
@Test
public void testElseBatchBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut);
CommandLineException expectedEx = null;
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle(getAddPropertyReq("1"));
ctx.handle("if result.value==\"3\" of " + getReadPropertyReq());
ctx.handle("else");
ctx.handle("batch");
ctx.handle(getWritePropertyReq("2"));
ctx.handle(getReadNonexistingPropReq());
ctx.handle("run-batch");
try {
ctx.handle("end-if");
} catch (CommandLineException e) {
expectedEx = e;
// for cleanup
throw e;
}
} catch (CommandLineException e) {
cliOut.reset();
ctx.handle(getReadPropertyReq());
assertEquals("1", getValue());
} finally {
ctx.handleSafe(getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
assertNotNull("expected exception", expectedEx);
}
Aggregations