use of org.sonarsource.sonarlint.core.client.api.connected.WsHelper in project sonarlint-core by SonarSource.
the class OrganizationTest method downloadOrganizations.
@Test
public void downloadOrganizations() throws Exception {
WsHelper helper = new WsHelperImpl();
List<RemoteOrganization> organizations = helper.listOrganizations(getServerConfigForOrg(null), null);
assertThat(organizations).hasSize(2);
}
use of org.sonarsource.sonarlint.core.client.api.connected.WsHelper in project sonarlint-intellij by SonarSource.
the class ConnectionTestTask method run.
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setText("Connecting to " + server.getHostUrl() + "...");
indicator.setIndeterminate(true);
try {
ServerConfiguration serverConfiguration = SonarLintUtils.getServerConfiguration(server);
WsHelper wsHelper = new WsHelperImpl();
result = wsHelper.validateConnection(serverConfiguration);
} catch (Exception e) {
String msg = "Connection test failed";
LOGGER.info(msg, e);
GlobalLogOutput.get().logError(msg, e);
exception = e;
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.WsHelper in project sonarlint-intellij by SonarSource.
the class InformationFetchTask method run.
@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.listOrganizations(serverConfiguration, new TaskProgressMonitor(indicator));
} catch (UnsupportedServerException e) {
organizations = Collections.emptyList();
} catch (Exception e) {
LOGGER.info("Failed to fetch information", e);
exception = e;
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.WsHelper in project sonarlint-core by SonarSource.
the class ConnectedModeTest method downloadOrganizations.
@Test
public void downloadOrganizations() throws Exception {
WsHelper helper = new WsHelperImpl();
if (ORCHESTRATOR.getServer().version().isGreaterThanOrEquals("6.3")) {
assertThat(helper.listOrganizations(getServerConfig(), null)).hasSize(1);
} else {
try {
helper.listOrganizations(getServerConfig(), null);
fail("Expected exception");
} catch (Exception e) {
assertThat(e).isInstanceOf(UnsupportedServerException.class);
}
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.WsHelper in project sonarlint-core by SonarSource.
the class ConnectedModeTest method generateToken.
@Test
public void generateToken() {
WsHelper ws = new WsHelperImpl();
ServerConfiguration serverConfig = getServerConfig(true);
if (!ORCHESTRATOR.getServer().version().isGreaterThanOrEquals("5.4")) {
exception.expect(UnsupportedServerException.class);
}
String token = ws.generateAuthenticationToken(serverConfig, "name", false);
assertThat(token).isNotNull();
token = ws.generateAuthenticationToken(serverConfig, "name", true);
assertThat(token).isNotNull();
}
Aggregations