use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.
the class DeleteCustomResourceTest 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(DeleteCustomResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
}
use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.
the class CreateCustomResourceTest method setUp.
@Before
public void setUp() {
parameters = new ParameterMap();
resources = habitat.<Domain>getService(Domain.class).getResources();
assertTrue(resources != null);
command = habitat.getService(org.glassfish.resources.admin.cli.CreateCustomResource.class);
assertTrue(command != null);
context = new AdminCommandContextImpl(LogDomains.getLogger(CreateCustomResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
cr = habitat.getService(CommandRunner.class);
}
use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.
the class CreateJdbcResourceTest method setUp.
@Before
public void setUp() {
assertTrue(resources != null);
// Get an instance of the CreateJdbcResource command
command = habitat.getService(CreateJdbcResource.class);
assertTrue(command != null);
// Set the options and operand to pass to the command
parameters.set("connectionpoolid", "H2Pool");
parameters.set("enabled", "true");
parameters.set("description", "my resource");
parameters.set("DEFAULT", "jdbc/foo");
context = new AdminCommandContextImpl(LogDomains.getLogger(CreateJdbcResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
cr = habitat.getService(CommandRunner.class);
}
use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.
the class ListJdbcResourcesTest method testExecuteFailInvalidOption.
/**
* Test of execute method, of class ListJdbcResource.
* list-jdbc-resources --invalid invalid
*/
@Ignore
@Test
public void testExecuteFailInvalidOption() {
listCommand = habitat.getService(ListJdbcResources.class);
parameters.add("invalid", "invalid");
context = new AdminCommandContextImpl(LogDomains.getLogger(ListJdbcResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
cr.getCommandInvocation("list-jdbc-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
assertEquals(1, list.size());
for (MessagePart mp : list) {
assertEquals("Usage: list-jdbc-resources ", mp.getMessage());
}
// Check the exit code is FAILURE
assertEquals(ActionReport.ExitCode.FAILURE, context.getActionReport().getActionExitCode());
}
use of com.sun.enterprise.admin.report.PropsFileActionReporter in project Payara by payara.
the class ListJdbcResourcesTest method testExecuteSuccessListBob.
/**
* Test of execute method, of class ListJdbcResource.
* create-jdbc-resource --connectionpoolid H2Pool 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", "H2Pool");
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());
}
Aggregations