use of com.faforever.client.config.ClientProperties in project downlords-faf-client by FAForever.
the class MainControllerTest method setUp.
@Before
public void setUp() throws Exception {
ClientProperties clientProperties = new ClientProperties();
clientProperties.getTrueSkill().setBeta(240).setInitialMean(1500).setInitialStandardDeviation(500);
instance = new MainController(preferencesService, i18n, notificationService, playerService, gameService, clientUpdateService, uiService, eventBus, clientProperties, gamePathHandler, platformService);
gameRunningProperty = new SimpleBooleanProperty();
when(persistentNotificationsController.getRoot()).thenReturn(new Pane());
when(transientNotificationsController.getRoot()).thenReturn(new Pane());
when(preferencesService.getPreferences()).thenReturn(preferences);
when(uiService.loadFxml("theme/window.fxml")).thenReturn(windowController);
when(preferences.getMainWindow()).thenReturn(mainWindowPrefs);
when(preferences.getNotification()).thenReturn(notificationPrefs);
when(gameService.gameRunningProperty()).thenReturn(gameRunningProperty);
when(uiService.loadFxml("theme/persistent_notifications.fxml")).thenReturn(persistentNotificationsController);
when(uiService.loadFxml("theme/transient_notifications.fxml")).thenReturn(transientNotificationsController);
when(uiService.loadFxml("theme/window.fxml")).thenReturn(windowController);
when(uiService.loadFxml("theme/settings/settings.fxml")).thenReturn(settingsController);
when(uiService.loadFxml("theme/login.fxml")).thenReturn(loginController);
when(uiService.loadFxml("theme/chat/chat.fxml")).thenReturn(chatController);
loadFxml("theme/main.fxml", clazz -> {
if (clazz == instance.getClass()) {
return instance;
}
return mock(clazz);
});
mainControllerInitializedLatch = new CountDownLatch(1);
// As the login check is executed AFTER the main controller has been switched to logged in state, we hook to it
doAnswer(invocation -> {
mainControllerInitializedLatch.countDown();
return null;
}).when(clientUpdateService).checkForUpdateInBackground();
}
use of com.faforever.client.config.ClientProperties in project downlords-faf-client by FAForever.
the class Ladder1V1ControllerTest method setUp.
@Before
public void setUp() throws Exception {
instance = new Ladder1v1Controller(gameService, preferencesService, playerService, leaderboardService, i18n, new ClientProperties(), eventBus);
Player player = new Player(USERNAME);
player.setId(PLAYER_ID);
currentPlayerProperty = new SimpleObjectProperty<>(player);
factionList = FXCollections.observableArrayList();
LeaderboardEntry leaderboardEntry = new LeaderboardEntry();
leaderboardEntry.setRating(500);
leaderboardEntry.setWinLossRatio(12.23f);
leaderboardEntry.setRank(100);
leaderboardEntry.setGamesPlayed(412);
leaderboardEntry.setUsername(USERNAME);
when(leaderboardService.getLadder1v1Stats()).thenReturn(CompletableFuture.completedFuture(new ArrayList<>()));
when(leaderboardService.getEntryForPlayer(PLAYER_ID)).thenReturn(CompletableFuture.completedFuture(leaderboardEntry));
when(gameService.searching1v1Property()).thenReturn(searching1v1Property);
when(preferencesService.getPreferences()).thenReturn(preferences);
when(preferences.getLadder1v1Prefs()).thenReturn(ladder1V1Prefs);
when(ladder1V1Prefs.getFactions()).thenReturn(factionList);
when(preferences.getForgedAlliance()).thenReturn(forgedAlliancePrefs);
when(playerService.getCurrentPlayer()).thenReturn(Optional.ofNullable(currentPlayerProperty.get()));
when(playerService.currentPlayerProperty()).thenReturn(currentPlayerProperty);
loadFxml("theme/play/ranked_1v1.fxml", clazz -> instance);
}
use of com.faforever.client.config.ClientProperties in project downlords-faf-client by FAForever.
the class ServerAccessorImplTest method setUp.
@Before
public void setUp() throws Exception {
serverToClientReadyLatch = new CountDownLatch(1);
messagesReceivedByFafServer = new ArrayBlockingQueue<>(10);
startFakeFafLobbyServer();
ClientProperties clientProperties = new ClientProperties();
clientProperties.getServer().setHost(LOOPBACK_ADDRESS.getHostAddress()).setPort(fafLobbyServerSocket.getLocalPort());
instance = new FafServerAccessorImpl(preferencesService, uidService, notificationService, i18n, clientProperties, reportingService);
LoginPrefs loginPrefs = new LoginPrefs();
loginPrefs.setUsername("junit");
loginPrefs.setPassword("password");
when(preferencesService.getFafDataDirectory()).thenReturn(faDirectory.getRoot().toPath());
when(uidService.generate(any(), any())).thenReturn("encrypteduidstring");
}
use of com.faforever.client.config.ClientProperties in project downlords-faf-client by FAForever.
the class LoginControllerTest method setUp.
@Before
public void setUp() throws Exception {
ClientProperties clientProperties = new ClientProperties();
instance = new LoginController(userService, preferencesService, platformService, clientProperties);
loadFxml("theme/login.fxml", param -> instance);
Website website = clientProperties.getWebsite();
website.setCreateAccountUrl("create");
website.setForgotPasswordUrl("forgot");
when(preferencesService.getPreferences()).thenReturn(new Preferences());
}
use of com.faforever.client.config.ClientProperties in project downlords-faf-client by FAForever.
the class CheckForUpdateTaskTest method setUp.
@Before
public void setUp() throws Exception {
instance = new CheckForUpdateTask();
instance.i18n = i18n;
instance.clientProperties = new ClientProperties();
terminateLatch = new CountDownLatch(1);
}
Aggregations