use of org.jboss.as.cli.CommandLineException in project eap-additional-testsuite by jboss-set.
the class CdTestCase method testInvalidAddress.
@Test
public void testInvalidAddress() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext();
try {
ctx.connectController();
ctx.handle("cd subsystem=subsystem");
Assert.fail("Can't cd into a non-existing nodepath.");
} catch (CommandLineException e) {
// expected
} finally {
ctx.terminateSession();
}
}
use of org.jboss.as.cli.CommandLineException 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.CommandLineException in project eap-additional-testsuite by jboss-set.
the class TryCatchFinallyTestCase method testErrorInTryErroInCatchFinally.
@Test
public void testErrorInTryErroInCatchFinally() 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("finally");
ctx.handle(this.getAddPropertyReq("finally"));
ctx.handle("end-try");
fail("catch is expceted to throw an exception");
} catch (CommandLineException e) {
cliOut.reset();
ctx.handle(getReadPropertyReq());
assertEquals("finally", getValue());
} finally {
ctx.handleSafe(getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
use of org.jboss.as.cli.CommandLineException in project eap-additional-testsuite by jboss-set.
the class TryCatchFinallyTestCase method testErrorInFinally.
@Test
public void testErrorInFinally() throws Exception {
cliOut.reset();
final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
try {
ctx.connectController();
ctx.handle("try");
ctx.handle(this.getAddPropertyReq("try"));
ctx.handle("finally");
ctx.handle(this.getReadNonexistingPropReq());
ctx.handle("end-try");
fail("finally is expceted to throw an exception");
} catch (CommandLineException e) {
cliOut.reset();
ctx.handle(getReadPropertyReq());
assertEquals("try", getValue());
} finally {
ctx.handleSafe(getRemovePropertyReq());
ctx.terminateSession();
cliOut.reset();
}
}
Aggregations