use of org.glassfish.api.ActionReport.MessagePart in project Payara by payara.
the class ListIiopListenersTest method testExecuteSuccessListNoListener.
/**
* Test of execute method, of class ListIiopListener.
* list-iiop-listeners
*/
@Test
public void testExecuteSuccessListNoListener() {
parameters = new ParameterMap();
ListIiopListeners listCommand = services.getService(ListIiopListeners.class);
cr.getCommandInvocation("list-iiop-listeners", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
CreateIiopListenerTest.checkActionReport(context.getActionReport());
List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
assertEquals(origNum, list.size());
List<String> listStr = new ArrayList<String>();
for (MessagePart mp : list) {
listStr.add(mp.getMessage());
}
assertFalse(listStr.contains("listener"));
}
use of org.glassfish.api.ActionReport.MessagePart in project Payara by payara.
the class SetRestMonitoringConfigurationCommand method messageSecurityProviderExists.
private boolean messageSecurityProviderExists(ActionReport subActionReport, Subject subject) {
boolean exists = false;
CommandInvocation invocation = commandRunner.getCommandInvocation("list-message-security-providers", subActionReport, subject, false);
ParameterMap parameters = new ParameterMap();
parameters.add("layer", "HttpServlet");
invocation.parameters(parameters).execute();
for (MessagePart message : subActionReport.getTopMessagePart().getChildren()) {
if (message.getMessage().equals(AUTH_MODULE_NAME)) {
exists = true;
break;
}
}
return exists;
}
use of org.glassfish.api.ActionReport.MessagePart in project Payara by payara.
the class ListJavaMailResourcesTest method testExecuteSuccessListNoMailResource.
/**
* Test of execute method, of class ListJdbcResource.
* delete-javamail-resource mailresource
* list-javamail-resources
*/
@Test
public void testExecuteSuccessListNoMailResource() {
createJavaMailResource();
parameters = new ParameterMap();
org.glassfish.resources.javamail.admin.cli.ListJavaMailResources listCommand = habitat.getService(org.glassfish.resources.javamail.admin.cli.ListJavaMailResources.class);
cr.getCommandInvocation("list-javamail-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
List<ActionReport.MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
assertEquals(origNum + 1, list.size());
// as we newly created a resource after test "setup".
origNum = origNum + 1;
deleteJavaMailResource();
parameters = new ParameterMap();
listCommand = habitat.getService(org.glassfish.resources.javamail.admin.cli.ListJavaMailResources.class);
context = new AdminCommandContextImpl(LogDomains.getLogger(ListJavaMailResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
cr.getCommandInvocation("list-javamail-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 ArrayList<String>();
for (MessagePart mp : list) {
listStr.add(mp.getMessage());
}
assertFalse(listStr.contains("mailresource"));
assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
}
use of org.glassfish.api.ActionReport.MessagePart in project Payara by payara.
the class ListCustomResourcesTest method testExecuteSuccessListResource.
/**
* Test of execute method, of class ListCustomResources.
* create-custom-resource ---restype=topic --factoryclass=javax.naming.spi.ObjectFactory
* Resource1
* list-custom-resources
*/
@Test
public void testExecuteSuccessListResource() {
createCustomResource();
ParameterMap parameters = new ParameterMap();
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());
List<String> listStr = new java.util.ArrayList<String>();
for (MessagePart mp : list) {
listStr.add(mp.getMessage());
}
assertTrue(listStr.contains("custom_resource1"));
assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
deleteCustomResource();
}
use of org.glassfish.api.ActionReport.MessagePart 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());
}
Aggregations