Search in sources :

Example 1 with WsHelperImpl

use of org.sonarsource.sonarlint.core.WsHelperImpl 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);
}
Also used : WsHelperImpl(org.sonarsource.sonarlint.core.WsHelperImpl) RemoteOrganization(org.sonarsource.sonarlint.core.client.api.connected.RemoteOrganization) WsHelper(org.sonarsource.sonarlint.core.client.api.connected.WsHelper) Test(org.junit.Test)

Example 2 with WsHelperImpl

use of org.sonarsource.sonarlint.core.WsHelperImpl in project sonarlint-core by SonarSource.

the class ConnectedModeRequirementsTest method dontCheckMinimalPluginVersionWhenValidatingConnection.

@Test
public void dontCheckMinimalPluginVersionWhenValidatingConnection() throws IOException {
    ValidationResult result = new WsHelperImpl().validateConnection(config());
    assertThat(result.success()).isTrue();
}
Also used : WsHelperImpl(org.sonarsource.sonarlint.core.WsHelperImpl) ValidationResult(org.sonarsource.sonarlint.core.client.api.connected.ValidationResult) Test(org.junit.Test)

Example 3 with WsHelperImpl

use of org.sonarsource.sonarlint.core.WsHelperImpl 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;
    }
}
Also used : WsHelperImpl(org.sonarsource.sonarlint.core.WsHelperImpl) ServerConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration) WsHelper(org.sonarsource.sonarlint.core.client.api.connected.WsHelper)

Example 4 with WsHelperImpl

use of org.sonarsource.sonarlint.core.WsHelperImpl 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;
    }
}
Also used : WsHelperImpl(org.sonarsource.sonarlint.core.WsHelperImpl) ServerConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration) WsHelper(org.sonarsource.sonarlint.core.client.api.connected.WsHelper) TaskProgressMonitor(org.sonarlint.intellij.util.TaskProgressMonitor) UnsupportedServerException(org.sonarsource.sonarlint.core.client.api.exceptions.UnsupportedServerException) UnsupportedServerException(org.sonarsource.sonarlint.core.client.api.exceptions.UnsupportedServerException)

Example 5 with WsHelperImpl

use of org.sonarsource.sonarlint.core.WsHelperImpl 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);
        }
    }
}
Also used : WsHelperImpl(org.sonarsource.sonarlint.core.WsHelperImpl) WsHelper(org.sonarsource.sonarlint.core.client.api.connected.WsHelper) UnsupportedServerException(org.sonarsource.sonarlint.core.client.api.exceptions.UnsupportedServerException) UnsupportedServerException(org.sonarsource.sonarlint.core.client.api.exceptions.UnsupportedServerException) ExpectedException(org.junit.rules.ExpectedException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

WsHelperImpl (org.sonarsource.sonarlint.core.WsHelperImpl)6 WsHelper (org.sonarsource.sonarlint.core.client.api.connected.WsHelper)5 Test (org.junit.Test)4 ServerConfiguration (org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration)3 UnsupportedServerException (org.sonarsource.sonarlint.core.client.api.exceptions.UnsupportedServerException)2 IOException (java.io.IOException)1 ExpectedException (org.junit.rules.ExpectedException)1 TaskProgressMonitor (org.sonarlint.intellij.util.TaskProgressMonitor)1 RemoteOrganization (org.sonarsource.sonarlint.core.client.api.connected.RemoteOrganization)1 ValidationResult (org.sonarsource.sonarlint.core.client.api.connected.ValidationResult)1