Search in sources :

Example 1 with RehostRequestEvent

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));
}
Also used : RehostRequestEvent(com.faforever.client.fa.relay.event.RehostRequestEvent) Test(org.junit.Test) AbstractPlainJavaFxTest(com.faforever.client.test.AbstractPlainJavaFxTest)

Example 2 with RehostRequestEvent

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));
}
Also used : RehostRequestEvent(com.faforever.client.fa.relay.event.RehostRequestEvent) Test(org.junit.Test) AbstractPlainJavaFxTest(com.faforever.client.test.AbstractPlainJavaFxTest)

Example 3 with RehostRequestEvent

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);
}
Also used : GpgClientCommand(com.faforever.client.fa.relay.GpgClientCommand) RehostRequestEvent(com.faforever.client.fa.relay.event.RehostRequestEvent) GameFullEvent(com.faforever.client.fa.relay.event.GameFullEvent) GpgGameMessage(com.faforever.client.fa.relay.GpgGameMessage) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

RehostRequestEvent (com.faforever.client.fa.relay.event.RehostRequestEvent)3 AbstractPlainJavaFxTest (com.faforever.client.test.AbstractPlainJavaFxTest)2 Test (org.junit.Test)2 GpgClientCommand (com.faforever.client.fa.relay.GpgClientCommand)1 GpgGameMessage (com.faforever.client.fa.relay.GpgGameMessage)1 GameFullEvent (com.faforever.client.fa.relay.event.GameFullEvent)1 Subscribe (com.google.common.eventbus.Subscribe)1