use of javax.naming.CompositeName in project wildfly by wildfly.
the class NamingContextTestCase method bindList.
private void bindList() throws NamingException {
final Name name = new CompositeName("test");
final Object object = new Object();
namingStore.bind(name, object);
final Name nameTwo = new CompositeName("testTwo");
final Object objectTwo = new Object();
namingStore.bind(nameTwo, objectTwo);
final Name nameThree = new CompositeName("testThree");
final Object objectThree = new Object();
namingStore.bind(nameThree, objectThree);
namingStore.bind(new CompositeName("testContext/test"), "testNested");
}
use of javax.naming.CompositeName in project wildfly by wildfly.
the class NamingContextTestCase method testListNameNotFound.
@Test
public void testListNameNotFound() throws Exception {
try {
namingContext.list(new CompositeName("test"));
fail("Should have thrown and NameNotFoundException");
} catch (NameNotFoundException expected) {
}
//the same with security permissions
try {
testActionPermission(JndiPermission.ACTION_LIST, namingContext, "test");
fail("Should have thrown and NameNotFoundException with appropriate permissions");
} catch (NameNotFoundException expected) {
}
}
use of javax.naming.CompositeName in project wildfly by wildfly.
the class NamingContextTestCase method testBindReferenceable.
@Test
public void testBindReferenceable() throws Exception {
Name name = new CompositeName("test");
final TestObjectReferenceable referenceable = new TestObjectReferenceable("addr");
namingContext.bind(name, referenceable);
Object result = namingContext.lookup(name);
assertEquals(referenceable.addr, result);
//the same with security permissions
name = new CompositeName("securitytest");
testActionPermission(JndiPermission.ACTION_BIND, namingContext, "securitytest", referenceable);
result = testActionPermission(JndiPermission.ACTION_LOOKUP, namingContext, "securitytest");
assertEquals(referenceable.addr, result);
}
use of javax.naming.CompositeName in project wildfly by wildfly.
the class NamingContextTestCase method testRebindReferenceable.
@Test
public void testRebindReferenceable() throws Exception {
final Name name = new CompositeName("test");
final TestObjectReferenceable referenceable = new TestObjectReferenceable("addr");
namingContext.bind(name, referenceable);
TestObjectReferenceable newReferenceable = new TestObjectReferenceable("newAddr");
namingContext.rebind(name, newReferenceable);
Object result = namingContext.lookup(name);
assertEquals(newReferenceable.addr, result);
//the same with security permissions
newReferenceable = new TestObjectReferenceable("yetAnotherNewAddr");
testActionPermission(JndiPermission.ACTION_REBIND, namingContext, "test", newReferenceable);
result = namingContext.lookup(name);
assertEquals(newReferenceable.addr, result);
}
use of javax.naming.CompositeName in project wildfly by wildfly.
the class NamingContextTestCase method testListBindingsWithContinuation.
@Test
@SuppressWarnings("unchecked")
public void testListBindingsWithContinuation() throws Exception {
bindListWithContinuations();
NamingEnumeration<Binding> results = namingContext.listBindings(new CompositeName("comp"));
checkListWithContinuationsResults(results);
//the same with security permissions
results = (NamingEnumeration<Binding>) testActionPermission(JndiPermission.ACTION_LIST_BINDINGS, Arrays.asList(new JndiPermission("test", "listBindings")), namingContext, "comp");
checkListWithContinuationsResults(results);
}
Aggregations