use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class IndexCreatorTest method create_index.
@Test
public void create_index() throws Exception {
assertThat(mappings()).isEmpty();
IndexDefinitions registry = new IndexDefinitions(new IndexDefinition[] { new FakeIndexDefinition() }, new MapSettings());
registry.start();
IndexCreator creator = new IndexCreator(es.client(), registry);
creator.start();
// check that index is created with related mapping
ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = mappings();
MappingMetaData mapping = mappings.get("fakes").get("fake");
assertThat(mapping.type()).isEqualTo("fake");
assertThat(mapping.getSourceAsMap()).isNotEmpty();
assertThat(countMappingFields(mapping)).isEqualTo(2);
assertThat(field(mapping, "updatedAt").get("type")).isEqualTo("date");
assertThat(setting("fakes", "index.sonar_hash")).isNotEmpty();
// of course do not delete indices on stop
creator.stop();
assertThat(mappings()).isNotEmpty();
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class NewIndexTest method default_shards_and_replicas.
@Test
public void default_shards_and_replicas() {
NewIndex index = new NewIndex("issues");
index.configureShards(new MapSettings(), 5);
assertThat(index.getSettings().get(IndexMetaData.SETTING_NUMBER_OF_SHARDS)).isEqualTo("5");
assertThat(index.getSettings().get(IndexMetaData.SETTING_NUMBER_OF_REPLICAS)).isEqualTo("0");
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class NewIndexTest method customize_number_of_shards.
@Test
public void customize_number_of_shards() {
NewIndex index = new NewIndex("issues");
MapSettings settings = new MapSettings();
settings.setProperty("sonar.search.issues.shards", "3");
index.configureShards(settings, 5);
assertThat(index.getSettings().get(IndexMetaData.SETTING_NUMBER_OF_SHARDS)).isEqualTo("3");
// keep default value
assertThat(index.getSettings().get(IndexMetaData.SETTING_NUMBER_OF_REPLICAS)).isEqualTo("0");
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class NotificationDaemonTest method setUpMocks.
private void setUpMocks() {
when(emailChannel.getKey()).thenReturn("email");
when(gtalkChannel.getKey()).thenReturn("gtalk");
when(commentOnIssueAssignedToMe.getKey()).thenReturn("CommentOnIssueAssignedToMe");
when(commentOnIssueAssignedToMe.getType()).thenReturn("issue-changes");
when(commentOnIssueCreatedByMe.getKey()).thenReturn("CommentOnIssueCreatedByMe");
when(commentOnIssueCreatedByMe.getType()).thenReturn("issue-changes");
when(qualityGateChange.getKey()).thenReturn("QGateChange");
when(qualityGateChange.getType()).thenReturn("qgate-changes");
when(manager.getFromQueue()).thenReturn(notification).thenReturn(null);
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
underTest = new NotificationDaemon(settings, manager, service);
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class NotificationDaemonTest method getDispatchers_empty.
@Test
public void getDispatchers_empty() {
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
service = new NotificationService(dbClient);
assertThat(service.getDispatchers()).hasSize(0);
}
Aggregations