3535import static org .sonar .process .ProcessProperties .Property .PATH_DATA ;
3636import static org .sonar .process .ProcessProperties .Property .PATH_HOME ;
3737import static org .sonar .process .ProcessProperties .Property .PATH_LOGS ;
38- import static org .sonar .process .ProcessProperties .Property .PATH_TEMP ;
3938
4039public class EsInstallationTest {
4140
@@ -52,14 +51,14 @@ public void constructor_fails_with_IAE_if_sq_home_property_is_not_defined() {
5251 }
5352
5453 @ Test
55- public void constructor_fails_with_IAE_if_temp_dir_property_is_not_defined () throws IOException {
54+ public void constructor_fails_with_IAE_if_logs_dir_property_is_not_defined () throws IOException {
5655 Props props = new Props (new Properties ());
5756 props .set (PATH_DATA .getKey (), temp .newFolder ().getAbsolutePath ());
5857 props .set (PATH_HOME .getKey (), temp .newFolder ().getAbsolutePath ());
5958
6059 assertThatThrownBy (() -> new EsInstallation (props ))
6160 .isInstanceOf (IllegalArgumentException .class )
62- .hasMessage ("Property sonar.path.temp is not set" );
61+ .hasMessage ("Property sonar.path.logs is not set" );
6362 }
6463
6564 @ Test
@@ -78,7 +77,6 @@ public void getHomeDirectory_is_elasticsearch_subdirectory_of_sq_home_directory(
7877 Props props = new Props (new Properties ());
7978 props .set (PATH_DATA .getKey (), temp .newFolder ().getAbsolutePath ());
8079 props .set (PATH_HOME .getKey (), sqHomeDir .getAbsolutePath ());
81- props .set (PATH_TEMP .getKey (), temp .newFolder ().getAbsolutePath ());
8280 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
8381
8482 EsInstallation underTest = new EsInstallation (props );
@@ -89,11 +87,9 @@ public void getHomeDirectory_is_elasticsearch_subdirectory_of_sq_home_directory(
8987 @ Test
9088 public void override_data_dir () throws Exception {
9189 File sqHomeDir = temp .newFolder ();
92- File tempDir = temp .newFolder ();
9390 File dataDir = temp .newFolder ();
9491 Props props = new Props (new Properties ());
9592 props .set (PATH_HOME .getKey (), sqHomeDir .getAbsolutePath ());
96- props .set (PATH_TEMP .getKey (), tempDir .getAbsolutePath ());
9793 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
9894
9995 props .set (PATH_DATA .getKey (), dataDir .getAbsolutePath ());
@@ -110,7 +106,6 @@ public void getLogDirectory_is_configured_with_non_nullable_PATH_LOG_variable()
110106 Props props = new Props (new Properties ());
111107 props .set (PATH_DATA .getKey (), temp .newFolder ().getAbsolutePath ());
112108 props .set (PATH_HOME .getKey (), sqHomeDir .getAbsolutePath ());
113- props .set (PATH_TEMP .getKey (), temp .newFolder ().getAbsolutePath ());
114109 props .set (PATH_LOGS .getKey (), logDir .getAbsolutePath ());
115110
116111 EsInstallation underTest = new EsInstallation (props );
@@ -125,7 +120,6 @@ public void getOutdatedSearchDirectories_returns_all_previously_used_es_data_dir
125120 Props props = new Props (new Properties ());
126121 props .set (PATH_DATA .getKey (), temp .newFolder ().getAbsolutePath ());
127122 props .set (PATH_HOME .getKey (), sqHomeDir .getAbsolutePath ());
128- props .set (PATH_TEMP .getKey (), temp .newFolder ().getAbsolutePath ());
129123 props .set (PATH_LOGS .getKey (), logDir .getAbsolutePath ());
130124
131125 EsInstallation underTest = new EsInstallation (props );
@@ -136,17 +130,16 @@ public void getOutdatedSearchDirectories_returns_all_previously_used_es_data_dir
136130 }
137131
138132 @ Test
139- public void conf_directory_is_conf_es_subdirectory_of_sq_temp_directory () throws IOException {
140- File tempDir = temp .newFolder ();
133+ public void conf_directory_is_config_subdirectory_of_es8_data_directory () throws IOException {
134+ File dataDir = temp .newFolder ();
141135 Props props = new Props (new Properties ());
142- props .set (PATH_DATA .getKey (), temp . newFolder () .getAbsolutePath ());
136+ props .set (PATH_DATA .getKey (), dataDir .getAbsolutePath ());
143137 props .set (PATH_HOME .getKey (), temp .newFolder ().getAbsolutePath ());
144- props .set (PATH_TEMP .getKey (), tempDir .getAbsolutePath ());
145138 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
146139
147140 EsInstallation underTest = new EsInstallation (props );
148141
149- assertThat (underTest .getConfDirectory ()).isEqualTo (new File (tempDir , "conf/es " ));
142+ assertThat (underTest .getConfDirectory ()).isEqualTo (new File (new File ( dataDir , "es8" ), "config " ));
150143 }
151144
152145 @ Test
@@ -155,7 +148,6 @@ public void getExecutable_resolve_executable_for_platform() throws IOException {
155148 Props props = new Props (new Properties ());
156149 props .set (PATH_DATA .getKey (), temp .newFolder ().getAbsolutePath ());
157150 props .set (PATH_HOME .getKey (), sqHomeDir .getAbsolutePath ());
158- props .set (PATH_TEMP .getKey (), temp .newFolder ().getAbsolutePath ());
159151 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
160152
161153 EsInstallation underTest = new EsInstallation (props );
@@ -165,44 +157,41 @@ public void getExecutable_resolve_executable_for_platform() throws IOException {
165157
166158 @ Test
167159 public void getLog4j2Properties_is_in_es_conf_directory () throws IOException {
168- File tempDir = temp .newFolder ();
160+ File dataDir = temp .newFolder ();
169161 Props props = new Props (new Properties ());
170- props .set (PATH_DATA .getKey (), temp . newFolder () .getAbsolutePath ());
162+ props .set (PATH_DATA .getKey (), dataDir .getAbsolutePath ());
171163 props .set (PATH_HOME .getKey (), temp .newFolder ().getAbsolutePath ());
172- props .set (PATH_TEMP .getKey (), tempDir .getAbsolutePath ());
173164 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
174165
175166 EsInstallation underTest = new EsInstallation (props );
176167
177- assertThat (underTest .getLog4j2PropertiesLocation ()).isEqualTo (new File (tempDir , "conf/es /log4j2.properties" ));
168+ assertThat (underTest .getLog4j2PropertiesLocation ()).isEqualTo (new File (new File ( dataDir , "es8" ), "config /log4j2.properties" ));
178169 }
179170
180171 @ Test
181172 public void getElasticsearchYml_is_in_es_conf_directory () throws IOException {
182- File tempDir = temp .newFolder ();
173+ File dataDir = temp .newFolder ();
183174 Props props = new Props (new Properties ());
184- props .set (PATH_DATA .getKey (), temp . newFolder () .getAbsolutePath ());
175+ props .set (PATH_DATA .getKey (), dataDir .getAbsolutePath ());
185176 props .set (PATH_HOME .getKey (), temp .newFolder ().getAbsolutePath ());
186- props .set (PATH_TEMP .getKey (), tempDir .getAbsolutePath ());
187177 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
188178
189179 EsInstallation underTest = new EsInstallation (props );
190180
191- assertThat (underTest .getElasticsearchYml ()).isEqualTo (new File (tempDir , "conf/es /elasticsearch.yml" ));
181+ assertThat (underTest .getElasticsearchYml ()).isEqualTo (new File (new File ( dataDir , "es8" ), "config /elasticsearch.yml" ));
192182 }
193183
194184 @ Test
195185 public void getJvmOptions_is_in_es_conf_directory () throws IOException {
196- File tempDir = temp .newFolder ();
186+ File dataDir = temp .newFolder ();
197187 Props props = new Props (new Properties ());
198- props .set (PATH_DATA .getKey (), temp . newFolder () .getAbsolutePath ());
188+ props .set (PATH_DATA .getKey (), dataDir .getAbsolutePath ());
199189 props .set (PATH_HOME .getKey (), temp .newFolder ().getAbsolutePath ());
200- props .set (PATH_TEMP .getKey (), tempDir .getAbsolutePath ());
201190 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
202191
203192 EsInstallation underTest = new EsInstallation (props );
204193
205- assertThat (underTest .getJvmOptions ()).isEqualTo (new File (tempDir , "conf/es /jvm.options" ));
194+ assertThat (underTest .getJvmOptions ()).isEqualTo (new File (new File ( dataDir , "es8" ), "config /jvm.options" ));
206195 }
207196
208197 @ Test
@@ -211,7 +200,6 @@ public void isHttpEncryptionEnabled_shouldReturnCorrectValue() throws IOExceptio
211200 Props props = new Props (new Properties ());
212201 props .set (PATH_DATA .getKey (), temp .newFolder ().getAbsolutePath ());
213202 props .set (PATH_HOME .getKey (), temp .newFolder ().getAbsolutePath ());
214- props .set (PATH_TEMP .getKey (), sqHomeDir .getAbsolutePath ());
215203 props .set (PATH_LOGS .getKey (), temp .newFolder ().getAbsolutePath ());
216204 props .set (CLUSTER_ENABLED .getKey (), "true" );
217205 props .set (CLUSTER_SEARCH_PASSWORD .getKey (), "password" );
0 commit comments