use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BatchesInIfElseTestCase method testIfBatchBoot.
@Test
public void testIfBatchBoot() 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==\"1\" of " + getReadPropertyReq());
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);
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class NonExistingPathComparisonTestCase method testNotGreaterThanBoot.
@Test
public void testNotGreaterThanBoot() 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 CliSpecialCharactersTestCase method testParenthesisBoot.
@Test
public void testParenthesisBoot() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
CommandContext ctx = new CommandContextImpl(out);
ctx.bindClient(managementClient.getControllerClient());
Supplier<String> str = () -> {
String s = out.toString();
out.reset();
return s;
};
testSetResourceValue("one(1)", "one(1)", Delimiters.DOUBLE_QUOTE, ctx, str);
testSetResourceValue("one(1)", "one(1)", Delimiters.CURLY_BRACE, ctx, str);
testSetResourceValue("one\\(1\\)", "one(1)", Delimiters.NONE, ctx, str);
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BatchFileTestCase method testBatchFileBoot.
@Test
public void testBatchFileBoot() throws Exception {
createFile(new String[] { "/system-property=batchfiletest:add(value=true)" });
final CommandContext ctx = new CommandContextImpl(null);
try {
ctx.bindClient(managementClient.getControllerClient());
doTestBatchFile(ctx);
} finally {
ctx.terminateSession();
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BatchTestCase method testRunBatchBoot.
@Test
public void testRunBatchBoot() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
CommandContext ctx = new CommandContextImpl(out);
ctx.bindClient(managementClient.getControllerClient());
try {
doRunBatch(ctx);
} finally {
ctx.terminateSession();
}
}
Aggregations