Search in sources :

Example 6 with ServerProperties

use of com.faforever.server.config.ServerProperties in project faf-java-server by FAForever.

the class GameServiceTest method setUp.

@Before
public void setUp() throws Exception {
    MapVersion map = new MapVersion();
    map.setRanked(true);
    player1 = new Player();
    player1.setId(1);
    player1.setLogin(PLAYER_NAME_1);
    player2 = new Player();
    player2.setId(2);
    player2.setLogin(PLAYER_NAME_2);
    FeaturedMod fafFeaturedMod = new FeaturedMod();
    fafFeaturedMod.setTechnicalName(FAF_TECHNICAL_NAME);
    when(gameRepository.findMaxId()).thenReturn(Optional.empty());
    when(mapService.findMap(anyString())).thenReturn(Optional.empty());
    when(mapService.findMap(MAP_NAME)).thenReturn(Optional.of(map));
    when(modService.getFeaturedMod(FAF_TECHNICAL_NAME)).thenReturn(Optional.of(fafFeaturedMod));
    when(playerService.getOnlinePlayer(anyInt())).thenReturn(Optional.empty());
    doAnswer(invocation -> invocation.getArgumentAt(0, Player.class).setGlobalRating(new GlobalRating())).when(ratingService).initGlobalRating(any());
    serverProperties = new ServerProperties();
    serverProperties.getGame().setRankedMinTimeMultiplicator(-10000);
    instance = new GameService(gameRepository, counterService, clientService, mapService, modService, playerService, ratingService, serverProperties, divisionService, entityManager, armyStatisticsService);
    instance.onApplicationEvent(null);
}
Also used : Player(com.faforever.server.entity.Player) ServerProperties(com.faforever.server.config.ServerProperties) GlobalRating(com.faforever.server.entity.GlobalRating) MapVersion(com.faforever.server.entity.MapVersion) FeaturedMod(com.faforever.server.entity.FeaturedMod) Before(org.junit.Before)

Example 7 with ServerProperties

use of com.faforever.server.config.ServerProperties in project faf-java-server by FAForever.

the class GeoIpServiceTest method setUp.

@Before
public void setUp() throws Exception {
    Path databaseFile = temporaryFolder.getRoot().toPath().resolve("cache.mmdb");
    assertThat(Files.exists(databaseFile), is(false));
    ServerProperties properties = new ServerProperties();
    GeoIp geoIp = properties.getGeoIp();
    geoIp.setDatabaseUrl(getClass().getResource("/geoip/GeoLite2-Country.mmdb.gz").toURI().toString());
    geoIp.setDatabaseFile(databaseFile);
    instance = new GeoIpService(properties);
    instance.postConstruct();
    assertThat(Files.exists(databaseFile), is(true));
}
Also used : Path(java.nio.file.Path) GeoIp(com.faforever.server.config.ServerProperties.GeoIp) ServerProperties(com.faforever.server.config.ServerProperties) Before(org.junit.Before)

Example 8 with ServerProperties

use of com.faforever.server.config.ServerProperties in project faf-java-server by FAForever.

the class CustomIceServersProviderTest method setUp.

@Before
public void setUp() throws Exception {
    properties = new ServerProperties();
    properties.getJwt().setSecret("banana");
    instance = new CustomIceServersProvider(properties, objectMapper);
}
Also used : ServerProperties(com.faforever.server.config.ServerProperties) Before(org.junit.Before)

Example 9 with ServerProperties

use of com.faforever.server.config.ServerProperties in project faf-java-server by FAForever.

the class ClientServiceTest method setUp.

@Before
public void setUp() throws Exception {
    serverProperties = new ServerProperties();
    clientConnection = new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class));
    player = new Player().setClientConnection(clientConnection);
    instance = new ClientService(clientGateway, coopService, serverProperties);
}
Also used : Player(com.faforever.server.entity.Player) ServerProperties(com.faforever.server.config.ServerProperties) Before(org.junit.Before)

Aggregations

ServerProperties (com.faforever.server.config.ServerProperties)9 Before (org.junit.Before)9 FeaturedMod (com.faforever.server.entity.FeaturedMod)2 MapVersion (com.faforever.server.entity.MapVersion)2 Player (com.faforever.server.entity.Player)2 Chat (com.faforever.server.config.ServerProperties.Chat)1 GeoIp (com.faforever.server.config.ServerProperties.GeoIp)1 Division (com.faforever.server.entity.Division)1 Game (com.faforever.server.entity.Game)1 GlobalRating (com.faforever.server.entity.GlobalRating)1 HardwareInformation (com.faforever.server.entity.HardwareInformation)1 PlayerDivisionInfo (com.faforever.server.entity.PlayerDivisionInfo)1 RatingService (com.faforever.server.rating.RatingService)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Path (java.nio.file.Path)1