use of com.faforever.server.security.FafUserDetails in project faf-java-server by FAForever.
the class PlayerServiceTest method onClientDisconnectRemovesPlayerAndUnsetsGameAndRemovesGameIfLastPlayer.
@Test
public void onClientDisconnectRemovesPlayerAndUnsetsGameAndRemovesGameIfLastPlayer() throws Exception {
FafUserDetails fafUserDetails = createFafUserDetails();
instance.setPlayerOnline(fafUserDetails.getPlayer());
assertThat(instance.getOnlinePlayer(player.getId()).isPresent(), is(true));
instance.removePlayer(fafUserDetails.getPlayer());
assertThat(instance.getOnlinePlayer(player.getId()).isPresent(), is(false));
}
use of com.faforever.server.security.FafUserDetails in project faf-java-server by FAForever.
the class PlayerServiceTest method createFafUserDetails.
private FafUserDetails createFafUserDetails() {
User user = new User();
user.setPassword("pw");
user.setLogin(player.getLogin());
user.setCountry("CH");
user.setPlayer(player);
player.setClientConnection(new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class)));
return new FafUserDetails(user);
}
use of com.faforever.server.security.FafUserDetails in project faf-java-server by FAForever.
the class PlayerServiceTest method isPlayerOnline.
@Test
public void isPlayerOnline() {
FafUserDetails fafUserDetails = createFafUserDetails();
assertThat(instance.isPlayerOnline(fafUserDetails.getPlayer().getLogin()), is(false));
instance.setPlayerOnline(fafUserDetails.getPlayer());
assertThat(instance.isPlayerOnline(fafUserDetails.getPlayer().getLogin()), is(true));
}
use of com.faforever.server.security.FafUserDetails in project faf-java-server by FAForever.
the class SocialServiceActivatorsTest method setUp.
@Before
public void setUp() throws Exception {
player = (Player) new Player().setId(1);
clientConnection = new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class));
clientConnection.setAuthentication(new TestingAuthenticationToken(new FafUserDetails((User) new User().setPlayer(player).setPassword("pw").setLogin("JUnit")), null));
instance = new SocialServiceActivators(socialService);
}
use of com.faforever.server.security.FafUserDetails in project faf-java-server by FAForever.
the class SocialServiceTest method onAuthenticationSuccessNullRelations.
@Test
public void onAuthenticationSuccessNullRelations() throws Exception {
User user = (User) new User().setPlayer(new Player().setSocialRelations(null)).setPassword("pw").setLogin("junit");
FafUserDetails userDetails = new FafUserDetails(user);
instance.onPlayerOnlineEvent(new PlayerOnlineEvent(this, userDetails.getPlayer()));
verify(clientService, never()).sendSocialRelations(any(), any());
}
Aggregations