Search in sources :

Example 26 with CommandContextImpl

use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.

the class BatchFileTestCase method testRunBatchFileBoot.

@Test
public void testRunBatchFileBoot() throws Exception {
    createFile(new String[] { "/system-property=batchfiletest:add(value=true)", "", "# comments", "/system-property=batchfiletest:write-attribute(value=false)" });
    final CommandContext ctx = new CommandContextImpl(null);
    try {
        ctx.bindClient(managementClient.getControllerClient());
        doTestRunBatchFile(ctx);
    } finally {
        ctx.terminateSession();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) CommandContextImpl(org.jboss.as.cli.impl.CommandContextImpl) Test(org.junit.Test)

Example 27 with CommandContextImpl

use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.

the class BatchWithHeadersTestCase method testSuccessfulTryBoot.

@Test
public void testSuccessfulTryBoot() throws Exception {
    final CommandContext ctx = new CommandContextImpl(null);
    try {
        ctx.bindClient(managementClient.getControllerClient());
        doTest(ctx);
    } finally {
        ctx.terminateSession();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) CommandContextImpl(org.jboss.as.cli.impl.CommandContextImpl) Test(org.junit.Test)

Example 28 with CommandContextImpl

use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.

the class AppendTestCase method testAppendNonExistingFileBoot.

@Test
public void testAppendNonExistingFileBoot() throws Exception {
    CommandContext ctx = new CommandContextImpl(null);
    String fileName = "non-existing-file-boot";
    Path path = Paths.get(fileName);
    try {
        ctx.handle("echo foo >> " + fileName);
        Assert.assertTrue("The file" + fileName + "doesn't contain expected content.", checkFileContains(path, "foo"));
    } finally {
        ctx.terminateSession();
        Files.delete(path);
    }
}
Also used : Path(java.nio.file.Path) CommandContext(org.jboss.as.cli.CommandContext) CommandContextImpl(org.jboss.as.cli.impl.CommandContextImpl) Test(org.junit.Test)

Example 29 with CommandContextImpl

use of org.jboss.as.cli.impl.CommandContextImpl in project wildfly-core by wildfly.

the class BasicOpsTestCase method testImplicitValuesBoot.

@Test
public void testImplicitValuesBoot() throws Exception {
    CommandContext ctx = new CommandContextImpl(null);
    ctx.bindClient(managementClient.getControllerClient());
    doTestImplicitValues(ctx);
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) CommandContextImpl(org.jboss.as.cli.impl.CommandContextImpl) Test(org.junit.Test)

Aggregations

CommandContextImpl (org.jboss.as.cli.impl.CommandContextImpl)29 Test (org.junit.Test)29 CommandContext (org.jboss.as.cli.CommandContext)27 ByteArrayOutputStream (java.io.ByteArrayOutputStream)8 CommandLineException (org.jboss.as.cli.CommandLineException)4 CLICommandInvocation (org.wildfly.core.cli.command.aesh.CLICommandInvocation)2 Path (java.nio.file.Path)1 CommandFormatException (org.jboss.as.cli.CommandFormatException)1 AeshCommands (org.jboss.as.cli.impl.aesh.AeshCommands)1 LegacyCommandContainer (org.jboss.as.cli.impl.aesh.cmd.operation.LegacyCommandContainer)1