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

The following examples show how to use javax.naming.Context#createSubcontext() . These examples are extracted from open source projects. 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
/**
 * 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 Project: james-project   File: RetryingContext.java    License: 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 Project: james-project   File: RetryingContext.java    License: 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 Project: tomee   File: AppNamingReadOnlyTest.java    License: 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);
    }