use of com.faforever.client.config.ClientProperties.Vault in project downlords-faf-client by FAForever.
the class PrivateChatTabControllerTest method setUp.
@Before
public void setUp() throws IOException {
Vault vault = new Vault();
vault.setReplayDownloadUrlFormat("test.de");
when(clientProperties.getVault()).thenReturn(vault);
PreferencesService preferencesService = new PreferencesService();
preferencesService.postConstruct();
preferencesService.getPreferences().getMainWindow().setLastView(NavigationItem.CHAT.name());
instance = new PrivateChatTabController(clanService, userService, platformService, preferencesService, playerService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, audioService, chatService, mapService, webViewConfigurer, countryFlagService, replayService, clientProperties, externalReplayInfoGenerator);
playerName = "testUser";
Player player = new Player(playerName);
when(playerService.getPlayerForUsername(playerName)).thenReturn(player);
when(userService.getUsername()).thenReturn(playerName);
when(uiService.getThemeFileUrl(CHAT_CONTAINER)).then(invocation -> getThemeFileUrl(invocation.getArgument(0)));
TabPane tabPane = new TabPane();
tabPane.setSkin(new TabPaneSkin(tabPane));
loadFxml("theme/chat/private_chat_tab.fxml", clazz -> {
if (clazz == PrivateUserInfoController.class) {
return privateUserInfoController;
}
if (clazz == GameDetailController.class) {
return gameDetailController;
}
if (clazz == WatchButtonController.class) {
return watchButtonController;
}
return instance;
});
instance.setReceiver(playerName);
WaitForAsyncUtils.asyncFx(() -> {
getRoot().getChildren().setAll(tabPane);
tabPane.getTabs().add(instance.getRoot());
});
WaitForAsyncUtils.waitForFxEvents();
verify(webViewConfigurer).configureWebView(instance.messagesWebView);
}
use of com.faforever.client.config.ClientProperties.Vault in project downlords-faf-client by FAForever.
the class ChannelTabControllerTest method setUp.
@Before
public void setUp() throws Exception {
Vault vault = new Vault();
vault.setReplayDownloadUrlFormat("test.de");
when(clientProperties.getVault()).thenReturn(vault);
instance = new ChannelTabController(clanService, userService, chatService, platformService, preferencesService, playerService, audioService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, webViewConfigurer, threadPoolExecutor, taskScheduler, countryFlagService, replayService, clientProperties, externalReplayInfoGenerator);
when(preferencesService.getPreferences()).thenReturn(new Preferences());
when(userService.getUsername()).thenReturn(USER_NAME);
when(uiService.loadFxml("theme/chat/user_filter.fxml")).thenReturn(userFilterController);
when(uiService.loadFxml("theme/chat/chat_user_item.fxml")).thenReturn(chatUserItemController);
when(userFilterController.getRoot()).thenReturn(new Pane());
when(chatUserItemController.getRoot()).thenReturn(new Pane());
when(uiService.getThemeFileUrl(CHAT_CONTAINER)).thenReturn(getClass().getResource("/theme/chat/chat_container.html"));
loadFxml("theme/chat/channel_tab.fxml", clazz -> instance);
TabPane tabPane = new TabPane();
tabPane.getTabs().add(instance.getRoot());
WaitForAsyncUtils.waitForAsyncFx(5000, () -> getRoot().getChildren().add(tabPane));
}
use of com.faforever.client.config.ClientProperties.Vault in project downlords-faf-client by FAForever.
the class AbstractChatTabControllerTest method start.
@Override
public void start(Stage stage) throws Exception {
super.start(stage);
preferences = new Preferences();
Clan clan = new Clan();
clan.setId("1234");
Vault vault = new Vault();
vault.setReplayDownloadUrlFormat(TEST_REPLAY_BASE_URL);
when(replayService.findById(any(Integer.class))).thenReturn(completedFuture(Optional.of(new Replay())));
when(clanService.getClanByTag(sampleClanTag)).thenReturn(completedFuture(Optional.of(clan)));
when(uiService.loadFxml("theme/chat/clan_tooltip.fxml")).thenReturn(mock(ClanTooltipController.class));
when(uiService.getThemeFileUrl(any())).thenReturn(getClass().getResource("/theme/chat/chat_section.html"));
when(timeService.asShortTime(any())).thenReturn("123");
when(userService.getUsername()).thenReturn("junit");
when(preferencesService.getPreferences()).thenReturn(preferences);
when(clientProperties.getVault()).thenReturn(vault);
instance = new AbstractChatTabController(clanService, webViewConfigurer, userService, chatService, platformService, preferencesService, playerService, audioService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, countryFlagService, replayService, clientProperties, externalReplayInfoGenerator) {
private final Tab root = new Tab();
private final WebView webView = new WebView();
private final TextInputControl messageTextField = new TextField();
@Override
public Tab getRoot() {
return root;
}
@Override
protected TextInputControl messageTextField() {
return messageTextField;
}
@Override
protected WebView getMessagesWebView() {
return webView;
}
};
TabPane tabPane = new TabPane(instance.getRoot());
getRoot().getChildren().setAll(tabPane);
chatReadyLatch = new CountDownLatch(1);
instance.getMessagesWebView().getEngine().getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
if (Worker.State.SUCCEEDED.equals(newValue)) {
chatReadyLatch.countDown();
}
});
instance.initialize();
}
Aggregations