Search in sources :

Example 96 with CompositeName

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

the class InMemoryNamingStoreTestCase method testAutoRemove.

@Test
public void testAutoRemove() throws Exception {
    nameStore.bind(new CompositeName("test/item"), new Object());
    assertNotNull(nameStore.lookup(new CompositeName("test/item")));
    assertNotNull(nameStore.lookup(new CompositeName("test")));
    nameStore.unbind(new CompositeName("test/item"));
    try {
        nameStore.lookup(new CompositeName("test"));
        fail("Should have throw name not found exception");
    } catch (NameNotFoundException expected) {
    }
}
Also used : NameNotFoundException(javax.naming.NameNotFoundException) CompositeName(javax.naming.CompositeName) Test(org.junit.Test)

Example 97 with CompositeName

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

the class InMemoryNamingStoreTestCase method testLookupNameNotFound.

@Test
public void testLookupNameNotFound() throws Exception {
    try {
        nameStore.lookup(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 98 with CompositeName

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

the class InMemoryNamingStoreTestCase method testUnbindNotFound.

@Test
public void testUnbindNotFound() throws Exception {
    try {
        nameStore.unbind(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 99 with CompositeName

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

the class InMemoryNamingStoreTestCase method testBindEmptyName.

@Test
public void testBindEmptyName() throws Exception {
    try {
        nameStore.bind(new CompositeName(), new Object(), Object.class);
        fail("Should have thrown and InvalidNameException");
    } catch (InvalidNameException expected) {
    }
    try {
        nameStore.bind(new CompositeName(""), new Object(), Object.class);
        fail("Should have thrown and InvalidNameException");
    } catch (InvalidNameException expected) {
    }
}
Also used : InvalidNameException(javax.naming.InvalidNameException) CompositeName(javax.naming.CompositeName) Test(org.junit.Test)

Example 100 with CompositeName

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

the class NamingContextTestCase method testLookupEmptyName.

@Test
public void testLookupEmptyName() throws Exception {
    Object result = namingContext.lookup(new CompositeName());
    assertTrue(result instanceof NamingContext);
    result = namingContext.lookup(new CompositeName(""));
    assertTrue(result instanceof NamingContext);
    //the same with security permissions
    result = testActionPermission(JndiPermission.ACTION_LOOKUP, namingContext, null);
    assertTrue(result instanceof NamingContext);
    result = testActionPermission(JndiPermission.ACTION_LOOKUP, namingContext, "");
    assertTrue(result instanceof NamingContext);
}
Also used : CompositeName(javax.naming.CompositeName) 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