Remove -Xlint:-deprecated from test/framwork
There were a few uses of deprecation I couldn't clear up quickly so I filed issues for them and suppressed the warnings.
This commit is contained in:
parent
81a7607256
commit
00edc8bc87
|
@ -33,7 +33,7 @@ dependencies {
|
|||
compile 'org.elasticsearch:securemock:1.2'
|
||||
}
|
||||
|
||||
compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes,-serial,-try,-unchecked'
|
||||
compileJava.options.compilerArgs << '-Xlint:-cast,-rawtypes,-serial,-try,-unchecked'
|
||||
compileTestJava.options.compilerArgs << '-Xlint:-rawtypes'
|
||||
|
||||
// the main files are actually test files, so use the appopriate forbidden api sigs
|
||||
|
|
|
@ -23,21 +23,22 @@ import org.apache.lucene.util.LuceneTestCase;
|
|||
|
||||
import java.nio.file.FileSystem;
|
||||
|
||||
/**
|
||||
* Exposes some package private stuff in PathUtils for framework purposes only!
|
||||
/**
|
||||
* Exposes some package private stuff in PathUtils for framework purposes only!
|
||||
*/
|
||||
public class PathUtilsForTesting {
|
||||
|
||||
|
||||
/** Sets a new default filesystem for testing */
|
||||
@SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15845
|
||||
public static void setup() {
|
||||
installMock(LuceneTestCase.getBaseTempDirForTestClass().getFileSystem());
|
||||
}
|
||||
|
||||
|
||||
/** Installs a mock filesystem for testing */
|
||||
public static void installMock(FileSystem mock) {
|
||||
PathUtils.DEFAULT = mock;
|
||||
}
|
||||
|
||||
|
||||
/** Resets filesystem back to the real system default */
|
||||
public static void teardown() {
|
||||
PathUtils.DEFAULT = PathUtils.ACTUAL_DEFAULT;
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.carrotsearch.randomizedtesting.SysGlobals;
|
|||
import com.carrotsearch.randomizedtesting.generators.RandomInts;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
||||
|
||||
import org.apache.lucene.store.StoreRateLimiting;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
|
@ -117,7 +118,6 @@ import java.util.function.Predicate;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.apache.lucene.util.LuceneTestCase.TEST_NIGHTLY;
|
||||
import static org.apache.lucene.util.LuceneTestCase.rarely;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
@ -127,6 +127,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* InternalTestCluster manages a set of JVM private nodes and allows convenient access to them.
|
||||
|
@ -1045,6 +1046,7 @@ public final class InternalTestCluster extends TestCluster {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15844
|
||||
private void randomlyResetClients() throws IOException {
|
||||
// only reset the clients on nightly tests, it causes heavy load...
|
||||
if (RandomizedTest.isNightly() && rarely(random)) {
|
||||
|
|
|
@ -75,6 +75,7 @@ public class LongGCDisruption extends SingleNodeDisruption {
|
|||
return TimeValue.timeValueMillis(0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // stops/resumes threads intentionally
|
||||
@SuppressForbidden(reason = "stops/resumes threads intentionally")
|
||||
protected boolean stopNodeThreads(String node, Set<Thread> nodeThreads) {
|
||||
Thread[] allThreads = null;
|
||||
|
@ -118,6 +119,7 @@ public class LongGCDisruption extends SingleNodeDisruption {
|
|||
return stopped;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // stops/resumes threads intentionally
|
||||
@SuppressForbidden(reason = "stops/resumes threads intentionally")
|
||||
protected void resumeThreads(Set<Thread> threads) {
|
||||
for (Thread thread : threads) {
|
||||
|
|
|
@ -513,9 +513,9 @@ public class ElasticsearchAssertions {
|
|||
public static <T extends Query> T assertBooleanSubQuery(Query query, Class<T> subqueryType, int i) {
|
||||
assertThat(query, instanceOf(BooleanQuery.class));
|
||||
BooleanQuery q = (BooleanQuery) query;
|
||||
assertThat(q.getClauses().length, greaterThan(i));
|
||||
assertThat(q.getClauses()[i].getQuery(), instanceOf(subqueryType));
|
||||
return (T) q.getClauses()[i].getQuery();
|
||||
assertThat(q.clauses().size(), greaterThan(i));
|
||||
assertThat(q.clauses().get(i).getQuery(), instanceOf(subqueryType));
|
||||
return subqueryType.cast(q.clauses().get(i).getQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.test.store;
|
|||
|
||||
import com.carrotsearch.randomizedtesting.SeedUtils;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||
|
||||
import org.apache.lucene.index.CheckIndex;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.store.BaseDirectoryWrapper;
|
||||
|
@ -105,6 +106,7 @@ public class MockFSDirectoryService extends FsDirectoryService {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15846
|
||||
public static void checkIndex(ESLogger logger, Store store, ShardId shardId) {
|
||||
if (store.tryIncRef()) {
|
||||
logger.info("start check index");
|
||||
|
|
Loading…
Reference in New Issue