Search in sources :

Example 6 with CommandContext

use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.

the class NonExistingPathComparisonTestCase method testNotEqual.

@Test
public void testNotEqual() throws Exception {
    final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
    try {
        ctx.connectController();
        ctx.handle(this.getAddPropertyReq("\"false\""));
        assertEquals("false", runIf(ctx, "!=", "&&", "\"true\""));
        assertEquals("true", runIf(ctx, "!=", "||", "\"true\""));
    } finally {
        ctx.handleSafe(this.getRemovePropertyReq());
        ctx.terminateSession();
        cliOut.reset();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) Test(org.junit.Test)

Example 7 with CommandContext

use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.

the class NonExistingPathComparisonTestCase method testNotGreaterThan.

@Test
public void testNotGreaterThan() 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();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) Test(org.junit.Test)

Example 8 with CommandContext

use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.

the class TryCatchFinallyTestCase method testTryFinally.

@Test
public void testTryFinally() 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.getWritePropertyReq("finally"));
        ctx.handle("end-try");
        cliOut.reset();
        ctx.handle(getReadPropertyReq());
        assertEquals("finally", getValue());
    } finally {
        ctx.handleSafe(getRemovePropertyReq());
        ctx.terminateSession();
        cliOut.reset();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) Test(org.junit.Test)

Example 9 with CommandContext

use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.

the class TryCatchFinallyTestCase method testSuccessfulTry.

@Test
public void testSuccessfulTry() throws Exception {
    cliOut.reset();
    final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
    try {
        ctx.connectController();
        ctx.handle("try");
        ctx.handle(getAddPropertyReq("try"));
        ctx.handle("catch");
        ctx.handle(getRemovePropertyReq());
        ctx.handle("end-try");
        cliOut.reset();
        ctx.handle(getReadPropertyReq());
        assertEquals("try", getValue());
    } finally {
        ctx.handleSafe(getRemovePropertyReq());
        ctx.terminateSession();
        cliOut.reset();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) Test(org.junit.Test)

Example 10 with CommandContext

use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.

the class BasicIfElseTestCase method testMain.

@Test
public void testMain() throws Exception {
    final CommandContext ctx = CLITestUtil.getCommandContext(cliOut);
    try {
        ctx.connectController();
        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();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) Test(org.junit.Test)

Aggregations

CommandContext (org.jboss.as.cli.CommandContext)37 Test (org.junit.Test)33 ModelNode (org.jboss.dmr.ModelNode)7 CommandLineException (org.jboss.as.cli.CommandLineException)4 Batch (org.jboss.as.cli.batch.Batch)3 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)3 InSequence (org.jboss.arquillian.junit.InSequence)2 Property (org.jboss.dmr.Property)2 Ignore (org.junit.Ignore)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 CliEvent (org.jboss.as.cli.CliEvent)1 CliEventListener (org.jboss.as.cli.CliEventListener)1