[ 
https://issues.apache.org/jira/browse/DIRSERVER-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Seelmann updated DIRSERVER-1847:
---------------------------------------

    Attachment: DIRSERVER-1847-api.patch
                DIRSERVER-1847-server.patch

I introduced a TimeProvider and made minimal changes for PasswordPolicyIT to 
use it. The good news is that the tests now run in 5 seconds instead of 60 
seconds :)

The DateUtils holds the default time provider in a static variable, a test can 
change the time provider via a static method. This has the advantage that only 
very few code had to be changed as the password policy code used the DateUtils 
class to determine the current time. The drawback is that when a test sets 
another time provider this is a global setting. The test must make sure to 
reset the time provider at the end of the test. And it won't be possible to run 
our test suite in parallel (what we currently don't do anyways) because 
parallel running tests may be impacted by the wrong time. 

A cleaner approach would be to inject the time provider into the unit under 
test (e.g. into the DirectoryService) but then more code has to be changed.

Thoughts?
                
> Introduce time provider for time dependent tests
> ------------------------------------------------
>
>                 Key: DIRSERVER-1847
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1847
>             Project: Directory ApacheDS
>          Issue Type: Test
>    Affects Versions: 2.0.0-M12
>            Reporter: Stefan Seelmann
>            Assignee: Stefan Seelmann
>             Fix For: 2.0.0-RC1
>
>         Attachments: DIRSERVER-1847-api.patch, DIRSERVER-1847-server.patch
>
>
> As discussed in 
> http://mail-archives.apache.org/mod_mbox/directory-dev/201305.mbox/%3C51A08EF4.6010502%40gmail.com%3E
>  we should introduce a time provider for time dependent tests so that they 
> don't have to sleep.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to