### Question:
ConfigPartitionReader { public AdsBaseBean readConfig( Entry entry ) throws Exception { ObjectClass objectClass = findObjectClass( entry.get( SchemaConstants.OBJECT_CLASS_AT ) ); AdsBaseBean bean = createBean( objectClass ); bean.setDn( entry.getDn() ); Class<?> beanClass = bean.getClass(); boolean adsBaseBeanClassFound = false; while ( !adsBaseBeanClassFound ) { if ( beanClass == AdsBaseBean.class ) { adsBaseBeanClassFound = true; } Field[] fields = beanClass.getDeclaredFields(); for ( Field field : fields ) { field.setAccessible( true ); Class<?> fieldClass = field.getType(); ConfigurationElement configurationElement = field.getAnnotation( ConfigurationElement.class ); if ( configurationElement != null ) { String fieldAttributeType = configurationElement.attributeType(); String fieldObjectClass = configurationElement.objectClass(); String container = configurationElement.container(); boolean isOptional = configurationElement.isOptional(); if ( ( fieldAttributeType != null ) && ( !"".equals( fieldAttributeType ) ) ) { readFieldValue( bean, field, entry, fieldAttributeType, !isOptional ); } else if ( ( fieldObjectClass != null ) && ( !"".equals( fieldObjectClass ) ) ) { if ( isMultiple( fieldClass ) && ( container != null ) && ( !"".equals( container ) ) ) { Dn newBase = entry.getDn().add( "ou=" + container ); Collection<AdsBaseBean> fieldValues = read( newBase, fieldObjectClass, SearchScope.ONELEVEL, !isOptional ); if ( ( fieldValues != null ) && !fieldValues.isEmpty() ) { field.set( bean, fieldValues ); } } else { List<AdsBaseBean> fieldValues = read( entry.getDn(), fieldObjectClass, SearchScope.ONELEVEL, !isOptional ); if ( ( fieldValues != null ) && !fieldValues.isEmpty() ) { field.set( bean, fieldValues.get( 0 ) ); } } } } } beanClass = beanClass.getSuperclass(); } return bean; } ConfigPartitionReader( AbstractBTreePartition configPartition ); List<AdsBaseBean> read( Dn baseDn, String name, SearchScope scope, boolean mandatory ); AdsBaseBean readConfig( Entry entry ); ConfigBean readConfig(); ConfigBean readConfig( String baseDn ); ConfigBean readConfig( Dn baseDn ); ConfigBean readConfig( String baseDn, String objectClass ); ConfigBean readConfig( Dn baseDn, String objectClass );  }### Answer:
@Test public void testReadFullConfig() throws Exception { File configDir = new File( workDir, "config" ); String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif", true ); SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory ); configPartition.setId( "config" ); configPartition.setPartitionPath( new File( configFile ).toURI() ); configPartition.setSuffixDn( new Dn( schemaManager, "ou=config" ) ); configPartition.setSchemaManager( schemaManager ); configPartition.initialize(); ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition ); ConfigBean configBean = cpReader.readConfig( "ou=config" ); assertNotNull( configBean ); DirectoryServiceBean directoryServiceBean = ( DirectoryServiceBean ) configBean.getDirectoryServiceBeans().get( 0 ); assertNotNull( directoryServiceBean ); configPartition.destroy( configPartition.beginReadTransaction() ); }