Search in sources :

Example 1 with MatchMakerSearchRequest

use of com.faforever.server.matchmaker.MatchMakerSearchRequest in project faf-java-server by FAForever.

the class V2ClientMessageTransformerTest method searchMatch.

@Test
public void searchMatch() throws Exception {
    ClientMessage result = instance.transform(write(new SearchMatchClientMessage(Faction.UEF, "ladder1v1")));
    assertThat(result, is(new MatchMakerSearchRequest(Faction.UEF, "ladder1v1")));
}
Also used : ClientMessage(com.faforever.server.common.ClientMessage) MatchMakerSearchRequest(com.faforever.server.matchmaker.MatchMakerSearchRequest) Test(org.junit.Test)

Example 2 with MatchMakerSearchRequest

use of com.faforever.server.matchmaker.MatchMakerSearchRequest in project faf-java-server by FAForever.

the class LegacyRequestTransformerTest method searchMatchMakingFactionString.

@Test
public void searchMatchMakingFactionString() throws Exception {
    MatchMakerSearchRequest result = (MatchMakerSearchRequest) instance.transform(ImmutableMap.of(KEY_COMMAND, "game_matchmaking", "mod", "ladder1v1", "faction", "seraphim", "state", "start"));
    assertThat(result.getPoolName(), is("ladder1v1"));
    assertThat(result.getFaction(), is(Faction.SERAPHIM));
}
Also used : MatchMakerSearchRequest(com.faforever.server.matchmaker.MatchMakerSearchRequest) Test(org.junit.Test)

Example 3 with MatchMakerSearchRequest

use of com.faforever.server.matchmaker.MatchMakerSearchRequest in project faf-java-server by FAForever.

the class LegacyRequestTransformerTest method searchMatchMakingFactionInteger.

@Test
public void searchMatchMakingFactionInteger() throws Exception {
    MatchMakerSearchRequest result = (MatchMakerSearchRequest) instance.transform(ImmutableMap.of(KEY_COMMAND, "game_matchmaking", "mod", "ladder1v1", "faction", Faction.SERAPHIM.toFaValue(), "state", "start"));
    assertThat(result.getPoolName(), is("ladder1v1"));
    assertThat(result.getFaction(), is(Faction.SERAPHIM));
}
Also used : MatchMakerSearchRequest(com.faforever.server.matchmaker.MatchMakerSearchRequest) Test(org.junit.Test)

Example 4 with MatchMakerSearchRequest

use of com.faforever.server.matchmaker.MatchMakerSearchRequest in project faf-java-server by FAForever.

the class LegacyRequestTransformer method handleMatchMaking.

private ClientMessage handleMatchMaking(Map<String, Object> source) {
    switch((String) source.get("state")) {
        case "stop":
            return new MatchMakerCancelRequest("ladder1v1");
        default:
            Object untypedFaction = source.get("faction");
            Faction faction;
            if (untypedFaction instanceof Number) {
                faction = Faction.fromFaValue(((Number) untypedFaction).intValue());
            } else {
                faction = Faction.fromString((String) untypedFaction);
            }
            return new MatchMakerSearchRequest(faction, "ladder1v1");
    }
}
Also used : MatchMakerCancelRequest(com.faforever.server.matchmaker.MatchMakerCancelRequest) MatchMakerSearchRequest(com.faforever.server.matchmaker.MatchMakerSearchRequest) Faction(com.faforever.server.game.Faction)

Example 5 with MatchMakerSearchRequest

use of com.faforever.server.matchmaker.MatchMakerSearchRequest in project faf-java-server by FAForever.

the class MatchMakerServiceActivatorTest method startSearch.

@Test
public void startSearch() throws Exception {
    instance.startSearch(new MatchMakerSearchRequest(Faction.CYBRAN, LADDER_1V1), authentication);
    verify(matchmakerService).submitSearch(player, Faction.CYBRAN, LADDER_1V1);
}
Also used : MatchMakerSearchRequest(com.faforever.server.matchmaker.MatchMakerSearchRequest) Test(org.junit.Test)

Aggregations

MatchMakerSearchRequest (com.faforever.server.matchmaker.MatchMakerSearchRequest)5 Test (org.junit.Test)4 ClientMessage (com.faforever.server.common.ClientMessage)1 Faction (com.faforever.server.game.Faction)1 MatchMakerCancelRequest (com.faforever.server.matchmaker.MatchMakerCancelRequest)1