fix tests
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
This commit is contained in:
parent
b5e8664ad3
commit
e5e3503abc
@ -9,19 +9,23 @@ import java.util.UUID;
|
|||||||
/**
|
/**
|
||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
@Getter
|
||||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
|
||||||
@ToString
|
@ToString
|
||||||
@RedisHash(value = "playerName", timeToLive = 60L * 60L * 6) // 6 hours (in seconds)
|
@RedisHash(value = "playerName", timeToLive = 60L * 60L * 6) // 6 hours (in seconds)
|
||||||
public final class CachedPlayerName {
|
public final class CachedPlayerName extends CachedResponse {
|
||||||
/**
|
/**
|
||||||
* The username of the player.
|
* The username of the player.
|
||||||
*/
|
*/
|
||||||
@Id @NonNull private String username;
|
@Id private final String username;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique id of the player.
|
* The unique id of the player.
|
||||||
*/
|
*/
|
||||||
@NonNull private UUID uniqueId;
|
private final UUID uniqueId;
|
||||||
|
|
||||||
|
public CachedPlayerName(String username, UUID uniqueId) {
|
||||||
|
super(CacheInformation.defaultCache());
|
||||||
|
this.username = username;
|
||||||
|
this.uniqueId = uniqueId;
|
||||||
|
}
|
||||||
}
|
}
|
@ -115,6 +115,7 @@ public class PlayerService {
|
|||||||
CachedPlayerName player = new CachedPlayerName(username, uuid);
|
CachedPlayerName player = new CachedPlayerName(username, uuid);
|
||||||
playerNameCacheRepository.save(player);
|
playerNameCacheRepository.save(player);
|
||||||
log.info("Got UUID from username: {} -> {}", username, uuid);
|
log.info("Got UUID from username: {} -> {}", username, uuid);
|
||||||
|
player.getCache().setCached(false);
|
||||||
return player;
|
return player;
|
||||||
} catch (RateLimitException exception) {
|
} catch (RateLimitException exception) {
|
||||||
throw new MojangAPIRateLimitException();
|
throw new MojangAPIRateLimitException();
|
||||||
|
@ -48,8 +48,8 @@ class PlayerControllerTests {
|
|||||||
.accept(MediaType.APPLICATION_JSON)
|
.accept(MediaType.APPLICATION_JSON)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.player.username").value(testPlayer))
|
.andExpect(jsonPath("$.username").value(testPlayer))
|
||||||
.andExpect(jsonPath("$.player.uniqueId").value(testPlayerUuid));
|
.andExpect(jsonPath("$.uniqueId").value(testPlayerUuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user