use of org.sonarlint.intellij.config.global.SonarQubeServer in project sonarlint-intellij by SonarSource.
the class GlobalConfigurationListenerTest method testApplied.
@Test
public void testApplied() {
List<SonarQubeServer> servers = new LinkedList<>();
AtomicBoolean bool = new AtomicBoolean(false);
GlobalConfigurationListener listener = new GlobalConfigurationListener.Adapter() {
@Override
public void applied(SonarLintGlobalSettings settings) {
servers.addAll(settings.getSonarQubeServers());
bool.set(settings.isAutoTrigger());
}
};
project.getMessageBus().connect().subscribe(GlobalConfigurationListener.TOPIC, listener);
SonarLintGlobalSettings settings = new SonarLintGlobalSettings();
settings.setSonarQubeServers(testList);
settings.setAutoTrigger(true);
project.getMessageBus().syncPublisher(GlobalConfigurationListener.TOPIC).applied(settings);
assertThat(servers).isEqualTo(testList);
assertThat(bool.get()).isTrue();
}
use of org.sonarlint.intellij.config.global.SonarQubeServer in project sonarlint-intellij by SonarSource.
the class WizardModelTest method testExportToConfig.
@Test
public void testExportToConfig() {
WizardModel model = new WizardModel();
model.setName("name");
model.setOrganization("org");
model.setServerUrl("url");
model.setLogin("login");
model.setProxyEnabled(true);
model.setPassword(new char[] { 'p', 'a', 's', 's' });
model.setServerType(WizardModel.ServerType.SONARQUBE);
SonarQubeServer server = model.createServer();
assertThat(server.getHostUrl()).isEqualTo("url");
assertThat(server.enableProxy()).isTrue();
assertThat(server.getLogin()).isEqualTo("login");
assertThat(server.getPassword()).isEqualTo("pass");
assertThat(server.getToken()).isNull();
assertThat(server.getOrganizationKey()).isEqualTo("org");
}
use of org.sonarlint.intellij.config.global.SonarQubeServer in project sonarlint-intellij by SonarSource.
the class WizardModelTest method testCreateFromConfig.
@Test
public void testCreateFromConfig() {
SonarQubeServer server = SonarQubeServer.newBuilder().setName("name").setToken("token").setOrganizationKey("org").setEnableProxy(true).setHostUrl("url").build();
WizardModel model = new WizardModel(server);
assertThat(model.getLogin()).isNull();
assertThat(model.getPassword()).isNull();
assertThat(model.getToken()).isEqualTo("token");
assertThat(model.getOrganization()).isEqualTo("org");
assertThat(model.getOrganizationList()).isNull();
assertThat(model.getName()).isEqualTo("name");
assertThat(model.getServerUrl()).isEqualTo("url");
}
use of org.sonarlint.intellij.config.global.SonarQubeServer in project sonarlint-intellij by SonarSource.
the class WizardModelTest method testMigrationSonarCloud.
@Test
public void testMigrationSonarCloud() {
SonarQubeServer server = SonarQubeServer.newBuilder().setName("name").setToken("token").setOrganizationKey("org").setEnableProxy(true).setHostUrl("https://www.sonarqube.com").build();
WizardModel model = new WizardModel(server);
server = model.createServer();
assertThat(server.enableProxy()).isTrue();
assertThat(server.getHostUrl()).isEqualTo("https://sonarcloud.io");
}
use of org.sonarlint.intellij.config.global.SonarQubeServer in project sonarlint-intellij by SonarSource.
the class ProjectBindingManagerTest method should_find_sq_server.
@Test
public void should_find_sq_server() throws InvalidBindingException {
settings.setBindingEnabled(true);
settings.setProjectKey("project1");
settings.setServerId("server1");
SonarQubeServer server = SonarQubeServer.newBuilder().setName("server1").build();
globalSettings.setSonarQubeServers(Collections.singletonList(server));
assertThat(projectBindingManager.getSonarQubeServer()).isEqualTo(server);
}
Aggregations