}
private ReplicationConsumer createConsumer() throws Exception
{
final ReplicationConsumer syncreplClient = new MockSyncReplConsumer();
final SyncReplConfiguration config = new SyncReplConfiguration();
config.setRemoteHost( "localhost" );
config.setRemotePort( 16000 );
config.setReplUserDn( "uid=admin,ou=system" );
config.setReplUserPassword( "secret".getBytes() );
config.setUseTls( false );
config.setBaseDn( "dc=example,dc=com" );
config.setRefreshInterval( 1000 );
syncreplClient.setConfig( config );
assertTrue( true );
Runnable consumerTask = new Runnable()
{
public void run()
{
try
{
String baseDn = config.getBaseDn();
SearchRequest searchRequest = new SearchRequestImpl();
searchRequest.setBase( new Dn( baseDn ) );
searchRequest.setFilter( config.getFilter() );
searchRequest.setSizeLimit( config.getSearchSizeLimit() );
searchRequest.setTimeLimit( config.getSearchTimeout() );
searchRequest.setDerefAliases( config.getAliasDerefMode() );
searchRequest.setScope( config.getSearchScope() );
searchRequest.setTypesOnly( false );
searchRequest.addAttributes( config.getAttributes() );
DirectoryService directoryService = new MockDirectoryService();
directoryService.setSchemaManager( schemaManager );
( ( MockSyncReplConsumer ) syncreplClient ).init( directoryService );
syncreplClient.connect( true );
syncreplClient.startSync();
}
catch ( Exception e )
{
throw new RuntimeException( e );
}