directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Seelmann (JIRA)" <>
Subject [jira] [Updated] (DIRSERVER-1847) Introduce time provider for time dependent tests
Date Sun, 26 May 2013 08:27:20 GMT


Stefan Seelmann updated DIRSERVER-1847:

    Attachment: DIRSERVER-1847-api.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.

> Introduce time provider for time dependent tests
> ------------------------------------------------
>                 Key: DIRSERVER-1847
>                 URL:
>             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
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:

View raw message