Search in sources :

Example 21 with PropsFileActionReporter

use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.

the class ListJdbcResourcesTest method testExecuteSuccessListBob.

/**
 * Test of execute method, of class ListJdbcResource.
 * create-jdbc-resource --connectionpoolid DerbyPool bob
 * list-jdbc-resources
 */
@Test
public void testExecuteSuccessListBob() {
    // Create JDBC Resource bob
    assertTrue(resources != null);
    // Get an instance of the CreateJdbcResource command
    createCommand = habitat.getService(CreateJdbcResource.class);
    assertTrue(createCommand != null);
    parameters.add("connectionpoolid", "DerbyPool");
    parameters.add("DEFAULT", "bob");
    context = new AdminCommandContextImpl(LogDomains.getLogger(ListJdbcResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    cr.getCommandInvocation("create-jdbc-resource", context.getActionReport(), adminSubject()).parameters(parameters).execute(createCommand);
    assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
    // List JDBC Resources and check if bob is in the list
    // Get an instance of the ListJdbcResources command
    listCommand = habitat.getService(ListJdbcResources.class);
    parameters = new ParameterMap();
    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 + 1, list.size());
    List<String> listStr = new java.util.ArrayList();
    for (MessagePart mp : list) {
        listStr.add(mp.getMessage());
    }
    assertTrue(listStr.contains("bob"));
    // 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) ParameterMap(org.glassfish.api.admin.ParameterMap) PropsFileActionReporter(com.sun.enterprise.v3.common.PropsFileActionReporter) Test(org.junit.Test) ConfigApiTest(org.glassfish.tests.utils.ConfigApiTest)

Example 22 with PropsFileActionReporter

use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.

the class ListJndiResourcesTest method setUp.

@Before
public void setUp() {
    habitat = getHabitat();
    cr = habitat.getService(CommandRunner.class);
    context = new AdminCommandContextImpl(LogDomains.getLogger(ListJndiResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    parameters = new ParameterMap();
    Resources resources = habitat.<Domain>getService(Domain.class).getResources();
    for (Resource resource : resources.getResources()) {
        if (resource instanceof org.glassfish.resources.config.ExternalJndiResource) {
            origNum = origNum + 1;
        }
    }
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) Resource(com.sun.enterprise.config.serverbeans.Resource) ParameterMap(org.glassfish.api.admin.ParameterMap) Resources(com.sun.enterprise.config.serverbeans.Resources) PropsFileActionReporter(com.sun.enterprise.v3.common.PropsFileActionReporter) Domain(com.sun.enterprise.config.serverbeans.Domain) CommandRunner(org.glassfish.api.admin.CommandRunner) Before(org.junit.Before)

Example 23 with PropsFileActionReporter

use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.

the class DeleteJavaMailResourceTest method setUp.

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

Example 24 with PropsFileActionReporter

use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.

the class ListJavaMailResourcesTest method setUp.

@Before
public void setUp() {
    habitat = getHabitat();
    parameters = new ParameterMap();
    cr = habitat.getService(CommandRunner.class);
    assertTrue(cr != null);
    Resources resources = habitat.<Domain>getService(Domain.class).getResources();
    context = new AdminCommandContextImpl(LogDomains.getLogger(ListJavaMailResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    for (Resource resource : resources.getResources()) {
        if (resource instanceof MailResource) {
            origNum = origNum + 1;
        }
    }
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) MailResource(org.glassfish.resources.javamail.config.MailResource) Resource(com.sun.enterprise.config.serverbeans.Resource) ParameterMap(org.glassfish.api.admin.ParameterMap) Resources(com.sun.enterprise.config.serverbeans.Resources) Domain(com.sun.enterprise.config.serverbeans.Domain) PropsFileActionReporter(com.sun.enterprise.v3.common.PropsFileActionReporter) CommandRunner(org.glassfish.api.admin.CommandRunner) MailResource(org.glassfish.resources.javamail.config.MailResource) Before(org.junit.Before)

Example 25 with PropsFileActionReporter

use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.

the class CreateIiopListenerTest method setUp.

@Before
public void setUp() {
    services = getHabitat();
    iiopService = services.getService(IiopService.class);
    parameters = new ParameterMap();
    context = new AdminCommandContextImpl(LogDomains.getLogger(CreateIiopListenerTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    cr = services.getService(CommandRunner.class);
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) IiopService(org.glassfish.orb.admin.config.IiopService) ParameterMap(org.glassfish.api.admin.ParameterMap) PropsFileActionReporter(com.sun.enterprise.v3.common.PropsFileActionReporter) CommandRunner(org.glassfish.api.admin.CommandRunner) Before(org.junit.Before)

Aggregations

PropsFileActionReporter (com.sun.enterprise.v3.common.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.v3.common.ActionReporter)1