use of com.faforever.client.fa.relay.event.RehostRequestEvent in project downlords-faf-client by FAForever.
the class GameServiceImplTest method testRehostIfGameIsRunning.
@Test
public void testRehostIfGameIsRunning() throws Exception {
instance.gameRunning.set(true);
Game game = GameBuilder.create().defaultValues().get();
instance.currentGame.set(game);
instance.onRehostRequest(new RehostRequestEvent());
verify(forgedAllianceService, never()).startGame(anyInt(), any(), any(), any(), anyInt(), eq(LOCAL_REPLAY_PORT), anyBoolean(), eq(junitPlayer));
}
use of com.faforever.client.fa.relay.event.RehostRequestEvent in project downlords-faf-client by FAForever.
the class GameServiceImplTest method testRehostIfGameIsNotRunning.
@Test
public void testRehostIfGameIsNotRunning() throws Exception {
Game game = GameBuilder.create().defaultValues().get();
instance.currentGame.set(game);
when(modService.getFeaturedMod(game.getFeaturedMod())).thenReturn(CompletableFuture.completedFuture(FeaturedModBeanBuilder.create().defaultValues().get()));
when(gameUpdater.update(any(), any(), any(), any())).thenReturn(completedFuture(null));
when(fafService.requestHostGame(any())).thenReturn(completedFuture(GameLaunchMessageBuilder.create().defaultValues().get()));
when(modService.getFeaturedMod(game.getFeaturedMod())).thenReturn(CompletableFuture.completedFuture(FeaturedModBeanBuilder.create().defaultValues().get()));
when(mapService.download(game.getMapFolderName())).thenReturn(CompletableFuture.completedFuture(null));
instance.onRehostRequest(new RehostRequestEvent());
verify(forgedAllianceService).startGame(anyInt(), eq(null), anyListOf(String.class), eq(GLOBAL), anyInt(), eq(LOCAL_REPLAY_PORT), eq(true), eq(junitPlayer));
}
use of com.faforever.client.fa.relay.event.RehostRequestEvent in project downlords-faf-client by FAForever.
the class IceAdapterImpl method onGpgGameMessage.
@Subscribe
public void onGpgGameMessage(GpgGameMessageEvent event) {
GpgGameMessage gpgGameMessage = event.getGpgGameMessage();
GpgClientCommand command = gpgGameMessage.getCommand();
if (command == GpgClientCommand.REHOST) {
eventBus.post(new RehostRequestEvent());
return;
}
if (command == GpgClientCommand.GAME_FULL) {
eventBus.post(new GameFullEvent());
return;
}
fafService.sendGpgGameMessage(gpgGameMessage);
}
Aggregations