On 25.05.2013 15:04, Emmanuel Lécharny wrote:
> Le 5/25/13 2:01 PM, Stefan Seelmann a écrit :
>> On 25.05.2013 12:14, Emmanuel Lécharny wrote:
>>> The PasswordPolicy tests are expensive because they need to sleep to
>>> check some time condition. At this point, I'm wondering if it would not
>>> worth creating a separate module for it.
>> Hm, maybe we can avoid using the "real" time (via
>> System.currentTimeMillis) and use a "time provider" instead. By default
>> it obtails the system time. But for tests the returned time can be
>> modified according to the test needs. JodaTime for example has a
>> DateTimeUtils class with static accessors for getting and setting the
>> time. In other projects we used a TimeProvider interface with different
>> implementations for production and tests.
> 
> That would be an extremely useful thing. I think we can benefit from
> such an addition for the replication tests, especially those which are
> time dependents. We can even simuate some use cases that are time
> dependent this way.
> 

In the apacheds project we have 81 occurrences of Thread.sleep and 347
occurrences of System.currentTimeMillis. I can try to find some time
this weekend to find out if and how it can be used, starting with the PP
tests.

Kind Regards,
Stefan

Reply via email to