Java Code Examples for javax.naming.Context#createSubcontext()

The following examples show how to use javax.naming.Context#createSubcontext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultInitialContextTest.java    From piranha with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Test listBindings method.
 *
 * @throws Exception when an error occurs.
 */
@Test
public void testListBindings5() throws Exception {
    DefaultInitialContext context = new DefaultInitialContext();
    Context subContext = context.createSubcontext("context1");
    subContext.createSubcontext("context2");
    NamingEnumeration<Binding> enumeration = context.listBindings("context1/context2");
    assertNotNull(enumeration);
}
 
Example 2
Source File: RetryingContext.java    From james-project with Apache License 2.0 5 votes vote down vote up
@Override
public Context createSubcontext(final Name name) throws NamingException {
    final Context context = getDelegate();
    return new RetryingContext(getSchedule(), getMaxRetries()) {

        @Override
        public Context newDelegate() throws NamingException {
            return context.createSubcontext(name);
        }
    };
}
 
Example 3
Source File: RetryingContext.java    From james-project with Apache License 2.0 5 votes vote down vote up
@Override
public Context createSubcontext(final String name) throws NamingException {
    final Context context = getDelegate();
    return new RetryingContext(getSchedule(), getMaxRetries()) {

        @Override
        public Context newDelegate() throws NamingException {
            return context.createSubcontext(name);
        }
    };
}
 
Example 4
Source File: AppNamingReadOnlyTest.java    From tomee with Apache License 2.0 3 votes vote down vote up
public void testAppNamingContextWritableByDefault() throws SystemException, URISyntaxException, NamingException {

    	List<BeanContext> mockBeanContextsList = getMockBeanContextsList();
    	
    	Assembler assembler = new Assembler();
    	assembler.setAppNamingContextReadOnly(mockBeanContextsList);
    	
    	Context beanNamingContext = mockBeanContextsList.get(0).getJndiContext();
		Context subContext = beanNamingContext.createSubcontext("sub");
		
		assertNotNull(subContext);
    }