use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class ListJndiResourcesTest method setUp.
@Before
public void setUp() {
habitat = getHabitat();
cr = habitat.getService(CommandRunner.class);
context = new AdminCommandContextImpl(LogDomains.getLogger(ListJndiResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
parameters = new ParameterMap();
Resources resources = habitat.<Domain>getService(Domain.class).getResources();
for (Resource resource : resources.getResources()) {
if (resource instanceof org.glassfish.resources.config.ExternalJndiResource) {
origNum = origNum + 1;
}
}
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class DeleteJavaMailResourceTest method setUp.
@Before
public void setUp() {
habitat = getHabitat();
parameters = new ParameterMap();
cr = habitat.getService(CommandRunner.class);
resources = habitat.<Domain>getService(Domain.class).getResources();
context = new AdminCommandContextImpl(LogDomains.getLogger(DeleteJavaMailResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class ListJavaMailResourcesTest method setUp.
@Before
public void setUp() {
habitat = getHabitat();
parameters = new ParameterMap();
cr = habitat.getService(CommandRunner.class);
assertTrue(cr != null);
Resources resources = habitat.<Domain>getService(Domain.class).getResources();
context = new AdminCommandContextImpl(LogDomains.getLogger(ListJavaMailResourcesTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
for (Resource resource : resources.getResources()) {
if (resource instanceof MailResource) {
origNum = origNum + 1;
}
}
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class ListJavaMailResourcesTest method testExecuteSuccessListMailResource.
/**
* Test of execute method, of class ListJavaMailResource.
* create-javamail-resource --mailuser=test --mailhost=localhost
* --fromaddress=test@sun.com mailresource
* list-javamail-resources
*/
@Test
public void testExecuteSuccessListMailResource() {
createJavaMailResource();
parameters = new ParameterMap();
org.glassfish.resources.javamail.admin.cli.ListJavaMailResources listCommand = habitat.getService(org.glassfish.resources.javamail.admin.cli.ListJavaMailResources.class);
assertTrue(listCommand != null);
cr.getCommandInvocation("list-javamail-resources", 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("mailresource"));
assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
deleteJavaMailResource();
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class DeleteJndiResourceTest method tearDown.
@After
public void tearDown() throws TransactionFailure {
parameters = new ParameterMap();
ConfigSupport.apply(new SingleConfigCode<Resources>() {
public Object run(Resources param) throws PropertyVetoException, TransactionFailure {
Resource target = null;
for (Resource resource : param.getResources()) {
if (resource instanceof BindableResource) {
BindableResource r = (BindableResource) resource;
if (r.getJndiName().equals("sample_jndi_resource") || r.getJndiName().equals("dupRes")) {
target = resource;
break;
}
}
}
if (target != null) {
param.getResources().remove(target);
}
return null;
}
}, resources);
}
Aggregations