Search in sources :

Example 36 with CompositeName

use of javax.naming.CompositeName 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) {
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) CompositeName(javax.naming.CompositeName) Test(org.junit.Test)

Example 37 with CompositeName

use of javax.naming.CompositeName in project wildfly by wildfly.

the class InMemoryNamingStoreTestCase method testLookupEmptyName.

@Test
public void testLookupEmptyName() throws Exception {
    Object result = nameStore.lookup(new CompositeName());
    assertTrue(result instanceof NamingContext);
    result = nameStore.lookup(new CompositeName(""));
    assertTrue(result instanceof NamingContext);
}
Also used : CompositeName(javax.naming.CompositeName) Test(org.junit.Test)

Example 38 with CompositeName

use of javax.naming.CompositeName 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) {
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) CompositeName(javax.naming.CompositeName) CompositeName(javax.naming.CompositeName) Name(javax.naming.Name) Test(org.junit.Test)

Example 39 with CompositeName

use of javax.naming.CompositeName 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) {
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) CompositeName(javax.naming.CompositeName) Test(org.junit.Test)

Example 40 with CompositeName

use of javax.naming.CompositeName in project wildfly by wildfly.

the class InMemoryNamingStoreTestCase method testBindAndLookupResolveResult.

@Test
public void testBindAndLookupResolveResult() throws Exception {
    final Name name = new CompositeName("test");
    final Reference reference = new Reference(Context.class.getName());
    nameStore.bind(name, reference, Context.class);
    final Object result = nameStore.lookup(new CompositeName("test/value"));
    assertTrue(result instanceof ResolveResult);
}
Also used : Context(javax.naming.Context) Reference(javax.naming.Reference) CompositeName(javax.naming.CompositeName) ResolveResult(javax.naming.spi.ResolveResult) CompositeName(javax.naming.CompositeName) Name(javax.naming.Name) Test(org.junit.Test)

Aggregations

CompositeName (javax.naming.CompositeName)124 Test (org.junit.Test)69 Name (javax.naming.Name)43 NameNotFoundException (javax.naming.NameNotFoundException)27 NamingException (javax.naming.NamingException)25 Reference (javax.naming.Reference)19 Context (javax.naming.Context)18 InvalidNameException (javax.naming.InvalidNameException)13 NotContextException (javax.naming.NotContextException)12 ServiceName (org.jboss.msc.service.ServiceName)11 Test (org.junit.jupiter.api.Test)10 JndiPermission (org.wildfly.naming.java.permission.JndiPermission)10 Hashtable (java.util.Hashtable)9 Binding (javax.naming.Binding)8 LinkRef (javax.naming.LinkRef)8 OperationNotSupportedException (javax.naming.OperationNotSupportedException)8 CallableWithoutResult (org.apereo.portal.concurrency.CallableWithoutResult)7 IEntityGroup (org.apereo.portal.groups.IEntityGroup)7 BaseAggrEventsJpaDaoTest (org.apereo.portal.test.BaseAggrEventsJpaDaoTest)7 StringRefAddr (javax.naming.StringRefAddr)5