test classes cleanup (fixed warnings and typos)

This commit is contained in:
Luca Cavanna 2013-11-29 16:22:20 +01:00
parent b214943522
commit 8e54319a1d
2 changed files with 7 additions and 8 deletions

View File

@ -183,7 +183,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
currentCluster = buildAndPutCluster(currentClusterScope, true); currentCluster = buildAndPutCluster(currentClusterScope, true);
break; break;
default: default:
assert false : "Unknonw Scope: [" + currentClusterScope + "]"; assert false : "Unknown Scope: [" + currentClusterScope + "]";
} }
currentCluster.beforeTest(getRandom(), getPerTestTransportClientRatio()); currentCluster.beforeTest(getRandom(), getPerTestTransportClientRatio());
wipeIndices(); wipeIndices();
@ -197,7 +197,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
if (createIfExists || testCluster == null) { if (createIfExists || testCluster == null) {
testCluster = buildTestCluster(currentClusterScope); testCluster = buildTestCluster(currentClusterScope);
} else { } else {
assert testCluster != null;
clusters.remove(this.getClass()); clusters.remove(this.getClass());
} }
clearClusters(); clearClusters();
@ -352,7 +351,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
success = true; success = true;
} finally { } finally {
if (!success) { if (!success) {
wipeIndices(created.toArray(new String[0])); wipeIndices(created.toArray(new String[created.size()]));
} }
} }
} }
@ -616,7 +615,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
for (IndexRequestBuilder builder : builders) { for (IndexRequestBuilder builder : builders) {
indicesSet.add(builder.request().index()); indicesSet.add(builder.request().index());
} }
final String[] indices = indicesSet.toArray(new String[0]); final String[] indices = indicesSet.toArray(new String[indicesSet.size()]);
Collections.shuffle(builders, random); Collections.shuffle(builders, random);
final CopyOnWriteArrayList<Tuple<IndexRequestBuilder, Throwable>> errors = new CopyOnWriteArrayList<Tuple<IndexRequestBuilder, Throwable>>(); final CopyOnWriteArrayList<Tuple<IndexRequestBuilder, Throwable>> errors = new CopyOnWriteArrayList<Tuple<IndexRequestBuilder, Throwable>>();
List<CountDownLatch> latches = new ArrayList<CountDownLatch>(); List<CountDownLatch> latches = new ArrayList<CountDownLatch>();
@ -677,7 +676,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
} }
} }
private static final CountDownLatch newLatch(List<CountDownLatch> latches) { private static CountDownLatch newLatch(List<CountDownLatch> latches) {
CountDownLatch l = new CountDownLatch(1); CountDownLatch l = new CountDownLatch(1);
latches.add(l); latches.add(l);
return l; return l;
@ -738,7 +737,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
/** /**
* The scope of a test cluster used together with * The scope of a test cluster used together with
* {@link ClusterScope} annonations on {@link ElasticsearchIntegrationTest} subclasses. * {@link ClusterScope} annotations on {@link ElasticsearchIntegrationTest} subclasses.
*/ */
public static enum Scope { public static enum Scope {
/** /**
@ -753,7 +752,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
/** /**
* A test exclusive test cluster * A test exclusive test cluster
*/ */
TEST; TEST
} }
private ClusterScope getAnnotation(Class<?> clazz) { private ClusterScope getAnnotation(Class<?> clazz) {

View File

@ -598,7 +598,7 @@ public final class TestCluster implements Iterable<Client> {
if (!dataDirToClean.isEmpty()) { if (!dataDirToClean.isEmpty()) {
logger.info("Wipe data directory for all nodes locations: {}", this.dataDirToClean); logger.info("Wipe data directory for all nodes locations: {}", this.dataDirToClean);
try { try {
FileSystemUtils.deleteRecursively(dataDirToClean.toArray(new File[0])); FileSystemUtils.deleteRecursively(dataDirToClean.toArray(new File[dataDirToClean.size()]));
} finally { } finally {
this.dataDirToClean.clear(); this.dataDirToClean.clear();
} }