use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class NonExistingPathComparisonTestCase method testNotLessThan.
@Test
public void testNotLessThan() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
try {
ctx.connectController();
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.CommandContext in project eap-additional-testsuite by jboss-set.
the class SilentModeTestCase method testMain.
@Test
public void testMain() throws Exception {
cliOut.reset();
final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
try {
ctx.handle("help");
assertFalse(cliOut.toString().isEmpty());
cliOut.reset();
ctx.setSilent(true);
ctx.handle("help");
assertTrue(cliOut.toString().isEmpty());
cliOut.reset();
ctx.setSilent(false);
ctx.handle("help");
assertFalse(cliOut.toString().isEmpty());
} finally {
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class TryCatchFinallyTestCase method testErrorInTryCatchFinally.
@Test
public void testErrorInTryCatchFinally() throws Exception {
cliOut.reset();
final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
try {
ctx.connectController();
ctx.handle("try");
ctx.handle(this.getReadNonexistingPropReq());
ctx.handle("catch");
ctx.handle(this.getAddPropertyReq("catch"));
ctx.handle("finally");
ctx.handle(this.getWritePropertyReq("finally"));
ctx.handle("end-try");
cliOut.reset();
ctx.handle(getReadPropertyReq());
assertEquals("finally", getValue());
} finally {
ctx.handleSafe(getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class TryCatchFinallyTestCase method testErrorInCatch.
@Test
public void testErrorInCatch() throws Exception {
cliOut.reset();
final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
try {
ctx.connectController();
ctx.handle("try");
ctx.handle(this.getReadNonexistingPropReq());
ctx.handle("catch");
ctx.handle(this.getReadNonexistingPropReq());
ctx.handle("end-try");
fail("catch is expected to throw an exception");
} catch (CommandLineException e) {
// expected
} finally {
ctx.handleSafe(getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class TryCatchFinallyTestCase method testCatch.
@Test
public void testCatch() throws Exception {
cliOut.reset();
final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
try {
ctx.connectController();
ctx.handle("try");
ctx.handle(this.getReadNonexistingPropReq());
ctx.handle("catch");
ctx.handle(getAddPropertyReq("catch"));
ctx.handle("end-try");
cliOut.reset();
ctx.handle(getReadPropertyReq());
assertEquals("catch", getValue());
} finally {
ctx.handleSafe(getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
Aggregations