You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Pierre-Arnaud Marcelot <pa...@marcelot.net> on 2011/05/31 10:00:47 UTC

Re: svn commit: r1129134 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java

Hi Kiran,

Looks like this test does not pass here (tested this under two different machines).

Here's the output:
> Tests in error: 
>   testRebootConsumer(org.apache.directory.server.replication.ClientServerReplicationIT): Attempt to lookup non-existant entry: cn=user5,dc=example,dc=com
> 
> Tests run: 303, Failures: 0, Errors: 1, Skipped: 5


Regards,
Pierre-Arnaud

On 30 mai 2011, at 13:59, kayyagari@apache.org wrote:

> Author: kayyagari
> Date: Mon May 30 11:59:34 2011
> New Revision: 1129134
> 
> URL: http://svn.apache.org/viewvc?rev=1129134&view=rev
> Log:
> o added a test to check the replication of data to the client when the client goes offline and reboots after some activity on the master server
> 
> Modified:
>    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
> 
> Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1129134&r1=1129133&r2=1129134&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java (original)
> +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java Mon May 30 11:59:34 2011
> @@ -67,11 +67,11 @@ public class ClientServerReplicationIT
> 
>     private static LdapServer consumerServer;
> 
> -    private SchemaManager schemaManager;
> +    private static SchemaManager schemaManager;
> 
> -    private CoreSession providerSession;
> +    private static CoreSession providerSession;
> 
> -    private CoreSession consumerSession;
> +    private static CoreSession consumerSession;
> 
>     private static AtomicInteger entryCount = new AtomicInteger();
> 
> @@ -93,15 +93,6 @@ public class ClientServerReplicationIT
>     }
> 
> 
> -    @Before
> -    public void accessFields()
> -    {
> -        schemaManager = providerServer.getDirectoryService().getSchemaManager();
> -        providerSession = providerServer.getDirectoryService().getAdminSession();
> -        consumerSession = consumerServer.getDirectoryService().getAdminSession();
> -    }
> -    
> -    
>     @Test
>     public void testInjectContextEntry() throws Exception
>     {
> @@ -202,6 +193,32 @@ public class ClientServerReplicationIT
>     }
> 
> 
> +    @Test
> +    public void testRebootConsumer() throws Exception
> +    {
> +        Entry provUser = createEntry();
> +        
> +        providerSession.add( provUser );
> +        
> +        waitAndCompareEntries( provUser.getDn() );
> +        
> +        consumerServer.stop();
> +        
> +        Dn deletedUserDn = provUser.getDn();
> +        providerSession.delete( deletedUserDn );
> +        
> +        provUser = createEntry();
> +        Dn addedUserDn = provUser.getDn();
> +        providerSession.add( provUser );
> +        
> +        startConsumer();
> +        
> +        Thread.sleep( 2000 );
> +        assertFalse( consumerSession.exists( deletedUserDn ) );
> +        waitAndCompareEntries( addedUserDn );
> +    }
> +    
> +    
>     private void waitAndCompareEntries( Dn dn ) throws Exception
>     {
>         // sleep for 2 sec (twice the refresh interval), just to let the first refresh request succeed
> @@ -263,6 +280,8 @@ public class ClientServerReplicationIT
>                 try
>                 {
>                     providerServer.start();
> +                    schemaManager = providerServer.getDirectoryService().getSchemaManager();
> +                    providerSession = providerServer.getDirectoryService().getAdminSession();
>                 }
>                 catch( Exception e )
>                 {
> @@ -274,6 +293,7 @@ public class ClientServerReplicationIT
>         Thread t = new Thread( r );
>         t.setDaemon( true );
>         t.start();
> +        t.join();
>     }
> 
> 
> @@ -325,6 +345,7 @@ public class ClientServerReplicationIT
>                 try
>                 {
>                     consumerServer.start();
> +                    
>                     DirectoryService ds = consumerServer.getDirectoryService();
> 
>                     Dn configDn = new Dn( ds.getSchemaManager(), "ads-replProviderId=localhost,ou=system" );
> @@ -347,7 +368,8 @@ public class ClientServerReplicationIT
>                     provConfigEntry.add( "ads-replUserDn", config.getReplUserDn() );
>                     provConfigEntry.add( "ads-replUserPassword", config.getReplUserPassword() );
> 
> -                    ds.getAdminSession().add( provConfigEntry );
> +                    consumerSession = consumerServer.getDirectoryService().getAdminSession();
> +                    consumerSession.add( provConfigEntry );
>                 }
>                 catch( Exception e )
>                 {
> @@ -359,5 +381,6 @@ public class ClientServerReplicationIT
>         Thread t = new Thread( r );
>         t.setDaemon( true );
>         t.start();
> +        t.join();
>     }
> }
> 
> 


Re: svn commit: r1129134 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
That's fixed!

Thanks Kiran.

Regards,
Pierre-Arnaud


On 31 mai 2011, at 13:25, Kiran Ayyagari wrote:

> Have increased the sleep time and committed, let me know if the issue
> is still there
> 
> On Tue, May 31, 2011 at 2:18 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net> wrote:
>> Yeah, that's what I thought too looking quickly at the code.
>> 
>> Tell me if I can be of any help (because I guess, you're not having it fail on your machine).
>> 
>> Regards,
>> Pierre-Arnaud
>> 
>> On 31 mai 2011, at 10:30, Kiran Ayyagari wrote:
>> 
>>> Yeah, Emmanuel had the same issue yesterday, looks like a timing
>>> issue, will fix it
>>> 
>>> On Tue, May 31, 2011 at 1:30 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net> wrote:
>>>> Hi Kiran,
>>>> 
>>>> Looks like this test does not pass here (tested this under two different machines).
>>>> 
>>>> Here's the output:
>>>>> Tests in error:
>>>>>   testRebootConsumer(org.apache.directory.server.replication.ClientServerReplicationIT): Attempt to lookup non-existant entry: cn=user5,dc=example,dc=com
>>>>> 
>>>>> Tests run: 303, Failures: 0, Errors: 1, Skipped: 5
>>>> 
>>>> 
>>>> Regards,
>>>> Pierre-Arnaud
>>>> 
>>>> On 30 mai 2011, at 13:59, kayyagari@apache.org wrote:
>>>> 
>>>>> Author: kayyagari
>>>>> Date: Mon May 30 11:59:34 2011
>>>>> New Revision: 1129134
>>>>> 
>>>>> URL: http://svn.apache.org/viewvc?rev=1129134&view=rev
>>>>> Log:
>>>>> o added a test to check the replication of data to the client when the client goes offline and reboots after some activity on the master server
>>>>> 
>>>>> Modified:
>>>>>    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>>>> 
>>>>> Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1129134&r1=1129133&r2=1129134&view=diff
>>>>> ==============================================================================
>>>>> --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java (original)
>>>>> +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java Mon May 30 11:59:34 2011
>>>>> @@ -67,11 +67,11 @@ public class ClientServerReplicationIT
>>>>> 
>>>>>     private static LdapServer consumerServer;
>>>>> 
>>>>> -    private SchemaManager schemaManager;
>>>>> +    private static SchemaManager schemaManager;
>>>>> 
>>>>> -    private CoreSession providerSession;
>>>>> +    private static CoreSession providerSession;
>>>>> 
>>>>> -    private CoreSession consumerSession;
>>>>> +    private static CoreSession consumerSession;
>>>>> 
>>>>>     private static AtomicInteger entryCount = new AtomicInteger();
>>>>> 
>>>>> @@ -93,15 +93,6 @@ public class ClientServerReplicationIT
>>>>>     }
>>>>> 
>>>>> 
>>>>> -    @Before
>>>>> -    public void accessFields()
>>>>> -    {
>>>>> -        schemaManager = providerServer.getDirectoryService().getSchemaManager();
>>>>> -        providerSession = providerServer.getDirectoryService().getAdminSession();
>>>>> -        consumerSession = consumerServer.getDirectoryService().getAdminSession();
>>>>> -    }
>>>>> -
>>>>> -
>>>>>     @Test
>>>>>     public void testInjectContextEntry() throws Exception
>>>>>     {
>>>>> @@ -202,6 +193,32 @@ public class ClientServerReplicationIT
>>>>>     }
>>>>> 
>>>>> 
>>>>> +    @Test
>>>>> +    public void testRebootConsumer() throws Exception
>>>>> +    {
>>>>> +        Entry provUser = createEntry();
>>>>> +
>>>>> +        providerSession.add( provUser );
>>>>> +
>>>>> +        waitAndCompareEntries( provUser.getDn() );
>>>>> +
>>>>> +        consumerServer.stop();
>>>>> +
>>>>> +        Dn deletedUserDn = provUser.getDn();
>>>>> +        providerSession.delete( deletedUserDn );
>>>>> +
>>>>> +        provUser = createEntry();
>>>>> +        Dn addedUserDn = provUser.getDn();
>>>>> +        providerSession.add( provUser );
>>>>> +
>>>>> +        startConsumer();
>>>>> +
>>>>> +        Thread.sleep( 2000 );
>>>>> +        assertFalse( consumerSession.exists( deletedUserDn ) );
>>>>> +        waitAndCompareEntries( addedUserDn );
>>>>> +    }
>>>>> +
>>>>> +
>>>>>     private void waitAndCompareEntries( Dn dn ) throws Exception
>>>>>     {
>>>>>         // sleep for 2 sec (twice the refresh interval), just to let the first refresh request succeed
>>>>> @@ -263,6 +280,8 @@ public class ClientServerReplicationIT
>>>>>                 try
>>>>>                 {
>>>>>                     providerServer.start();
>>>>> +                    schemaManager = providerServer.getDirectoryService().getSchemaManager();
>>>>> +                    providerSession = providerServer.getDirectoryService().getAdminSession();
>>>>>                 }
>>>>>                 catch( Exception e )
>>>>>                 {
>>>>> @@ -274,6 +293,7 @@ public class ClientServerReplicationIT
>>>>>         Thread t = new Thread( r );
>>>>>         t.setDaemon( true );
>>>>>         t.start();
>>>>> +        t.join();
>>>>>     }
>>>>> 
>>>>> 
>>>>> @@ -325,6 +345,7 @@ public class ClientServerReplicationIT
>>>>>                 try
>>>>>                 {
>>>>>                     consumerServer.start();
>>>>> +
>>>>>                     DirectoryService ds = consumerServer.getDirectoryService();
>>>>> 
>>>>>                     Dn configDn = new Dn( ds.getSchemaManager(), "ads-replProviderId=localhost,ou=system" );
>>>>> @@ -347,7 +368,8 @@ public class ClientServerReplicationIT
>>>>>                     provConfigEntry.add( "ads-replUserDn", config.getReplUserDn() );
>>>>>                     provConfigEntry.add( "ads-replUserPassword", config.getReplUserPassword() );
>>>>> 
>>>>> -                    ds.getAdminSession().add( provConfigEntry );
>>>>> +                    consumerSession = consumerServer.getDirectoryService().getAdminSession();
>>>>> +                    consumerSession.add( provConfigEntry );
>>>>>                 }
>>>>>                 catch( Exception e )
>>>>>                 {
>>>>> @@ -359,5 +381,6 @@ public class ClientServerReplicationIT
>>>>>         Thread t = new Thread( r );
>>>>>         t.setDaemon( true );
>>>>>         t.start();
>>>>> +        t.join();
>>>>>     }
>>>>> }
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Kiran Ayyagari
>> 
>> 
> 
> 
> 
> -- 
> Kiran Ayyagari


Re: svn commit: r1129134 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java

Posted by Kiran Ayyagari <ka...@apache.org>.
Have increased the sleep time and committed, let me know if the issue
is still there

On Tue, May 31, 2011 at 2:18 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net> wrote:
> Yeah, that's what I thought too looking quickly at the code.
>
> Tell me if I can be of any help (because I guess, you're not having it fail on your machine).
>
> Regards,
> Pierre-Arnaud
>
> On 31 mai 2011, at 10:30, Kiran Ayyagari wrote:
>
>> Yeah, Emmanuel had the same issue yesterday, looks like a timing
>> issue, will fix it
>>
>> On Tue, May 31, 2011 at 1:30 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net> wrote:
>>> Hi Kiran,
>>>
>>> Looks like this test does not pass here (tested this under two different machines).
>>>
>>> Here's the output:
>>>> Tests in error:
>>>>   testRebootConsumer(org.apache.directory.server.replication.ClientServerReplicationIT): Attempt to lookup non-existant entry: cn=user5,dc=example,dc=com
>>>>
>>>> Tests run: 303, Failures: 0, Errors: 1, Skipped: 5
>>>
>>>
>>> Regards,
>>> Pierre-Arnaud
>>>
>>> On 30 mai 2011, at 13:59, kayyagari@apache.org wrote:
>>>
>>>> Author: kayyagari
>>>> Date: Mon May 30 11:59:34 2011
>>>> New Revision: 1129134
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1129134&view=rev
>>>> Log:
>>>> o added a test to check the replication of data to the client when the client goes offline and reboots after some activity on the master server
>>>>
>>>> Modified:
>>>>    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>>>
>>>> Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1129134&r1=1129133&r2=1129134&view=diff
>>>> ==============================================================================
>>>> --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java (original)
>>>> +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java Mon May 30 11:59:34 2011
>>>> @@ -67,11 +67,11 @@ public class ClientServerReplicationIT
>>>>
>>>>     private static LdapServer consumerServer;
>>>>
>>>> -    private SchemaManager schemaManager;
>>>> +    private static SchemaManager schemaManager;
>>>>
>>>> -    private CoreSession providerSession;
>>>> +    private static CoreSession providerSession;
>>>>
>>>> -    private CoreSession consumerSession;
>>>> +    private static CoreSession consumerSession;
>>>>
>>>>     private static AtomicInteger entryCount = new AtomicInteger();
>>>>
>>>> @@ -93,15 +93,6 @@ public class ClientServerReplicationIT
>>>>     }
>>>>
>>>>
>>>> -    @Before
>>>> -    public void accessFields()
>>>> -    {
>>>> -        schemaManager = providerServer.getDirectoryService().getSchemaManager();
>>>> -        providerSession = providerServer.getDirectoryService().getAdminSession();
>>>> -        consumerSession = consumerServer.getDirectoryService().getAdminSession();
>>>> -    }
>>>> -
>>>> -
>>>>     @Test
>>>>     public void testInjectContextEntry() throws Exception
>>>>     {
>>>> @@ -202,6 +193,32 @@ public class ClientServerReplicationIT
>>>>     }
>>>>
>>>>
>>>> +    @Test
>>>> +    public void testRebootConsumer() throws Exception
>>>> +    {
>>>> +        Entry provUser = createEntry();
>>>> +
>>>> +        providerSession.add( provUser );
>>>> +
>>>> +        waitAndCompareEntries( provUser.getDn() );
>>>> +
>>>> +        consumerServer.stop();
>>>> +
>>>> +        Dn deletedUserDn = provUser.getDn();
>>>> +        providerSession.delete( deletedUserDn );
>>>> +
>>>> +        provUser = createEntry();
>>>> +        Dn addedUserDn = provUser.getDn();
>>>> +        providerSession.add( provUser );
>>>> +
>>>> +        startConsumer();
>>>> +
>>>> +        Thread.sleep( 2000 );
>>>> +        assertFalse( consumerSession.exists( deletedUserDn ) );
>>>> +        waitAndCompareEntries( addedUserDn );
>>>> +    }
>>>> +
>>>> +
>>>>     private void waitAndCompareEntries( Dn dn ) throws Exception
>>>>     {
>>>>         // sleep for 2 sec (twice the refresh interval), just to let the first refresh request succeed
>>>> @@ -263,6 +280,8 @@ public class ClientServerReplicationIT
>>>>                 try
>>>>                 {
>>>>                     providerServer.start();
>>>> +                    schemaManager = providerServer.getDirectoryService().getSchemaManager();
>>>> +                    providerSession = providerServer.getDirectoryService().getAdminSession();
>>>>                 }
>>>>                 catch( Exception e )
>>>>                 {
>>>> @@ -274,6 +293,7 @@ public class ClientServerReplicationIT
>>>>         Thread t = new Thread( r );
>>>>         t.setDaemon( true );
>>>>         t.start();
>>>> +        t.join();
>>>>     }
>>>>
>>>>
>>>> @@ -325,6 +345,7 @@ public class ClientServerReplicationIT
>>>>                 try
>>>>                 {
>>>>                     consumerServer.start();
>>>> +
>>>>                     DirectoryService ds = consumerServer.getDirectoryService();
>>>>
>>>>                     Dn configDn = new Dn( ds.getSchemaManager(), "ads-replProviderId=localhost,ou=system" );
>>>> @@ -347,7 +368,8 @@ public class ClientServerReplicationIT
>>>>                     provConfigEntry.add( "ads-replUserDn", config.getReplUserDn() );
>>>>                     provConfigEntry.add( "ads-replUserPassword", config.getReplUserPassword() );
>>>>
>>>> -                    ds.getAdminSession().add( provConfigEntry );
>>>> +                    consumerSession = consumerServer.getDirectoryService().getAdminSession();
>>>> +                    consumerSession.add( provConfigEntry );
>>>>                 }
>>>>                 catch( Exception e )
>>>>                 {
>>>> @@ -359,5 +381,6 @@ public class ClientServerReplicationIT
>>>>         Thread t = new Thread( r );
>>>>         t.setDaemon( true );
>>>>         t.start();
>>>> +        t.join();
>>>>     }
>>>> }
>>>>
>>>>
>>>
>>>
>>
>>
>>
>> --
>> Kiran Ayyagari
>
>



-- 
Kiran Ayyagari

Re: svn commit: r1129134 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Yeah, that's what I thought too looking quickly at the code.

Tell me if I can be of any help (because I guess, you're not having it fail on your machine).

Regards,
Pierre-Arnaud

On 31 mai 2011, at 10:30, Kiran Ayyagari wrote:

> Yeah, Emmanuel had the same issue yesterday, looks like a timing
> issue, will fix it
> 
> On Tue, May 31, 2011 at 1:30 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net> wrote:
>> Hi Kiran,
>> 
>> Looks like this test does not pass here (tested this under two different machines).
>> 
>> Here's the output:
>>> Tests in error:
>>>   testRebootConsumer(org.apache.directory.server.replication.ClientServerReplicationIT): Attempt to lookup non-existant entry: cn=user5,dc=example,dc=com
>>> 
>>> Tests run: 303, Failures: 0, Errors: 1, Skipped: 5
>> 
>> 
>> Regards,
>> Pierre-Arnaud
>> 
>> On 30 mai 2011, at 13:59, kayyagari@apache.org wrote:
>> 
>>> Author: kayyagari
>>> Date: Mon May 30 11:59:34 2011
>>> New Revision: 1129134
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1129134&view=rev
>>> Log:
>>> o added a test to check the replication of data to the client when the client goes offline and reboots after some activity on the master server
>>> 
>>> Modified:
>>>    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>> 
>>> Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1129134&r1=1129133&r2=1129134&view=diff
>>> ==============================================================================
>>> --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java (original)
>>> +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java Mon May 30 11:59:34 2011
>>> @@ -67,11 +67,11 @@ public class ClientServerReplicationIT
>>> 
>>>     private static LdapServer consumerServer;
>>> 
>>> -    private SchemaManager schemaManager;
>>> +    private static SchemaManager schemaManager;
>>> 
>>> -    private CoreSession providerSession;
>>> +    private static CoreSession providerSession;
>>> 
>>> -    private CoreSession consumerSession;
>>> +    private static CoreSession consumerSession;
>>> 
>>>     private static AtomicInteger entryCount = new AtomicInteger();
>>> 
>>> @@ -93,15 +93,6 @@ public class ClientServerReplicationIT
>>>     }
>>> 
>>> 
>>> -    @Before
>>> -    public void accessFields()
>>> -    {
>>> -        schemaManager = providerServer.getDirectoryService().getSchemaManager();
>>> -        providerSession = providerServer.getDirectoryService().getAdminSession();
>>> -        consumerSession = consumerServer.getDirectoryService().getAdminSession();
>>> -    }
>>> -
>>> -
>>>     @Test
>>>     public void testInjectContextEntry() throws Exception
>>>     {
>>> @@ -202,6 +193,32 @@ public class ClientServerReplicationIT
>>>     }
>>> 
>>> 
>>> +    @Test
>>> +    public void testRebootConsumer() throws Exception
>>> +    {
>>> +        Entry provUser = createEntry();
>>> +
>>> +        providerSession.add( provUser );
>>> +
>>> +        waitAndCompareEntries( provUser.getDn() );
>>> +
>>> +        consumerServer.stop();
>>> +
>>> +        Dn deletedUserDn = provUser.getDn();
>>> +        providerSession.delete( deletedUserDn );
>>> +
>>> +        provUser = createEntry();
>>> +        Dn addedUserDn = provUser.getDn();
>>> +        providerSession.add( provUser );
>>> +
>>> +        startConsumer();
>>> +
>>> +        Thread.sleep( 2000 );
>>> +        assertFalse( consumerSession.exists( deletedUserDn ) );
>>> +        waitAndCompareEntries( addedUserDn );
>>> +    }
>>> +
>>> +
>>>     private void waitAndCompareEntries( Dn dn ) throws Exception
>>>     {
>>>         // sleep for 2 sec (twice the refresh interval), just to let the first refresh request succeed
>>> @@ -263,6 +280,8 @@ public class ClientServerReplicationIT
>>>                 try
>>>                 {
>>>                     providerServer.start();
>>> +                    schemaManager = providerServer.getDirectoryService().getSchemaManager();
>>> +                    providerSession = providerServer.getDirectoryService().getAdminSession();
>>>                 }
>>>                 catch( Exception e )
>>>                 {
>>> @@ -274,6 +293,7 @@ public class ClientServerReplicationIT
>>>         Thread t = new Thread( r );
>>>         t.setDaemon( true );
>>>         t.start();
>>> +        t.join();
>>>     }
>>> 
>>> 
>>> @@ -325,6 +345,7 @@ public class ClientServerReplicationIT
>>>                 try
>>>                 {
>>>                     consumerServer.start();
>>> +
>>>                     DirectoryService ds = consumerServer.getDirectoryService();
>>> 
>>>                     Dn configDn = new Dn( ds.getSchemaManager(), "ads-replProviderId=localhost,ou=system" );
>>> @@ -347,7 +368,8 @@ public class ClientServerReplicationIT
>>>                     provConfigEntry.add( "ads-replUserDn", config.getReplUserDn() );
>>>                     provConfigEntry.add( "ads-replUserPassword", config.getReplUserPassword() );
>>> 
>>> -                    ds.getAdminSession().add( provConfigEntry );
>>> +                    consumerSession = consumerServer.getDirectoryService().getAdminSession();
>>> +                    consumerSession.add( provConfigEntry );
>>>                 }
>>>                 catch( Exception e )
>>>                 {
>>> @@ -359,5 +381,6 @@ public class ClientServerReplicationIT
>>>         Thread t = new Thread( r );
>>>         t.setDaemon( true );
>>>         t.start();
>>> +        t.join();
>>>     }
>>> }
>>> 
>>> 
>> 
>> 
> 
> 
> 
> -- 
> Kiran Ayyagari


Re: svn commit: r1129134 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java

Posted by Kiran Ayyagari <ka...@apache.org>.
Yeah, Emmanuel had the same issue yesterday, looks like a timing
issue, will fix it

On Tue, May 31, 2011 at 1:30 PM, Pierre-Arnaud Marcelot <pa...@marcelot.net> wrote:
> Hi Kiran,
>
> Looks like this test does not pass here (tested this under two different machines).
>
> Here's the output:
>> Tests in error:
>>   testRebootConsumer(org.apache.directory.server.replication.ClientServerReplicationIT): Attempt to lookup non-existant entry: cn=user5,dc=example,dc=com
>>
>> Tests run: 303, Failures: 0, Errors: 1, Skipped: 5
>
>
> Regards,
> Pierre-Arnaud
>
> On 30 mai 2011, at 13:59, kayyagari@apache.org wrote:
>
>> Author: kayyagari
>> Date: Mon May 30 11:59:34 2011
>> New Revision: 1129134
>>
>> URL: http://svn.apache.org/viewvc?rev=1129134&view=rev
>> Log:
>> o added a test to check the replication of data to the client when the client goes offline and reboots after some activity on the master server
>>
>> Modified:
>>    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>>
>> Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1129134&r1=1129133&r2=1129134&view=diff
>> ==============================================================================
>> --- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java (original)
>> +++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java Mon May 30 11:59:34 2011
>> @@ -67,11 +67,11 @@ public class ClientServerReplicationIT
>>
>>     private static LdapServer consumerServer;
>>
>> -    private SchemaManager schemaManager;
>> +    private static SchemaManager schemaManager;
>>
>> -    private CoreSession providerSession;
>> +    private static CoreSession providerSession;
>>
>> -    private CoreSession consumerSession;
>> +    private static CoreSession consumerSession;
>>
>>     private static AtomicInteger entryCount = new AtomicInteger();
>>
>> @@ -93,15 +93,6 @@ public class ClientServerReplicationIT
>>     }
>>
>>
>> -    @Before
>> -    public void accessFields()
>> -    {
>> -        schemaManager = providerServer.getDirectoryService().getSchemaManager();
>> -        providerSession = providerServer.getDirectoryService().getAdminSession();
>> -        consumerSession = consumerServer.getDirectoryService().getAdminSession();
>> -    }
>> -
>> -
>>     @Test
>>     public void testInjectContextEntry() throws Exception
>>     {
>> @@ -202,6 +193,32 @@ public class ClientServerReplicationIT
>>     }
>>
>>
>> +    @Test
>> +    public void testRebootConsumer() throws Exception
>> +    {
>> +        Entry provUser = createEntry();
>> +
>> +        providerSession.add( provUser );
>> +
>> +        waitAndCompareEntries( provUser.getDn() );
>> +
>> +        consumerServer.stop();
>> +
>> +        Dn deletedUserDn = provUser.getDn();
>> +        providerSession.delete( deletedUserDn );
>> +
>> +        provUser = createEntry();
>> +        Dn addedUserDn = provUser.getDn();
>> +        providerSession.add( provUser );
>> +
>> +        startConsumer();
>> +
>> +        Thread.sleep( 2000 );
>> +        assertFalse( consumerSession.exists( deletedUserDn ) );
>> +        waitAndCompareEntries( addedUserDn );
>> +    }
>> +
>> +
>>     private void waitAndCompareEntries( Dn dn ) throws Exception
>>     {
>>         // sleep for 2 sec (twice the refresh interval), just to let the first refresh request succeed
>> @@ -263,6 +280,8 @@ public class ClientServerReplicationIT
>>                 try
>>                 {
>>                     providerServer.start();
>> +                    schemaManager = providerServer.getDirectoryService().getSchemaManager();
>> +                    providerSession = providerServer.getDirectoryService().getAdminSession();
>>                 }
>>                 catch( Exception e )
>>                 {
>> @@ -274,6 +293,7 @@ public class ClientServerReplicationIT
>>         Thread t = new Thread( r );
>>         t.setDaemon( true );
>>         t.start();
>> +        t.join();
>>     }
>>
>>
>> @@ -325,6 +345,7 @@ public class ClientServerReplicationIT
>>                 try
>>                 {
>>                     consumerServer.start();
>> +
>>                     DirectoryService ds = consumerServer.getDirectoryService();
>>
>>                     Dn configDn = new Dn( ds.getSchemaManager(), "ads-replProviderId=localhost,ou=system" );
>> @@ -347,7 +368,8 @@ public class ClientServerReplicationIT
>>                     provConfigEntry.add( "ads-replUserDn", config.getReplUserDn() );
>>                     provConfigEntry.add( "ads-replUserPassword", config.getReplUserPassword() );
>>
>> -                    ds.getAdminSession().add( provConfigEntry );
>> +                    consumerSession = consumerServer.getDirectoryService().getAdminSession();
>> +                    consumerSession.add( provConfigEntry );
>>                 }
>>                 catch( Exception e )
>>                 {
>> @@ -359,5 +381,6 @@ public class ClientServerReplicationIT
>>         Thread t = new Thread( r );
>>         t.setDaemon( true );
>>         t.start();
>> +        t.join();
>>     }
>> }
>>
>>
>
>



-- 
Kiran Ayyagari