Search in sources :

Example 6 with PropsFileActionReporter

use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.

the class DeleteJndiResourceTest method setUp.

@Before
public void setUp() {
    habitat = getHabitat();
    resources = habitat.<Domain>getService(Domain.class).getResources();
    parameters = new ParameterMap();
    cr = habitat.getService(CommandRunner.class);
    context = new AdminCommandContextImpl(LogDomains.getLogger(DeleteJndiResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) ParameterMap(org.glassfish.api.admin.ParameterMap) PropsFileActionReporter(com.sun.enterprise.admin.report.PropsFileActionReporter) CommandRunner(org.glassfish.api.admin.CommandRunner) Before(org.junit.Before)

Example 7 with PropsFileActionReporter

use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.

the class GetCommand method preAuthorizationForNonMonitoring.

private boolean preAuthorizationForNonMonitoring(final AdminCommandContext context) {
    report = context.getActionReport();
    /* Issue 5918 Used in ManifestManager to keep output sorted */
    try {
        PropsFileActionReporter reporter = (PropsFileActionReporter) report;
        reporter.useMainChildrenAttribute(true);
    } catch (ClassCastException e) {
    // ignore this is not a manifest output.
    }
    matchingNodesSorted = findSortedMatchingNodes();
    return matchingNodesSorted != null;
}
Also used : PropsFileActionReporter(com.sun.enterprise.admin.report.PropsFileActionReporter)

Example 8 with PropsFileActionReporter

use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.

the class ListJdbcResourcesTest method testExecuteSuccessListOriginal.

/**
 * Test of execute method, of class ListJdbcResources.
 * list-jdbc-resources
 */
@Test
public void testExecuteSuccessListOriginal() {
    // List the original set of JDBC Resources
    // Get an instance of the ListJdbcResources command
    ListJdbcResources listCommand = habitat.getService(ListJdbcResources.class);
    AdminCommandContext context = new AdminCommandContextImpl(LogDomains.getLogger(ListJdbcResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    // Call CommandRunnerImpl.doCommand(..) to execute the command
    cr.getCommandInvocation("list-jdbc-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
    List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
    assertEquals(origNum, list.size());
    // Check the exit code is SUCCESS
    assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) MessagePart(org.glassfish.api.ActionReport.MessagePart) PropsFileActionReporter(com.sun.enterprise.admin.report.PropsFileActionReporter) AdminCommandContext(org.glassfish.api.admin.AdminCommandContext) Test(org.junit.Test) ConfigApiTest(org.glassfish.tests.utils.ConfigApiTest)

Example 9 with PropsFileActionReporter

use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.

the class ListJdbcResourcesTest method testExecuteSuccessValidTargetOperand.

/**
 * Test of execute method, of class ListJdbcResource.
 * list-jdbc-resources server
 */
@Test
public void testExecuteSuccessValidTargetOperand() {
    // List the original set of JDBC Resources
    // Get an instance of the ListJdbcResources command
    listCommand = habitat.getService(ListJdbcResources.class);
    parameters.add("DEFAULT", "server");
    context = new AdminCommandContextImpl(LogDomains.getLogger(ListJdbcResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    // Call CommandRunnerImpl.doCommand(..) to execute the command
    cr.getCommandInvocation("list-jdbc-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
    List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
    assertEquals(origNum, list.size());
    // Check the exit code is Success
    assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) MessagePart(org.glassfish.api.ActionReport.MessagePart) PropsFileActionReporter(com.sun.enterprise.admin.report.PropsFileActionReporter) Test(org.junit.Test) ConfigApiTest(org.glassfish.tests.utils.ConfigApiTest)

Example 10 with PropsFileActionReporter

use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.

the class ListJdbcResourcesTest method testExecuteFailInvalidTargetOperand.

/**
 * Test of execute method, of class ListJdbcResource.
 * list-jdbc-resources invalid
 */
@Ignore
@Test
public void testExecuteFailInvalidTargetOperand() {
    // List the original set of JDBC Resources
    // Get an instance of the ListJdbcResources command
    listCommand = habitat.getService(ListJdbcResources.class);
    parameters.add("DEFAULT", "invalid");
    context = new AdminCommandContextImpl(LogDomains.getLogger(ListJdbcResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    // Call CommandRunnerImpl.doCommand(..) to execute the command
    cr.getCommandInvocation("list-jdbc-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
// Need bug fix before uncommenting assertion
// List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
// assertEquals(0, list.size());
// Check the exit code is FAILURE
// Need bug fix before uncommenting assertion
// assertEquals(ActionReport.ExitCode.FAILURE, context.getActionReport().getActionExitCode());
// Check error msg 'Invalid target: invalid'
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) PropsFileActionReporter(com.sun.enterprise.admin.report.PropsFileActionReporter) Ignore(org.junit.Ignore) Test(org.junit.Test) ConfigApiTest(org.glassfish.tests.utils.ConfigApiTest)

Aggregations

PropsFileActionReporter (com.sun.enterprise.admin.report.PropsFileActionReporter)30 AdminCommandContextImpl (org.glassfish.api.admin.AdminCommandContextImpl)23 ParameterMap (org.glassfish.api.admin.ParameterMap)19 Before (org.junit.Before)14 CommandRunner (org.glassfish.api.admin.CommandRunner)13 ConfigApiTest (org.glassfish.tests.utils.ConfigApiTest)9 Test (org.junit.Test)9 MessagePart (org.glassfish.api.ActionReport.MessagePart)7 ActionReport (org.glassfish.api.ActionReport)5 Domain (com.sun.enterprise.config.serverbeans.Domain)4 Resource (com.sun.enterprise.config.serverbeans.Resource)4 Resources (com.sun.enterprise.config.serverbeans.Resources)3 IiopService (org.glassfish.orb.admin.config.IiopService)3 RestPayloadImpl (com.sun.enterprise.admin.remote.RestPayloadImpl)2 CachedCommandModel (com.sun.enterprise.admin.util.CachedCommandModel)2 ArrayList (java.util.ArrayList)2 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)2 Ignore (org.junit.Ignore)2 ParamsWithPayload (com.sun.enterprise.admin.remote.ParamsWithPayload)1 ActionReporter (com.sun.enterprise.admin.report.ActionReporter)1