#674 PurgeService: Always register if purging, reduce code duplication

- Rename autoPurging to isPurging: we should always register if a purge task is in progress (regardless if autopurge or not) and deny any new requests
- Reduce the same logic being coded multiple times by calling through the methods
- DataSource: remove purgeBanned in favor of purgeRecords, both do exactly the same thing
This commit is contained in:
ljacqu
2016-06-16 22:52:11 +02:00
parent 94451647f3
commit 3629c51fc1
10 changed files with 61 additions and 135 deletions
@@ -5,13 +5,13 @@ import fr.xephi.authme.security.crypts.HashedPassword;
import org.junit.Test;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static fr.xephi.authme.AuthMeMatchers.equalToHash;
import static fr.xephi.authme.AuthMeMatchers.hasAuthBasicData;
import static fr.xephi.authme.AuthMeMatchers.hasAuthLocation;
import java.util.HashSet;
import java.util.Set;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
@@ -227,7 +227,7 @@ public abstract class AbstractDataSourceIntegrationTest {
assumeThat(dataSource.getAccountsRegistered(), equalTo(2));
// when
dataSource.purgeBanned(playersToDelete);
dataSource.purgeRecords(playersToDelete);
// then
assertThat(dataSource.getAccountsRegistered(), equalTo(1));