Search in sources :

Example 1 with ArmyScoreReport

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

the class V2ClientMessageTransformerTest method armyScore.

@Test
public void armyScore() throws Exception {
    ClientMessage result = instance.transform(write(new ArmyScoreClientMessage(1, 10)));
    assertThat(result, is(new ArmyScoreReport(1, 10)));
}
Also used : ArmyScoreReport(com.faforever.server.game.ArmyScoreReport) ClientMessage(com.faforever.server.common.ClientMessage) Test(org.junit.Test)

Example 2 with ArmyScoreReport

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

the class LegacyRequestTransformer method handleGameResult.

private ClientMessage handleGameResult(Map<String, Object> source) {
    List<Object> args;
    args = getArgs(source);
    int armyId = (int) args.get(0);
    String[] results = ((String) args.get(1)).split(" ");
    if ("score".equals(results[0])) {
        return new ArmyScoreReport(armyId, Integer.parseInt(results[1]));
    }
    Outcome outcome = Outcome.fromString(results[0]);
    return ArmyOutcomeReport.valueOf(armyId, outcome);
}
Also used : Outcome(com.faforever.server.game.Outcome) ArmyScoreReport(com.faforever.server.game.ArmyScoreReport)

Example 3 with ArmyScoreReport

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

the class GameServiceActivatorsTest method reportArmyScore.

@Test
public void reportArmyScore() throws Exception {
    instance.reportArmyScore(new ArmyScoreReport(1, 10), clientConnection.getAuthentication());
    verify(gameService).reportArmyScore(player, 1, 10);
}
Also used : ArmyScoreReport(com.faforever.server.game.ArmyScoreReport) Test(org.junit.Test)

Example 4 with ArmyScoreReport

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

the class LegacyRequestTransformerTest method transformGameResultToArmyScoreReport.

@Test
public void transformGameResultToArmyScoreReport() throws Exception {
    ArmyScoreReport armyScoreReport = (ArmyScoreReport) instance.transform(ImmutableMap.of(KEY_COMMAND, "GameResult", KEY_ARGS, Arrays.asList(1, "score 10")));
    assertThat(armyScoreReport, is(notNullValue()));
    assertThat(armyScoreReport.getArmyId(), is(1));
    assertThat(armyScoreReport.getScore(), is(10));
}
Also used : ArmyScoreReport(com.faforever.server.game.ArmyScoreReport) Test(org.junit.Test)

Aggregations

ArmyScoreReport (com.faforever.server.game.ArmyScoreReport)4 Test (org.junit.Test)3 ClientMessage (com.faforever.server.common.ClientMessage)1 Outcome (com.faforever.server.game.Outcome)1