use of com.sun.enterprise.v3.common.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;
}
use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.
the class ListCommand method execute.
public void execute(AdminCommandContext context) {
ActionReport 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
}
if (monitor) {
listMonitorElements(context);
return;
}
List<Map.Entry> matchingNodesSorted = sortNodesByDottedName(matchingNodes);
for (Map.Entry<Dom, String> node : matchingNodesSorted) {
ActionReport.MessagePart part = report.getTopMessagePart().addChild();
part.setChildrenType("DottedName");
if (parentNodes[0].name.isEmpty()) {
part.setMessage(node.getValue());
} else {
part.setMessage(parentNodes[0].name + "." + node.getValue());
}
}
}
use of com.sun.enterprise.v3.common.PropsFileActionReporter in project Payara by payara.
the class DeleteJdbcResourceTest method setUp.
@Before
public void setUp() {
assertTrue(resources != null);
// Create a JDBC Resource jdbc/foo for each test
CreateJdbcResource createCommand = habitat.getService(CreateJdbcResource.class);
assertTrue(createCommand != null);
parameters.add("connectionpoolid", "DerbyPool");
parameters.add("DEFAULT", "jdbc/foo");
context = new AdminCommandContextImpl(LogDomains.getLogger(DeleteJdbcResourceTest.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());
// Setup for delete-jdbc-resource
parameters = new ParameterMap();
deleteCommand = habitat.getService(DeleteJdbcResource.class);
assertTrue(deleteCommand != null);
}
use of com.sun.enterprise.v3.common.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", "DerbyPool");
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.v3.common.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());
}
Aggregations