Search in sources :

Example 1 with ServerProperties

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

the class ChatServiceTest method setUp.

@Before
public void setUp() throws Exception {
    ServerProperties properties = new ServerProperties();
    Chat chat = properties.getChat();
    chat.setAdminChannels(Collections.singletonList("#admins"));
    chat.setModeratorChannels(Collections.singletonList("#moderators"));
    chat.setDefaultChannels(Arrays.asList("#foo", "#bar"));
    chat.setClanChannelFormat("#clan_%s");
    instance = new ChatService(nickCoreRepository, properties, clientService);
}
Also used : ServerProperties(com.faforever.server.config.ServerProperties) Chat(com.faforever.server.config.ServerProperties.Chat) Before(org.junit.Before)

Example 2 with ServerProperties

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

the class UniqueIdServiceTest method setUp.

@Before
public void setUp() throws Exception {
    player = newPlayer(51234);
    properties = new ServerProperties();
    properties.getUid().setEnabled(true);
    properties.getUid().setPrivateKey(PRIVATE_KEY);
    hardwareInformation = new HardwareInformation();
    hardwareInformation.setPlayers(new HashSet<>());
    when(hardwareInformationRepository.save(any(HardwareInformation.class))).thenAnswer(invocation -> invocation.getArgumentAt(0, HardwareInformation.class));
    instance = new UniqueIdService(properties, new ObjectMapper(), hardwareInformationRepository);
}
Also used : ServerProperties(com.faforever.server.config.ServerProperties) HardwareInformation(com.faforever.server.entity.HardwareInformation) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 3 with ServerProperties

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

the class SchemaVersionVerifierTest method setUp.

@Before
public void setUp() throws Exception {
    ServerProperties properties = new ServerProperties();
    properties.getDatabase().setSchemaVersion("1337");
    instance = new SchemaVersionVerifier(schemaVersionRepository, properties);
}
Also used : ServerProperties(com.faforever.server.config.ServerProperties) Before(org.junit.Before)

Example 4 with ServerProperties

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

the class DivisionServiceTest method setUp.

@Before
public void setUp() throws Exception {
    serverProperties = new ServerProperties();
    serverProperties.getLadder1v1().setSeason(1);
    info1 = new PlayerDivisionInfo();
    info1.setPlayer(player1);
    info1.setSeason(serverProperties.getLadder1v1().getSeason());
    info2 = new PlayerDivisionInfo();
    info2.setPlayer(player2);
    info2.setSeason(serverProperties.getLadder1v1().getSeason());
    Division[] divisions = new Division[] { createDivision(1, "League 1 - Division A", 1, 10), createDivision(2, "League 1 - Division B", 1, 30), createDivision(3, "League 1 - Division C", 1, 50), createDivision(4, "League 2 - Division D", 2, 20), createDivision(5, "League 2 - Division E", 2, 60), createDivision(6, "League 2 - Division F", 2, 100), createDivision(7, "League 3 - Division G", 3, 100), createDivision(8, "League 3 - Division H", 3, 200), createDivision(9, "League 3 - Division I", 3, 9999) };
    when(divisionRepository.findAllByOrderByLeagueAscThresholdAsc()).thenReturn(Arrays.asList(divisions));
    instance = new DivisionService(serverProperties, divisionRepository, playerDivisionInfoRepository);
    instance.init();
}
Also used : PlayerDivisionInfo(com.faforever.server.entity.PlayerDivisionInfo) ServerProperties(com.faforever.server.config.ServerProperties) Division(com.faforever.server.entity.Division) Before(org.junit.Before)

Example 5 with ServerProperties

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

the class MatchMakerServiceTest method setUp.

@Before
public void setUp() throws Exception {
    properties = new ServerProperties();
    FeaturedMod ladder1v1Mod = new FeaturedMod().setTechnicalName("faf");
    when(modService.getFeaturedMod(ladder1v1Mod.getTechnicalName())).thenReturn(Optional.of(ladder1v1Mod));
    when(modService.getLadder1v1()).thenReturn(Optional.of(ladder1v1Mod));
    when(modService.isLadder1v1(ladder1v1Mod)).thenReturn(true);
    when(mapService.getRandomLadderMap()).thenReturn(new MapVersion().setFilename("maps/SCMP_001.zip"));
    when(gameService.createGame(any(), any(), any(), any(), any(), anyInt(), anyInt(), any())).thenReturn(CompletableFuture.completedFuture(new Game().setId(1)));
    RatingService ratingService = new RatingService(properties);
    instance = new MatchMakerService(modService, properties, ratingService, clientService, gameService, mapService, playerService);
}
Also used : Game(com.faforever.server.entity.Game) ServerProperties(com.faforever.server.config.ServerProperties) MapVersion(com.faforever.server.entity.MapVersion) FeaturedMod(com.faforever.server.entity.FeaturedMod) RatingService(com.faforever.server.rating.RatingService) 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