Search in sources :

Example 1 with NameParserImpl

use of org.apache.naming.NameParserImpl in project tomcat by apache.

the class TestJNDIRealm method mockDirContext.

private DirContext mockDirContext(NamingEnumeration<SearchResult> namingEnumeration) throws NamingException {
    DirContext dirContext = EasyMock.createNiceMock(InitialDirContext.class);
    EasyMock.expect(dirContext.search(EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyObject(SearchControls.class))).andReturn(namingEnumeration).times(2);
    EasyMock.expect(dirContext.getNameParser("")).andReturn(new NameParserImpl()).times(2);
    EasyMock.expect(dirContext.getNameInNamespace()).andReturn("ANY NAME").times(2);
    EasyMock.replay(dirContext);
    return dirContext;
}
Also used : NameParserImpl(org.apache.naming.NameParserImpl) DirContext(javax.naming.directory.DirContext) InitialDirContext(javax.naming.directory.InitialDirContext)

Aggregations

DirContext (javax.naming.directory.DirContext)1 InitialDirContext (javax.naming.directory.InitialDirContext)1 NameParserImpl (org.apache.naming.NameParserImpl)1