Search in sources :

Example 1 with StartGameProcessResponse

use of com.faforever.server.game.StartGameProcessResponse in project faf-java-server by FAForever.

the class ClientService method startGameProcess.

public void startGameProcess(Game game, Player player) {
    log.debug("Telling '{}' to start game process for game '{}'", game.getHost(), game);
    send(new StartGameProcessResponse(game.getFeaturedMod().getTechnicalName(), game.getId(), getCommandLineArgs(player)), player);
}
Also used : StartGameProcessResponse(com.faforever.server.game.StartGameProcessResponse)

Example 2 with StartGameProcessResponse

use of com.faforever.server.game.StartGameProcessResponse in project faf-java-server by FAForever.

the class V2ServerMessageTransformerTest method startGameProcess.

@Test
public void startGameProcess() throws Exception {
    String response = instance.transform(new StartGameProcessResponse("faf", 1, Arrays.asList("/foo", "/bar")));
    assertThat(response, is("{\"data\":{\"mod\":\"faf\",\"gameId\":1,\"commandLineArguments\":[\"/foo\",\"/bar\"]},\"type\":\"startGameProcess\"}"));
}
Also used : StartGameProcessResponse(com.faforever.server.game.StartGameProcessResponse) Test(org.junit.Test)

Example 3 with StartGameProcessResponse

use of com.faforever.server.game.StartGameProcessResponse in project faf-java-server by FAForever.

the class LaunchGameResponseTransformerTest method transform.

@Test
public void transform() throws Exception {
    Map<String, Serializable> result = LaunchGameResponseTransformer.INSTANCE.transform(new StartGameProcessResponse("faf", 4, Arrays.asList("/numgames", "4")));
    assertThat(result.get("command"), is("game_launch"));
    assertThat(result.get("mod"), is("faf"));
    assertThat(result.get("uid"), is(4));
    assertThat(result.get("args"), is(new String[] { "/numgames 4" }));
}
Also used : Serializable(java.io.Serializable) StartGameProcessResponse(com.faforever.server.game.StartGameProcessResponse) Test(org.junit.Test)

Example 4 with StartGameProcessResponse

use of com.faforever.server.game.StartGameProcessResponse in project faf-java-server by FAForever.

the class ClientServiceTest method startGameProcess.

@Test
public void startGameProcess() throws Exception {
    Game game = new Game().setId(1).setFeaturedMod(new FeaturedMod());
    instance.startGameProcess(game, player);
    ArgumentCaptor<StartGameProcessResponse> captor = ArgumentCaptor.forClass(StartGameProcessResponse.class);
    verify(clientGateway).send(captor.capture(), any());
    assertThat(captor.getValue().getGameId(), is(1));
}
Also used : Game(com.faforever.server.entity.Game) FeaturedMod(com.faforever.server.entity.FeaturedMod) StartGameProcessResponse(com.faforever.server.game.StartGameProcessResponse) Test(org.junit.Test)

Aggregations

StartGameProcessResponse (com.faforever.server.game.StartGameProcessResponse)4 Test (org.junit.Test)3 FeaturedMod (com.faforever.server.entity.FeaturedMod)1 Game (com.faforever.server.entity.Game)1 Serializable (java.io.Serializable)1