use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class CreateJndiResourceTest method setUp.
@Before
public void setUp() {
habitat = getHabitat();
resources = habitat.<Domain>getService(Domain.class).getResources();
server = habitat.getService(Server.class);
parameters = new ParameterMap();
context = new AdminCommandContextImpl(LogDomains.getLogger(CreateJndiResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
cr = habitat.getService(CommandRunner.class);
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class CreateJndiResourceTest method tearDown.
@After
public void tearDown() throws TransactionFailure {
org.glassfish.resources.admin.cli.DeleteJndiResource deleteCommand = habitat.getService(org.glassfish.resources.admin.cli.DeleteJndiResource.class);
parameters = new ParameterMap();
parameters.set("jndi_name", "sample_jndi_resource");
cr.getCommandInvocation("delete-jndi-resource", context.getActionReport(), adminSubject()).parameters(parameters).execute(deleteCommand);
parameters = new ParameterMap();
parameters.set("jndi_name", "dupRes");
cr.getCommandInvocation("delete-jndi-resource", context.getActionReport(), adminSubject()).parameters(parameters).execute(deleteCommand);
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class DeleteJndiResourceTest method testExecuteSuccessDefaultTarget.
/**
* Test of execute method, of class DeleteJndiResource.
* asadmin create-jndi-resource --restype=queue --factoryclass=sampleClass --jndilookupname=sample_jndi
* sample_jndi_resource
* delete-jndi-resource sample_jndi_resource
*/
@Test
public void testExecuteSuccessDefaultTarget() {
parameters.set("restype", "topic");
parameters.set("jndilookupname", "sample_jndi");
parameters.set("factoryclass", "javax.naming.spi.ObjectFactory");
parameters.set("jndi_name", "sample_jndi_resource");
org.glassfish.resources.admin.cli.CreateJndiResource createCommand = habitat.getService(org.glassfish.resources.admin.cli.CreateJndiResource.class);
cr.getCommandInvocation("create-jndi-resource", context.getActionReport(), adminSubject()).parameters(parameters).execute(createCommand);
assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
parameters = new ParameterMap();
parameters.set("jndi_name", "sample_jndi_resource");
org.glassfish.resources.admin.cli.DeleteJndiResource deleteCommand = habitat.getService(org.glassfish.resources.admin.cli.DeleteJndiResource.class);
cr.getCommandInvocation("delete-jndi-resource", context.getActionReport(), adminSubject()).parameters(parameters).execute(deleteCommand);
assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
boolean isDeleted = true;
for (Resource resource : resources.getResources()) {
if (resource instanceof BindableResource) {
BindableResource jr = (BindableResource) resource;
if (jr.getJndiName().equals("sample_jndi_resource")) {
isDeleted = false;
logger.fine("Jndi Resource config bean sample_jndi_resource is created.");
break;
}
}
}
assertTrue(isDeleted);
logger.fine("msg: " + context.getActionReport().getMessage());
Servers servers = habitat.getService(Servers.class);
boolean isRefDeleted = true;
for (Server server : servers.getServer()) {
if (server.getName().equals(SystemPropertyConstants.DEFAULT_SERVER_INSTANCE_NAME)) {
for (ResourceRef ref : server.getResourceRef()) {
if (ref.getRef().equals("sample_jndi_resource")) {
isRefDeleted = false;
break;
}
}
}
}
assertTrue(isRefDeleted);
}
use of org.glassfish.api.admin.ParameterMap in project Payara by payara.
the class DeleteJndiResourceTest 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(DeleteJndiResourceTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
}
use of org.glassfish.api.admin.ParameterMap 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());
}
Aggregations