use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class CliSpecialCharactersTestCase method testWhitespaceTrimmingBoot.
@Test
public void testWhitespaceTrimmingBoot() 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(" Hello World! ", " Hello World! ", Delimiters.DOUBLE_QUOTE, ctx, str);
testSetResourceValue(" Hello World! ", "Hello World!", Delimiters.CURLY_BRACE, ctx, str);
testSetResourceValue(" Hello\\ World! ", "Hello World!", Delimiters.NONE, ctx, str);
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class CliSpecialCharactersTestCase method testCommasInDoubleQuotesBoot.
@Test
public void testCommasInDoubleQuotesBoot() 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("Last,First", "Last,First", Delimiters.DOUBLE_QUOTE, ctx, str);
testSetResourceValue(",,,A,B,C,D,E,F,,,", ",,,A,B,C,D,E,F,,,", Delimiters.DOUBLE_QUOTE, ctx, str);
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BasicIfElseTestCase method testIfInsideIfBoot.
@Test
public void testIfInsideIfBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut);
boolean failed = false;
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle("if result.value==\"true\" of " + this.getReadPropertyReq());
ctx.handle("if result.value==\"true\" of " + this.getReadPropertyReq());
} catch (CommandFormatException ex) {
failed = true;
} finally {
try {
if (!failed) {
throw new Exception("if inside if should have failed");
}
} finally {
ctx.terminateSession();
cliOut.reset();
}
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BasicIfElseTestCase method testIfMatchComparisonBoot.
@Test
public void testIfMatchComparisonBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut, false);
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle(this.getAddPropertyReq("match-test-values", "\"AAA BBB\""));
assertEquals("true", runIfWithMatchComparison("match-test-values", "AAA", ctx));
assertEquals("true", runIfWithMatchComparison("match-test-values", "BBB", ctx));
assertEquals("false", runIfWithMatchComparison("match-test-values", "CCC", ctx));
} finally {
ctx.handleSafe(this.getRemovePropertyReq("match-test-values"));
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.
the class BasicIfElseTestCase method testMainBoot.
@Test
public void testMainBoot() throws Exception {
final CommandContext ctx = new CommandContextImpl(cliOut);
try {
ctx.bindClient(managementClient.getControllerClient());
ctx.handle(this.getAddPropertyReq("\"true\""));
assertEquals("false", runIf(ctx));
assertEquals("true", runIf(ctx));
assertEquals("false", runIf(ctx));
} finally {
ctx.handleSafe(this.getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
Aggregations