use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-intellij by SonarSource.
the class SonarLintUtilsTest method testServerConfigurationToken.
@Test
public void testServerConfigurationToken() {
SonarApplication app = mock(SonarApplication.class);
when(app.getVersion()).thenReturn("1.0");
super.register(ApplicationManager.getApplication(), SonarApplication.class, app);
SonarQubeServer server = SonarQubeServer.newBuilder().setHostUrl("http://myhost").setEnableProxy(false).setToken("token").build();
ServerConfiguration config = SonarLintUtils.getServerConfiguration(server);
assertThat(config.getLogin()).isEqualTo(server.getToken());
assertThat(config.getPassword()).isNull();
assertThat(config.getConnectTimeoutMs()).isEqualTo(SonarLintUtils.CONNECTION_TIMEOUT_MS);
assertThat(config.getReadTimeoutMs()).isEqualTo(SonarLintUtils.READ_TIMEOUT_MS);
assertThat(config.getUserAgent()).contains("SonarLint");
assertThat(config.getUrl()).isEqualTo(server.getHostUrl());
assertThat(config.getOrganizationKey()).isNull();
}
use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-intellij by SonarSource.
the class SonarLintUtilsTest method testServerConfigurationPassword.
@Test
public void testServerConfigurationPassword() {
SonarApplication app = mock(SonarApplication.class);
when(app.getVersion()).thenReturn("1.0");
super.register(ApplicationManager.getApplication(), SonarApplication.class, app);
SonarQubeServer server = SonarQubeServer.newBuilder().setHostUrl("http://myhost").setLogin("token").setPassword("pass").build();
ServerConfiguration config = SonarLintUtils.getServerConfiguration(server);
assertThat(config.getLogin()).isEqualTo(server.getLogin());
assertThat(config.getPassword()).isEqualTo(server.getPassword());
}
Aggregations