Search in sources :

Example 1 with MatchMakerCancelRequest

use of com.faforever.server.matchmaker.MatchMakerCancelRequest 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 2 with MatchMakerCancelRequest

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

the class V2ClientMessageTransformerTest method cancelMatchSearch.

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

Example 3 with MatchMakerCancelRequest

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

the class LegacyRequestTransformerTest method stopMatchMaking.

@Test
public void stopMatchMaking() throws Exception {
    MatchMakerCancelRequest result = (MatchMakerCancelRequest) instance.transform(ImmutableMap.of(KEY_COMMAND, "game_matchmaking", "mod", "ladder1v1", "state", "stop"));
    assertThat(result.getPoolName(), is("ladder1v1"));
}
Also used : MatchMakerCancelRequest(com.faforever.server.matchmaker.MatchMakerCancelRequest) Test(org.junit.Test)

Example 4 with MatchMakerCancelRequest

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

the class MatchMakerServiceActivatorTest method cancelSearch.

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

Aggregations

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