use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class CreateIiopListenerTest method testExecuteFailForSamePortAndListenerAddress.
/**
* Test of execute method, of class CreateIiopListener with same iiop port number
* and listener address.
* asadmin create-iiop-listener --listeneraddress localhost
* --iiopport 4440 iiop_1
* asadmin create-iiop-listener --listeneraddress localhost
* --iiopport 4440 iiop_2
*/
@Test
public void testExecuteFailForSamePortAndListenerAddress() {
parameters.set("listeneraddress", "localhost");
parameters.set("iiopport", "4440");
parameters.set("listener_id", "iiop_1");
CreateIiopListener command = services.getService(CreateIiopListener.class);
cr.getCommandInvocation("create-iiop-listener", context.getActionReport(), adminSubject()).parameters(parameters).execute(command);
checkActionReport(context.getActionReport());
boolean isCreated = false;
List<IiopListener> listenerList = iiopService.getIiopListener();
for (IiopListener listener : listenerList) {
if (listener.getId().equals("iiop_1")) {
assertEquals("localhost", listener.getAddress());
assertEquals("4440", listener.getPort());
isCreated = true;
logger.fine("IIOPListener name iiop_1 is created.");
break;
}
}
assertTrue(isCreated);
logger.fine("msg: " + context.getActionReport().getMessage());
parameters = new ParameterMap();
parameters.set("listener_id", "iiop_2");
parameters.set("iiopport", "4440");
parameters.set("listeneraddress", "localhost");
cr.getCommandInvocation("create-iiop-listener", context.getActionReport(), adminSubject()).parameters(parameters).execute(command);
assertEquals(ActionReport.ExitCode.FAILURE, context.getActionReport().getActionExitCode());
logger.fine("msg: " + context.getActionReport().getMessage());
}
use of org.glassfish.api.admin.ParameterMap 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);
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class DeleteIiopListenerTest method testExecuteSuccessDefaultTarget.
/**
* Test of execute method, of class DeleteIiopListener.
* delete-iiop-listener iiop_1
*/
@Test
public void testExecuteSuccessDefaultTarget() {
parameters.set("listeneraddress", "localhost");
parameters.set("iiopport", "4440");
parameters.set("listener_id", "iiop_1");
CreateIiopListener createCommand = services.getService(CreateIiopListener.class);
cr.getCommandInvocation("create-iiop-listener", context.getActionReport(), adminSubject()).parameters(parameters).execute(createCommand);
CreateIiopListenerTest.checkActionReport(context.getActionReport());
parameters = new ParameterMap();
parameters.set("listener_id", "iiop_1");
DeleteIiopListener deleteCommand = services.getService(DeleteIiopListener.class);
cr.getCommandInvocation("delete-iiop-listener", context.getActionReport(), adminSubject()).parameters(parameters).execute(deleteCommand);
CreateIiopListenerTest.checkActionReport(context.getActionReport());
boolean isDeleted = true;
List<IiopListener> listenerList = iiopService.getIiopListener();
for (IiopListener listener : listenerList) {
if (listener.getId().equals("iiop_1")) {
isDeleted = false;
logger.fine("IIOPListener name iiop_1 is not deleted.");
break;
}
}
assertTrue(isDeleted);
logger.fine("msg: " + context.getActionReport().getMessage());
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class DeleteIiopListenerTest method setUp.
@Before
public void setUp() {
services = getHabitat();
iiopService = services.getService(IiopService.class);
parameters = new ParameterMap();
cr = services.getService(CommandRunner.class);
context = new AdminCommandContextImpl(LogDomains.getLogger(DeleteIiopListenerTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class ListIiopListenersTest method testExecuteSuccessListListener.
/**
* Test of execute method, of class ListIiopListeners.
* asadmin create-iiop-listener --listeneraddress localhost
* --iiopport 4440 listener
* list-iiop-listeners
* delete-iiop-listener listener
*/
@Test
public void testExecuteSuccessListListener() {
parameters.set("listeneraddress", "localhost");
parameters.set("iiopport", "4440");
parameters.set("listener_id", "listener");
CreateIiopListener createCommand = services.getService(CreateIiopListener.class);
cr.getCommandInvocation("create-iiop-listener", context.getActionReport(), adminSubject()).parameters(parameters).execute(createCommand);
CreateIiopListenerTest.checkActionReport(context.getActionReport());
parameters = new ParameterMap();
ListIiopListeners listCommand = services.getService(ListIiopListeners.class);
cr.getCommandInvocation("list-iiop-listeners", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
List<MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
assertEquals(origNum + 1, list.size());
List<String> listStr = new ArrayList<String>();
for (MessagePart mp : list) {
listStr.add(mp.getMessage());
}
assertTrue(listStr.contains("listener"));
CreateIiopListenerTest.checkActionReport(context.getActionReport());
parameters = new ParameterMap();
parameters.set("listener_id", "listener");
DeleteIiopListener deleteCommand = services.getService(DeleteIiopListener.class);
cr.getCommandInvocation("delete-iiop-listener", context.getActionReport(), adminSubject()).parameters(parameters).execute(deleteCommand);
CreateIiopListenerTest.checkActionReport(context.getActionReport());
}
Aggregations