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 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 testListBindingsNameNotFound.
@Test
public void testListBindingsNameNotFound() throws Exception {
try {
nameStore.listBindings(new CompositeName("test"));
fail("Should have thrown and NameNotFoundException");
} catch (NameNotFoundException expected) {
}
}
use of javax.naming.NameNotFoundException in project wildfly by wildfly.
the class BusinessViewAnnotationProcessorTestCase method testEJB32MultipleLocalViews.
/**
* Tests that if a bean has a {@link javax.ejb.Local} annotation without any specific value and if the bean implements n (valid) interfaces, then all those n (valid) interfaces are considered
* as local business interfaces
*
* @throws Exception
*/
@Test
public void testEJB32MultipleLocalViews() throws Exception {
final Context ctx = new InitialContext();
final One interfaceOne = (One) ctx.lookup("java:module/" + MultipleLocalViewBean.class.getSimpleName() + "!" + One.class.getName());
assertNotNull("View " + One.class.getName() + " not found", interfaceOne);
final Two interfaceTwo = (Two) ctx.lookup("java:module/" + MultipleLocalViewBean.class.getSimpleName() + "!" + Two.class.getName());
assertNotNull("View " + Two.class.getName() + " not found", interfaceTwo);
final Three interfaceThree = (Three) ctx.lookup("java:module/" + MultipleLocalViewBean.class.getSimpleName() + "!" + Three.class.getName());
assertNotNull("View " + Three.class.getName() + " not found", interfaceThree);
try {
final Object view = ctx.lookup("java:module/" + MultipleLocalViewBean.class.getSimpleName() + "!" + Serializable.class.getName());
Assert.fail("Unexpected view found: " + view + " for interface " + Serializable.class.getName());
} catch (NameNotFoundException nnfe) {
// expected
}
try {
final Object view = ctx.lookup("java:module/" + MultipleLocalViewBean.class.getSimpleName() + "!" + Externalizable.class.getName());
Assert.fail("Unexpected view found: " + view + " for interface " + Externalizable.class.getName());
} catch (NameNotFoundException nnfe) {
// expected
}
}
Aggregations