[TEST] resolved a few compiler warnings in ElasticsearchIntegrationTest

Mainly simplified buildTestCluster method now that there is no global cluster anymore.
This commit is contained in:
javanna 2015-02-26 17:03:42 +01:00 committed by Luca Cavanna
parent b3be23ea11
commit 624549b4eb
1 changed files with 9 additions and 16 deletions

View File

@ -268,7 +268,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
switch (currentClusterScope) {
case SUITE:
assert SUITE_SEED != null : "Suite seed was not initialized";
currentCluster = buildAndPutCluster(currentClusterScope, SUITE_SEED.longValue());
currentCluster = buildAndPutCluster(currentClusterScope, SUITE_SEED);
break;
case TEST:
currentCluster = buildAndPutCluster(currentClusterScope, randomLong());
@ -1278,7 +1278,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
Set<Tuple<String, String>> bogusIds = new HashSet<>();
if (random.nextBoolean() && !builders.isEmpty() && dummyDocuments) {
builders = new ArrayList<>(builders);
final String[] indices = indicesSet.toArray(new String[0]);
final String[] indices = indicesSet.toArray(new String[indicesSet.size()]);
// inject some bogus docs
final int numBogusDocs = scaledRandomIntBetween(1, builders.size() * 2);
final int unicodeLen = between(1, 10);
@ -1562,7 +1562,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
private boolean randomDynamicTemplates() {
ClusterScope annotation = getAnnotation(this.getClass());
return annotation == null ? true : annotation.randomDynamicTemplates();
return annotation == null || annotation.randomDynamicTemplates();
}
/**
@ -1592,12 +1592,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
}
protected TestCluster buildTestCluster(Scope scope, long seed) throws IOException {
int numClientNodes = InternalTestCluster.DEFAULT_NUM_CLIENT_NODES;
boolean enableRandomBenchNodes = InternalTestCluster.DEFAULT_ENABLE_RANDOM_BENCH_NODES;
boolean enableHttpPipelining = InternalTestCluster.DEFAULT_ENABLE_HTTP_PIPELINING;
int minNumDataNodes = InternalTestCluster.DEFAULT_MIN_NUM_DATA_NODES;
int maxNumDataNodes = InternalTestCluster.DEFAULT_MAX_NUM_DATA_NODES;
SettingsSource settingsSource = InternalTestCluster.DEFAULT_SETTINGS_SOURCE;
final String nodePrefix;
switch (scope) {
case TEST:
@ -1609,7 +1603,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
default:
throw new ElasticsearchException("Scope not supported: " + scope);
}
settingsSource = new SettingsSource() {
SettingsSource settingsSource = new SettingsSource() {
@Override
public Settings node(int nodeOrdinal) {
return ImmutableSettings.builder().put(Node.HTTP_ENABLED, false).
@ -1623,19 +1617,18 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
};
int numDataNodes = getNumDataNodes();
int minNumDataNodes;
int maxNumDataNodes;
if (numDataNodes >= 0) {
minNumDataNodes = maxNumDataNodes = numDataNodes;
} else {
minNumDataNodes = getMinNumDataNodes();
maxNumDataNodes = getMaxNumDataNodes();
}
numClientNodes = getNumClientNodes();
enableRandomBenchNodes = enableRandomBenchNodes();
return new InternalTestCluster(seed, minNumDataNodes, maxNumDataNodes,
clusterName(scope.name(), Integer.toString(CHILD_JVM_ID), seed), settingsSource, numClientNodes,
enableRandomBenchNodes, enableHttpPipelining, CHILD_JVM_ID, nodePrefix);
clusterName(scope.name(), Integer.toString(CHILD_JVM_ID), seed), settingsSource, getNumClientNodes(),
enableRandomBenchNodes(), InternalTestCluster.DEFAULT_ENABLE_HTTP_PIPELINING, CHILD_JVM_ID, nodePrefix);
}
/**