Search in sources :

Example 1 with HostGameRequest

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

the class V2ClientMessageTransformerTest method hostGame.

@Test
public void hostGame() throws Exception {
    ClientMessage result = instance.transform(write(new HostGameClientMessage("scmp1", "Game", "faf", "123", GameVisibility.PUBLIC, 500, 900)));
    assertThat(result, is(new HostGameRequest("scmp1", "Game", "faf", "123", GameVisibility.PUBLIC, 500, 900)));
}
Also used : ClientMessage(com.faforever.server.common.ClientMessage) HostGameRequest(com.faforever.server.game.HostGameRequest) Test(org.junit.Test)

Example 2 with HostGameRequest

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

the class GameServiceActivatorsTest method hostGameRequest.

@Test
public void hostGameRequest() throws Exception {
    instance.hostGameRequest(new HostGameRequest("scmp01", "Title", "mod", "pw", GameVisibility.PUBLIC, 600, 900), clientConnection.getAuthentication());
    verify(gameService).createGame("Title", "mod", "scmp01", "pw", GameVisibility.PUBLIC, 600, 900, player);
}
Also used : HostGameRequest(com.faforever.server.game.HostGameRequest) Test(org.junit.Test)

Example 3 with HostGameRequest

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

the class LegacyRequestTransformerTest method transformHostGameRequest.

@Test
public void transformHostGameRequest() throws Exception {
    HostGameRequest hostGameRequest = (HostGameRequest) instance.transform(ImmutableMap.<String, Object>builder().put(KEY_COMMAND, "game_host").put("mapname", "SCMP_001").put("title", "Test").put("mod", "faf").put("access", "private").put("password", TEST_PASSWORD).put("visibility", "public").put("minRating", // Because JSON deserializes integer values to Double
    1000.0).put("maxRating", // Because JSON deserializes integer values to Double
    1500.0).build());
    assertThat(hostGameRequest, is(notNullValue()));
    assertThat(hostGameRequest.getMapName(), is("SCMP_001"));
    assertThat(hostGameRequest.getTitle(), is("Test"));
    assertThat(hostGameRequest.getMod(), is("faf"));
    assertThat(hostGameRequest.getPassword(), is(TEST_PASSWORD));
    assertThat(hostGameRequest.getVisibility(), is(GameVisibility.PUBLIC));
    assertThat(hostGameRequest.getMinRating(), is(1000));
    assertThat(hostGameRequest.getMaxRating(), is(1500));
}
Also used : HostGameRequest(com.faforever.server.game.HostGameRequest) Test(org.junit.Test)

Aggregations

HostGameRequest (com.faforever.server.game.HostGameRequest)3 Test (org.junit.Test)3 ClientMessage (com.faforever.server.common.ClientMessage)1