use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class InMemoryNamingStoreTestCase method testRebindInvalidContext.
@Test
public void testRebindInvalidContext() throws Exception {
try {
nameStore.rebind(new CompositeName("subcontext/test"), new Object(), Object.class);
fail("Should have thrown and NameNotFoundException");
} catch (NameNotFoundException expected) {
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class InMemoryNamingStoreTestCase method testBindUnbindLookup.
@Test
public void testBindUnbindLookup() throws Exception {
final Name name = new CompositeName("test");
final Object object = new Object();
nameStore.bind(name, object, Object.class);
final Object result = nameStore.lookup(name);
assertEquals(object, result);
nameStore.unbind(name);
try {
nameStore.lookup(name);
fail("Should have thrown and NameNotFoundException");
} catch (NameNotFoundException expected) {
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class InMemoryNamingStoreTestCase method testListNameNotFound.
@Test
public void testListNameNotFound() throws Exception {
try {
nameStore.list(new CompositeName("test"));
fail("Should have thrown and NameNotFoundException");
} catch (NameNotFoundException expected) {
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class OptionalEnvEntryBean method checkLookup.
public void checkLookup() {
try {
InitialContext ctx = new InitialContext();
ctx.lookup("java:comp/env/entry");
throw new RuntimeException("Should have thrown a NameNotFoundException");
} catch (NameNotFoundException e) {
// okay
} catch (NamingException e) {
throw new RuntimeException(e);
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class EEConcurrentManagementTestCase method testManagedScheduledExecutorServiceManagement.
@Test
public void testManagedScheduledExecutorServiceManagement() throws Exception {
final PathAddress pathAddress = EE_SUBSYSTEM_PATH_ADDRESS.append(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE, RESOURCE_NAME);
// add
final ModelNode addOperation = Util.createAddOperation(pathAddress);
final String jndiName = "java:jboss/ee/concurrency/scheduledexecutor/" + RESOURCE_NAME;
addOperation.get(ManagedScheduledExecutorServiceResourceDefinition.JNDI_NAME).set(jndiName);
addOperation.get(ManagedScheduledExecutorServiceResourceDefinition.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
}
}
}
Aggregations