Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: ElasticIndexIT: replace member with local variable Elasticsearch tests: remove password duplication Change-Id: I9d71a0f156621b8c528db979577bd7ebcaf9edaf
This commit is contained in:
commit
de0488a5fb
|
@ -33,8 +33,7 @@ public class ElasticReindexIT extends AbstractReindexTests {
|
|||
elasticNodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
String indicesPrefix = UUID.randomUUID().toString();
|
||||
Config cfg = new Config();
|
||||
String password = version == ElasticVersion.V5_6 ? "changeme" : null;
|
||||
ElasticTestUtils.configure(cfg, elasticNodeInfo.port, indicesPrefix, password);
|
||||
ElasticTestUtils.configure(cfg, elasticNodeInfo.port, indicesPrefix, version);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,16 +24,14 @@ import java.util.UUID;
|
|||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
public class ElasticIndexIT extends AbstractIndexTests {
|
||||
private static ElasticContainer<?> container;
|
||||
|
||||
private static Config getConfig(ElasticVersion version) {
|
||||
ElasticNodeInfo elasticNodeInfo;
|
||||
container = ElasticContainer.createAndStart(version);
|
||||
ElasticContainer<?> container = ElasticContainer.createAndStart(version);
|
||||
elasticNodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
String indicesPrefix = UUID.randomUUID().toString();
|
||||
Config cfg = new Config();
|
||||
String password = version == ElasticVersion.V5_6 ? "changeme" : null;
|
||||
ElasticTestUtils.configure(cfg, elasticNodeInfo.port, indicesPrefix, password);
|
||||
ElasticTestUtils.configure(cfg, elasticNodeInfo.port, indicesPrefix, version);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,11 +32,12 @@ public final class ElasticTestUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void configure(Config config, int port, String prefix, String password) {
|
||||
public static void configure(Config config, int port, String prefix, ElasticVersion version) {
|
||||
config.setEnum("index", null, "type", IndexType.ELASTICSEARCH);
|
||||
config.setString("elasticsearch", null, "server", "http://localhost:" + port);
|
||||
config.setString("elasticsearch", null, "prefix", prefix);
|
||||
config.setInt("index", null, "maxLimit", 10000);
|
||||
String password = version == ElasticVersion.V5_6 ? "changeme" : null;
|
||||
if (password != null) {
|
||||
config.setString("elasticsearch", null, "password", password);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
|
|||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix, "changeme");
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
|
|||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix, "changeme");
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
|
|||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix, "changeme");
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue