use of com.faforever.server.client.ClientConnection 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.client.ClientConnection 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.client.ClientConnection in project faf-java-server by FAForever.
the class GameServiceTest method restoreGameSessionOpenGame.
@Test
public void restoreGameSessionOpenGame() throws Exception {
Game game = hostGame(player1);
assertThat(player2.getCurrentGame(), is(nullValue()));
instance.joinGame(game.getId(), game.getPassword(), player2);
assertThat(player2.getCurrentGame(), is(game));
assertThat(player2.getGameState(), is(PlayerGameState.INITIALIZING));
instance.updatePlayerGameState(PlayerGameState.LOBBY, player2);
instance.updatePlayerGameState(PlayerGameState.LAUNCHING, player2);
assertThat(player2.getGameState(), is(PlayerGameState.LAUNCHING));
ClientConnection clientConnection = new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class));
clientConnection.setAuthentication(new TestingAuthenticationToken(new FafUserDetails((User) new User().setPlayer(player2).setPassword("pw").setLogin("JUnit")), null));
player2.setClientConnection(clientConnection);
instance.removePlayer(player2);
assertThat(player2.getCurrentGame(), is(nullValue()));
assertThat(player2.getGameState(), is(PlayerGameState.NONE));
instance.restoreGameSession(player2, game.getId());
assertThat(player2.getCurrentGame(), is(game));
assertThat(player2.getGameState(), is(PlayerGameState.LOBBY));
}
use of com.faforever.server.client.ClientConnection in project faf-java-server by FAForever.
the class GameServiceTest method restoreGameSessionPlayingGame.
@Test
public void restoreGameSessionPlayingGame() throws Exception {
Game game = hostGame(player1);
instance.joinGame(game.getId(), game.getPassword(), player2);
assertThat(player2.getCurrentGame(), is(game));
instance.updatePlayerGameState(PlayerGameState.LOBBY, player2);
instance.updatePlayerGameState(PlayerGameState.LAUNCHING, player2);
assertThat(player2.getGameState(), is(PlayerGameState.LAUNCHING));
instance.updatePlayerGameState(PlayerGameState.LAUNCHING, player1);
ClientConnection clientConnection = new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class));
clientConnection.setAuthentication(new TestingAuthenticationToken(new FafUserDetails((User) new User().setPlayer(player2).setPassword("pw").setLogin("JUnit")), null));
player2.setClientConnection(clientConnection);
instance.removePlayer(player2);
assertThat(player2.getCurrentGame(), is(nullValue()));
assertThat(player2.getGameState(), is(PlayerGameState.NONE));
instance.restoreGameSession(player2, game.getId());
assertThat(player2.getCurrentGame(), is(game));
assertThat(player2.getGameState(), is(PlayerGameState.LAUNCHING));
}
use of com.faforever.server.client.ClientConnection in project faf-java-server by FAForever.
the class LegacyServicesActivatorsTest method setUp.
@Before
public void setUp() throws Exception {
clientConnection = new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class));
player = new Player();
player.setClientConnection(clientConnection);
when(geoIpService.lookupCountryCode(any())).thenReturn(Optional.empty());
instance = new LegacyServicesActivators(authenticationManager, clientService, uniqueIdService, geoIpService, playerService, chatService, counterService);
}
Aggregations