#886 Do not include players with lastlogin = 0 in autopurge or default purge

This commit is contained in:
ljacqu
2016-09-18 16:49:34 +02:00
parent 405bd563d8
commit ff9f50f63f
12 changed files with 97 additions and 54 deletions
@@ -328,14 +328,16 @@ public abstract class AbstractDataSourceIntegrationTest {
public void shouldGetRecordsToPurge() {
// given
DataSource dataSource = getDataSource();
// 1453242857 -> user, 1449136800 -> bobby
PlayerAuth auth = PlayerAuth.builder().name("potato").lastLogin(0).build();
dataSource.saveAuth(auth);
// 1453242857 -> user, 1449136800 -> bobby, 0 -> potato
// when
Set<String> records1 = dataSource.getRecordsToPurge(1450000000);
Set<String> records2 = dataSource.getRecordsToPurge(1460000000);
Set<String> records1 = dataSource.getRecordsToPurge(1450000000, true);
Set<String> records2 = dataSource.getRecordsToPurge(1460000000, false);
// then
assertThat(records1, contains("bobby"));
assertThat(records1, containsInAnyOrder("bobby", "potato"));
assertThat(records2, containsInAnyOrder("bobby", "user"));
// check that the entry was not deleted because of running this command
assertThat(dataSource.isAuthAvailable("bobby"), equalTo(true));
@@ -241,6 +241,7 @@ public abstract class AbstractResourceClosingTest {
.put(String.class, "test")
.put(int.class, 3)
.put(long.class, 102L)
.put(boolean.class, true)
.put(PlayerAuth.class, PlayerAuth.builder().name("test").realName("test").password(hash).build())
.put(HashedPassword.class, hash)
.build();