Search in sources :

Example 26 with CommandRunner

use of org.glassfish.api.admin.CommandRunner in project Payara by payara.

the class CommandRunnerTest method tryOut.

@Test
public void tryOut() {
    Assert.assertTrue(commandRunner != null);
    try {
        ActionReport report = commandRunner.getActionReport("plain");
        CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation("list-contracts", report, kernelIdentity.getSubject());
        inv.execute();
        System.out.println(report.getTopMessagePart().getMessage());
        for (ActionReport.MessagePart child : report.getTopMessagePart().getChildren()) {
            System.out.println(child.getMessage());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ActionReport(org.glassfish.api.ActionReport) CommandRunner(org.glassfish.api.admin.CommandRunner) Test(org.junit.Test)

Aggregations

CommandRunner (org.glassfish.api.admin.CommandRunner)26 ParameterMap (org.glassfish.api.admin.ParameterMap)14 ActionReport (org.glassfish.api.ActionReport)12 ArrayList (java.util.ArrayList)8 Properties (java.util.Properties)5 RestActionReporter (org.glassfish.admin.rest.utils.xml.RestActionReporter)4 IOException (java.io.IOException)3 RemoteRestAdminCommand (com.sun.enterprise.admin.remote.RemoteRestAdminCommand)2 Server (com.sun.enterprise.config.serverbeans.Server)2 File (java.io.File)2 AdminCommand (org.glassfish.api.admin.AdminCommand)2 CommandException (org.glassfish.api.admin.CommandException)2 CommandModel (org.glassfish.api.admin.CommandModel)2 CommandInvocation (org.glassfish.api.admin.CommandRunner.CommandInvocation)2 InternalSystemAdministrator (org.glassfish.internal.api.InternalSystemAdministrator)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 ServerRemoteRestAdminCommand (com.sun.enterprise.admin.remote.ServerRemoteRestAdminCommand)1 DoNothingActionReporter (com.sun.enterprise.admin.report.DoNothingActionReporter)1 PlainTextActionReporter (com.sun.enterprise.admin.report.PlainTextActionReporter)1 Application (com.sun.enterprise.config.serverbeans.Application)1