use of com.sun.enterprise.v3.common.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.v3.common.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.v3.common.PropsFileActionReporter in project Payara by payara.
the class ListCustomResourcesTest method setUp.
@Before
public void setUp() {
parameters = new ParameterMap();
cr = habitat.getService(CommandRunner.class);
context = new AdminCommandContextImpl(LogDomains.getLogger(ListCustomResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
Resources resources = habitat.<Domain>getService(Domain.class).getResources();
assertTrue(resources != null);
for (Resource resource : resources.getResources()) {
if (resource instanceof org.glassfish.resources.config.CustomResource) {
origNum = origNum + 1;
}
}
}
use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.
the class ListCustomResourcesTest method testExecuteSuccessListNoResource.
/**
* Test of execute method, of class ListCustomResources.
* delete-custom-resource Resource1
* list-Custom-resources
*/
@Test
public void testExecuteSuccessListNoResource() {
createCustomResource();
org.glassfish.resources.admin.cli.ListCustomResources listCommand = habitat.getService(org.glassfish.resources.admin.cli.ListCustomResources.class);
cr.getCommandInvocation("list-custom-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
assertEquals(origNum + 1, list.size());
// as we newly created a resource after test "setup".
origNum = origNum + 1;
deleteCustomResource();
ParameterMap parameters = new ParameterMap();
listCommand = habitat.getService(org.glassfish.resources.admin.cli.ListCustomResources.class);
context = new AdminCommandContextImpl(LogDomains.getLogger(ListCustomResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
cr.getCommandInvocation("list-custom-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
list = context.getActionReport().getTopMessagePart().getChildren();
if ((origNum - 1) == 0) {
// Nothing to list.
} else {
assertEquals(origNum - 1, list.size());
}
List<String> listStr = new java.util.ArrayList<String>();
for (MessagePart mp : list) {
listStr.add(mp.getMessage());
}
assertFalse(listStr.contains("custom_resource1"));
assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
}
use of com.sun.enterprise.v3.common.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());
}
Aggregations