use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class EEConcurrentManagementTestCase method testManagedExecutorServiceManagement.
@Test
public void testManagedExecutorServiceManagement() throws Exception {
final PathAddress pathAddress = EE_SUBSYSTEM_PATH_ADDRESS.append(EESubsystemModel.MANAGED_EXECUTOR_SERVICE, RESOURCE_NAME);
// add
final ModelNode addOperation = Util.createAddOperation(pathAddress);
final String jndiName = "java:jboss/ee/concurrency/executor/" + RESOURCE_NAME;
addOperation.get(ManagedExecutorServiceResourceDefinition.JNDI_NAME).set(jndiName);
addOperation.get(ManagedExecutorServiceResourceDefinition.CORE_THREADS).set(2);
final ModelNode addResult = managementClient.getControllerClient().execute(addOperation);
Assert.assertFalse(addResult.get(FAILURE_DESCRIPTION).toString(), addResult.get(FAILURE_DESCRIPTION).isDefined());
try {
// lookup
Assert.assertNotNull(new InitialContext().lookup(jndiName));
} finally {
// remove
final ModelNode removeOperation = Util.createRemoveOperation(pathAddress);
removeOperation.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true);
final ModelNode removeResult = managementClient.getControllerClient().execute(removeOperation);
Assert.assertFalse(removeResult.get(FAILURE_DESCRIPTION).toString(), removeResult.get(FAILURE_DESCRIPTION).isDefined());
try {
new InitialContext().lookup(jndiName);
Assert.fail();
} catch (NameNotFoundException e) {
// expected
}
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class SimpleSLSB method isUnInjectedIntEnvEntryPresentInEnc.
public boolean isUnInjectedIntEnvEntryPresentInEnc() {
Context ctx = null;
try {
ctx = new InitialContext();
ctx.lookup("java:comp/env/missingEnvEntryValIntResource");
return true;
} catch (NameNotFoundException nnfe) {
return false;
} catch (NamingException ne) {
throw new RuntimeException(ne);
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class SimpleSLSB method isUnInjectedStringEnvEntryPresentInEnc.
public boolean isUnInjectedStringEnvEntryPresentInEnc() {
Context ctx = null;
try {
ctx = new InitialContext();
ctx.lookup("java:comp/env/missingEnvEntryValStringResource");
return true;
} catch (NameNotFoundException nnfe) {
return false;
} catch (NamingException ne) {
throw new RuntimeException(ne);
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class AbstractCustomDescriptorTests method test1.
@Test
public void test1() throws NamingException {
final InitialContext ctx = new InitialContext();
try {
final DescriptorGreeterBean bean = (DescriptorGreeterBean) ctx.lookup("java:global/ejb-descriptor-test/DescriptorGreeter!org.jboss.as.test.integration.ejb.descriptor.DescriptorGreeterBean");
final String name = "test1";
final String result = bean.greet(name);
assertEquals("Hi test1", result);
} catch (NameNotFoundException e) {
fail(e.getMessage());
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class CustomDescriptorTestCase method testAnnotated.
// @EJB
// private DescriptorGreeterBean bean;
@Test
public void testAnnotated() throws NamingException {
final InitialContext ctx = new InitialContext();
try {
final AnnotatedGreeterBean bean = (AnnotatedGreeterBean) ctx.lookup("java:global/ejb-descriptor-test/AnnotatedGreeter!org.jboss.as.test.integration.ejb.descriptor.AnnotatedGreeterBean");
final String name = "testAnnotated";
final String result = bean.greet(name);
assertEquals("Hi testAnnotated", result);
} catch (NameNotFoundException e) {
fail(e.getMessage());
}
}
Aggregations