From d66de7082395dcc2c2535c6429db68617cc98137 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sun, 24 Sep 2017 22:05:31 +0200 Subject: [PATCH] SONAR-9802 rename section Search Statistics to Search Indexes --- ...sStatisticsSection.java => EsIndexesSection.java} | 8 ++++---- .../platform/monitoring/WebSystemInfoModule.java | 4 ++-- ...icsSectionTest.java => EsIndexesSectionTest.java} | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) rename server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/{EsStatisticsSection.java => EsIndexesSection.java} (89%) rename server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/{EsStatisticsSectionTest.java => EsIndexesSectionTest.java} (90%) diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStatisticsSection.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java similarity index 89% rename from server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStatisticsSection.java rename to server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java index c317854fc6f..d35f5d6409b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStatisticsSection.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java @@ -34,22 +34,22 @@ import static org.apache.commons.io.FileUtils.byteCountToDisplaySize; import static org.sonar.process.systeminfo.SystemInfoUtils.setAttribute; @ServerSide -public class EsStatisticsSection implements SystemInfoSection, Global { +public class EsIndexesSection implements SystemInfoSection, Global { private final EsClient esClient; - public EsStatisticsSection(EsClient esClient) { + public EsIndexesSection(EsClient esClient) { this.esClient = esClient; } @Override public ProtobufSystemInfo.Section toProtobuf() { ProtobufSystemInfo.Section.Builder protobuf = ProtobufSystemInfo.Section.newBuilder(); - protobuf.setName("Search Statistics"); + protobuf.setName("Search Indexes"); try { completeIndexAttributes(protobuf); } catch (Exception es) { - Loggers.get(EsStatisticsSection.class).warn("Failed to retrieve ES attributes. There will be only a single \"Error\" attribute.", es); + Loggers.get(EsIndexesSection.class).warn("Failed to retrieve ES attributes. There will be only a single \"Error\" attribute.", es); setAttribute(protobuf, "Error", es.getCause() instanceof ElasticsearchException ? es.getCause().getMessage() : es.getMessage()); } return protobuf.build(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/WebSystemInfoModule.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/WebSystemInfoModule.java index 01dec926e3a..aae7dc5c087 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/WebSystemInfoModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/WebSystemInfoModule.java @@ -43,7 +43,7 @@ public class WebSystemInfoModule { new JvmStateSection("Web JVM State"), DatabaseSection.class, EsStateSection.class, - EsStatisticsSection.class, + EsIndexesSection.class, PluginsSection.class, SettingsSection.class, StandaloneSystemSection.class, @@ -59,7 +59,7 @@ public class WebSystemInfoModule { new JvmPropertiesSection("Web JVM Properties"), new JvmStateSection("Web JVM State"), DatabaseSection.class, - EsStatisticsSection.class, + EsIndexesSection.class, GlobalSystemSection.class, LoggingSection.class, NodeSystemSection.class, diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStatisticsSectionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsIndexesSectionTest.java similarity index 90% rename from server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStatisticsSectionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsIndexesSectionTest.java index 44c583ebb2e..eac9b66f8f7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStatisticsSectionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsIndexesSectionTest.java @@ -34,16 +34,16 @@ import static org.mockito.Mockito.when; import static org.sonar.process.systeminfo.SystemInfoUtils.attribute; import static org.sonar.server.platform.monitoring.SystemInfoTesting.assertThatAttributeIs; -public class EsStatisticsSectionTest { +public class EsIndexesSectionTest { @Rule public EsTester esTester = new EsTester(new IssueIndexDefinition(new MapSettings().asConfig())); - private EsStatisticsSection underTest = new EsStatisticsSection(esTester.client()); + private EsIndexesSection underTest = new EsIndexesSection(esTester.client()); @Test public void name() { - assertThat(underTest.toProtobuf().getName()).isEqualTo("Search Statistics"); + assertThat(underTest.toProtobuf().getName()).isEqualTo("Search Indexes"); } @Test @@ -59,7 +59,7 @@ public class EsStatisticsSectionTest { @Test public void attributes_displays_exception_message_when_cause_null_when_client_fails() { EsClient esClientMock = mock(EsClient.class); - EsStatisticsSection underTest = new EsStatisticsSection(esClientMock); + EsIndexesSection underTest = new EsIndexesSection(esClientMock); when(esClientMock.prepareStats()).thenThrow(new RuntimeException("RuntimeException with no cause")); ProtobufSystemInfo.Section section = underTest.toProtobuf(); @@ -69,7 +69,7 @@ public class EsStatisticsSectionTest { @Test public void attributes_displays_exception_message_when_cause_is_not_ElasticSearchException_when_client_fails() { EsClient esClientMock = mock(EsClient.class); - EsStatisticsSection underTest = new EsStatisticsSection(esClientMock); + EsIndexesSection underTest = new EsIndexesSection(esClientMock); when(esClientMock.prepareStats()).thenThrow(new RuntimeException("RuntimeException with cause not ES", new IllegalArgumentException("some cause message"))); ProtobufSystemInfo.Section section = underTest.toProtobuf(); @@ -79,7 +79,7 @@ public class EsStatisticsSectionTest { @Test public void attributes_displays_cause_message_when_cause_is_ElasticSearchException_when_client_fails() { EsClient esClientMock = mock(EsClient.class); - EsStatisticsSection underTest = new EsStatisticsSection(esClientMock); + EsIndexesSection underTest = new EsIndexesSection(esClientMock); when(esClientMock.prepareStats()).thenThrow(new RuntimeException("RuntimeException with ES cause", new ElasticsearchException("some cause message"))); ProtobufSystemInfo.Section section = underTest.toProtobuf(); -- 2.39.5