diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2020-01-16 11:05:55 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-11-05 20:06:21 +0000 |
commit | 8cdee7d30f96e87b8bb7ec55fdfd8101ab717dfd (patch) | |
tree | 7a82e64d82a2b0d6f8c6ab3592aba38a2b58678c /server/sonar-main | |
parent | 6390f55dcf651f5c9c7a0fb1e54a2ec8594f8940 (diff) | |
download | sonarqube-8cdee7d30f96e87b8bb7ec55fdfd8101ab717dfd.tar.gz sonarqube-8cdee7d30f96e87b8bb7ec55fdfd8101ab717dfd.zip |
SONAR-12686 enforce index rebuilding by changing ES data directory
Diffstat (limited to 'server/sonar-main')
-rw-r--r-- | server/sonar-main/src/main/java/org/sonar/application/es/EsInstallation.java | 9 | ||||
-rw-r--r-- | server/sonar-main/src/test/java/org/sonar/application/es/EsInstallationTest.java | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/es/EsInstallation.java b/server/sonar-main/src/main/java/org/sonar/application/es/EsInstallation.java index 6926c1054ad..6d084d23cba 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/es/EsInstallation.java +++ b/server/sonar-main/src/main/java/org/sonar/application/es/EsInstallation.java @@ -20,11 +20,12 @@ package org.sonar.application.es; import java.io.File; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Properties; +import java.util.stream.Stream; import org.sonar.application.command.EsJvmOptions; +import org.sonar.core.util.stream.MoreCollectors; import org.sonar.process.Props; import static org.sonar.process.ProcessProperties.Property.PATH_DATA; @@ -65,12 +66,14 @@ public class EsInstallation { private static List<File> buildOutdatedSearchDirs(Props props) { String dataPath = props.nonNullValue(PATH_DATA.getKey()); - return Arrays.asList(new File(dataPath, "es"), new File(dataPath, "es5")); + return Stream.of("es", "es5", "es6") + .map(t -> new File(dataPath, t)) + .collect(MoreCollectors.toList()); } private static File buildDataDir(Props props) { String dataPath = props.nonNullValue(PATH_DATA.getKey()); - return new File(dataPath, "es6"); + return new File(dataPath, "es7"); } private static File buildLogPath(Props props) { diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsInstallationTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsInstallationTest.java index 445fce74baf..b2e70b77b29 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/es/EsInstallationTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsInstallationTest.java @@ -102,7 +102,7 @@ public class EsInstallationTest { EsInstallation underTest = new EsInstallation(props); - assertThat(underTest.getDataDirectory()).isEqualTo(new File(dataDir, "es6")); + assertThat(underTest.getDataDirectory()).isEqualTo(new File(dataDir, "es7")); } @Test @@ -133,8 +133,8 @@ public class EsInstallationTest { EsInstallation underTest = new EsInstallation(props); assertThat(underTest.getOutdatedSearchDirectories()) - .extracting(t -> t.getName()) - .containsOnly("es", "es5"); + .extracting(File::getName) + .containsExactlyInAnyOrder("es", "es5", "es6"); } @Test |