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")));
}
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));
}
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));
}
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");
}
}
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);
}
Aggregations