public static boolean checkNotificationsSupported(String url, @Nullable String organization, String username, String password) { Builder builder = Server.getConfigBuilderNoCredentials(url, organization); if (StringUtils.isNotBlank(username) || StringUtils.isNotBlank(password)) { builder.credentials(username, password); } return SonarQubeNotifications.get().isSupported(builder.build()); }
@Override public void run(@NotNull ProgressIndicator indicator) { indicator.setText("Connecting to " + server.getHostUrl() + "..."); indicator.setIndeterminate(false); try { ServerConfiguration serverConfiguration = SonarLintUtils.getServerConfiguration(server); indicator.setText("Checking support of notifications"); notificationsSupported = SonarQubeNotifications.get().isSupported(serverConfiguration); WsHelper wsHelper = new WsHelperImpl(); organizations = wsHelper.listUserOrganizations(serverConfiguration, new TaskProgressMonitor(indicator)); } catch (UnsupportedServerException e) { organizations = Collections.emptyList(); } catch (Exception e) { LOGGER.info("Failed to fetch information", e); exception = e; } }