Apache Solr open-source search software
SOLR-14574: Fix or suppress warnings in solr/core/src/test (part 2)
Erick Erickson84729edbba04
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 23ceea98c8c..013a84510d0 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -359,7 +359,7 @@ Other Changes* SOLR-14573: Fix or suppress warnings in solrj/src/test (Erick Erickson)-* SOLR-14574: Fix or suppress warnings in solr/core/src/test (Erick Erickson)+* SOLR-14574: Fix or suppress warnings in solr/core/src/test (parts 1 and 2) (Erick Erickson)================== 8.5.2 ==================diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetCloudTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetCloudTest.javaindex dbc9522aace..76ff31b8e96 100644--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetCloudTest.java+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetCloudTest.java@@ -131,22 +131,22 @@ public class LegacyNoFacetCloudTest extends LegacyAbstractAnalyticsCloudTest {//IntDouble intResult = getValue(response, "sr", "int_id");- Double intTest = (Double)calculateNumberStat(intTestStart, "sum");+ Double intTest = calculateNumberStat(intTestStart, "sum");assertEquals(responseStr, intResult,intTest);//LongDouble longResult = getValue(response, "sr", "long_ld");- Double longTest = (Double)calculateNumberStat(longTestStart, "sum");+ Double longTest = calculateNumberStat(longTestStart, "sum");assertEquals(responseStr, longResult,longTest);//FloatDouble floatResult = getValue(response, "sr", "float_fd");- Double floatTest = (Double)calculateNumberStat(floatTestStart, "sum");+ Double floatTest = calculateNumberStat(floatTestStart, "sum");assertEquals(responseStr, floatResult,floatTest);//DoubleDouble doubleResult = getValue(response, "sr", "double_dd");- Double doubleTest = (Double) calculateNumberStat(doubleTestStart, "sum");+ Double doubleTest = calculateNumberStat(doubleTestStart, "sum");assertEquals(responseStr, doubleResult,doubleTest);}@@ -163,22 +163,22 @@ public class LegacyNoFacetCloudTest extends LegacyAbstractAnalyticsCloudTest {//IntDouble intResult = getValue(response, "mr", "int_id");- Double intTest = (Double)calculateNumberStat(intTestStart, "mean");+ Double intTest = calculateNumberStat(intTestStart, "mean");assertEquals(responseStr, intResult,intTest);//LongDouble longResult = getValue(response, "mr", "long_ld");- Double longTest = (Double)calculateNumberStat(longTestStart, "mean");+ Double longTest = calculateNumberStat(longTestStart, "mean");assertEquals(responseStr, longResult,longTest);//FloatDouble floatResult = getValue(response, "mr", "float_fd");- Double floatTest = (Double)calculateNumberStat(floatTestStart, "mean");+ Double floatTest = calculateNumberStat(floatTestStart, "mean");assertEquals(responseStr, floatResult,floatTest);//DoubleDouble doubleResult = getValue(response, "mr", "double_dd");- Double doubleTest = (Double)calculateNumberStat(doubleTestStart, "mean");+ Double doubleTest = calculateNumberStat(doubleTestStart, "mean");assertEquals(responseStr, doubleResult,doubleTest);}@@ -195,23 +195,23 @@ public class LegacyNoFacetCloudTest extends LegacyAbstractAnalyticsCloudTest {//IntDouble intResult = getValue(response, "str", "int_id");- Double intTest = (Double)calculateNumberStat(intTestStart, "stddev");+ Double intTest = calculateNumberStat(intTestStart, "stddev");assertEquals(responseStr, intResult, intTest, 0.00000000001);//LongDouble longResult = getValue(response, "str", "long_ld");- Double longTest = (Double)calculateNumberStat(longTestStart, "stddev");+ Double longTest = calculateNumberStat(longTestStart, "stddev");assertEquals(responseStr, longResult, longTest, 0.00000000001);//FloatDouble floatResult = getValue(response, "str", "float_fd");- Double floatTest = (Double)calculateNumberStat(floatTestStart, "stddev");+ Double floatTest = calculateNumberStat(floatTestStart, "stddev");assertEquals(responseStr, floatResult, floatTest, 0.00000000001);//DoubleDouble doubleResult = getValue(response, "str", "double_dd");- Double doubleTest = (Double)calculateNumberStat(doubleTestStart, "stddev");+ Double doubleTest = calculateNumberStat(doubleTestStart, "stddev");assertEquals(responseStr, doubleResult, doubleTest, 0.00000000001);}@@ -229,22 +229,22 @@ public class LegacyNoFacetCloudTest extends LegacyAbstractAnalyticsCloudTest {//IntDouble intResult = getValue(response, "medr", "int_id");- Double intTest = (Double)calculateNumberStat(intTestStart, "median");+ Double intTest = calculateNumberStat(intTestStart, "median");assertEquals(responseStr, intResult,intTest);//LongDouble longResult = getValue(response, "medr", "long_ld");- Double longTest = (Double)calculateNumberStat(longTestStart, "median");+ Double longTest = calculateNumberStat(longTestStart, "median");assertEquals(responseStr, longResult,longTest);//FloatDouble floatResult = getValue(response, "medr", "float_fd");- Double floatTest = (Double)calculateNumberStat(floatTestStart, "median");+ Double floatTest = calculateNumberStat(floatTestStart, "median");assertEquals(responseStr, floatResult,floatTest);//DoubleDouble doubleResult = getValue(response, "medr", "double_dd");- Double doubleTest = (Double)calculateNumberStat(doubleTestStart, "median");+ Double doubleTest = calculateNumberStat(doubleTestStart, "median");assertEquals(responseStr, doubleResult,doubleTest);// TODO: Add test for date mediandiff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetTest.javaindex da737c8853b..310af596c3b 100644--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetTest.java+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/LegacyNoFacetTest.java@@ -139,22 +139,22 @@ public class LegacyNoFacetTest extends LegacyAbstractAnalyticsTest {public void sumTest() throws Exception {//IntDouble intResult = (Double)getStatResult("sr", "int_id", VAL_TYPE.DOUBLE);- Double intTest = (Double)calculateNumberStat(intTestStart, "sum");+ Double intTest = calculateNumberStat(intTestStart, "sum");assertEquals(getRawResponse(), intResult,intTest);//LongDouble longResult = (Double)getStatResult("sr", "long_ld", VAL_TYPE.DOUBLE);- Double longTest = (Double)calculateNumberStat(longTestStart, "sum");+ Double longTest = calculateNumberStat(longTestStart, "sum");assertEquals(getRawResponse(), longResult,longTest);//FloatDouble floatResult = (Double)getStatResult("sr", "float_fd", VAL_TYPE.DOUBLE);- Double floatTest = (Double)calculateNumberStat(floatTestStart, "sum");+ Double floatTest = calculateNumberStat(floatTestStart, "sum");assertEquals(getRawResponse(), floatResult,floatTest);//DoubleDouble doubleResult = (Double)getStatResult("sr", "double_dd", VAL_TYPE.DOUBLE);- Double doubleTest = (Double) calculateNumberStat(doubleTestStart, "sum");+ Double doubleTest = calculateNumberStat(doubleTestStart, "sum");assertEquals(getRawResponse(), doubleResult,doubleTest);}@@ -162,22 +162,22 @@ public class LegacyNoFacetTest extends LegacyAbstractAnalyticsTest {public void meanTest() throws Exception {//IntDouble intResult = (Double)getStatResult("mr", "int_id", VAL_TYPE.DOUBLE);- Double intTest = (Double)calculateNumberStat(intTestStart, "mean");+ Double intTest = calculateNumberStat(intTestStart, "mean");assertEquals(getRawResponse(), intResult,intTest);//LongDouble longResult = (Double)getStatResult("mr", "long_ld", VAL_TYPE.DOUBLE);- Double longTest = (Double)calculateNumberStat(longTestStart, "mean");+ Double longTest = calculateNumberStat(longTestStart, "mean");assertEquals(getRawResponse(), longResult,longTest);//FloatDouble floatResult = (Double)getStatResult("mr", "float_fd", VAL_TYPE.DOUBLE);- Double floatTest = (Double)calculateNumberStat(floatTestStart, "mean");+ Double floatTest = calculateNumberStat(floatTestStart, "mean");assertEquals(getRawResponse(), floatResult,floatTest);//DoubleDouble doubleResult = (Double)getStatResult("mr", "double_dd", VAL_TYPE.DOUBLE);- Double doubleTest = (Double)calculateNumberStat(doubleTestStart, "mean");+ Double doubleTest = calculateNumberStat(doubleTestStart, "mean");assertEquals(getRawResponse(), doubleResult,doubleTest);}@@ -185,23 +185,23 @@ public class LegacyNoFacetTest extends LegacyAbstractAnalyticsTest {public void stddevTest() throws Exception {//IntDouble intResult = (Double)getStatResult("str", "int_id", VAL_TYPE.DOUBLE);- Double intTest = (Double)calculateNumberStat(intTestStart, "stddev");+ Double intTest = calculateNumberStat(intTestStart, "stddev");assertEquals(getRawResponse(), intResult, intTest, 0.00000000001);//LongDouble longResult = (Double)getStatResult("str", "long_ld", VAL_TYPE.DOUBLE);- Double longTest = (Double)calculateNumberStat(longTestStart, "stddev");+ Double longTest = calculateNumberStat(longTestStart, "stddev");assertEquals(getRawResponse(), longResult, longTest, 0.00000000001);//FloatDouble floatResult = (Double)getStatResult("str", "float_fd", VAL_TYPE.DOUBLE);- Double floatTest = (Double)calculateNumberStat(floatTestStart, "stddev");+ Double floatTest = calculateNumberStat(floatTestStart, "stddev");assertEquals(getRawResponse(), floatResult, floatTest, 0.00000000001);//DoubleDouble doubleResult = (Double)getStatResult("str", "double_dd", VAL_TYPE.DOUBLE);- Double doubleTest = (Double)calculateNumberStat(doubleTestStart, "stddev");+ Double doubleTest = calculateNumberStat(doubleTestStart, "stddev");assertEquals(getRawResponse(), doubleResult, doubleTest, 0.00000000001);}@@ -209,22 +209,22 @@ public class LegacyNoFacetTest extends LegacyAbstractAnalyticsTest {public void medianTest() throws Exception {//IntDouble intResult = (Double)getStatResult("medr", "int_id", VAL_TYPE.DOUBLE);- Double intTest = (Double)calculateNumberStat(intTestStart, "median");+ Double intTest = calculateNumberStat(intTestStart, "median");assertEquals(getRawResponse(), intResult,intTest);//LongDouble longResult = (Double)getStatResult("medr", "long_ld", VAL_TYPE.DOUBLE);- Double longTest = (Double)calculateNumberStat(longTestStart, "median");+ Double longTest = calculateNumberStat(longTestStart, "median");assertEquals(getRawResponse(), longResult,longTest);//FloatDouble floatResult = (Double)getStatResult("medr", "float_fd", VAL_TYPE.DOUBLE);- Double floatTest = (Double)calculateNumberStat(floatTestStart, "median");+ Double floatTest = calculateNumberStat(floatTestStart, "median");assertEquals(getRawResponse(), floatResult,floatTest);//DoubleDouble doubleResult = (Double)getStatResult("medr", "double_dd", VAL_TYPE.DOUBLE);- Double doubleTest = (Double)calculateNumberStat(doubleTestStart, "median");+ Double doubleTest = calculateNumberStat(doubleTestStart, "median");assertEquals(getRawResponse(), doubleResult,doubleTest);}diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetCloudTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetCloudTest.javaindex 02bb7efd940..521b6df220b 100644--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetCloudTest.java+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetCloudTest.java@@ -171,7 +171,7 @@ public class LegacyAbstractAnalyticsFacetCloudTest extends LegacyAbstractAnalytiresult = new ArrayList<T>();for (List<T> list : lists) {if( list.size() == 0) continue;- Collections.sort((List<T>)list);+ Collections.sort(list);result.add(list.get(0));}} else {diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.javaindex d406b677ca2..94f679d1ba1 100644--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyAbstractAnalyticsFacetTest.java@@ -267,9 +267,9 @@ public class LegacyAbstractAnalyticsFacetTest extends SolrTestCaseJ4 {}} else if (stat.equals("min")) {result = new ArrayList<T>();- for (List<T> list : lists) {+ for (List list : lists) {if( list.size() == 0) continue;- Collections.sort((List<T>)list);+ Collections.sort(list);result.add(list.get(0));}} else {diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyFieldFacetTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyFieldFacetTest.javaindex 843c605d70a..596b0bae384 100644--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyFieldFacetTest.java+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyFieldFacetTest.java@@ -1074,6 +1074,7 @@ public class LegacyFieldFacetTest extends LegacyAbstractAnalyticsFacetTest{}}+ @SuppressWarnings({"unchecked", "rawtypes"})public static void assertEquals(String mes, Object actual, Object expected) {Collections.sort((List<Comparable>) actual);Collections.sort((List<Comparable>) expected);diff --git a/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java b/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.javaindex 14de8422ee1..a68870844cf 100644--- a/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java+++ b/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java@@ -467,12 +467,14 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {assertTrue("handler is null and it shouldn't be", handler != null);SolrQueryResponse rsp = loadLocal("extraction/solr-word.pdf", ExtractingParams.EXTRACT_ONLY, "true");assertTrue("rsp is null and it shouldn't be", rsp != null);+ @SuppressWarnings({"rawtypes"})NamedList list = rsp.getValues();String extraction = (String) list.get("solr-word.pdf");assertTrue("extraction is null and it shouldn't be", extraction != null);assertTrue(extraction + " does not contain " + "solr-word", extraction.indexOf("solr-word") != -1);+ @SuppressWarnings({"rawtypes"})NamedList nl = (NamedList) list.get("solr-word.pdf_metadata");assertTrue("nl is null and it shouldn't be", nl != null);Object title = nl.get("title");@@ -507,6 +509,7 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {ExtractingParams.EXTRACT_ONLY, "true");assertTrue("rsp is null and it shouldn't be", rsp != null);+ @SuppressWarnings({"rawtypes"})NamedList list = rsp.getValues();String val = (String) list.get("example.html");assertEquals("News", val.trim()); //there is only one matching <a> tagdiff --git a/solr/contrib/jaegertracer-configurator/src/test/org/apache/solr/jaeger/TestJaegerConfigurator.java b/solr/contrib/jaegertracer-configurator/src/test/org/apache/solr/jaeger/TestJaegerConfigurator.javaindex 55018eb5ae8..a0867f78dd6 100644--- a/solr/contrib/jaegertracer-configurator/src/test/org/apache/solr/jaeger/TestJaegerConfigurator.java+++ b/solr/contrib/jaegertracer-configurator/src/test/org/apache/solr/jaeger/TestJaegerConfigurator.java@@ -69,8 +69,10 @@ public class TestJaegerConfigurator extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testRequiredParameters() throws IOException {JaegerTracerConfigurator configurator = new JaegerTracerConfigurator();+ @SuppressWarnings({"rawtypes"})NamedList initArgs = new NamedList();IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> configurator.init(initArgs));assertTrue(exc.getMessage().contains(AGENT_HOST) || exc.getMessage().contains(AGENT_PORT));@@ -92,8 +94,10 @@ public class TestJaegerConfigurator extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testIncorrectFormat() {JaegerTracerConfigurator configurator = new JaegerTracerConfigurator();+ @SuppressWarnings({"rawtypes"})NamedList initArgs = new NamedList();initArgs.add(AGENT_HOST, 100);initArgs.add(AGENT_PORT, 5775);diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureExtractionFromMultipleSegments.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureExtractionFromMultipleSegments.javaindex a15178bd007..8b75dd62882 100644--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureExtractionFromMultipleSegments.java+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureExtractionFromMultipleSegments.java@@ -91,8 +91,10 @@ public class TestFeatureExtractionFromMultipleSegments extends TestRerankBase {query.add("fl", "*, score,id,normHits,description,fv:[features store='feature-store-6' format='dense' efi.user_text='apple']");String res = restTestHarness.query("/query" + query.toQueryString());+ @SuppressWarnings({"unchecked"})Map<String,Object> resultJson = (Map<String,Object>) Utils.fromJSONString(res);+ @SuppressWarnings({"unchecked"})List<Map<String,Object>> docs = (List<Map<String,Object>>)((Map<String,Object>)resultJson.get("response")).get("docs");int passCount = 0;for (final Map<String,Object> doc : docs) {diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.javaindex 48c1262c547..052733e74ca 100644--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java@@ -100,8 +100,10 @@ public class TestNoMatchSolrFeature extends TestRerankBase {String res = restTestHarness.query("/query"+ yesMatchFeatureQuery.toQueryString());+ @SuppressWarnings({"unchecked"})final Map<String,Object> jsonParse = (Map<String,Object>) Utils.fromJSONString(res);+ @SuppressWarnings({"unchecked"})final Double doc0Score = (Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse.get("response")).get("docs")).get(0)).get("score");@@ -165,8 +167,10 @@ public class TestNoMatchSolrFeature extends TestRerankBase {String res = restTestHarness.query("/query"+ yesMatchFeatureQuery.toQueryString());+ @SuppressWarnings({"unchecked"})final Map<String,Object> jsonParse = (Map<String,Object>) Utils.fromJSONString(res);+ @SuppressWarnings({"unchecked"})final Double doc0Score = (Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse.get("response")).get("docs")).get(0)).get("score");diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.javaindex 8ff56842605..0a482ff295d 100644--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java@@ -97,14 +97,20 @@ public class TestOriginalScoreFeature extends TestRerankBase {assertJQ("/query" + query.toQueryString(), "/response/docs/[3]/id=='"+doc3Id+"'");final String res = restTestHarness.query("/query" + query.toQueryString());+ @SuppressWarnings({"unchecked"})final Map<String,Object> jsonParse = (Map<String,Object>) Utils.fromJSONString (res);+ @SuppressWarnings({"unchecked"})final String doc0Score = ((Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse.get("response")).get("docs")).get(0)).get("score")).toString();++ @SuppressWarnings({"unchecked"})final String doc1Score = ((Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse.get("response")).get("docs")).get(1)).get("score")).toString();+ @SuppressWarnings({"unchecked"})final String doc2Score = ((Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse.get("response")).get("docs")).get(2)).get("score")).toString();+ @SuppressWarnings({"unchecked"})final String doc3Score = ((Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse.get("response")).get("docs")).get(3)).get("score")).toString();diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestNeuralNetworkModel.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestNeuralNetworkModel.javaindex 045c625a218..6eea812325c 100644--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestNeuralNetworkModel.java+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestNeuralNetworkModel.java@@ -315,6 +315,7 @@ public class TestNeuralNetworkModel extends TestRerankBase {}@Override+ @SuppressWarnings({"unchecked"})protected Layer createLayer(Object o) {final DefaultLayer layer = new DefaultLayer();if (o != null) {diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.javaindex 0e829e68d95..f52acdcc045 100644--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java@@ -94,16 +94,20 @@ public class TestModelManagerPersistence extends TestRerankBase {.readFileToString(mstorefile, "UTF-8");//check feature/model stores on deletion+ @SuppressWarnings({"unchecked"})final ArrayList<Object> fStore = (ArrayList<Object>) ((Map<String,Object>)Utils.fromJSONString(fstorecontent)).get("managedList");for (int idx = 0;idx < fStore.size(); ++ idx) {+ @SuppressWarnings({"unchecked"})String store = (String) ((Map<String,Object>)fStore.get(idx)).get("store");assertTrue(store.equals("test") || store.equals("test2") || store.equals("test1"));}+ @SuppressWarnings({"unchecked"})final ArrayList<Object> mStore = (ArrayList<Object>) ((Map<String,Object>)Utils.fromJSONString(mstorecontent)).get("managedList");for (int idx = 0;idx < mStore.size(); ++ idx) {+ @SuppressWarnings({"unchecked"})String store = (String) ((Map<String,Object>)mStore.get(idx)).get("store");assertTrue(store.equals("test") || store.equals("test1"));}diff --git a/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.javaindex 104a766dc50..3f05eceb83a 100644--- a/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java+++ b/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java@@ -88,15 +88,14 @@ import org.slf4j.LoggerFactory;** @since solr 1.3*/-public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfoInitialized-{+public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfoInitialized {- /**- * This constant was formerly part of HighlightParams. After deprecation it was removed so clients+ /**+ * This constant was formerly part of HighlightParams. After deprecation it was removed so clients* would no longer use it, but we still support it server side.*/private static final String USE_FVH = HighlightParams.HIGHLIGHT + ".useFastVectorHighlighter";-+private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());protected final SolrCore solrCore;@@ -107,28 +106,28 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf}// Thread safe registry- protected final Map<String,SolrFormatter> formatters =- new HashMap<>();+ protected final Map<String, SolrFormatter> formatters =+ new HashMap<>();// Thread safe registry- protected final Map<String,SolrEncoder> encoders =- new HashMap<>();+ protected final Map<String, SolrEncoder> encoders =+ new HashMap<>();// Thread safe registry- protected final Map<String,SolrFragmenter> fragmenters =- new HashMap<>() ;+ protected final Map<String, SolrFragmenter> fragmenters =+ new HashMap<>();// Thread safe registryprotected final Map<String, SolrFragListBuilder> fragListBuilders =- new HashMap<>() ;+ new HashMap<>();// Thread safe registryprotected final Map<String, SolrFragmentsBuilder> fragmentsBuilders =- new HashMap<>() ;+ new HashMap<>();// Thread safe registryprotected final Map<String, SolrBoundaryScanner> boundaryScanners =- new HashMap<>() ;+ new HashMap<>();@Overridepublic void init(PluginInfo info) {@@ -140,7 +139,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfboundaryScanners.clear();// Load the fragmenters- SolrFragmenter frag = solrCore.initPlugins(info.getChildren("fragmenter") , fragmenters,SolrFragmenter.class,null);+ SolrFragmenter frag = solrCore.initPlugins(info.getChildren("fragmenter"), fragmenters, SolrFragmenter.class, null);if (frag == null) {frag = new GapFragmenter();solrCore.initDefaultPlugin(frag, SolrFragmenter.class);@@ -149,7 +148,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInffragmenters.put(null, frag);// Load the formatters- SolrFormatter fmt = solrCore.initPlugins(info.getChildren("formatter"), formatters,SolrFormatter.class,null);+ SolrFormatter fmt = solrCore.initPlugins(info.getChildren("formatter"), formatters, SolrFormatter.class, null);if (fmt == null) {fmt = new HtmlFormatter();solrCore.initDefaultPlugin(fmt, SolrFormatter.class);@@ -158,7 +157,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfformatters.put(null, fmt);// Load the encoders- SolrEncoder enc = solrCore.initPlugins(info.getChildren("encoder"), encoders,SolrEncoder.class,null);+ SolrEncoder enc = solrCore.initPlugins(info.getChildren("encoder"), encoders, SolrEncoder.class, null);if (enc == null) {enc = new DefaultEncoder();solrCore.initDefaultPlugin(enc, SolrEncoder.class);@@ -168,28 +167,28 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf// Load the FragListBuildersSolrFragListBuilder fragListBuilder = solrCore.initPlugins(info.getChildren("fragListBuilder"),- fragListBuilders, SolrFragListBuilder.class, null );- if( fragListBuilder == null ) {+ fragListBuilders, SolrFragListBuilder.class, null);+ if (fragListBuilder == null) {fragListBuilder = new SimpleFragListBuilder();solrCore.initDefaultPlugin(fragListBuilder, SolrFragListBuilder.class);}- fragListBuilders.put( "", fragListBuilder );- fragListBuilders.put( null, fragListBuilder );+ fragListBuilders.put("", fragListBuilder);+ fragListBuilders.put(null, fragListBuilder);// Load the FragmentsBuildersSolrFragmentsBuilder fragsBuilder = solrCore.initPlugins(info.getChildren("fragmentsBuilder"),- fragmentsBuilders, SolrFragmentsBuilder.class, null);- if( fragsBuilder == null ) {+ fragmentsBuilders, SolrFragmentsBuilder.class, null);+ if (fragsBuilder == null) {fragsBuilder = new ScoreOrderFragmentsBuilder();solrCore.initDefaultPlugin(fragsBuilder, SolrFragmentsBuilder.class);}- fragmentsBuilders.put( "", fragsBuilder );- fragmentsBuilders.put( null, fragsBuilder );+ fragmentsBuilders.put("", fragsBuilder);+ fragmentsBuilders.put(null, fragsBuilder);// Load the BoundaryScannersSolrBoundaryScanner boundaryScanner = solrCore.initPlugins(info.getChildren("boundaryScanner"),- boundaryScanners, SolrBoundaryScanner.class, null);- if(boundaryScanner == null) {+ boundaryScanners, SolrBoundaryScanner.class, null);+ if (boundaryScanner == null) {boundaryScanner = new SimpleBoundaryScanner();solrCore.initDefaultPlugin(boundaryScanner, SolrBoundaryScanner.class);}@@ -200,9 +199,10 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf/*** Return a phrase {@link org.apache.lucene.search.highlight.Highlighter} appropriate for this field.- * @param query The current Query- * @param fieldName The name of the field- * @param request The current SolrQueryRequest+ *+ * @param query The current Query+ * @param fieldName The name of the field+ * @param request The current SolrQueryRequest* @param tokenStream document text tokenStream that implements reset() efficiently (e.g. CachingTokenFilter).* If it's used, call reset() first.* @throws IOException If there is a low-level I/O error.@@ -210,9 +210,9 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfprotected Highlighter getPhraseHighlighter(Query query, String fieldName, SolrQueryRequest request, TokenStream tokenStream) throws IOException {SolrParams params = request.getParams();Highlighter highlighter = new Highlighter(- getFormatter(fieldName, params),- getEncoder(fieldName, params),- getSpanQueryScorer(query, fieldName, tokenStream, request));+ getFormatter(fieldName, params),+ getEncoder(fieldName, params),+ getSpanQueryScorer(query, fieldName, tokenStream, request));highlighter.setTextFragmenter(getFragmenter(fieldName, params));@@ -221,31 +221,33 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf/*** Return a {@link org.apache.lucene.search.highlight.Highlighter} appropriate for this field.- * @param query The current Query+ *+ * @param query The current Query* @param fieldName The name of the field- * @param request The current SolrQueryRequest+ * @param request The current SolrQueryRequest*/protected Highlighter getHighlighter(Query query, String fieldName, SolrQueryRequest request) {SolrParams params = request.getParams();Highlighter highlighter = new Highlighter(- getFormatter(fieldName, params),- getEncoder(fieldName, params),- getQueryScorer(query, fieldName, request));+ getFormatter(fieldName, params),+ getEncoder(fieldName, params),+ getQueryScorer(query, fieldName, request));highlighter.setTextFragmenter(getFragmenter(fieldName, params));return highlighter;}/*** Return a {@link org.apache.lucene.search.highlight.QueryScorer} suitable for this Query and field.- * @param query The current query+ *+ * @param query The current query* @param tokenStream document text tokenStream that implements reset() efficiently (e.g. CachingTokenFilter).* If it's used, call reset() first.- * @param fieldName The name of the field- * @param request The SolrQueryRequest+ * @param fieldName The name of the field+ * @param request The SolrQueryRequest*/protected QueryScorer getSpanQueryScorer(Query query, String fieldName, TokenStream tokenStream, SolrQueryRequest request) {QueryScorer scorer = new QueryScorer(query,- request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false) ? fieldName : null) {+ request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false) ? fieldName : null) {@Overrideprotected WeightedSpanTermExtractor newTermExtractor(String defaultField) {return new CustomSpanTermExtractor(defaultField);@@ -288,9 +290,10 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf/*** Return a {@link org.apache.lucene.search.highlight.Scorer} suitable for this Query and field.- * @param query The current query+ *+ * @param query The current query* @param fieldName The name of the field- * @param request The SolrQueryRequest+ * @param request The SolrQueryRequest*/protected Scorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request) {boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false);@@ -305,8 +308,9 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf* Return the max number of snippets for this field. If this has not* been configured for this field, fall back to the configured default* or the solr default.+ ** @param fieldName The name of the field- * @param params The params controlling Highlighting+ * @param params The params controlling Highlighting*/protected int getMaxSnippets(String fieldName, SolrParams params) {return params.getFieldInt(fieldName, HighlightParams.SNIPPETS, 1);@@ -314,10 +318,11 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf/*** Return whether adjacent fragments should be merged.+ ** @param fieldName The name of the field- * @param params The params controlling Highlighting+ * @param params The params controlling Highlighting*/- protected boolean isMergeContiguousFragments(String fieldName, SolrParams params){+ protected boolean isMergeContiguousFragments(String fieldName, SolrParams params) {return params.getFieldBool(fieldName, HighlightParams.MERGE_CONTIGUOUS_FRAGMENTS, false);}@@ -327,15 +332,14 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf* default or the solr default ({@link org.apache.lucene.search.highlight.SimpleHTMLFormatter}).** @param fieldName The name of the field- * @param params The params controlling Highlighting+ * @param params The params controlling Highlighting* @return An appropriate {@link org.apache.lucene.search.highlight.Formatter}.*/- protected Formatter getFormatter(String fieldName, SolrParams params )- {- String str = params.getFieldParam( fieldName, HighlightParams.FORMATTER );+ protected Formatter getFormatter(String fieldName, SolrParams params) {+ String str = params.getFieldParam(fieldName, HighlightParams.FORMATTER);SolrFormatter formatter = formatters.get(str);- if( formatter == null ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown formatter: "+str );+ if (formatter == null) {+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown formatter: " + str);}return formatter.getFormatter(fieldName, params);}@@ -346,14 +350,14 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf* default or the solr default ({@link org.apache.lucene.search.highlight.DefaultEncoder}).** @param fieldName The name of the field- * @param params The params controlling Highlighting+ * @param params The params controlling Highlighting* @return An appropriate {@link org.apache.lucene.search.highlight.Encoder}.*/- protected Encoder getEncoder(String fieldName, SolrParams params){- String str = params.getFieldParam( fieldName, HighlightParams.ENCODER );- SolrEncoder encoder = encoders.get( str );- if( encoder == null ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown encoder: "+str );+ protected Encoder getEncoder(String fieldName, SolrParams params) {+ String str = params.getFieldParam(fieldName, HighlightParams.ENCODER);+ SolrEncoder encoder = encoders.get(str);+ if (encoder == null) {+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown encoder: " + str);}return encoder.getEncoder(fieldName, params);}@@ -364,46 +368,45 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf* default or the solr default ({@link GapFragmenter}).** @param fieldName The name of the field- * @param params The params controlling Highlighting+ * @param params The params controlling Highlighting* @return An appropriate {@link org.apache.lucene.search.highlight.Fragmenter}.*/- protected Fragmenter getFragmenter(String fieldName, SolrParams params)- {- String fmt = params.getFieldParam( fieldName, HighlightParams.FRAGMENTER );+ protected Fragmenter getFragmenter(String fieldName, SolrParams params) {+ String fmt = params.getFieldParam(fieldName, HighlightParams.FRAGMENTER);SolrFragmenter frag = fragmenters.get(fmt);- if( frag == null ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown fragmenter: "+fmt );+ if (frag == null) {+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown fragmenter: " + fmt);}return frag.getFragmenter(fieldName, params);}- protected FragListBuilder getFragListBuilder( String fieldName, SolrParams params ){- String flb = params.getFieldParam( fieldName, HighlightParams.FRAG_LIST_BUILDER );+ protected FragListBuilder getFragListBuilder(String fieldName, SolrParams params) {+ String flb = params.getFieldParam(fieldName, HighlightParams.FRAG_LIST_BUILDER);SolrFragListBuilder solrFlb = fragListBuilders.get(flb);- if( solrFlb == null ){- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown fragListBuilder: " + flb );+ if (solrFlb == null) {+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown fragListBuilder: " + flb);}return solrFlb.getFragListBuilder(params);}- protected FragmentsBuilder getFragmentsBuilder( String fieldName, SolrParams params ){+ protected FragmentsBuilder getFragmentsBuilder(String fieldName, SolrParams params) {BoundaryScanner bs = getBoundaryScanner(fieldName, params);- return getSolrFragmentsBuilder( fieldName, params ).getFragmentsBuilder(params, bs);+ return getSolrFragmentsBuilder(fieldName, params).getFragmentsBuilder(params, bs);}- protected SolrFragmentsBuilder getSolrFragmentsBuilder( String fieldName, SolrParams params ){- String fb = params.getFieldParam( fieldName, HighlightParams.FRAGMENTS_BUILDER );+ protected SolrFragmentsBuilder getSolrFragmentsBuilder(String fieldName, SolrParams params) {+ String fb = params.getFieldParam(fieldName, HighlightParams.FRAGMENTS_BUILDER);SolrFragmentsBuilder solrFb = fragmentsBuilders.get(fb);- if( solrFb == null ){- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown fragmentsBuilder: " + fb );+ if (solrFb == null) {+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown fragmentsBuilder: " + fb);}return solrFb;}- protected BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params){+ protected BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params) {String bs = params.getFieldParam(fieldName, HighlightParams.BOUNDARY_SCANNER);SolrBoundaryScanner solrBs = boundaryScanners.get(bs);- if(solrBs == null){+ if (solrBs == null) {throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown boundaryScanner: " + bs);}return solrBs.getBoundaryScanner(fieldName, params);@@ -413,12 +416,11 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf* Generates a list of Highlighted query fragments for each item in a list* of documents, or returns null if highlighting is disabled.*- * @param docs query results- * @param query the query- * @param req the current request+ * @param docs query results+ * @param query the query+ * @param req the current request* @param defaultFields default list of fields to summarize- *- * @return NamedList containing a NamedList for each document, which in+ * @return NamedList containing a NamedList for each document, which in* turns contains sets (field, summary) pairs.*/@Override@@ -429,7 +431,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfreturn null;boolean rewrite = query != null && !(Boolean.valueOf(params.get(HighlightParams.USE_PHRASE_HIGHLIGHTER, "true")) &&- Boolean.valueOf(params.get(HighlightParams.HIGHLIGHT_MULTI_TERM, "true")));+ Boolean.valueOf(params.get(HighlightParams.HIGHLIGHT_MULTI_TERM, "true")));if (rewrite) {query = query.rewrite(req.getSearcher().getIndexReader());@@ -500,10 +502,10 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf} else if (useFastVectorHighlighter(params, schemaField)) {if (fvhContainer.fieldQuery == null) {FastVectorHighlighter fvh = new FastVectorHighlighter(- // FVH cannot process hl.usePhraseHighlighter parameter per-field basis- params.getBool(HighlightParams.USE_PHRASE_HIGHLIGHTER, true),- // FVH cannot process hl.requireFieldMatch parameter per-field basis- params.getBool(HighlightParams.FIELD_MATCH, false)) {+ // FVH cannot process hl.usePhraseHighlighter parameter per-field basis+ params.getBool(HighlightParams.USE_PHRASE_HIGHLIGHTER, true),+ // FVH cannot process hl.requireFieldMatch parameter per-field basis+ params.getBool(HighlightParams.FIELD_MATCH, false)) {@Overridepublic FieldQuery getFieldQuery(Query query, IndexReader reader) throws IOException {return new FieldQuery(query, reader, phraseHighlight, fieldMatch) {@@ -526,7 +528,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInffvhContainer.fieldQuery = fvh.getFieldQuery(query, reader);}fieldHighlights =- doHighlightingByFastVectorHighlighter(doc, docId, schemaField, fvhContainer, reader, req);+ doHighlightingByFastVectorHighlighter(doc, docId, schemaField, fvhContainer, reader, req);} else { // standard/default highlighterfieldHighlights = doHighlightingByHighlighter(doc, docId, schemaField, query, reader, req);}@@ -555,14 +557,14 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf*/protected boolean useFastVectorHighlighter(SolrParams params, SchemaField schemaField) {boolean methodFvh =- HighlightComponent.HighlightMethod.FAST_VECTOR.getMethodName().equals(- params.getFieldParam(schemaField.getName(), HighlightParams.METHOD))- || params.getFieldBool(schemaField.getName(), USE_FVH, false);+ HighlightComponent.HighlightMethod.FAST_VECTOR.getMethodName().equals(+ params.getFieldParam(schemaField.getName(), HighlightParams.METHOD))+ || params.getFieldBool(schemaField.getName(), USE_FVH, false);if (!methodFvh) return false;boolean termPosOff = schemaField.storeTermPositions() && schemaField.storeTermOffsets();if (!termPosOff) {log.warn("Solr will use the standard Highlighter instead of FastVectorHighlighter because the {} field {}"- , "does not store TermVectors with TermPositions and TermOffsets.", schemaField.getName());+ , "does not store TermVectors with TermPositions and TermOffsets.", schemaField.getName());}return termPosOff;}@@ -576,15 +578,15 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfString fieldName = schemaField.getName();SolrFragmentsBuilder solrFb = getSolrFragmentsBuilder(fieldName, params);- String[] snippets = fvhContainer.fvh.getBestFragments( fvhContainer.fieldQuery, reader, docId, fieldName,- params.getFieldInt( fieldName, HighlightParams.FRAGSIZE, 100 ),- params.getFieldInt( fieldName, HighlightParams.SNIPPETS, 1 ),- getFragListBuilder( fieldName, params ),- getFragmentsBuilder( fieldName, params ),- solrFb.getPreTags( params, fieldName ),- solrFb.getPostTags( params, fieldName ),- getEncoder( fieldName, params ) );- if (snippets != null && snippets.length > 0 )+ String[] snippets = fvhContainer.fvh.getBestFragments(fvhContainer.fieldQuery, reader, docId, fieldName,+ params.getFieldInt(fieldName, HighlightParams.FRAGSIZE, 100),+ params.getFieldInt(fieldName, HighlightParams.SNIPPETS, 1),+ getFragListBuilder(fieldName, params),+ getFragmentsBuilder(fieldName, params),+ solrFb.getPreTags(params, fieldName),+ solrFb.getPostTags(params, fieldName),+ getEncoder(fieldName, params));+ if (snippets != null && snippets.length > 0)return snippets;return null;}@@ -597,18 +599,18 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInffinal String fieldName = schemaField.getName();final int mvToExamine =- params.getFieldInt(fieldName, HighlightParams.MAX_MULTIVALUED_TO_EXAMINE,- (schemaField.multiValued()) ? Integer.MAX_VALUE : 1);+ params.getFieldInt(fieldName, HighlightParams.MAX_MULTIVALUED_TO_EXAMINE,+ (schemaField.multiValued()) ? Integer.MAX_VALUE : 1);// Technically this is the max *fragments* (snippets), not max values:int mvToMatch =- params.getFieldInt(fieldName, HighlightParams.MAX_MULTIVALUED_TO_MATCH, Integer.MAX_VALUE);+ params.getFieldInt(fieldName, HighlightParams.MAX_MULTIVALUED_TO_MATCH, Integer.MAX_VALUE);if (mvToExamine <= 0 || mvToMatch <= 0) {return null;}int maxCharsToAnalyze = params.getFieldInt(fieldName,- HighlightParams.MAX_CHARS, DEFAULT_MAX_CHARS);+ HighlightParams.MAX_CHARS, DEFAULT_MAX_CHARS);if (maxCharsToAnalyze < 0) {//e.g. -1maxCharsToAnalyze = Integer.MAX_VALUE;}@@ -630,7 +632,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf// note: offsets are minimally sufficient for this HL.final Fields tvFields = schemaField.storeTermOffsets() ? reader.getTermVectors(docId) : null;final TokenStream tvStream =- TokenSources.getTermVectorTokenStreamOrNull(fieldName, tvFields, maxCharsToAnalyze - 1);+ TokenSources.getTermVectorTokenStreamOrNull(fieldName, tvFields, maxCharsToAnalyze - 1);// We need to wrap in OffsetWindowTokenFilter if multi-valuedtry (OffsetWindowTokenFilter tvWindowStream = (tvStream != null && fieldValues.size() > 1) ? new OffsetWindowTokenFilter(tvStream) : null) {@@ -687,7 +689,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf// Highlight!try {TextFragment[] bestTextFragments =- highlighter.getBestTextFragments(tstream, thisText, mergeContiguousFragments, numFragments);+ highlighter.getBestTextFragments(tstream, thisText, mergeContiguousFragments, numFragments);for (TextFragment bestTextFragment : bestTextFragments) {if (bestTextFragment == null)//can happen via mergeContiguousFragmentscontinue;@@ -720,7 +722,8 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfreturn null;//no highlights for this field}- /** Fetches field values to highlight. If the field value should come from an atypical place (or another aliased+ /**+ * Fetches field values to highlight. If the field value should come from an atypical place (or another aliased* field name, then a subclass could override to implement that.*/protected List<String> getFieldValues(SolrDocument doc, String fieldName, int maxValues, int maxCharsToAnalyze,@@ -735,7 +738,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInffor (Object value : fieldValues) {String strValue;if (value instanceof IndexableField) {- strValue = fieldType.toExternal((IndexableField)value);+ strValue = fieldType.toExternal((IndexableField) value);} else {strValue = value.toString(); // TODO FieldType needs an API for this, e.g. toExternalFromDv()}@@ -750,7 +753,8 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfreturn result;}- /** Given the fragments, return the result to be put in the field {@link NamedList}. This is an extension+ /**+ * Given the fragments, return the result to be put in the field {@link NamedList}. This is an extension* point to allow adding other metadata like the absolute offsets or scores.*/protected Object getResponseForFragments(List<TextFragment> frags, SolrQueryRequest req) {@@ -783,7 +787,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfinvariants.put("f." + alternateField + "." + HighlightParams.SNIPPETS, "1");// Enforce maxAlternateFieldLength by FRAGSIZE. Minimum 18 due to FVH limitationsinvariants.put("f." + alternateField + "." + HighlightParams.FRAGSIZE,- alternateFieldLen > 0 ? String.valueOf(Math.max(18, alternateFieldLen)) : String.valueOf(Integer.MAX_VALUE));+ alternateFieldLen > 0 ? String.valueOf(Math.max(18, alternateFieldLen)) : String.valueOf(Integer.MAX_VALUE));SolrParams origParams = req.getParams();req.setParams(SolrParams.wrapDefaults(new MapSolrParams(invariants), origParams));fieldHighlights = doHighlightingOfField(doc, docId, schemaField, fvhContainer, query, reader, req, params);@@ -810,15 +814,15 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfEncoder encoder = getEncoder(fieldName, params);List<String> altList = new ArrayList<>();int len = 0;- for( String altText: altTexts ){- if( alternateFieldLen <= 0 ){+ for (String altText : altTexts) {+ if (alternateFieldLen <= 0) {altList.add(encoder.encodeText(altText));- } else{- altList.add( len + altText.length() > alternateFieldLen ?- encoder.encodeText(altText.substring(0, alternateFieldLen - len)) :- encoder.encodeText(altText) );+ } else {+ altList.add(len + altText.length() > alternateFieldLen ?+ encoder.encodeText(altText.substring(0, alternateFieldLen - len)) :+ encoder.encodeText(altText));len += altText.length();- if( len >= alternateFieldLen ) break;+ if (len >= alternateFieldLen) break;}}return altList;@@ -839,169 +843,172 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfthis.fieldQuery = fieldQuery;}}-}-/** Orders Tokens in a window first by their startOffset ascending.- * endOffset is currently ignored.- * This is meant to work around fickleness in the highlighter only. It- * can mess up token positions and should not be used for indexing or querying.- */-final class TokenOrderingFilter extends TokenFilter {- private final int windowSize;- private final LinkedList<OrderedToken> queue = new LinkedList<>(); //TODO replace with Deque, Array impl- private boolean done=false;- private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);-- protected TokenOrderingFilter(TokenStream input, int windowSize) {- super(input);- this.windowSize = windowSize;- }- @Override- public void reset() throws IOException {- super.reset();- queue.clear();- done = false;- }+ /**+ * Orders Tokens in a window first by their startOffset ascending.+ * endOffset is currently ignored.+ * This is meant to work around fickleness in the highlighter only. It+ * can mess up token positions and should not be used for indexing or querying.+ */+ static final class TokenOrderingFilter extends TokenFilter {+ private final int windowSize;+ private final LinkedList<OrderedToken> queue = new LinkedList<>(); //TODO replace with Deque, Array impl+ private boolean done = false;+ private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);- @Override- public boolean incrementToken() throws IOException {- while (!done && queue.size() < windowSize) {- if (!input.incrementToken()) {- done = true;- break;- }+ protected TokenOrderingFilter(TokenStream input, int windowSize) {+ super(input);+ this.windowSize = windowSize;+ }++ @Override+ public void reset() throws IOException {+ super.reset();+ queue.clear();+ done = false;+ }- // reverse iterating for better efficiency since we know the- // list is already sorted, and most token start offsets will be too.- ListIterator<OrderedToken> iter = queue.listIterator(queue.size());- while(iter.hasPrevious()) {- if (offsetAtt.startOffset() >= iter.previous().startOffset) {- // insertion will be before what next() would return (what- // we just compared against), so move back one so the insertion- // will be after.- iter.next();+ @Override+ public boolean incrementToken() throws IOException {+ while (!done && queue.size() < windowSize) {+ if (!input.incrementToken()) {+ done = true;break;}++ // reverse iterating for better efficiency since we know the+ // list is already sorted, and most token start offsets will be too.+ ListIterator<OrderedToken> iter = queue.listIterator(queue.size());+ while (iter.hasPrevious()) {+ if (offsetAtt.startOffset() >= iter.previous().startOffset) {+ // insertion will be before what next() would return (what+ // we just compared against), so move back one so the insertion+ // will be after.+ iter.next();+ break;+ }+ }+ OrderedToken ot = new OrderedToken();+ ot.state = captureState();+ ot.startOffset = offsetAtt.startOffset();+ iter.add(ot);}- OrderedToken ot = new OrderedToken();- ot.state = captureState();- ot.startOffset = offsetAtt.startOffset();- iter.add(ot);- }- if (queue.isEmpty()) {- return false;- } else {- restoreState(queue.removeFirst().state);- return true;+ if (queue.isEmpty()) {+ return false;+ } else {+ restoreState(queue.removeFirst().state);+ return true;+ }}- }-}--// for TokenOrderingFilter, so it can easily sort by startOffset-class OrderedToken {- State state;- int startOffset;-}+ }-/** For use with term vectors of multi-valued fields. We want an offset based window into its TokenStream. */-final class OffsetWindowTokenFilter extends TokenFilter {+ // for TokenOrderingFilter, so it can easily sort by startOffset+ static class OrderedToken {+ State state;+ int startOffset;+ }- private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);- private final PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class);- private int windowStartOffset;- private int windowEndOffset = -1;//exclusive- private boolean windowTokenIncremented = false;- private boolean inputWasReset = false;- private State capturedState;//only used for first token of each subsequent window+ /** For use with term vectors of multi-valued fields. We want an offset based window into its TokenStream. */+ static final class OffsetWindowTokenFilter extends TokenFilter {- OffsetWindowTokenFilter(TokenStream input) {//input should not have been reset already- super(input);- }+ private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);+ private final PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class);+ private int windowStartOffset;+ private int windowEndOffset = -1;//exclusive+ private boolean windowTokenIncremented = false;+ private boolean inputWasReset = false;+ private State capturedState;//only used for first token of each subsequent window- //Called at the start of each value/window- OffsetWindowTokenFilter advanceToNextWindowOfLength(int length) {- windowStartOffset = windowEndOffset + 1;//unclear why there's a single offset gap between values, but tests show it- windowEndOffset = windowStartOffset + length;- windowTokenIncremented = false;//thereby permit reset()- return this;- }+ OffsetWindowTokenFilter(TokenStream input) {//input should not have been reset already+ super(input);+ }- @Override- public void reset() throws IOException {- //we do some state checking to ensure this is being used correctly- if (windowTokenIncremented) {- throw new IllegalStateException("This TokenStream does not support being subsequently reset()");+ //Called at the start of each value/window+ OffsetWindowTokenFilter advanceToNextWindowOfLength(int length) {+ windowStartOffset = windowEndOffset + 1;//unclear why there's a single offset gap between values, but tests show it+ windowEndOffset = windowStartOffset + length;+ windowTokenIncremented = false;//thereby permit reset()+ return this;}- if (!inputWasReset) {- super.reset();- inputWasReset = true;++ @Override+ public void reset() throws IOException {+ //we do some state checking to ensure this is being used correctly+ if (windowTokenIncremented) {+ throw new IllegalStateException("This TokenStream does not support being subsequently reset()");+ }+ if (!inputWasReset) {+ super.reset();+ inputWasReset = true;+ }}- }- @Override- public boolean incrementToken() throws IOException {- assert inputWasReset;- windowTokenIncremented = true;- while (true) {- //increment Token- if (capturedState == null) {- if (!input.incrementToken()) {- return false;+ @Override+ public boolean incrementToken() throws IOException {+ assert inputWasReset;+ windowTokenIncremented = true;+ while (true) {+ //increment Token+ if (capturedState == null) {+ if (!input.incrementToken()) {+ return false;+ }+ } else {+ restoreState(capturedState);+ capturedState = null;+ //Set posInc to 1 on first token of subsequent windows. To be thorough, we could subtract posIncGap?+ posIncAtt.setPositionIncrement(1);}- } else {- restoreState(capturedState);- capturedState = null;- //Set posInc to 1 on first token of subsequent windows. To be thorough, we could subtract posIncGap?- posIncAtt.setPositionIncrement(1);- }- final int startOffset = offsetAtt.startOffset();- final int endOffset = offsetAtt.endOffset();- if (startOffset >= windowEndOffset) {//end of window- capturedState = captureState();- return false;- }- if (startOffset >= windowStartOffset) {//in this window- offsetAtt.setOffset(startOffset - windowStartOffset, endOffset - windowStartOffset);- return true;+ final int startOffset = offsetAtt.startOffset();+ final int endOffset = offsetAtt.endOffset();+ if (startOffset >= windowEndOffset) {//end of window+ capturedState = captureState();+ return false;+ }+ if (startOffset >= windowStartOffset) {//in this window+ offsetAtt.setOffset(startOffset - windowStartOffset, endOffset - windowStartOffset);+ return true;+ }+ //otherwise this token is before the window; continue to advance}- //otherwise this token is before the window; continue to advance}}-}-/** Wraps a DirectoryReader that caches the {@link LeafReader#getTermVectors(int)} so that- * if the next call has the same ID, then it is reused.- */-class TermVectorReusingLeafReader extends FilterLeafReader {+ /**+ * Wraps a DirectoryReader that caches the {@link LeafReader#getTermVectors(int)} so that+ * if the next call has the same ID, then it is reused.+ */+ static class TermVectorReusingLeafReader extends FilterLeafReader {- private int lastDocId = -1;- private Fields tvFields;+ private int lastDocId = -1;+ private Fields tvFields;- public TermVectorReusingLeafReader(LeafReader in) {- super(in);- }+ public TermVectorReusingLeafReader(LeafReader in) {+ super(in);+ }- @Override- public Fields getTermVectors(int docID) throws IOException {- if (docID != lastDocId) {- lastDocId = docID;- tvFields = in.getTermVectors(docID);+ @Override+ public Fields getTermVectors(int docID) throws IOException {+ if (docID != lastDocId) {+ lastDocId = docID;+ tvFields = in.getTermVectors(docID);+ }+ return tvFields;}- return tvFields;- }- @Override- public CacheHelper getCoreCacheHelper() {- return null;- }+ @Override+ public CacheHelper getCoreCacheHelper() {+ return null;+ }- @Override- public CacheHelper getReaderCacheHelper() {- return null;- }+ @Override+ public CacheHelper getReaderCacheHelper() {+ return null;+ }+ }}diff --git a/solr/core/src/test/org/apache/hadoop/fs/FileUtil.java b/solr/core/src/test/org/apache/hadoop/fs/FileUtil.javaindex 56ad7312559..c24c9b04ebf 100644--- a/solr/core/src/test/org/apache/hadoop/fs/FileUtil.java+++ b/solr/core/src/test/org/apache/hadoop/fs/FileUtil.java@@ -726,6 +726,7 @@ public class FileUtil {try {// Consume stdout and stderr, to avoid blocking the commandexecutor = Executors.newFixedThreadPool(2);+ @SuppressWarnings({"rawtypes"})Future output = executor.submit(() -> {try {// Read until the output stream receives an EOF and closed.@@ -751,6 +752,7 @@ public class FileUtil {}}});+ @SuppressWarnings({"rawtypes"})Future error = executor.submit(() -> {try {// Read until the error stream receives an EOF and closed.diff --git a/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java b/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.javaindex e73f3ee1e5b..0630dec559d 100644--- a/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java+++ b/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java@@ -132,6 +132,7 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {Map<String, Metric> metrics = manager.registry(registry).getMetrics();assertTrue(metrics.containsKey("CORE.coreName"));assertTrue(metrics.containsKey("CORE.refCount"));+ @SuppressWarnings({"unchecked"})Gauge<Number> g = (Gauge<Number>)metrics.get("CORE.refCount");assertTrue(g.getValue().intValue() > 0);@@ -451,6 +452,7 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"rawtypes"})public void testRequestHandlerBaseException() {final String tmp = "BOO! ignore_exception";SolrRequestHandler handler = new RequestHandlerBase() {@@ -540,7 +542,9 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testLocalSolrQueryRequestParams() {+ @SuppressWarnings({"rawtypes"})HashMap args = new HashMap();args.put("string", "string value");args.put("array", new String[] {"array", "value"});@@ -615,7 +619,9 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testSolrParams() throws Exception {+ @SuppressWarnings({"rawtypes"})NamedList nl = new NamedList();nl.add("i",555);nl.add("s","bbb");@@ -653,6 +659,7 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {assertEquals(p.getBool("foo",false), false);assertEquals(!!p.getBool("bt"), !p.getBool("bf"));+ @SuppressWarnings({"rawtypes"})NamedList more = new NamedList();more.add("s", "aaa");more.add("s", "ccc");diff --git a/solr/core/src/test/org/apache/solr/CursorPagingTest.java b/solr/core/src/test/org/apache/solr/CursorPagingTest.javaindex a1331473d89..2210e18ec3f 100644--- a/solr/core/src/test/org/apache/solr/CursorPagingTest.java+++ b/solr/core/src/test/org/apache/solr/CursorPagingTest.java@@ -668,11 +668,13 @@ public class CursorPagingTest extends SolrTestCaseJ4 {while (0 < docsOnThisPage) {String json = assertJQ(req(params,CURSOR_MARK_PARAM, cursorMark));+ @SuppressWarnings({"rawtypes"})Map rsp = (Map) fromJSONString(json);assertTrue("response doesn't contain " + CURSOR_MARK_NEXT + ": " + json,rsp.containsKey(CURSOR_MARK_NEXT));String nextCursorMark = (String)rsp.get(CURSOR_MARK_NEXT);assertNotNull(CURSOR_MARK_NEXT + " is null", nextCursorMark);+ @SuppressWarnings({"unchecked"})List<Map<Object,Object>> docs = (List) (((Map)rsp.get("response")).get("docs"));docsOnThisPage = docs.size();if (null != params.getInt(CommonParams.ROWS)) {@@ -743,6 +745,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {** Also checks that facets are the same with each page, and that they are correct.*/+ @SuppressWarnings({"unchecked"})public SentinelIntSet assertFullWalkNoDupsWithFacets(int maxSize, SolrParams params)throws Exception {@@ -754,9 +757,11 @@ public class CursorPagingTest extends SolrTestCaseJ4 {SentinelIntSet ids = new SentinelIntSet(maxSize, -1);String cursorMark = CURSOR_MARK_START;int docsOnThisPage = Integer.MAX_VALUE;+ @SuppressWarnings({"rawtypes"})List previousFacets = null;while (0 < docsOnThisPage) {String json = assertJQ(req(params, CURSOR_MARK_PARAM, cursorMark));+ @SuppressWarnings({"rawtypes"})Map rsp = (Map) fromJSONString(json);assertTrue("response doesn't contain " + CURSOR_MARK_NEXT + ": " + json,rsp.containsKey(CURSOR_MARK_NEXT));@@ -790,7 +795,9 @@ public class CursorPagingTest extends SolrTestCaseJ4 {}cursorMark = nextCursorMark;+ @SuppressWarnings({"rawtypes"})Map facetFields = (Map)((Map)rsp.get("facet_counts")).get("facet_fields");+ @SuppressWarnings({"rawtypes"})List facets = (List)facetFields.get(facetField);if (null != previousFacets) {assertEquals("Facets not the same as on previous page:\nprevious page facets: "@@ -825,6 +832,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {*/public String assertCursor(SolrQueryRequest req, String... tests) throws Exception {String json = assertJQ(req, tests);+ @SuppressWarnings({"rawtypes"})Map rsp = (Map) fromJSONString(json);assertTrue("response doesn't contain "+CURSOR_MARK_NEXT + ": " + json,rsp.containsKey(CURSOR_MARK_NEXT));diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.javaindex a8ce5d6fcf9..aebc772f02f 100644--- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java+++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java@@ -117,6 +117,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void test() throws Exception {assertEquals(clients.size(), jettys.size());@@ -599,7 +600,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {if (shardReq.params.getBool(StatsParams.STATS, false)) {numStatsShardRequests++;for (ShardResponse shardRsp : shardReq.sreq.responses) {- NamedList<Object> shardStats =+ NamedList<Object> shardStats =((NamedList<NamedList<NamedList<Object>>>)shardRsp.getSolrResponse().getResponse().get("stats")).get("stats_fields").get(i1);@@ -629,7 +630,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {//assertEquals("wrong min", -987.0D, (Double)s.getMin(), 0.0001D );assertEquals("wrong mean", 377.153846D, (Double)s.getMean(), 0.0001D );- assertEquals("wrong stddev", 1271.76215D, (Double)s.getStddev(), 0.0001D );+ assertEquals("wrong stddev", 1271.76215D, s.getStddev(), 0.0001D );//assertNull("expected null for count", s.getCount());assertNull("expected null for calcDistinct", s.getCountDistinct());@@ -683,7 +684,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {// ignore the FieldStatsInfo convinience class, and look directly at the NamedList// so we don't need any sort of crazy reflection- NamedList<Object> svals =+ NamedList<Object> svals =((NamedList<NamedList<NamedList<Object>>>)rsp.getResponse().get("stats")).get("stats_fields").get(i1);@@ -806,7 +807,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {// NOTE: min is expected to be null even though requested because of no valuesassertEquals("wrong min", null, s.getMin());assertTrue("mean should be NaN", ((Double)s.getMean()).isNaN());- assertEquals("wrong stddev", 0.0D, (Double)s.getStddev(), 0.0D );+ assertEquals("wrong stddev", 0.0D, s.getStddev(), 0.0D );// things that we didn't ask for, so they better be nullassertNull("expected null for count", s.getCount());@@ -1154,6 +1155,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {}}+ @SuppressWarnings({"unchecked", "rawtypes"})protected void queryPartialResults(final List<String> upShards,final List<SolrClient> upClients,Object... q) throws Exception {diff --git a/solr/core/src/test/org/apache/solr/TestGroupingSearch.java b/solr/core/src/test/org/apache/solr/TestGroupingSearch.javaindex a7ff5a51d0c..54e983bb9b7 100644--- a/solr/core/src/test/org/apache/solr/TestGroupingSearch.java+++ b/solr/core/src/test/org/apache/solr/TestGroupingSearch.java@@ -772,6 +772,7 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {types.add(new FldType("foo_bdv", ZERO_ONE, new BVal()));clearIndex();+ @SuppressWarnings({"rawtypes"})Map<Comparable, Doc> model = indexDocs(types, null, indexSize);//System.out.println("############### model=" + model);@@ -848,6 +849,7 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {rows=1; start=0; group_offset=1; group_limit=1;}+ @SuppressWarnings({"rawtypes"})Map<Comparable, Grp> groups = groupBy(model.values(), groupField);// first sort the docs in each group@@ -888,7 +890,7 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {continue;}- for (Comparable field : doc.getValues(FOO_STRING_FIELD)) {+ for (@SuppressWarnings({"rawtypes"})Comparable field : doc.getValues(FOO_STRING_FIELD)) {String key = field.toString();boolean exists = facetCounts.containsKey(key);int count = exists ? facetCounts.get(key) : 0;@@ -896,6 +898,7 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {}}}+ @SuppressWarnings({"rawtypes"})List<Comparable> expectedFacetResponse = new ArrayList<>();for (Map.Entry<String, Integer> stringIntegerEntry : facetCounts.entrySet()) {expectedFacetResponse.add(stringIntegerEntry.getKey());@@ -1023,6 +1026,7 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {};}+ @SuppressWarnings({"rawtypes"})public static Map<Comparable, Grp> groupBy(Collection<Doc> docs, String field) {Map<Comparable, Grp> groups = new HashMap<>();for (Doc doc : docs) {@@ -1055,6 +1059,7 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {public static class Grp {+ @SuppressWarnings({"rawtypes"})public Comparable groupValue;public List<Doc> docs;public Doc maxDoc; // the document highest according to the "sort" paramdiff --git a/solr/core/src/test/org/apache/solr/TestJoin.java b/solr/core/src/test/org/apache/solr/TestJoin.javaindex f3d9b07ff6b..3cd8fc2404e 100644--- a/solr/core/src/test/org/apache/solr/TestJoin.java+++ b/solr/core/src/test/org/apache/solr/TestJoin.java@@ -177,6 +177,7 @@ public class TestJoin extends SolrTestCaseJ4 {@Test+ @SuppressWarnings({"unchecked"})public void testRandomJoin() throws Exception {int indexIter=50 * RANDOM_MULTIPLIER;int queryIter=50 * RANDOM_MULTIPLIER;@@ -207,7 +208,9 @@ public class TestJoin extends SolrTestCaseJ4 {types.add(new FldType("small_is_dv",ZERO_ONE, new IRange(0,5+indexSize/3)));clearIndex();+ @SuppressWarnings({"rawtypes"})Map<Comparable, Doc> model = indexDocs(types, null, indexSize);+ @SuppressWarnings({"rawtypes"})Map<String, Map<Comparable, Set<Comparable>>> pivots = new HashMap<>();for (int qiter=0; qiter<queryIter; qiter++) {@@ -228,6 +231,7 @@ public class TestJoin extends SolrTestCaseJ4 {toField = group[random().nextInt(group.length)];}+ @SuppressWarnings({"rawtypes"})Map<Comparable, Set<Comparable>> pivot = pivots.get(fromField+"/"+toField);if (pivot == null) {pivot = createJoinMap(model, fromField, toField);@@ -235,10 +239,12 @@ public class TestJoin extends SolrTestCaseJ4 {}Collection<Doc> fromDocs = model.values();+ @SuppressWarnings({"rawtypes"})Set<Comparable> docs = join(fromDocs, pivot);List<Doc> docList = new ArrayList<>(docs.size());- for (Comparable id : docs) docList.add(model.get(id));+ for (@SuppressWarnings({"rawtypes"})Comparable id : docs) docList.add(model.get(id));Collections.sort(docList, createComparator("_docid_",true,false,false,false));+ @SuppressWarnings({"rawtypes"})List sortedDocs = new ArrayList();for (Doc doc : docList) {if (sortedDocs.size() >= 10) break;@@ -279,6 +285,7 @@ public class TestJoin extends SolrTestCaseJ4 {}+ @SuppressWarnings({"rawtypes"})Map<Comparable, Set<Comparable>> createJoinMap(Map<Comparable, Doc> model, String fromField, String toField) {Map<Comparable, Set<Comparable>> id_to_id = new HashMap<>();@@ -305,9 +312,12 @@ public class TestJoin extends SolrTestCaseJ4 {}+ @SuppressWarnings({"rawtypes"})Set<Comparable> join(Collection<Doc> input, Map<Comparable, Set<Comparable>> joinMap) {+ @SuppressWarnings({"rawtypes"})Set<Comparable> ids = new HashSet<>();for (Doc doc : input) {+ @SuppressWarnings({"rawtypes"})Collection<Comparable> output = joinMap.get(doc.id);if (output == null) continue;ids.addAll(output);diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.javaindex 3b7a67df237..fbeaad1f49d 100644--- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java@@ -141,6 +141,7 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase@Test//05-Jul-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 09-Apr-2018// commented out on: 24-Dec-2018 @LuceneTestCase.BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 2-Aug-2018+ @SuppressWarnings({"try"})public void test() throws Exception {// None of the operations used here are particularly costly, so this should work.// Using this low timeout will also help us catch index stalling.diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.javaindex 1ffa4d7896b..1a6d54e3bc9 100644--- a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java@@ -284,6 +284,7 @@ public class CollectionPropsTest extends SolrCloudTestCase {}@Override+ @SuppressWarnings({"unchecked", "rawtypes"})public boolean onStateChanged(Map<String, String> collectionProperties) {log.info("{}: state changed...", name);if (forceReadPropsFromZk) {diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.javaindex 33a0a6ddf28..f7435736cb1 100644--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java@@ -143,6 +143,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {.process(cluster.getSolrClient());for (int i = 0; i < 300; i++) {+ @SuppressWarnings({"rawtypes"})Map m = cluster.getSolrClient().getZkStateReader().getClusterProperty(COLLECTION_DEF, null);if (m != null) break;Thread.sleep(10);@@ -227,6 +228,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {.process(cluster.getSolrClient());for (int i = 0; i < 300; i++) {+ @SuppressWarnings({"rawtypes"})Map m = cluster.getSolrClient().getZkStateReader().getClusterProperty(COLLECTION_DEF, null);if (m != null) break;Thread.sleep(10);@@ -643,9 +645,11 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {req.setWithSizeInfo(true);CollectionAdminResponse rsp = req.process(cluster.getSolrClient());assertEquals(0, rsp.getStatus());+ @SuppressWarnings({"unchecked"})List<Object> nonCompliant = (List<Object>)rsp.getResponse().findRecursive(collectionName, "schemaNonCompliant");assertEquals(nonCompliant.toString(), 1, nonCompliant.size());assertTrue(nonCompliant.toString(), nonCompliant.contains("(NONE)"));+ @SuppressWarnings({"unchecked"})NamedList<Object> segInfos = (NamedList<Object>) rsp.getResponse().findRecursive(collectionName, "shards", "shard1", "leader", "segInfos");assertNotNull(Utils.toJSONString(rsp), segInfos.findRecursive("info", "core", "startTime"));assertNotNull(Utils.toJSONString(rsp), segInfos.get("fieldInfoLegend"));diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.javaindex 9e0289ec956..0b488f02e2b 100644--- a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java@@ -615,6 +615,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {LukeRequest req = new LukeRequest("/admin/luke");req.setShowSchema(true);NamedList<Object> rsp = controlClient.request(req);+ @SuppressWarnings({"unchecked"})NamedList<Object> fields = (NamedList) ((NamedList)rsp.get("schema")).get("fields");ArrayList<String> names = new ArrayList<>(fields.size());for (Map.Entry<String,Object> item : fields) {diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.javaindex d99a4069e21..d9a1a09e9e6 100644--- a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java@@ -78,6 +78,7 @@ public class DistribDocExpirationUpdateProcessorTest extends SolrCloudTestCase {/*** Modifies the request to inlcude authentication params if needed, returns the request*/+ @SuppressWarnings({"rawtypes"})private <T extends SolrRequest> T setAuthIfNeeded(T req) {if (null != USER) {assert null != PASS;diff --git a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.javaindex 4b1d7d43b11..0b15fe018eb 100644--- a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java@@ -418,7 +418,7 @@ public class FullSolrCloudDistribCmdsTest extends SolrCloudTestCase {final int totalDocsExpected = numThreads * numBatchesPerThread * numDocsPerBatch;ExecutorUtil.shutdownAndAwaitTermination(executor);- for (Future result : futures) {+ for (@SuppressWarnings({"rawtypes"})Future result : futures) {assertFalse(result.isCancelled());assertTrue(result.isDone());// all we care about is propogating any possibile execution exception...diff --git a/solr/core/src/test/org/apache/solr/cloud/MetricsHistoryIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/MetricsHistoryIntegrationTest.javaindex 5332e7ad831..a720677a5e4 100644--- a/solr/core/src/test/org/apache/solr/cloud/MetricsHistoryIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/MetricsHistoryIntegrationTest.java@@ -100,6 +100,7 @@ public class MetricsHistoryIntegrationTest extends SolrCloudTestCase {NamedList<Object> rsp = solrClient.request(createHistoryRequest(params(CommonParams.ACTION, "list")));assertNotNull(rsp);// expected solr.jvm, solr.node and solr.collection..system+ @SuppressWarnings({"unchecked"})SimpleOrderedMap<Object> lst = (SimpleOrderedMap<Object>) rsp.get("metrics");assertNotNull(lst);assertEquals(lst.toString(), 3, lst.size());@@ -109,6 +110,7 @@ public class MetricsHistoryIntegrationTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testStatus() throws Exception {NamedList<Object> rsp = solrClient.request(createHistoryRequest(params(CommonParams.ACTION, "status", CommonParams.NAME, "solr.jvm")));@@ -129,6 +131,7 @@ public class MetricsHistoryIntegrationTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testGet() throws Exception {NamedList<Object> rsp = solrClient.request(createHistoryRequest(params(CommonParams.ACTION, "get", CommonParams.NAME, "solr.jvm")));@@ -192,6 +195,7 @@ public class MetricsHistoryIntegrationTest extends SolrCloudTestCase {});}+ @SuppressWarnings({"rawtypes"})public static SolrRequest createHistoryRequest(SolrParams params) {return new GenericSolrRequest(SolrRequest.METHOD.GET, "/admin/metrics/history", params);}diff --git a/solr/core/src/test/org/apache/solr/cloud/MockSolrSource.java b/solr/core/src/test/org/apache/solr/cloud/MockSolrSource.javaindex 05d56f5ce96..72813960132 100644--- a/solr/core/src/test/org/apache/solr/cloud/MockSolrSource.java+++ b/solr/core/src/test/org/apache/solr/cloud/MockSolrSource.java@@ -43,6 +43,6 @@ public class MockSolrSource {when(zkControllerMock.getZkStateReader()).thenReturn(reader);when(zkControllerMock.getZkClient()).thenReturn(zkClient);when(zkControllerMock.getOverseer()).thenReturn(overseer);- return (ZkController) zkControllerMock;+ return zkControllerMock;}}diff --git a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.javaindex c9bbb8fd17a..c8357afad01 100644--- a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java@@ -290,6 +290,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());params.set("collection", "collection1");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");diff --git a/solr/core/src/test/org/apache/solr/cloud/NestedShardedAtomicUpdateTest.java b/solr/core/src/test/org/apache/solr/cloud/NestedShardedAtomicUpdateTest.javaindex b640fe80cd7..43fc6fdd1ed 100644--- a/solr/core/src/test/org/apache/solr/cloud/NestedShardedAtomicUpdateTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/NestedShardedAtomicUpdateTest.java@@ -108,10 +108,12 @@ public class NestedShardedAtomicUpdateTest extends AbstractFullDistribZkTestBaseQueryResponse rsp = getRandomSolrClient().query(params("qt","/get", "id","1", "fl", "*, [child]"));SolrDocument val = (SolrDocument) rsp.getResponse().get("doc");assertEquals("1", val.getFieldValue("id"));+ @SuppressWarnings({"unchecked"})List<SolrDocument> children = (List) val.getFieldValues("children");assertEquals(1, children.size());SolrDocument childDoc = children.get(0);assertEquals("2", childDoc.getFieldValue("id"));+ @SuppressWarnings({"unchecked"})List<SolrDocument> grandChildren = (List) childDoc.getFieldValues("grandChildren");assertEquals(idIndex + 1, grandChildren.size());SolrDocument grandChild = grandChildren.get(0);@@ -164,10 +166,12 @@ public class NestedShardedAtomicUpdateTest extends AbstractFullDistribZkTestBaseQueryResponse rsp = getRandomSolrClient().query(params("qt","/get", "id","1", "fl", "*, [child]"));SolrDocument val = (SolrDocument) rsp.getResponse().get("doc");assertEquals("1", val.getFieldValue("id"));+ @SuppressWarnings({"unchecked"})List<SolrDocument> children = (List) val.getFieldValues("children");assertEquals(1, children.size());SolrDocument childDoc = children.get(0);assertEquals("2", childDoc.getFieldValue("id"));+ @SuppressWarnings({"unchecked"})List<SolrDocument> grandChildren = (List) childDoc.getFieldValues("grandChildren");assertEquals(1, grandChildren.size());SolrDocument grandChild = grandChildren.get(0);diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.javaindex 6602fac85cc..a5f9e796d3a 100644--- a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java@@ -269,6 +269,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {when(workQueueMock.getTailId()).thenAnswer(invocation -> {Object result = null;+ @SuppressWarnings({"rawtypes"})Iterator iter = queue.iterator();while(iter.hasNext()) {result = iter.next();diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.javaindex c9a90a56b60..ed113cd4cdd 100644--- a/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerModifyCollectionTest.java@@ -73,6 +73,7 @@ public class OverseerModifyCollectionTest extends SolrCloudTestCase {private String getConfigNameFromZk(String collName) throws KeeperException, InterruptedException {byte[] b = zkClient().getData(ZkStateReader.getCollectionPathRoot(collName), null, null, false);+ @SuppressWarnings({"rawtypes"})Map confData = (Map) Utils.fromJSON(b);return (String) confData.get(ZkController.CONFIGNAME_PROP);}diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.javaindex 029103abe8e..8be7a2c2332 100644--- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java@@ -507,6 +507,7 @@ public class OverseerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"try"})public void testDownNodeFailover() throws Exception {MockZKController mockController = null;SolrZkClient overseerClient = null;diff --git a/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.javaindex a2a6de88f61..8bd0c875748 100644--- a/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java@@ -132,6 +132,7 @@ public class ReindexCollectionTest extends SolrCloudTestCase {.setTarget(targetCollection);CollectionAdminResponse rsp = req.process(solrClient);assertNotNull(rsp.toString(), rsp.getResponse().get(ReindexCollectionCmd.REINDEX_STATUS));+ @SuppressWarnings({"unchecked"})Map<String, Object> status = (Map<String, Object>)rsp.getResponse().get(ReindexCollectionCmd.REINDEX_STATUS);assertEquals(status.toString(), (long)NUM_DOCS, ((Number)status.get("inputDocs")).longValue());assertEquals(status.toString(), (long)NUM_DOCS, ((Number)status.get("processedDocs")).longValue());@@ -334,6 +335,7 @@ public class ReindexCollectionTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testAbort() throws Exception {final String sourceCollection = "abortReindexing";final String targetCollection = "abortReindexingTarget";diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeNoTargetTest.java b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeNoTargetTest.javaindex 843e05c65cb..cd5d4be5c6a 100644--- a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeNoTargetTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeNoTargetTest.java@@ -73,6 +73,7 @@ public class ReplaceNodeNoTargetTest extends SolrCloudTestCase {String setClusterPolicyCommand = "{" +" 'set-cluster-policy': [" +" {'replica':'<5', 'shard': '#EACH', 'node': '#ANY'}]}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);diff --git a/solr/core/src/test/org/apache/solr/cloud/RoutingToNodesWithPropertiesTest.java b/solr/core/src/test/org/apache/solr/cloud/RoutingToNodesWithPropertiesTest.javaindex 9133875b3a5..4f9cbfc09ba 100644--- a/solr/core/src/test/org/apache/solr/cloud/RoutingToNodesWithPropertiesTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/RoutingToNodesWithPropertiesTest.java@@ -83,6 +83,7 @@ public class RoutingToNodesWithPropertiesTest extends SolrCloudTestCase {" 'shard':'#EACH'," +" 'sysprop.zone':'#EACH'}]}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = CloudTestUtils.AutoScalingRequest.create(SolrRequest.METHOD.POST, commands);cluster.getSolrClient().request(req);diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.javaindex f86284a5797..7d63d8acf46 100644--- a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java@@ -268,6 +268,7 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {for (Slice slice : coll.getActiveSlices()) {for (Replica replica : slice.getReplicas()) {String uri = "" + replica.get(ZkStateReader.BASE_URL_PROP) + "/" + replica.get(ZkStateReader.CORE_NAME_PROP) + "/config";+ @SuppressWarnings({"rawtypes"})Map respMap = getAsMap(cloudClient, uri);Long maxTime = (Long) (getObjectByPath(respMap, true, asList("config", "updateHandler", "autoSoftCommit", "maxTime")));ret.put(replica.getCoreName(), maxTime);@@ -276,6 +277,7 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {return ret;}+ @SuppressWarnings({"rawtypes"})private Map getAsMap(CloudSolrClient cloudClient, String uri) throws Exception {HttpGet get = new HttpGet(uri);HttpEntity entity = null;diff --git a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.javaindex 4394eb14aa1..c5a249f58c6 100644--- a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java@@ -102,6 +102,7 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase {params.set("action", CollectionAction.SYNCSHARD.toString());params.set("collection", "collection1");params.set("shard", "shard1");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");diff --git a/solr/core/src/test/org/apache/solr/cloud/SystemCollectionCompatTest.java b/solr/core/src/test/org/apache/solr/cloud/SystemCollectionCompatTest.javaindex bede77537d5..fba4aff67ea 100644--- a/solr/core/src/test/org/apache/solr/cloud/SystemCollectionCompatTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/SystemCollectionCompatTest.java@@ -180,6 +180,7 @@ public class SystemCollectionCompatTest extends SolrCloudTestCase {}assertNotNull(overseerNode);LogWatcherConfig watcherCfg = new LogWatcherConfig(true, null, "WARN", 100);+ @SuppressWarnings({"rawtypes"})LogWatcher watcher = LogWatcher.newRegisteredLogWatcher(watcherCfg, null);watcher.reset();diff --git a/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java b/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.javaindex 85f9f5dda47..2a200fa2f79 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java@@ -108,6 +108,7 @@ public abstract class TestBaseStatsCacheCloud extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testBasicStats() throws Exception {QueryResponse cloudRsp = solrClient.query(collectionName,params("q", "foo_t:\"bar baz\"", "fl", "*,score", "rows", "" + NUM_DOCS, "debug", "true"));diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.javaindex 916836861cf..61e6dbdc881 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java@@ -295,12 +295,14 @@ public class TestCloudConsistency extends SolrCloudTestCase {}private void assertDocExists(HttpSolrClient solr, String coll, String docId) throws Exception {+ @SuppressWarnings({"rawtypes"})NamedList rsp = realTimeGetDocId(solr, docId);String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), docId);assertTrue("Doc with id=" + docId + " not found in " + solr.getBaseURL()+ " due to: " + match + "; rsp="+rsp, match == null);}+ @SuppressWarnings({"rawtypes"})private NamedList realTimeGetDocId(HttpSolrClient solr, String docId) throws SolrServerException, IOException {QueryRequest qr = new QueryRequest(params("qt", "/get", "id", docId, "distrib", "false"));return solr.request(qr);diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.javaindex 8bd391950eb..ff2af57a328 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java@@ -135,10 +135,12 @@ public class TestCloudPhrasesIdentificationComponent extends SolrCloudTestCase {req.setPath(path);final QueryResponse rsp = req.process(getRandClient(random()));try {+ @SuppressWarnings({"unchecked"})NamedList<Object> phrases = (NamedList<Object>) rsp.getResponse().get("phrases");assertEquals("input", input, phrases.get("input"));assertEquals("summary", expected, phrases.get("summary"));+ @SuppressWarnings({"unchecked"})final List<NamedList<Object>> details = (List<NamedList<Object>>) phrases.get("details");assertNotNull("null details", details);assertEquals("num phrases found", 2, details.size());@@ -167,10 +169,12 @@ public class TestCloudPhrasesIdentificationComponent extends SolrCloudTestCase {req.setPath("/phrases");final QueryResponse rsp = req.process(getRandClient(random()));try {+ @SuppressWarnings({"unchecked"})NamedList<Object> phrases = (NamedList<Object>) rsp.getResponse().get("phrases");assertEquals("input", input, phrases.get("input"));assertEquals("summary", input, phrases.get("summary"));+ @SuppressWarnings({"unchecked"})final List<NamedList<Object>> details = (List<NamedList<Object>>) phrases.get("details");assertNotNull("null details", details);assertEquals("num phrases found", 0, details.size());diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.javaindex 54bd9b7e2f1..5e20994e597 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudSearcherWarming.java@@ -311,7 +311,7 @@ public class TestCloudSearcherWarming extends SolrCloudTestCase {public static class SleepingSolrEventListener implements SolrEventListener {@Override- public void init(NamedList args) {+ public void init(@SuppressWarnings({"rawtypes"})NamedList args) {// No-Op}diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.javaindex 1dc2d0441a4..86742fada2d 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java@@ -214,6 +214,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {solrClient.close();}+ @SuppressWarnings({"rawtypes"})private NamedList getConfigSetPropertiesFromZk(SolrZkClient zkClient, String path) throws Exception {byte [] oldPropsData = null;@@ -236,6 +237,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {private void verifyProperties(String configSetName, Map<String, String> oldProps,Map<String, String> newProps, SolrZkClient zkClient) throws Exception {+ @SuppressWarnings({"rawtypes"})NamedList properties = getConfigSetPropertiesFromZk(zkClient,ZkConfigManager.CONFIGS_ZKNODE + "/" + configSetName + "/" + DEFAULT_FILENAME);// let's check without merging the maps, since that's what the MessageHandler does@@ -260,6 +262,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {}// check the value in properties are correct+ @SuppressWarnings({"unchecked"})Iterator<Map.Entry<String, Object>> it = properties.iterator();while (it.hasNext()) {Map.Entry<String, Object> entry = it.next();@@ -283,6 +286,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {ByteBuffer emptyData = ByteBuffer.allocate(0);// Checking error when no configuration name is specified in request+ @SuppressWarnings({"rawtypes"})Map map = postDataAndGetResponse(solrCluster.getSolrClient(),solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString()+ "/admin/configs?action=UPLOAD", emptyData, null, null);@@ -488,6 +492,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {ZkConfigManager configManager = new ZkConfigManager(zkClient);assertFalse(configManager.configExists(configSetName+suffix));+ @SuppressWarnings({"rawtypes"})Map map = postDataAndGetResponse(solrCluster.getSolrClient(),solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/admin/configs?action=UPLOAD&name="+configSetName+suffix,sampleZippedConfig, username, password);@@ -577,6 +582,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {params.set("name", collectionName);params.set("numShards", numShards);params.set("replicationFactor", replicationFactor);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -585,6 +591,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {return res;}+ @SuppressWarnings({"rawtypes"})public static Map postDataAndGetResponse(CloudSolrClient cloudClient,String uri, ByteBuffer bytarr, String username, String password) throws IOException {HttpPost httpPost = null;@@ -620,7 +627,9 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {return m;}- private static Object getObjectByPath(Map root, boolean onlyPrimitive, java.util.List<String> hierarchy) {+ private static Object getObjectByPath(@SuppressWarnings({"rawtypes"})Map root,+ boolean onlyPrimitive, java.util.List<String> hierarchy) {+ @SuppressWarnings({"rawtypes"})Map obj = root;for (int i = 0; i < hierarchy.size(); i++) {String s = hierarchy.get(i);@@ -677,7 +686,8 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {solrClient.close();}- private void verifyException(SolrClient solrClient, ConfigSetAdminRequest request,+ private void verifyException(SolrClient solrClient,+ @SuppressWarnings({"rawtypes"})ConfigSetAdminRequest request,String errorContains) throws Exception {Exception e = expectThrows(Exception.class, () -> solrClient.request(request));assertTrue("Expected exception message to contain: " + errorContains@@ -773,6 +783,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {}public static class CreateNoErrorChecking extends ConfigSetAdminRequest.Create {+ @SuppressWarnings({"rawtypes"})public ConfigSetAdminRequest setAction(ConfigSetAction action) {return super.setAction(action);}@@ -788,6 +799,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {}public static class DeleteNoErrorChecking extends ConfigSetAdminRequest.Delete {+ @SuppressWarnings({"rawtypes"})public ConfigSetAdminRequest setAction(ConfigSetAction action) {return super.setAction(action);}diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIExclusivity.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIExclusivity.javaindex 407828bca0a..20a88e0dcac 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIExclusivity.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIExclusivity.java@@ -112,11 +112,13 @@ public class TestConfigSetsAPIExclusivity extends SolrTestCaseJ4 {this.trials = trials;}+ @SuppressWarnings({"rawtypes"})public abstract ConfigSetAdminRequest createRequest();public void run() {final String baseUrl = solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString();final SolrClient solrClient = getHttpSolrClient(baseUrl);+ @SuppressWarnings({"rawtypes"})ConfigSetAdminRequest request = createRequest();for (int i = 0; i < trials; ++i) {@@ -159,6 +161,7 @@ public class TestConfigSetsAPIExclusivity extends SolrTestCaseJ4 {}@Override+ @SuppressWarnings({"rawtypes"})public ConfigSetAdminRequest createRequest() {Create create = new Create();create.setBaseConfigSetName(baseConfigSet).setConfigSetName(configSet);@@ -175,6 +178,7 @@ public class TestConfigSetsAPIExclusivity extends SolrTestCaseJ4 {}@Override+ @SuppressWarnings({"rawtypes"})public ConfigSetAdminRequest createRequest() {Delete delete = new Delete();delete.setConfigSetName(configSet);diff --git a/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.java b/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.javaindex 55e69fae0f7..2188f6bc094 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.java@@ -267,6 +267,7 @@ public class TestHashPartitioner extends SolrTestCaseJ4 {+ @SuppressWarnings({"unchecked"})DocCollection createCollection(int nSlices, DocRouter router) {List<Range> ranges = router.partitionRange(nSlices, router.fullRange());diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.javaindex 33e29e979ed..65a03e8ef0a 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java@@ -52,7 +52,6 @@ import org.apache.solr.common.cloud.DocCollection;import org.apache.solr.common.cloud.Replica;import org.apache.solr.common.cloud.Slice;import org.apache.solr.common.cloud.ZkStateReader;-import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.TimeSource;import org.apache.solr.core.SolrCore;import org.apache.solr.util.TestInjection;@@ -262,7 +261,7 @@ public class TestPullReplica extends SolrCloudTestCase {"stats", "true");QueryResponse statsResponse = pullReplicaClient.query(req);assertEquals("Replicas shouldn't process the add document request: " + statsResponse,- 0L, ((Map<String, Object>)((NamedList<Object>)statsResponse.getResponse()).findRecursive("plugins", "UPDATE", "updateHandler", "stats")).get("UPDATE.updateHandler.adds"));+ 0L, ((Map<String, Object>)(statsResponse.getResponse()).findRecursive("plugins", "UPDATE", "updateHandler", "stats")).get("UPDATE.updateHandler.adds"));}}if (reloaded) {@@ -392,6 +391,7 @@ public class TestPullReplica extends SolrCloudTestCase {/** validate that replication still happens on a new leader*/+ @SuppressWarnings({"try"})private void doTestNoLeader(boolean removeReplica) throws Exception {CollectionAdminRequest.createCollection(collectionName, "conf", 1, 1, 0, 1).setMaxShardsPerNode(100)diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.javaindex b207fa3c91c..e981167b6ac 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java@@ -447,6 +447,7 @@ public class TestRebalanceLeaders extends SolrCloudTestCase {params.set("shardUnique", "true");}+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");cluster.getSolrClient().request(request);diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSSLRandomization.java b/solr/core/src/test/org/apache/solr/cloud/TestSSLRandomization.javaindex e846f73bc33..23a453fc46b 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestSSLRandomization.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestSSLRandomization.java@@ -139,7 +139,7 @@ public class TestSSLRandomization extends SolrCloudTestCase {// for some cases, we know exactly what the config should be regardless of randomization factorsSSLTestConfig conf;- for (Class c : Arrays.asList(FullyAnnotated.class, InheritedFullyAnnotated.class,+ for (@SuppressWarnings({"rawtypes"})Class c : Arrays.asList(FullyAnnotated.class, InheritedFullyAnnotated.class,GrandchildInheritedEmptyAnnotatationWithOverride.class )) {r = SSLRandomizer.getSSLRandomizerForClass(c);assertEquals(c.toString(), 0.42D, r.ssl, 0.0D);@@ -147,7 +147,7 @@ public class TestSSLRandomization extends SolrCloudTestCase {assertTrue(c.toString(), r.debug.contains("foo"));}- for (Class c : Arrays.asList(NotAnnotated.class, InheritedNotAnnotated.class)) {+ for (@SuppressWarnings({"rawtypes"})Class c : Arrays.asList(NotAnnotated.class, InheritedNotAnnotated.class)) {r = SSLRandomizer.getSSLRandomizerForClass(c);assertEquals(c.toString(), 0.0D, r.ssl, 0.0D);assertEquals(c.toString(), 0.0D, r.clientAuth, 0.0D);@@ -157,7 +157,7 @@ public class TestSSLRandomization extends SolrCloudTestCase {assertEquals(c.toString(), false, conf.isClientAuthMode());}- for (Class c : Arrays.asList(Suppressed.class,+ for (@SuppressWarnings({"rawtypes"})Class c : Arrays.asList(Suppressed.class,InheritedSuppressed.class,InheritedAnnotationButSuppressed.class,InheritedSuppressedWithIgnoredAnnotation.class)) {@@ -171,13 +171,13 @@ public class TestSSLRandomization extends SolrCloudTestCase {assertEquals(c.toString(), false, conf.isClientAuthMode());}- for (Class c : Arrays.asList(EmptyAnnotated.class, InheritedEmptyAnnotated.class)) {+ for (@SuppressWarnings({"rawtypes"})Class c : Arrays.asList(EmptyAnnotated.class, InheritedEmptyAnnotated.class)) {r = SSLRandomizer.getSSLRandomizerForClass(c);assertEquals(c.toString(), RandomizeSSL.DEFAULT_ODDS, r.ssl, 0.0D);assertEquals(c.toString(), RandomizeSSL.DEFAULT_ODDS, r.clientAuth, 0.0D);}- for (Class c : Arrays.asList(SimplyAnnotated.class, InheritedEmptyAnnotatationWithOverride.class)) {+ for (@SuppressWarnings({"rawtypes"})Class c : Arrays.asList(SimplyAnnotated.class, InheritedEmptyAnnotatationWithOverride.class)) {r = SSLRandomizer.getSSLRandomizerForClass(c);assertEquals(c.toString(), 0.5D, r.ssl, 0.0D);assertEquals(c.toString(), 0.5D, r.clientAuth, 0.0D);@@ -205,7 +205,7 @@ public class TestSSLRandomization extends SolrCloudTestCase {assertEquals(RandomizeSSL.DEFAULT_ODDS, r.ssl, 0.0D);assertEquals(0.42D, r.clientAuth, 0.0D);- for (Class c : Arrays.asList(SSLOutOfRangeAnnotated.class,+ for (@SuppressWarnings({"rawtypes"})Class c : Arrays.asList(SSLOutOfRangeAnnotated.class,ClientAuthOutOfRangeAnnotated.class,InheritedOutOfRangeAnnotated.class)) {expectThrows(IllegalArgumentException.class, () -> {diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithDelegationTokens.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithDelegationTokens.javaindex b1ec4aaf889..d28fad77a67 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithDelegationTokens.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithDelegationTokens.java@@ -169,6 +169,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {assertEquals("Did not receive expected status code", expectedStatusCode, lastStatusCode);}+ @SuppressWarnings({"rawtypes"})private SolrRequest getAdminRequest(final SolrParams params) {return new CollectionAdminRequest.List() {@Override@@ -179,6 +180,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {}};}+ @SuppressWarnings({"rawtypes"})private SolrRequest getUpdateRequest(boolean commit) {UpdateRequest request = new UpdateRequest();if (commit) {@@ -190,6 +192,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {return request;}+ @SuppressWarnings({"unchecked"})private int getStatusCode(String token, final String user, final String op, HttpSolrClient client)throws Exception {SolrClient delegationTokenClient;@@ -210,6 +213,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {ModifiableSolrParams p = new ModifiableSolrParams();if (user != null) p.set(USER_PARAM, user);if (op != null) p.set("op", op);+ @SuppressWarnings({"rawtypes"})SolrRequest req = getAdminRequest(p);if (user != null || op != null) {Set<String> queryParams = new HashSet<>();@@ -228,7 +232,8 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {}}- private void doSolrRequest(HttpSolrClient client, SolrRequest request,+ private void doSolrRequest(HttpSolrClient client,+ @SuppressWarnings({"rawtypes"})SolrRequest request,int expectedStatusCode) throws Exception {try {client.request(request);@@ -238,7 +243,8 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {}}- private void doSolrRequest(HttpSolrClient client, SolrRequest request, String collectionName,+ private void doSolrRequest(HttpSolrClient client,+ @SuppressWarnings({"rawtypes"})SolrRequest request, String collectionName,int expectedStatusCode) throws Exception {try {client.request(request, collectionName);@@ -408,6 +414,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {String token = getDelegationToken(null, "bar", solrClientPrimary);assertNotNull(token);+ @SuppressWarnings({"rawtypes"})SolrRequest request = getAdminRequest(new ModifiableSolrParams());// test without token@@ -465,6 +472,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {try {// test update request with token via property and commit=true+ @SuppressWarnings({"rawtypes"})SolrRequest request = getUpdateRequest(true);doSolrRequest(scUpdateWToken, request, collectionName, HttpStatus.SC_OK);diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.javaindex 1b4fe995788..ee1515f01c0 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java@@ -193,14 +193,17 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {}}+ @SuppressWarnings({"rawtypes"})private SolrRequest getProxyRequest(String user, String doAs) {return getProxyRequest(user, doAs, null);}+ @SuppressWarnings({"rawtypes"})private SolrRequest getProxyRequest(String user, String doAs, String remoteHost) {return getProxyRequest(user, doAs, remoteHost, null);}+ @SuppressWarnings({"rawtypes"})private SolrRequest getProxyRequest(String user, String doAs, String remoteHost, String remoteAddress) {return new CollectionAdminRequest.List() {@Overridediff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.javaindex 15d7c46aa23..789136e22d1 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java@@ -105,8 +105,9 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {* initial index seeding has finished (we're focusing on testing atomic updates, not basic indexing).*/private String testInjection = null;-+@BeforeClass+ @SuppressWarnings({"unchecked"})private static void createMiniSolrCloudCluster() throws Exception {// NOTE: numDocsToCheck uses atLeast, so nightly & multiplier are alreayd a factor in index size// no need to redundently factor them in here as well@@ -144,8 +145,6 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {CLIENTS.add(getHttpSolrClient(baseUrl + "/" + COLLECTION_NAME + "/"));}- final boolean usingPoints = Boolean.getBoolean(NUMERIC_POINTS_SYSPROP);-// sanity check no one broke the assumptions we make about our schemacheckExpectedSchemaType( map("name","long","class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Long.class),@@ -207,6 +206,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {@Test+ @SuppressWarnings({"unchecked"})public void test_dv() throws Exception {String field = "long_dv";checkExpectedSchemaField(map("name", field,@@ -219,6 +219,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void test_dv_stored() throws Exception {String field = "long_dv_stored";checkExpectedSchemaField(map("name", field,@@ -230,6 +231,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {checkField(field);}+ @SuppressWarnings({"unchecked"})public void test_dv_stored_idx() throws Exception {String field = "long_dv_stored_idx";checkExpectedSchemaField(map("name", field,@@ -241,6 +243,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {checkField(field);}+ @SuppressWarnings({"unchecked"})public void test_dv_idx() throws Exception {String field = "long_dv_idx";checkExpectedSchemaField(map("name", field,@@ -251,6 +254,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {checkField(field);}+ @SuppressWarnings({"unchecked"})public void test_stored_idx() throws Exception {String field = "long_stored_idx";checkExpectedSchemaField(map("name", field,@@ -282,7 +286,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {UpdateResponse rsp = update(doc).process(CLOUD_CLIENT);assertEquals(doc.toString() + " => " + rsp.toString(), 0, rsp.getStatus());if (0 == id % DOC_ID_INCR) {- expected[(int)(id / DOC_ID_INCR)] = new AtomicLong(initValue);+ expected[id / DOC_ID_INCR] = new AtomicLong(initValue);}}assertNotNull("Sanity Check no off-by-one in expected init: ", expected[expected.length-1]);@@ -337,7 +341,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {for (int id = 0; id < numDocsInIndex; id += DOC_ID_INCR) {assert 0 == id % DOC_ID_INCR : "WTF? " + id;- final long expect = expected[(int)(id / DOC_ID_INCR)].longValue();+ final long expect = expected[id / DOC_ID_INCR].longValue();final String docId = "" + id;@@ -397,7 +401,7 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {UpdateResponse rsp = update(doc).process(client);assertEquals(doc + " => " + rsp, 0, rsp.getStatus());- AtomicLong counter = expected[(int)(docId / DOC_ID_INCR)];+ AtomicLong counter = expected[docId / DOC_ID_INCR];assertNotNull("null counter for " + docId + "/" + DOC_ID_INCR, counter);counter.getAndAdd(delta);diff --git a/solr/core/src/test/org/apache/solr/cloud/TestWithCollection.java b/solr/core/src/test/org/apache/solr/cloud/TestWithCollection.javaindex ca7f68791e5..2ee47f4e79a 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestWithCollection.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestWithCollection.java@@ -139,6 +139,7 @@ public class TestWithCollection extends SolrCloudTestCase {" {'cores':'<10', 'node':'#ANY'}," +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);@@ -258,6 +259,7 @@ public class TestWithCollection extends SolrCloudTestCase {" {'replica':'<2', 'node':'#ANY'}," +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);@@ -299,6 +301,7 @@ public class TestWithCollection extends SolrCloudTestCase {" {'replica':'<2', 'node':'#ANY'}," +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);@@ -349,6 +352,7 @@ public class TestWithCollection extends SolrCloudTestCase {" {'replica':'<2', 'node':'#ANY'}," +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);@@ -411,6 +415,7 @@ public class TestWithCollection extends SolrCloudTestCase {" {'replica':'<2', 'node':'#ANY'}," +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);@@ -528,6 +533,7 @@ public class TestWithCollection extends SolrCloudTestCase {" {'replica':'<2', 'node':'#ANY'}," +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.javaindex 6a091620063..e9afc3bdd9d 100644--- a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java@@ -16,6 +16,7 @@*/package org.apache.solr.cloud;+import java.io.IOException;import java.nio.file.Path;import java.util.HashSet;import java.util.Set;@@ -41,6 +42,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {initCore("solrconfig.xml", "schema.xml");}+ @SuppressWarnings({"try"})static class ZkConnection implements AutoCloseable {private ZkTestServer server = null;@@ -67,18 +69,20 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {}@Override- public void close() throws Exception {+ public void close() throws IOException, InterruptedException {if (zkClient != null) zkClient.close();if (server != null) server.shutdown();}}+ @SuppressWarnings({"try"})public void testConnect() throws Exception {try (ZkConnection conn = new ZkConnection (false)) {// do nothing}}+ @SuppressWarnings({"try"})public void testMakeRootNode() throws Exception {try (ZkConnection conn = new ZkConnection ()) {final SolrZkClient zkClient = new SolrZkClient(conn.getServer().getZkHost(), AbstractZkTestCase.TIMEOUT);@@ -90,6 +94,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {}}+ @SuppressWarnings({"try"})public void testClean() throws Exception {try (ZkConnection conn = new ZkConnection ()) {final SolrZkClient zkClient = conn.getClient();@@ -226,6 +231,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"try"})public void testMultipleWatchesAsync() throws Exception {try (ZkConnection conn = new ZkConnection()) {final SolrZkClient zkClient = conn.getClient();@@ -276,6 +282,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {}}+ @SuppressWarnings({"try"})public void testWatchChildren() throws Exception {try (ZkConnection conn = new ZkConnection ()) {final SolrZkClient zkClient = conn.getClient();@@ -323,7 +330,8 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {}}-++ @SuppressWarnings({"try"})public void testSkipPathPartsOnMakePath() throws Exception {try (ZkConnection conn = new ZkConnection()) {final SolrZkClient zkClient = conn.getClient();diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/AssignTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/AssignTest.javaindex 8c97c8de09d..962d04e0fd9 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/AssignTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/AssignTest.java@@ -194,6 +194,7 @@ public class AssignTest extends SolrTestCaseJ4 {// lets provide a custom preference and assert that autoscaling is used even if useLegacyReplicaAssignment=false// our custom preferences are exactly the same as the default ones// but because we are providing them explicitly, they must cause autoscaling to turn on+ @SuppressWarnings({"rawtypes"})List<Map> customPreferences = Policy.DEFAULT_PREFERENCES.stream().map(preference -> preference.getOriginal()).collect(Collectors.toList());diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.javaindex 1d2c5b1cb8a..ad02ab1e0b4 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java@@ -215,6 +215,7 @@ public class CollectionsAPIDistributedZkTest extends SolrCloudTestCase {params.set("action", CollectionAction.CREATE.toString());params.set("numShards", 2);// missing required collection parameter+ @SuppressWarnings({"rawtypes"})final SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -225,6 +226,7 @@ public class CollectionsAPIDistributedZkTest extends SolrCloudTestCase {@Testpublic void testTooManyReplicas() {+ @SuppressWarnings({"rawtypes"})CollectionAdminRequest req = CollectionAdminRequest.createCollection("collection", "conf", 2, 10);expectThrows(Exception.class, () -> {@@ -241,6 +243,7 @@ public class CollectionsAPIDistributedZkTest extends SolrCloudTestCase {params.set(REPLICATION_FACTOR, 10);params.set("collection.configName", "conf");+ @SuppressWarnings({"rawtypes"})final SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -258,6 +261,7 @@ public class CollectionsAPIDistributedZkTest extends SolrCloudTestCase {params.set("numShards", 0);params.set("collection.configName", "conf");+ @SuppressWarnings({"rawtypes"})final SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");expectThrows(Exception.class, () -> {diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/ConcurrentCreateCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/ConcurrentCreateCollectionTest.javaindex 42fd19d10e9..d9fb8b19eaa 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/ConcurrentCreateCollectionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/ConcurrentCreateCollectionTest.java@@ -159,6 +159,7 @@ public class ConcurrentCreateCollectionTest extends SolrCloudTestCase {" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = CloudTestUtils.AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);client.request(req);}diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.javaindex 9c0ada78799..54b0368da07 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java@@ -58,6 +58,7 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestBif (request.get("success") != null) {assertTrue(cloudClient.getZkStateReader().getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, false));+ @SuppressWarnings({"rawtypes"})CollectionAdminRequest delete = CollectionAdminRequest.deleteCollection(collectionName);cloudClient.request(delete);diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.javaindex 9be6d9e3a17..b0a96913af2 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java@@ -111,6 +111,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("numShards", "10");params.set("maxShardsPerNode", 1);params.set("shards", "b0,b1,b2,b3,b4,b5,b6,b7,b8,b9");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -131,12 +132,14 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {assertNull(clusterState.getCollectionOrNull(collectionName));}+ @SuppressWarnings({"unchecked", "rawtypes"})private void testModifyCollection() throws Exception {try (CloudSolrClient client = createCloudClient(null)) {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.MODIFYCOLLECTION.toString());params.set("collection", COLLECTION_NAME);params.set("replicationFactor", 25);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -198,6 +201,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("numShards", "1");params.set("replicationFactor", "1");params.set("nrtReplicas", "2");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -245,6 +249,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("numShards", "1");params.set("replicationFactor", "1");params.set("collection.configName", configSet);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -260,8 +265,10 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {final CollectionAdminRequest.ClusterStatus req = CollectionAdminRequest.getClusterStatus();NamedList<Object> rsp = client.request(req);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertNotNull("Testing to insure collections are returned", collections.get(COLLECTION_NAME1));@@ -284,11 +291,14 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertEquals(1, collections.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> collection = (Map<String, Object>) collections.get(collectionName);assertNotNull(collection);assertEquals(collection.get("replicationFactor"), collection.get("nrtReplicas"));@@ -301,19 +311,25 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());params.set("collection", COLLECTION_NAME);params.set("shard", SHARD1);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertNotNull(collections.get(COLLECTION_NAME));assertEquals(1, collections.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> collection = (Map<String, Object>) collections.get(COLLECTION_NAME);+ @SuppressWarnings({"unchecked"})Map<String, Object> shardStatus = (Map<String, Object>) collection.get("shards");assertEquals(1, shardStatus.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> selectedShardStatus = (Map<String, Object>) shardStatus.get(SHARD1);assertNotNull(selectedShardStatus);@@ -327,17 +343,23 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {request.setShardName(SHARD1 + "," + SHARD2);NamedList<Object> rsp = request.process(client).getResponse();+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertNotNull(collections.get(COLLECTION_NAME));assertEquals(1, collections.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> collection = (Map<String, Object>) collections.get(COLLECTION_NAME);+ @SuppressWarnings({"unchecked"})Map<String, Object> shardStatus = (Map<String, Object>) collection.get("shards");assertEquals(2, shardStatus.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> firstSelectedShardStatus = (Map<String, Object>) shardStatus.get(SHARD1);assertNotNull(firstSelectedShardStatus);+ @SuppressWarnings({"unchecked"})Map<String, Object> secondSelectedShardStatus = (Map<String, Object>) shardStatus.get(SHARD2);assertNotNull(secondSelectedShardStatus);}@@ -348,10 +370,12 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {try (CloudSolrClient client = createCloudClient(null)) {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.LIST.toString());+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})List<String> collections = (List<String>) rsp.get("collections");assertTrue("control_collection was not found in list", collections.contains("control_collection"));assertTrue(DEFAULT_COLLECTION + " was not found in list", collections.contains(DEFAULT_COLLECTION));@@ -366,17 +390,21 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {try (CloudSolrClient client = createCloudClient(null)) {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertNotNull(collections.get(COLLECTION_NAME1));assertEquals(4, collections.size());+ @SuppressWarnings({"unchecked"})List<String> liveNodes = (List<String>) cluster.get("live_nodes");assertNotNull("Live nodes should not be null", liveNodes);assertFalse(liveNodes.isEmpty());@@ -389,15 +417,19 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());params.set("collection", COLLECTION_NAME);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertEquals(1, collections.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> collection = (Map<String, Object>) collections.get(COLLECTION_NAME);assertNotNull(collection);assertEquals("conf1", collection.get("configName"));@@ -405,6 +437,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {}}+ @SuppressWarnings({"unchecked"})private void clusterStatusZNodeVersion() throws Exception {String cname = "clusterStatusZNodeVersion";try (CloudSolrClient client = createCloudClient(null)) {@@ -415,6 +448,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());params.set("collection", cname);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -448,6 +482,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {private static long totalexpectedV2Calls;+ @SuppressWarnings({"rawtypes"})public static SolrRequest setV2(SolrRequest req) {if (V2Request.v2Calls.get() == null) V2Request.v2Calls.set(new AtomicLong());totalexpectedV2Calls = V2Request.v2Calls.get().get();@@ -474,25 +509,32 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());params.set("collection", DEFAULT_COLLECTION);params.set(ShardParams._ROUTE_, "a!");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");assertNotNull("Collections should not be null in cluster state", collections);assertNotNull(collections.get(DEFAULT_COLLECTION));assertEquals(1, collections.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> collection = (Map<String, Object>) collections.get(DEFAULT_COLLECTION);assertEquals("conf1", collection.get("configName"));+ @SuppressWarnings({"unchecked"})Map<String, Object> shardStatus = (Map<String, Object>) collection.get("shards");assertEquals(1, shardStatus.size());+ @SuppressWarnings({"unchecked"})Map<String, Object> selectedShardStatus = (Map<String, Object>) shardStatus.get(SHARD2);assertNotNull(selectedShardStatus);}}+ @SuppressWarnings({"unchecked"})private void clusterStatusAliasTest() throws Exception {try (CloudSolrClient client = createCloudClient(null)) {// create an alias named myalias@@ -500,6 +542,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("action", CollectionParams.CollectionAction.CREATEALIAS.toString());params.set("name", "myalias");params.set("collections", DEFAULT_COLLECTION + "," + COLLECTION_NAME);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -572,6 +615,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("action", CollectionParams.CollectionAction.ADDROLE.toString());params.set("node", replica.getNodeName());params.set("role", "overseer");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");client.request(request);@@ -583,10 +627,13 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");assertNotNull("Cluster state should not be null", cluster);+ @SuppressWarnings({"unchecked"})Map<String, Object> roles = (Map<String, Object>) cluster.get("roles");assertNotNull("Role information should not be null", roles);+ @SuppressWarnings({"unchecked"})List<String> overseer = (List<String>) roles.get("overseer");assertNotNull(overseer);assertEquals(1, overseer.size());@@ -599,6 +646,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());params.set("collection", "bad_collection_name");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -650,6 +698,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {missingParamsError(client, params);params.set("property.value", "true");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");client.request(request);@@ -897,6 +946,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.CREATE.toString());params.set("name", "invalid@name#with$weird%characters");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -920,6 +970,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("router.name", "implicit");params.set("numShards", "1");params.set("shards", "invalid@name#with$weird%characters");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -941,6 +992,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("action", CollectionParams.CollectionAction.CREATEALIAS.toString());params.set("name", "invalid@name#with$weird%characters");params.set("collections", COLLECTION_NAME);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -965,6 +1017,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {params.set("name", "valid_collection_name");params.set("shards", "a");params.set("router.name", "implicit");+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");client.request(request);@@ -1009,6 +1062,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {private void missingParamsError(CloudSolrClient client, ModifiableSolrParams origParams)throws IOException, SolrServerException {+ @SuppressWarnings({"rawtypes"})SolrRequest request;try {request = new QueryRequest(origParams);diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.javaindex d327aec470d..f80edabd74c 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java@@ -73,10 +73,12 @@ public class TestReplicaProperties extends ReplicaPropertiesBase {try (CloudSolrClient client = createCloudClient(null)) {ModifiableSolrParams params = new ModifiableSolrParams();params.set("action", CollectionParams.CollectionAction.LIST.toString());+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");NamedList<Object> rsp = client.request(request);+ @SuppressWarnings({"unchecked"})List<String> collections = (List<String>) rsp.get("collections");assertTrue("control_collection was not found in list", collections.contains("control_collection"));assertTrue(DEFAULT_COLLECTION + " was not found in list", collections.contains(DEFAULT_COLLECTION));diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.javaindex a0fa70c2b37..58c4686443f 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java@@ -60,7 +60,9 @@ public class TestRequestStatusCollectionAPI extends BasicDistributedZkTest {// Check for the request to be completed.+ @SuppressWarnings({"rawtypes"})NamedList r = null;+ @SuppressWarnings({"rawtypes"})NamedList status = null;String message = null;diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.javaindex 15c8d37ad8c..7a595d5e855 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java@@ -382,19 +382,23 @@ public class AutoAddReplicasIntegrationTest extends SolrCloudTestCase {}private void disableAutoAddReplicasInCluster() throws SolrServerException, IOException {+ @SuppressWarnings({"rawtypes"})Map m = makeMap("action", CollectionParams.CollectionAction.CLUSTERPROP.toLower(),"name", ZkStateReader.AUTO_ADD_REPLICAS,"val", "false");+ @SuppressWarnings({"unchecked"})QueryRequest request = new QueryRequest(new MapSolrParams(m));request.setPath("/admin/collections");cluster.getSolrClient().request(request);}private void enableAutoAddReplicasInCluster() throws SolrServerException, IOException {+ @SuppressWarnings({"rawtypes"})Map m = makeMap("action", CollectionParams.CollectionAction.CLUSTERPROP.toLower(),"name", ZkStateReader.AUTO_ADD_REPLICAS);+ @SuppressWarnings({"unchecked"})QueryRequest request = new QueryRequest(new MapSolrParams(m));request.setPath("/admin/collections");cluster.getSolrClient().request(request);diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasPlanActionTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasPlanActionTest.javaindex 8b41f2f026e..8fca98da48d 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasPlanActionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasPlanActionTest.java@@ -113,7 +113,9 @@ public class AutoAddReplicasPlanActionTest extends SolrCloudTestCase{"'removeListeners': true" +"}" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeTriggerCommand);+ @SuppressWarnings({"rawtypes"})NamedList response = cluster.getSolrClient().request(req);assertEquals(response.get("result").toString(), "success");@@ -132,6 +134,7 @@ public class AutoAddReplicasPlanActionTest extends SolrCloudTestCase{reader.waitForLiveNodes(30, TimeUnit.SECONDS, missingLiveNode(lostNodeName));+ @SuppressWarnings({"rawtypes"})List<SolrRequest> operations = getOperations(jetty3, lostNodeName);assertOperations(collection1, operations, lostNodeName, cloudDescriptors, null);@@ -210,22 +213,25 @@ public class AutoAddReplicasPlanActionTest extends SolrCloudTestCase{}@SuppressForbidden(reason = "Needs currentTimeMillis to create unique id")+ @SuppressWarnings({"rawtypes"})private List<SolrRequest> getOperations(JettySolrRunner actionJetty, String lostNodeName) throws Exception {try (AutoAddReplicasPlanAction action = new AutoAddReplicasPlanAction()) {action.configure(actionJetty.getCoreContainer().getResourceLoader(), actionJetty.getCoreContainer().getZkController().getSolrCloudManager(), new HashMap<>());TriggerEvent lostNode = new NodeLostTrigger.NodeLostEvent(TriggerEventType.NODELOST, ".auto_add_replicas", Collections.singletonList(System.currentTimeMillis()), Collections.singletonList(lostNodeName), CollectionParams.CollectionAction.MOVEREPLICA.toLower());ActionContext context = new ActionContext(actionJetty.getCoreContainer().getZkController().getSolrCloudManager(), null, new HashMap<>());action.process(lostNode, context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List) context.getProperty("operations");return operations;}}- private void assertOperations(String collection, List<SolrRequest> operations, String lostNodeName,+ private void assertOperations(String collection,+ @SuppressWarnings({"rawtypes"})List<SolrRequest> operations, String lostNodeName,List<CloudDescriptor> cloudDescriptors, JettySolrRunner destJetty) {assertEquals("Replicas of " + collection + " is not fully moved, operations="+operations,cloudDescriptors.stream().filter(cd -> cd.getCollectionName().equals(collection)).count(), operations.size());- for (SolrRequest solrRequest : operations) {+ for (@SuppressWarnings({"rawtypes"})SolrRequest solrRequest : operations) {assertTrue(solrRequest instanceof CollectionAdminRequest.MoveReplica);SolrParams params = solrRequest.getParams();diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.javaindex fb65c589697..2a8c9c11673 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java@@ -77,10 +77,13 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {while (!timeOut.hasTimedOut()) {byte[] data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);ZkNodeProps loaded = ZkNodeProps.load(data);+ @SuppressWarnings({"rawtypes"})Map triggers = (Map) loaded.get("triggers");if (triggers != null && triggers.containsKey(".auto_add_replicas")) {+ @SuppressWarnings({"unchecked"})Map<String, Object> autoAddReplicasTrigger = (Map<String, Object>) triggers.get(".auto_add_replicas");assertNotNull(autoAddReplicasTrigger);+ @SuppressWarnings({"unchecked"})List<Map<String, Object>> actions = (List<Map<String, Object>>) autoAddReplicasTrigger.get("actions");assertNotNull(actions);assertEquals(2, actions.size());@@ -116,6 +119,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {" 'cluster-policy': [{'replica': 0, 'node': '_NODE'}]\n" +"}";configPayload = configPayload.replaceAll("_NODE", aReplica.getNodeName());+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, "/suggestions", configPayload);NamedList<Object> response = solrClient.request(req);assertFalse(((Collection) response.get("suggestions")).isEmpty());@@ -149,6 +153,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {" 'cluster-policy': [{'replica': 0, 'node': '_NODE'}]\n" +"}";configPayload = configPayload.replaceAll("_NODE", aReplica.getNodeName());+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, "/diagnostics", configPayload);NamedList<Object> response = solrClient.request(req);assertEquals(response._getStr("diagnostics/violations[0]/node",null),response._getStr("diagnostics/violations[0]/node",null));@@ -157,6 +162,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testSuspendTrigger() throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();String suspendEachCommand = "{\n" +@@ -170,6 +176,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {"\t}\n" +"}";// these should be no-ops because there are no triggers, and it should succeed+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendEachCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -319,6 +326,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void test() throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();String setTriggerCommand = "{" +@@ -332,6 +340,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {"'name' : 'compute_plan'," +"'class' : 'solr.ComputePlanAction'" +"}]}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);@@ -474,6 +483,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {" ]" +"}";try {+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);solrClient.request(req);fail("expect exception");@@ -501,6 +511,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {"'name' : 'compute_plan'," +"'class' : 'solr.ComputePlanAction'" +"}]}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);try {@@ -601,6 +612,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testPolicyAndPreferences() throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();// add multiple policies@@ -614,6 +626,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +" ]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPolicyCommand);NamedList<Object> response = null;try {@@ -658,6 +671,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);loaded = ZkNodeProps.load(data);policies = (Map<String, Object>) loaded.get("policies");+ @SuppressWarnings({"rawtypes"})List conditions = (List) policies.get("xyz");assertEquals(1, conditions.size());@@ -683,6 +697,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {assertEquals(response.get("result").toString(), "success");data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);loaded = ZkNodeProps.load(data);+ @SuppressWarnings({"rawtypes"})List preferences = (List) loaded.get("cluster-preferences");assertEquals(3, preferences.size());@@ -711,6 +726,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {assertEquals(response.get("result").toString(), "success");data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);loaded = ZkNodeProps.load(data);+ @SuppressWarnings({"rawtypes"})List clusterPolicy = (List) loaded.get("cluster-policy");assertNotNull(clusterPolicy);assertEquals(3, clusterPolicy.size());@@ -734,6 +750,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {@Test// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 17-Aug-2018+ @SuppressWarnings({"unchecked", "rawtypes"})public void testReadApi() throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();// first trigger@@ -927,6 +944,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {"'waitFor' : '0s'," +"'enabled' : true" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = null;try {@@ -945,13 +963,16 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {t2.start();boolean await = updateLatch.await(60, TimeUnit.SECONDS);assertTrue("not all updates executed in time, remaining=" + updateLatch.getCount(), await);+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);NamedList<Object> response = solrClient.request(req);+ @SuppressWarnings({"rawtypes"})Map triggers = (Map) response.get("triggers");assertNotNull(triggers);assertEquals(1, countNotImplicitTriggers(triggers));assertTrue(triggers.containsKey("node_added_trigger1"));+ @SuppressWarnings({"rawtypes"})Map node_added_trigger1 = (Map) triggers.get("node_added_trigger1");assertEquals(4, node_added_trigger1.size());assertEquals(0L, node_added_trigger1.get("waitFor"));@@ -960,7 +981,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {}- private int countNotImplicitTriggers(Map triggers) {+ private int countNotImplicitTriggers(@SuppressWarnings({"rawtypes"})Map triggers) {if (triggers == null) return 0;int count = 0;for (Object trigger : triggers.keySet()) {@@ -1003,8 +1024,10 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {"\t}\n" +"}";solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);NamedList<Object> response = solrClient.request(req);+ @SuppressWarnings({"rawtypes"})Map properties = (Map) response.get("properties");assertNotNull(properties);assertEquals(1, properties.size());@@ -1077,6 +1100,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {String setPropertiesCommand = "{'set-cluster-policy': [" +"{'cores': '<4','node': '#ANY'}]}";solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);NamedList<Object> response = solrClient.request(req);assertEquals("<4", response._get("cluster-policy[0]/cores", null));diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.javaindex 471a0a7bb9e..eab52d5f30c 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ComputePlanActionTest.java@@ -67,6 +67,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {private static final AtomicBoolean fired = new AtomicBoolean(false);private static final int NODE_COUNT = 1;private static CountDownLatch triggerFiredLatch = new CountDownLatch(1);+ @SuppressWarnings({"rawtypes"})private static final AtomicReference<Map> actionContextPropsRef = new AtomicReference<>();private static final AtomicReference<TriggerEvent> eventRef = new AtomicReference<>();private static SolrCloudManager cloudManager;@@ -113,6 +114,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {" {'nodeRole':'overseer', 'replica':0}" +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -189,6 +191,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -225,11 +228,14 @@ public class ComputePlanActionTest extends SolrCloudTestCase {assertTrue("Trigger was not fired even after 10 seconds", triggerFiredLatch.await(10, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null , "+ getNodeStateProviderState() + eventRef.get(), operations);assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());+ @SuppressWarnings({"rawtypes"})SolrRequest solrRequest = operations.get(0);SolrParams params = solrRequest.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));@@ -274,6 +280,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -315,8 +322,10 @@ public class ComputePlanActionTest extends SolrCloudTestCase {assertEquals(TriggerEventType.NODELOST, triggerEvent.getEventType());// TODO assertEquals(stoppedNodeName, triggerEvent.getProperty(TriggerEvent.NODE_NAME));+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null "+ getNodeStateProviderState() + actionContextPropsRef.get(), operations);if (log.isInfoEnabled()) {@@ -324,7 +333,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {}assertEquals("ComputePlanAction should have computed exactly 2 operation", 2, operations.size());- for (SolrRequest solrRequest : operations) {+ for (@SuppressWarnings({"rawtypes"})SolrRequest solrRequest : operations) {SolrParams params = solrRequest.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));String moved = params.get("replica");@@ -345,6 +354,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -384,11 +394,14 @@ public class ComputePlanActionTest extends SolrCloudTestCase {JettySolrRunner runner = cluster.startJettySolrRunner();assertTrue("Trigger was not fired even after 5 seconds", triggerFiredLatch.await(5, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null" + getNodeStateProviderState() + context, operations);assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());+ @SuppressWarnings({"rawtypes"})SolrRequest request = operations.get(0);SolrParams params = request.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));@@ -417,6 +430,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {@Overridepublic void process(TriggerEvent event, ActionContext context) {if (expectedNode != null) {+ @SuppressWarnings({"rawtypes"})Collection nodes = (Collection) event.getProperty(TriggerEvent.NODE_NAMES);if (nodes == null || !nodes.contains(expectedNode)) return;//this is not the event we are looking for}@@ -450,6 +464,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {" {'replica':'<5', 'shard': '#EACH', 'node': '#ANY'}," +" ]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setSearchPolicyCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -482,6 +497,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction', 'collections' : " + collectionsFilter + "}," +"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -542,11 +558,14 @@ public class ComputePlanActionTest extends SolrCloudTestCase {}assertTrue("Trigger was not fired even after 5 seconds", triggerFiredLatch.await(5, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null. " + getNodeStateProviderState() + context, operations);assertEquals("ComputePlanAction should have computed exactly 2 operations", 2, operations.size());+ @SuppressWarnings({"rawtypes"})SolrRequest request = operations.get(0);SolrParams params = request.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));@@ -636,6 +655,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {}private void nodeAddedTriggerWithAddReplicaPreferredOp(String collectionNamePrefix, int numShards, int numCollections, String setTriggerCommand, String setClusterPolicyCommand, Integer nNrtReplicas, Integer nTlogReplicas, Integer nPullReplicas) throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -657,7 +677,9 @@ public class ComputePlanActionTest extends SolrCloudTestCase {cluster.waitForAllNodes(30);assertTrue(triggerFiredLatch.await(30, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map actionContext = actionContextPropsRef.get();+ @SuppressWarnings({"rawtypes"})List operations = (List) actionContext.get("operations");assertNotNull(operations);assertEquals(numShards, operations.size());@@ -724,6 +746,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {"{'name':'execute_plan','class':'solr.ExecutePlanAction'}" +"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -754,7 +777,9 @@ public class ComputePlanActionTest extends SolrCloudTestCase {cluster.stopJettySolrRunner(newNode);assertTrue(triggerFiredLatch.await(30, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map actionContext = actionContextPropsRef.get();+ @SuppressWarnings({"rawtypes"})List operations = (List) actionContext.get("operations");assertNotNull(operations);assertEquals(1, operations.size());diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ExecutePlanActionTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ExecutePlanActionTest.javaindex d286faf57b2..25a7616eb2c 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ExecutePlanActionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ExecutePlanActionTest.java@@ -167,6 +167,7 @@ public class ExecutePlanActionTest extends SolrCloudTestCase {if (!children.isEmpty()) {String child = children.get(0);byte[] data = zkClient().getData(parentPath + "/" + child, null, null, true);+ @SuppressWarnings({"rawtypes"})Map m = (Map) Utils.fromJSON(data);if (m.containsKey("requestid")) {znodeCreated.set(m.get("requestid").equals(asyncId));@@ -190,6 +191,7 @@ public class ExecutePlanActionTest extends SolrCloudTestCase {action.process(nodeLostEvent, actionContext);// assertTrue("ExecutePlanAction should have stored the requestid in ZK before executing the request", znodeCreated.get());+ @SuppressWarnings({"unchecked"})List<NamedList<Object>> responses = (List<NamedList<Object>>) actionContext.getProperty("responses");assertNotNull(responses);assertEquals(2, responses.size());@@ -215,6 +217,7 @@ public class ExecutePlanActionTest extends SolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'execute_plan','class':'solr.ExecutePlanAction'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -281,6 +284,7 @@ public class ExecutePlanActionTest extends SolrCloudTestCase {"{'name':'execute_plan','class':'solr.ExecutePlanAction', 'taskTimeoutSeconds' : '1','taskTimeoutFail':'" + taskTimeoutFail + "'}," +"{'name':'finish','class':'" + FinishAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -339,6 +343,7 @@ public class ExecutePlanActionTest extends SolrCloudTestCase {"{'name':'execute_plan','class':'solr.ExecutePlanAction'}," +"{'name':'finish','class':'" + FinishAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/HttpTriggerListenerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/HttpTriggerListenerTest.javaindex af10586f211..a712aee6c00 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/HttpTriggerListenerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/HttpTriggerListenerTest.java@@ -89,6 +89,7 @@ public class HttpTriggerListenerTest extends SolrCloudTestCase {"{'name':'test','class':'" + TestDummyAction.class.getName() + "'}" +"]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerMixedBoundsTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerMixedBoundsTest.javaindex 87f5b23354e..2075fea0645 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerMixedBoundsTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerMixedBoundsTest.java@@ -120,6 +120,7 @@ public class IndexSizeTriggerMixedBoundsTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testMixedBounds() throws Exception {String collectionName = "testMixedBounds_collection";CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,@@ -181,6 +182,7 @@ public class IndexSizeTriggerMixedBoundsTest extends SolrCloudTestCase {"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerSizeEstimationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerSizeEstimationTest.javaindex c791d4cb3f5..150a67f00bd 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerSizeEstimationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerSizeEstimationTest.java@@ -184,6 +184,7 @@ public class IndexSizeTriggerSizeEstimationTest extends SolrCloudTestCase {"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -250,12 +251,14 @@ public class IndexSizeTriggerSizeEstimationTest extends SolrCloudTestCase {assertNotNull(listenerEvents.toString(), events);assertFalse("empty events?", events.isEmpty());CapturedEvent ev = events.get(0);+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> ops = (List< TriggerEvent.Op>)ev.event.properties.get(TriggerEvent.REQUESTED_OPS);assertNotNull("no requested ops in " + ev, ops);assertFalse("empty list of ops in " + ev, ops.isEmpty());Set<String> parentShards = new HashSet<>();ops.forEach(op -> {assertTrue(op.toString(), op.getAction() == CollectionParams.CollectionAction.SPLITSHARD);+ @SuppressWarnings({"unchecked"})Collection<Pair<String, String>> hints = (Collection<Pair<String, String>>)op.getHints().get(Suggester.Hint.COLL_SHARD);assertNotNull("no hints in op " + op, hints);hints.forEach(h -> parentShards.add(h.second()));diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.javaindex 4852b861657..b937668f0fb 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java@@ -197,6 +197,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {trigger.run();ev = eventRef.get();assertNotNull("should have fired an event", ev);+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> ops = (List<TriggerEvent.Op>) ev.getProperty(TriggerEvent.REQUESTED_OPS);assertNotNull("should contain requestedOps", ops);assertEquals("number of ops: " + ops, 2, ops.size());@@ -204,6 +205,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {boolean shard2 = false;for (TriggerEvent.Op op : ops) {assertEquals(CollectionParams.CollectionAction.SPLITSHARD, op.getAction());+ @SuppressWarnings({"unchecked"})Set<Pair<String, String>> hints = (Set<Pair<String, String>>)op.getHints().get(Suggester.Hint.COLL_SHARD);assertNotNull("hints", hints);assertEquals("hints", 1, hints.size());@@ -216,6 +218,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {} else {fail("unexpected shard name " + p.second());}+ @SuppressWarnings({"unchecked"})Map<String, Object> params = (Map<String, Object>)op.getHints().get(Suggester.Hint.PARAMS);assertNotNull("params are null: " + op, params);@@ -281,6 +284,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -346,6 +350,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {assertEquals(TriggerEventProcessorStage.AFTER_ACTION, events.get(4).stage);assertEquals(TriggerEventProcessorStage.SUCCEEDED, events.get(5).stage);// check ops+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> ops = (List<TriggerEvent.Op>) events.get(4).event.getProperty(TriggerEvent.REQUESTED_OPS);assertNotNull("should contain requestedOps", ops);assertEquals("number of ops", 2, ops.size());@@ -353,6 +358,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {boolean shard2 = false;for (TriggerEvent.Op op : ops) {assertEquals(CollectionParams.CollectionAction.SPLITSHARD, op.getAction());+ @SuppressWarnings({"unchecked"})Set<Pair<String, String>> hints = (Set<Pair<String, String>>)op.getHints().get(Suggester.Hint.COLL_SHARD);assertNotNull("hints", hints);assertEquals("hints", 1, hints.size());@@ -409,6 +415,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -472,11 +479,13 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {assertEquals(TriggerEventProcessorStage.AFTER_ACTION, events.get(4).stage);assertEquals(TriggerEventProcessorStage.SUCCEEDED, events.get(5).stage);// check ops+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> ops = (List<TriggerEvent.Op>) events.get(4).event.getProperty(TriggerEvent.REQUESTED_OPS);assertNotNull("should contain requestedOps", ops);assertTrue("number of ops: " + ops, ops.size() > 0);for (TriggerEvent.Op op : ops) {assertEquals(CollectionParams.CollectionAction.MERGESHARDS, op.getAction());+ @SuppressWarnings({"unchecked"})Set<Pair<String, String>> hints = (Set<Pair<String, String>>)op.getHints().get(Suggester.Hint.COLL_SHARD);assertNotNull("hints", hints);assertEquals("hints", 2, hints.size());@@ -485,6 +494,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {}// TODO: fix this once MERGESHARDS is supported+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> unsupportedOps = (List<TriggerEvent.Op>)events.get(2).context.get("properties.unsupportedOps");assertNotNull("should have unsupportedOps", unsupportedOps);assertEquals(unsupportedOps.toString() + "\n" + ops, ops.size(), unsupportedOps.size());@@ -492,6 +502,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testMaxOps() throws Exception {String collectionName = "testMaxOps_collection";CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,@@ -512,6 +523,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {"'enabled' : false," +"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -684,6 +696,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {trigger.run();ev = eventRef.get();assertNotNull("should have fired an event", ev);+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> ops = (List<TriggerEvent.Op>) ev.getProperty(TriggerEvent.REQUESTED_OPS);assertNotNull("should contain requestedOps", ops);assertEquals("number of ops: " + ops, 2, ops.size());@@ -691,6 +704,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {boolean shard2 = false;for (TriggerEvent.Op op : ops) {assertEquals(CollectionParams.CollectionAction.SPLITSHARD, op.getAction());+ @SuppressWarnings({"unchecked"})Set<Pair<String, String>> hints = (Set<Pair<String, String>>)op.getHints().get(Suggester.Hint.COLL_SHARD);assertNotNull("hints", hints);assertEquals("hints", 1, hints.size());@@ -703,6 +717,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {} else {fail("unexpected shard name " + p.second());}+ @SuppressWarnings({"unchecked"})Map<String, Object> params = (Map<String, Object>)op.getHints().get(Suggester.Hint.PARAMS);assertNotNull("params are null: " + op, params);diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/MetricTriggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/MetricTriggerIntegrationTest.javaindex da06a75410d..bba3096d105 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/MetricTriggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/MetricTriggerIntegrationTest.java@@ -115,6 +115,7 @@ public class MetricTriggerIntegrationTest extends SolrCloudTestCase {"{'name':'test','class':'" + MetricAction.class.getName() + "'}" +"]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerIntegrationTest.javaindex 08bf6eaab8d..bbd24826b48 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerIntegrationTest.java@@ -126,6 +126,7 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testNodeAddedTriggerRestoreState() throws Exception {final String triggerName = "node_added_restore_trigger";@@ -241,6 +242,7 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {assertTrue(triggerFired.get());NodeAddedTrigger.NodeAddedEvent nodeAddedEvent = (NodeAddedTrigger.NodeAddedEvent) events.iterator().next();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>) nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode.getNodeName()));diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerTest.javaindex a2b820f09dc..88cdcc34b6f 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeAddedTriggerTest.java@@ -118,6 +118,7 @@ public class NodeAddedTriggerTest extends SolrCloudTestCase {TriggerEvent nodeAddedEvent = eventRef.get();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode1.getNodeName()));assertTrue(nodeNames.contains(newNode2.getNodeName()));@@ -172,6 +173,7 @@ public class NodeAddedTriggerTest extends SolrCloudTestCase {public void testActionLifecycle() throws Exception {CoreContainer container = cluster.getJettySolrRunners().get(0).getCoreContainer();Map<String, Object> props = createTriggerProps(0);+ @SuppressWarnings({"unchecked"})List<Map<String, String>> actions = (List<Map<String, String>>) props.get("actions");Map<String, String> action = new HashMap<>(2);action.put("name", "testActionInit");@@ -298,6 +300,7 @@ public class NodeAddedTriggerTest extends SolrCloudTestCase {if (currentTimeNanos - eventTimeNanos <= waitForNanos) {fail("NodeAddedListener was fired before the configured waitFor period: currentTimeNanos=" + currentTimeNanos + ", eventTimeNanos=" + eventTimeNanos + ",waitForNanos=" + waitForNanos);}+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>) event.getProperty(NodeAddedTrigger.NodeAddedEvent.NODE_NAMES);if (nodeNames.contains(newNode.getNodeName())) {stop.set(true);diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerIntegrationTest.javaindex 06f20df6541..ef52267bcaa 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerIntegrationTest.java@@ -129,6 +129,7 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testNodeLostTriggerRestoreState() throws Exception {final String triggerName = "node_lost_restore_trigger";@@ -276,6 +277,7 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {assertTrue(triggerFired.get());NodeLostTrigger.NodeLostEvent nodeLostEvent = (NodeLostTrigger.NodeLostEvent) events.iterator().next();assertNotNull(nodeLostEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>) nodeLostEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(lostNodeName));diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerTest.javaindex bf55a85acc2..5d417f987e1 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeLostTriggerTest.java@@ -120,6 +120,7 @@ public class NodeLostTriggerTest extends SolrCloudTestCase {TriggerEvent nodeLostEvent = eventRef.get();assertNotNull(nodeLostEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeLostEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames + " doesn't contain " + lostNodeName1, nodeNames.contains(lostNodeName1));assertTrue(nodeNames + " doesn't contain " + lostNodeName2, nodeNames.contains(lostNodeName2));@@ -189,6 +190,7 @@ public class NodeLostTriggerTest extends SolrCloudTestCase {public void testActionLifecycle() throws Exception {CoreContainer container = cluster.getJettySolrRunners().get(0).getCoreContainer();Map<String, Object> props = createTriggerProps(0);+ @SuppressWarnings({"unchecked"})List<Map<String, String>> actions = (List<Map<String, String>>) props.get("actions");Map<String, String> action = new HashMap<>(2);action.put("name", "testActionInit");@@ -366,6 +368,7 @@ public class NodeLostTriggerTest extends SolrCloudTestCase {TriggerEvent nodeLostEvent = eventRef.get();assertNotNull(nodeLostEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeLostEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(lostNodeName));}diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeMarkersRegistrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeMarkersRegistrationTest.javaindex 849c5c81f9b..5ed30c04c8d 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeMarkersRegistrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/NodeMarkersRegistrationTest.java@@ -179,6 +179,7 @@ public class NodeMarkersRegistrationTest extends SolrCloudTestCase {"'enabled' : true," +"'actions' : [{'name':'test','class':'" + TestEventMarkerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -274,6 +275,7 @@ public class NodeMarkersRegistrationTest extends SolrCloudTestCase {}assertEquals(1, events.size());TriggerEvent ev = events.iterator().next();+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>) ev.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(overseerLeader));assertEquals(TriggerEventType.NODELOST, ev.getEventType());diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/RestoreTriggerStateTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/RestoreTriggerStateTest.javaindex 66fac4cac58..7fa4dc74701 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/RestoreTriggerStateTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/RestoreTriggerStateTest.java@@ -85,6 +85,7 @@ public class RestoreTriggerStateTest extends SolrCloudTestCase {"'enabled' : true," +"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -116,6 +117,7 @@ public class RestoreTriggerStateTest extends SolrCloudTestCase {triggerFiredLatch = new CountDownLatch(1);NodeAddedTrigger.NodeAddedEvent nodeAddedEvent = (NodeAddedTrigger.NodeAddedEvent) events.iterator().next();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>) nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode.getNodeName()));// add a second node - state of the trigger will change but it won't fire for waitFor sec.diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledMaintenanceTriggerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledMaintenanceTriggerTest.javaindex cb222a3f5b8..68808e19e47 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledMaintenanceTriggerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledMaintenanceTriggerTest.java@@ -91,6 +91,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {String suspendTriggerCommand = "{" +"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -127,6 +128,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {@Afterpublic void restoreDefaults() throws Exception {+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST,"{'set-trigger' : " + AutoScaling.SCHEDULED_MAINTENANCE_TRIGGER_DSL + "}");NamedList<Object> response = solrClient.request(req);@@ -200,6 +202,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {@Test@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 17-Mar-2018+ @SuppressWarnings({"unchecked"})public void testInactiveShardCleanup() throws Exception {String collection1 = getClass().getSimpleName() + "_collection1";CollectionAdminRequest.Create create1 = CollectionAdminRequest.createCollection(collection1,@@ -231,6 +234,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {"'class' : '" + CapturingTriggerListener.class.getName() + "'" +"}" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -337,6 +341,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {"'actions' : [" +"{'name' : 'test', 'class' : '" + TestTriggerAction2.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledTriggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledTriggerIntegrationTest.javaindex af6a761d6de..63c0e70d7c8 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledTriggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/ScheduledTriggerIntegrationTest.java@@ -94,6 +94,7 @@ public class ScheduledTriggerIntegrationTest extends SolrCloudTestCase {" {\"cores\" : \"<2\", \"node\" : \"#EACH\"}\n" +" ]\n" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicy);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -122,10 +123,11 @@ public class ScheduledTriggerIntegrationTest extends SolrCloudTestCase {Map<String, Object> actionContextProps = actionContextPropertiesRef.get();assertNotNull(actionContextProps);TriggerEvent event = events.iterator().next();+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) actionContextProps.get("operations");assertNotNull(operations);assertEquals(1, operations.size());- for (SolrRequest operation : operations) {+ for (@SuppressWarnings({"rawtypes"})SolrRequest operation : operations) {SolrParams params = operation.getParams();assertEquals(newNode.getNodeName(), params.get("targetNode"));}diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerIntegrationTest.javaindex 46e419b417f..15ab7010113 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerIntegrationTest.java@@ -126,6 +126,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testAboveSearchRate() throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();String COLL1 = "aboveRate_collection";@@ -278,6 +279,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testBelowSearchRate() throws Exception {CloudSolrClient solrClient = cluster.getSolrClient();String COLL1 = "belowRate_collection";@@ -630,6 +632,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {CapturedEvent ev = events.get(0);assertEquals(ev.toString(), "compute", ev.actionName);+ @SuppressWarnings({"unchecked"})List<TriggerEvent.Op> ops = (List<TriggerEvent.Op>)ev.event.getProperty(TriggerEvent.REQUESTED_OPS);assertNotNull("there should be some requestedOps: " + ev.toString(), ops);// 4 DELETEREPLICA, 4 DELETENODE (minReplicas==1 & leader should be protected)@@ -664,6 +667,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {// check statusev = events.get(1);assertEquals(ev.toString(), "execute", ev.actionName);+ @SuppressWarnings({"unchecked"})List<NamedList<Object>> responses = (List<NamedList<Object>>)ev.context.get("properties.responses");assertNotNull(ev.toString(), responses);assertEquals(responses.toString(), 8, responses.size());diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerTest.javaindex d3b523d87a2..41bbd8bb79b 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/SearchRateTriggerTest.java@@ -89,6 +89,7 @@ public class SearchRateTriggerTest extends SolrCloudTestCase {@Test@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028")+ @SuppressWarnings({"unchecked"})public void testTrigger() throws Exception {JettySolrRunner targetNode = cluster.getJettySolrRunner(0);SolrZkClient zkClient = cluster.getSolrClient().getZkStateReader().getZkClient();@@ -214,6 +215,7 @@ public class SearchRateTriggerTest extends SolrCloudTestCase {private static final AtomicDouble mockRate = new AtomicDouble();@Test+ @SuppressWarnings({"unchecked"})public void testWaitForElapsed() throws Exception {SolrResourceLoader loader = cluster.getJettySolrRunner(0).getCoreContainer().getResourceLoader();CloudSolrClient solrClient = cluster.getSolrClient();@@ -315,6 +317,7 @@ public class SearchRateTriggerTest extends SolrCloudTestCase {try (SearchRateTrigger trigger = new SearchRateTrigger("search_rate_trigger2")) {trigger.configure(loader, cloudManager, props);Map<String, Object> config = trigger.getConfig();+ @SuppressWarnings({"unchecked"})Set<String> collections = (Set<String>)config.get(SearchRateTrigger.COLLECTIONS_PROP);assertEquals(collections.toString(), 1, collections.size());assertEquals("test", collections.iterator().next());diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/SystemLogListenerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/SystemLogListenerTest.javaindex ee9750e00da..d2f7c238b6c 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/SystemLogListenerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/SystemLogListenerTest.java@@ -61,6 +61,7 @@ public class SystemLogListenerTest extends SolrCloudTestCase {private static final AtomicBoolean fired = new AtomicBoolean(false);private static final int NODE_COUNT = 3;private static CountDownLatch triggerFiredLatch = new CountDownLatch(1);+ @SuppressWarnings({"rawtypes"})private static final AtomicReference<Map> actionContextPropsRef = new AtomicReference<>();private static final AtomicReference<TriggerEvent> eventRef = new AtomicReference<>();@@ -111,6 +112,7 @@ public class SystemLogListenerTest extends SolrCloudTestCase {"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}," +"{'name':'error','class':'" + ErrorTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -158,6 +160,7 @@ public class SystemLogListenerTest extends SolrCloudTestCase {assertTrue("Trigger was not fired ", triggerFiredLatch.await(60, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TestPolicyCloud.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TestPolicyCloud.javaindex de7522ea2ba..9899e946616 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TestPolicyCloud.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TestPolicyCloud.java@@ -151,6 +151,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {" ]" +" }" +"}";+ @SuppressWarnings({"unchecked"})AutoScalingConfig config = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScaleJson));AtomicInteger count = new AtomicInteger(0);try (SolrCloudManager cloudManager = new SolrClientCloudManager(new ZkDistributedQueueFactory(cluster.getZkClient()), cluster.getSolrClient())) {@@ -351,6 +352,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {" {'metrics:abc':'overseer', 'replica':0}" +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);try {solrClient.request(req);diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerCooldownIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerCooldownIntegrationTest.javaindex 6f377568a22..b7f40cf6e0b 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerCooldownIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerCooldownIntegrationTest.java@@ -88,6 +88,7 @@ public class TriggerCooldownIntegrationTest extends SolrCloudTestCase {"{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}" +"]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerEventQueueTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerEventQueueTest.javaindex 6e83c6bb778..9dc8169faf3 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerEventQueueTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerEventQueueTest.java@@ -57,6 +57,7 @@ public class TriggerEventQueueTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testSerialization() throws Exception {TriggerEventQueue queue = new TriggerEventQueue(cloudManager, "test", null);Map<String, Number> hotHosts = new HashMap<>();diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerIntegrationTest.javaindex 0f9d009c6aa..73cfcfa139d 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/TriggerIntegrationTest.java@@ -196,6 +196,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {"'enabled' : true," +"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -352,6 +353,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {"'enabled' : true," +"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -369,6 +371,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {assertTrue(triggerFired.get());NodeAddedTrigger.NodeAddedEvent nodeAddedEvent = (NodeAddedTrigger.NodeAddedEvent) events.iterator().next();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode.getNodeName()));}@@ -466,6 +469,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {break;}}+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -575,6 +579,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {"{'name':'test1','class':'" + TestDummyAction.class.getName() + "'}," +"]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.javaindex 607adc74cc2..3d2e31489a1 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java@@ -225,6 +225,7 @@ public class SimSolrCloudTestCase extends SolrTestCaseJ4 {assertReplicaPropsEquals(one.getProperties(), two.getProperties());}+ @SuppressWarnings({"unchecked"})public static void assertReplicaInfoEquals(ReplicaInfo one, ReplicaInfo two) {assertEquals(one.getName(), two.getName());assertEquals(one.getNode(), two.getNode());diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimComputePlanAction.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimComputePlanAction.javaindex aea4b2ef41b..9cc3e1a27ab 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimComputePlanAction.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimComputePlanAction.java@@ -69,6 +69,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {private static final AtomicBoolean fired = new AtomicBoolean(false);private static final int NODE_COUNT = 1;private static CountDownLatch triggerFiredLatch = new CountDownLatch(1);+ @SuppressWarnings({"rawtypes"})private static final AtomicReference<Map> actionContextPropsRef = new AtomicReference<>();private static final AtomicReference<TriggerEvent> eventRef = new AtomicReference<>();@@ -86,6 +87,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {" {'nodeRole':'overseer', 'replica':0}" +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);SolrResponse rsp = cluster.request(req);NamedList<Object> response = rsp.getResponse();@@ -144,6 +146,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'test','class':'" + TestSimComputePlanAction.AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -175,11 +178,14 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {assertTrue("Trigger was not fired even after 10 seconds", triggerFiredLatch.await(10, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null , " + eventRef.get(), operations);assertEquals("ComputePlanAction should have computed exactly 1 operation", 1, operations.size());+ @SuppressWarnings({"rawtypes"})SolrRequest solrRequest = operations.get(0);SolrParams params = solrRequest.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));@@ -209,6 +215,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -249,8 +256,10 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {assertEquals(TriggerEventType.NODELOST, triggerEvent.getEventType());// TODO assertEquals(stoppedNodeName, triggerEvent.getProperty(TriggerEvent.NODE_NAME));+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null " + actionContextPropsRef.get() + "\nevent: " + eventRef.get(), operations);if (log.isInfoEnabled()) {@@ -260,7 +269,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {// TODO: this can be 3!// assertEquals("ComputePlanAction should have computed exactly 2 operation", 2, operations.size());- for (SolrRequest solrRequest : operations) {+ for (@SuppressWarnings({"rawtypes"})SolrRequest solrRequest : operations) {SolrParams params = solrRequest.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));String moved = params.get("replica");@@ -285,6 +294,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'test','class':'" + TestSimComputePlanAction.AssertingTriggerAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");@@ -328,6 +338,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {String newNode = cluster.simAddNode();assertTrue("Trigger was not fired even after 5 seconds", triggerFiredLatch.await(5, TimeUnit.SECONDS));assertTrue(fired.get());+ @SuppressWarnings({"rawtypes"})Map context = actionContextPropsRef.get();assertNotNull(context);if (log.isInfoEnabled()) {@@ -336,12 +347,14 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {, cluster.getClusterStateProvider().getLiveNodes(), cluster.getClusterStateProvider().getClusterState().getCollection("testNodeAdded")); // logOk}+ @SuppressWarnings({"unchecked", "rawtypes"})List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");assertNotNull("The operations computed by ComputePlanAction should not be null" + context, operations);// TODO: can be 2!// assertEquals("ComputePlanAction should have computed exactly 1 operation, but was: " + operations, 1, operations.size());+ @SuppressWarnings({"rawtypes"})SolrRequest request = operations.get(0);SolrParams params = request.getParams();assertEquals("Expected MOVEREPLICA action after adding node", MOVEREPLICA, CollectionParams.CollectionAction.get(params.get("action")));@@ -370,6 +383,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {@Overridepublic void process(TriggerEvent event, ActionContext context) {if (expectedNode != null) {+ @SuppressWarnings({"rawtypes"})Collection nodes = (Collection) event.getProperty(TriggerEvent.NODE_NAMES);if (nodes == null || !nodes.contains(expectedNode)) return;//this is not the event we are looking for}diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.javaindex 5117a2c86fc..5919c1cffae 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExecutePlanAction.java@@ -132,6 +132,7 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {if (!children.isEmpty()) {String child = children.get(0);VersionedData data = cluster.getDistribStateManager().getData(parentPath + "/" + child);+ @SuppressWarnings({"rawtypes"})Map m = (Map) Utils.fromJSON(data.getData());if (m.containsKey("requestid")) {znodeCreated.set(m.get("requestid").equals(asyncId));@@ -153,6 +154,7 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {action.process(nodeLostEvent, actionContext);// assertTrue("ExecutePlanAction should have stored the requestid in ZK before executing the request", znodeCreated.get());+ @SuppressWarnings({"unchecked"})List<NamedList<Object>> responses = (List<NamedList<Object>>) actionContext.getProperty("responses");assertNotNull(responses);assertEquals(2, responses.size());@@ -180,6 +182,7 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name':'execute_plan','class':'solr.ExecutePlanAction'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExtremeIndexing.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExtremeIndexing.javaindex 5c03d59f3f2..13fb8b4766a 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExtremeIndexing.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimExtremeIndexing.java@@ -115,6 +115,7 @@ public class TestSimExtremeIndexing extends SimSolrCloudTestCase {"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +"}}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);NamedList<Object> response = solrClient.request(req);assertEquals(response.get("result").toString(), "success");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimLargeCluster.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimLargeCluster.javaindex 16dde7eb3cf..01336ef40e1 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimLargeCluster.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimLargeCluster.java@@ -695,6 +695,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testSearchRate() throws Exception {SolrClient solrClient = cluster.simGetSolrClient();String collectionName = "testSearchRate";diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeAddedTrigger.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeAddedTrigger.javaindex 928046a8822..759715425d6 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeAddedTrigger.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeAddedTrigger.java@@ -115,6 +115,7 @@ public class TestSimNodeAddedTrigger extends SimSolrCloudTestCase {TriggerEvent nodeAddedEvent = eventRef.get();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode1));assertTrue(nodeNames.contains(newNode2));@@ -163,6 +164,7 @@ public class TestSimNodeAddedTrigger extends SimSolrCloudTestCase {public void testActionLifecycle() throws Exception {Map<String, Object> props = createTriggerProps(0);+ @SuppressWarnings({"unchecked"})List<Map<String, String>> actions = (List<Map<String, String>>) props.get("actions");Map<String, String> action = new HashMap<>(2);action.put("name", "testActionInit");diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.javaindex 8eb6156b936..f1d38aab8e5 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java@@ -117,6 +117,7 @@ public class TestSimNodeLostTrigger extends SimSolrCloudTestCase {TriggerEvent nodeLostEvent = eventRef.get();assertNotNull(nodeLostEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeLostEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames + " doesn't contain " + lostNodeName1, nodeNames.contains(lostNodeName1));assertTrue(nodeNames + " doesn't contain " + lostNodeName2, nodeNames.contains(lostNodeName2));@@ -176,6 +177,7 @@ public class TestSimNodeLostTrigger extends SimSolrCloudTestCase {public void testActionLifecycle() throws Exception {Map<String, Object> props = createTriggerProps(0);+ @SuppressWarnings({"unchecked"})List<Map<String, String>> actions = (List<Map<String, String>>) props.get("actions");Map<String, String> action = new HashMap<>(2);action.put("name", "testActionInit");@@ -322,6 +324,7 @@ public class TestSimNodeLostTrigger extends SimSolrCloudTestCase {TriggerEvent nodeLostEvent = eventRef.get();assertNotNull(nodeLostEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeLostEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode));}diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimPolicyCloud.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimPolicyCloud.javaindex c5af182561e..915aa3fba7e 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimPolicyCloud.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimPolicyCloud.java@@ -98,6 +98,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {" ]" +" }" +"}";+ @SuppressWarnings({"unchecked"})AutoScalingConfig config = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScaleJson));Policy.Session session = config.getPolicy().createSession(cluster);@@ -201,6 +202,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {" {'metrics:abc':'overseer', 'replica':0}" +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);try {solrClient.request(req);diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.javaindex c87fccf6e93..f2460627100 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimScenario.java@@ -93,15 +93,19 @@ public class TestSimScenario extends SimSolrCloudTestCase {scenario.context.put("iterative", "0");scenario.context.put("justCalc", "1");scenario.run();+ @SuppressWarnings({"unchecked"})List<Suggester.SuggestionInfo> suggestions = (List<Suggester.SuggestionInfo>)scenario.context.get(SimScenario.SUGGESTIONS_CTX_PROP);assertNotNull(suggestions);assertEquals(suggestions.toString(), 1, suggestions.size());// reconstruct the snapshot from the dump+ @SuppressWarnings({"unchecked"})Map<String, Object> snapshot = (Map<String, Object>)Utils.fromJSON(baos.toByteArray());+ @SuppressWarnings({"unchecked"})Map<String, Object> autoscalingState = (Map<String, Object>)snapshot.get(SnapshotCloudManager.AUTOSCALING_STATE_KEY);assertNotNull(autoscalingState);assertEquals(autoscalingState.toString(), 1, autoscalingState.size());assertTrue(autoscalingState.toString(), autoscalingState.containsKey("suggestions"));+ @SuppressWarnings({"unchecked"})List<Map<String, Object>> snapSuggestions = (List<Map<String, Object>>)autoscalingState.get("suggestions");assertEquals(snapSuggestions.toString(), 1, snapSuggestions.size());// _loop_iter_ should be present and 0 (first iteration)diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.javaindex 65baf60b7c1..a49a7396e0d 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimTriggerIntegration.java@@ -286,6 +286,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testNodeLostTriggerRestoreState() throws Exception {final String triggerName = "node_lost_restore_trigger";@@ -396,6 +397,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testNodeAddedTriggerRestoreState() throws Exception {final String triggerName = "node_added_restore_trigger";@@ -522,6 +524,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {assertTrue(triggerFired.get());TriggerEvent nodeAddedEvent = events.iterator().next();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeAddedEvent.toString(), nodeNames.contains(newNode));@@ -575,6 +578,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {assertTrue(triggerFired.get());TriggerEvent nodeLostEvent = events.iterator().next();assertNotNull(nodeLostEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeLostEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(lostNodeName));@@ -831,6 +835,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {triggerFiredLatch = new CountDownLatch(1);TriggerEvent nodeAddedEvent = events.iterator().next();assertNotNull(nodeAddedEvent);+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>)nodeAddedEvent.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(newNode));// add a second node - state of the trigger will change but it won't fire for waitFor sec.@@ -1066,6 +1071,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {}assertEquals(1, events.size());TriggerEvent ev = events.iterator().next();+ @SuppressWarnings({"unchecked"})List<String> nodeNames = (List<String>) ev.getProperty(TriggerEvent.NODE_NAMES);assertTrue(nodeNames.contains(overseerLeader));assertEquals(TriggerEventType.NODELOST, ev.getEventType());@@ -1385,6 +1391,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {@Test+ @SuppressWarnings({"unchecked"})public void testSearchRate() throws Exception {SolrClient solrClient = cluster.simGetSolrClient();String COLL1 = "collection1";diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.javaindex 03318be5ffb..81d2f8f4a63 100644--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSnapshotCloudManager.java@@ -186,6 +186,7 @@ public class TestSnapshotCloudManager extends SolrCloudTestCase {}}+ @SuppressWarnings({"unchecked"})private static void assertNodeStateProvider(SolrCloudManager oneMgr, SolrCloudManager twoMgr, String... ignorableNodeValues) throws Exception {NodeStateProvider one = oneMgr.getNodeStateProvider();NodeStateProvider two = twoMgr.getNodeStateProvider();diff --git a/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.javaindex 9ed68583438..a6256aea407 100644--- a/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java@@ -174,6 +174,7 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {}@Before+ @SuppressWarnings({"rawtypes"})public void baseBefore() throws Exception {this.createSourceCollection();if (this.createTargetCollection) this.createTargetCollection();@@ -283,6 +284,7 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {/*** Invokes a CDCR action on a given node.*/+ @SuppressWarnings({"rawtypes"})protected NamedList invokeCdcrAction(CloudJettyRunner jetty, CdcrParams.CdcrAction action) throws Exception {ModifiableSolrParams params = new ModifiableSolrParams();params.set(CommonParams.ACTION, action.toString());@@ -298,9 +300,11 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {int cnt = 30;while (cnt > 0) {+ @SuppressWarnings({"rawtypes"})NamedList status = null;boolean allEquals = true;for (CloudJettyRunner jetty : cloudJettys.get(collection)) { // check all replicas+ @SuppressWarnings({"rawtypes"})NamedList rsp = invokeCdcrAction(jetty, CdcrParams.CdcrAction.STATUS);if (status == null) {status = (NamedList) rsp.get(CdcrParams.CdcrAction.STATUS.toLower());@@ -331,7 +335,9 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {throws Exception {this.waitForCdcrStateReplication(collection); // ensure that cdcr state is replicated and stablefor (CloudJettyRunner jetty : cloudJettys.get(collection)) { // check all replicas+ @SuppressWarnings({"rawtypes"})NamedList rsp = invokeCdcrAction(jetty, CdcrParams.CdcrAction.STATUS);+ @SuppressWarnings({"rawtypes"})NamedList status = (NamedList) rsp.get(CdcrParams.CdcrAction.STATUS.toLower());assertEquals(processState.toLower(), status.get(CdcrParams.ProcessState.getParam()));assertEquals(bufferState.toLower(), status.get(CdcrParams.BufferState.getParam()));@@ -460,6 +466,7 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {collectionInfos.put(collectionName, list);}params.set("name", collectionName);+ @SuppressWarnings({"rawtypes"})SolrRequest request = new QueryRequest(params);request.setPath("/admin/collections");@@ -785,6 +792,7 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {}protected void waitForBootstrapToComplete(String collectionName, String shardId) throws Exception {+ @SuppressWarnings({"rawtypes"})NamedList rsp;// we need to wait until bootstrap is complete otherwise the replicator thread will never startTimeOut timeOut = new TimeOut(60, TimeUnit.SECONDS, TimeSource.NANO_TIME);while (!timeOut.hasTimedOut()) {@@ -812,8 +820,11 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {}protected long getQueueSize(String collectionName, String shardId) throws Exception {+ @SuppressWarnings({"rawtypes"})NamedList rsp = this.invokeCdcrAction(shardToLeaderJetty.get(collectionName).get(shardId), CdcrParams.CdcrAction.QUEUES);+ @SuppressWarnings({"rawtypes"})NamedList host = (NamedList) ((NamedList) rsp.get(CdcrParams.QUEUES)).getVal(0);+ @SuppressWarnings({"rawtypes"})NamedList status = (NamedList) host.get(TARGET_COLLECTION);return (Long) status.get(CdcrParams.QUEUE_SIZE);}diff --git a/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrOpsAndBoundariesTest.java b/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrOpsAndBoundariesTest.javaindex 4827a126374..2eb8d9f8fe2 100644--- a/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrOpsAndBoundariesTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrOpsAndBoundariesTest.java@@ -70,7 +70,7 @@ public class CdcrOpsAndBoundariesTest extends SolrTestCaseJ4 {* Check the ops statistics.*/@Test- // commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 14-Oct-2018+ @SuppressWarnings({"rawtypes"})public void testOps() throws Exception {createCollections();@@ -150,9 +150,12 @@ public class CdcrOpsAndBoundariesTest extends SolrTestCaseJ4 {while (cnt > 0) {try {QueryResponse rsp = CdcrTestsUtil.invokeCdcrAction(sourceSolrClient, CdcrParams.CdcrAction.ERRORS);+ @SuppressWarnings({"rawtypes"})NamedList collections = (NamedList) ((NamedList) rsp.getResponse().get(CdcrParams.ERRORS)).getVal(0);+ @SuppressWarnings({"rawtypes"})NamedList errors = (NamedList) collections.get(TARGET_COLLECTION);assertTrue(0 < (Long) errors.get(CdcrParams.CONSECUTIVE_ERRORS));+ @SuppressWarnings({"rawtypes"})NamedList lastErrors = (NamedList) errors.get(CdcrParams.LAST);assertNotNull(lastErrors);assertTrue(0 < lastErrors.size());diff --git a/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrRequestHandlerTest.javaindex e12c693e601..0944a610c06 100644--- a/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrRequestHandlerTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/cdcr/CdcrRequestHandlerTest.java@@ -42,7 +42,9 @@ public class CdcrRequestHandlerTest extends BaseCdcrDistributedZkTest {this.assertState(SOURCE_COLLECTION, CdcrParams.ProcessState.STOPPED, CdcrParams.BufferState.ENABLED);// send start action to first shard+ @SuppressWarnings({"rawtypes"})NamedList rsp = invokeCdcrAction(shardToLeaderJetty.get(SOURCE_COLLECTION).get(SHARD1), CdcrParams.CdcrAction.START);+ @SuppressWarnings({"rawtypes"})NamedList status = (NamedList) rsp.get(CdcrParams.CdcrAction.STATUS.toLower());assertEquals(CdcrParams.ProcessState.STARTED.toLower(), status.get(CdcrParams.ProcessState.getParam()));@@ -69,6 +71,7 @@ public class CdcrRequestHandlerTest extends BaseCdcrDistributedZkTest {@ShardsFixed(num = 2)public void testCheckpointActions() throws Exception {// initial request on an empty index, must return -1+ @SuppressWarnings({"rawtypes"})NamedList rsp = invokeCdcrAction(shardToLeaderJetty.get(SOURCE_COLLECTION).get(SHARD1), CdcrParams.CdcrAction.COLLECTIONCHECKPOINT);assertEquals(-1l, rsp.get(CdcrParams.CHECKPOINT));@@ -152,7 +155,9 @@ public class CdcrRequestHandlerTest extends BaseCdcrDistributedZkTest {this.assertState(SOURCE_COLLECTION, CdcrParams.ProcessState.STOPPED, CdcrParams.BufferState.ENABLED);// send disable buffer action to first shard+ @SuppressWarnings({"rawtypes"})NamedList rsp = invokeCdcrAction(shardToLeaderJetty.get(SOURCE_COLLECTION).get(SHARD1), CdcrParams.CdcrAction.DISABLEBUFFER);+ @SuppressWarnings({"rawtypes"})NamedList status = (NamedList) rsp.get(CdcrParams.CdcrAction.STATUS.toLower());assertEquals(CdcrParams.BufferState.DISABLED.toLower(), status.get(CdcrParams.BufferState.getParam()));diff --git a/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java b/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.javaindex 04f93875f9b..2cf16242331 100644--- a/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java@@ -193,7 +193,9 @@ public class StressHdfsTest extends BasicDistributedZkTest {NamedList<Object> response = c.query(new SolrQuery().setRequestHandler("/admin/system")).getResponse();+ @SuppressWarnings({"unchecked"})NamedList<Object> coreInfo = (NamedList<Object>) response.get("core");+ @SuppressWarnings({"unchecked"})String dataDir = (String) ((NamedList<Object>) coreInfo.get("directory")).get("data");dataDirs.add(dataDir);}diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.javaindex ea4e1e8a0ab..8bc1d79b188 100644--- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java@@ -134,6 +134,7 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {writer.enqueueUpdate(reader.getClusterState(), Collections.singletonList(c1), null);writer.writePendingUpdates();+ @SuppressWarnings({"rawtypes"})Map map = (Map) Utils.fromJSON(zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null, true));assertNotNull(map.get("c1"));}diff --git a/solr/core/src/test/org/apache/solr/cloud/rule/ImplicitSnitchTest.java b/solr/core/src/test/org/apache/solr/cloud/rule/ImplicitSnitchTest.javaindex b312e969a10..175c373da14 100644--- a/solr/core/src/test/org/apache/solr/cloud/rule/ImplicitSnitchTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/rule/ImplicitSnitchTest.java@@ -204,11 +204,13 @@ public class ImplicitSnitchTest extends SolrTestCaseJ4 {ImplicitSnitch implicitSnitch = new ImplicitSnitch();ServerSnitchContext noNodeExceptionSnitch = new ServerSnitchContext(null, null, new HashMap<>(), null) {@Override+ @SuppressWarnings({"rawtypes"})public Map getZkJson(String path) throws KeeperException, InterruptedException {throw new KeeperException.NoNodeException();}};implicitSnitch.getTags("", Collections.singleton(ImplicitSnitch.ROLE), noNodeExceptionSnitch);+ @SuppressWarnings({"rawtypes"})Map map = (Map) noNodeExceptionSnitch.retrieve(ZkStateReader.ROLES); // todo it the key really supposed to /roles.json?assertNotNull(map);assertEquals(0, map.size());@@ -220,6 +222,7 @@ public class ImplicitSnitchTest extends SolrTestCaseJ4 {ServerSnitchContext keeperExceptionSnitch = new ServerSnitchContext(null, null, new HashMap<>(), null) {@Override+ @SuppressWarnings({"rawtypes"})public Map getZkJson(String path) throws KeeperException, InterruptedException {throw new KeeperException.ConnectionLossException();}diff --git a/solr/core/src/test/org/apache/solr/cloud/rule/RuleEngineTest.java b/solr/core/src/test/org/apache/solr/cloud/rule/RuleEngineTest.javaindex f04895f8b5f..02cc477f278 100644--- a/solr/core/src/test/org/apache/solr/cloud/rule/RuleEngineTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/rule/RuleEngineTest.java@@ -46,6 +46,7 @@ import static org.apache.solr.common.util.Utils.makeMap;public class RuleEngineTest extends SolrTestCaseJ4{@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testPlacement2(){@@ -101,6 +102,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{protected SnitchContext getSnitchCtx(String node, SnitchInfoImpl info, SolrCloudManager cloudManager) {return new ServerSnitchContext(info, node, snitchSession,cloudManager){@Override+ @SuppressWarnings({"rawtypes"})public Map getZkJson(String path) {if(ZkStateReader.ROLES.equals(path)){return Collections.singletonMap("overseer", preferredOverseerNodes);@@ -121,6 +123,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{}+ @SuppressWarnings({"unchecked", "rawtypes"})public void testPlacement3(){String s = "{" +" '127.0.0.1:49961_':{" +@@ -244,6 +247,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{}+ @SuppressWarnings({"rawtypes"})private List<Rule> parseRules(String s) {List maps = (List) Utils.fromJSON(s.getBytes(StandardCharsets.UTF_8));@@ -254,6 +258,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testPlacement() throws Exception {String rulesStr = "rack:*,replica:<2";List<Rule> rules = parse(Arrays.asList(rulesStr));@@ -289,15 +294,18 @@ public class RuleEngineTest extends SolrTestCaseJ4{}public static class MockSnitch extends Snitch {+ @SuppressWarnings({"rawtypes"})static Map nodeVsTags = Collections.emptyMap();@Override+ @SuppressWarnings({"unchecked"})public void getTags(String solrNode, Set<String> requestedTags, SnitchContext ctx) {ctx.getTags().putAll((Map<? extends String, ?>) nodeVsTags.get(solrNode));}@Overridepublic boolean isKnownTag(String tag) {+ @SuppressWarnings({"rawtypes"})Map next = (Map) nodeVsTags.values().iterator().next();return next.containsKey(tag);}diff --git a/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.javaindex 17dd0199260..d9677932575 100644--- a/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/rule/RulesTest.java@@ -97,6 +97,7 @@ public class RulesTest extends SolrCloudTestCase {DocCollection rulesCollection = getCollectionState(rulesColl);+ @SuppressWarnings({"rawtypes"})List list = (List) rulesCollection.get("rule");assertEquals(3, list.size());assertEquals ( "<4", ((Map)list.get(0)).get("cores"));@@ -169,6 +170,7 @@ public class RulesTest extends SolrCloudTestCase {" {'replica': 0, 'port':'" + port + "'}" +" ]" +"}";+ @SuppressWarnings({"rawtypes"})SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);cluster.getSolrClient().request(req);@@ -186,6 +188,7 @@ public class RulesTest extends SolrCloudTestCase {if (null == rulesCollection) {return false;} else {+ @SuppressWarnings({"rawtypes"})List list = (List) rulesCollection.get("rule");if (null == list || 1 != list.size()) {return false;@@ -230,6 +233,7 @@ public class RulesTest extends SolrCloudTestCase {if (null == rulesCollection) {return false;} else {+ @SuppressWarnings({"rawtypes"})List list = (List) rulesCollection.get("rule");if (null == list || 1 != list.size()) {return false;@@ -256,6 +260,7 @@ public class RulesTest extends SolrCloudTestCase {}@Test+ @SuppressWarnings({"unchecked"})public void testHostFragmentRule() throws Exception {String rulesColl = "hostFragment";@@ -274,6 +279,7 @@ public class RulesTest extends SolrCloudTestCase {cluster.waitForActiveCollection(rulesColl, 1, 2);DocCollection rulesCollection = getCollectionState(rulesColl);+ @SuppressWarnings({"rawtypes"})List<Map> list = (List<Map>) rulesCollection.get("rule");assertEquals(2, list.size());assertEquals(ip_2, list.get(0).get("ip_2"));@@ -358,6 +364,7 @@ public class RulesTest extends SolrCloudTestCase {if (null == rulesCollection) {return false;}+ @SuppressWarnings({"rawtypes"})List list = (List) rulesCollection.get("rule");if (null == list || 3 != list.size()) {return false;diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.javaindex 087f11141fb..77ef0bc531f 100644--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java@@ -1610,10 +1610,20 @@ public class DistributedFacetPivotSmallTest extends BaseDistributedSearchTestCas}return true;}++ @Override+ public int hashCode() {+ throw new UnsupportedOperationException("Calling hashCode in ComparablePivotField");+ }}public static class UnorderedEqualityArrayList<T> extends ArrayList<T> {-++ @Override+ public int hashCode() {+ throw new UnsupportedOperationException("Calling hashCode in UnorderedEqualityArrayList");+ }+@Overridepublic boolean equals(Object o) {boolean equal = false;diff --git a/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java b/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.javaindex a21e197754c..0deb6a2e860 100644--- a/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java+++ b/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java@@ -200,7 +200,7 @@ public class HighlighterTest extends SolrTestCaseJ4 {try (Analyzer a1 = new WhitespaceAnalyzer()) {TokenStream tokenStream = a1.tokenStream("", "a b c d e f g h i j k l m n");- try (OffsetWindowTokenFilter tots = new OffsetWindowTokenFilter(tokenStream)) {+ try (DefaultSolrHighlighter.OffsetWindowTokenFilter tots = new DefaultSolrHighlighter.OffsetWindowTokenFilter(tokenStream)) {for (String v : multivalued) {TokenStream ts1 = tots.advanceToNextWindowOfLength(v.length());ts1.reset();diff --git a/solr/core/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.java b/solr/core/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.javaindex d31bd820be8..de7286d91ab 100644--- a/solr/core/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.java+++ b/solr/core/src/test/org/apache/solr/index/hdfs/CheckHdfsIndexTest.java@@ -118,7 +118,9 @@ public class CheckHdfsIndexTest extends AbstractFullDistribZkTestBase {{SolrClient client = clients.get(0);NamedList<Object> response = client.query(new SolrQuery().setRequestHandler("/admin/system")).getResponse();+ @SuppressWarnings({"unchecked"})NamedList<Object> coreInfo = (NamedList<Object>) response.get("core");+ @SuppressWarnings({"unchecked"})String indexDir = ((NamedList<Object>) coreInfo.get("directory")).get("data") + "/index";args = new String[] {indexDir};diff --git a/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java b/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.javaindex 2caf3e0df3a..a351ea81126 100644--- a/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java+++ b/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java@@ -47,6 +47,7 @@ public class TestLogWatcher extends SolrTestCaseJ4 {// explicitly. See SOLR-12732.@Testpublic void testLog4jWatcher() throws InterruptedException {+ @SuppressWarnings({"rawtypes"})LogWatcher watcher = null;int lim = random().nextInt(3) + 2;// Every time through this loop, insure that, of all the test messages that have been logged, only the currentdiff --git a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java b/solr/core/src/test/org/apache/solr/pkg/TestPackages.javaindex 5a5476ea9c9..2d63c183201 100644--- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java+++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java@@ -96,6 +96,7 @@ public class TestPackages extends SolrCloudTestCase {public String klass;}@Test+ @SuppressWarnings({"unchecked"})public void testPluginLoading() throws Exception {MiniSolrCloudCluster cluster =configureCluster(4)@@ -443,7 +444,10 @@ public class TestPackages extends SolrCloudTestCase {}- private void executeReq(String uri, JettySolrRunner jetty, Utils.InputStreamConsumer parser, Map expected) throws Exception {+ @SuppressWarnings({"unchecked"})+ private void executeReq(String uri, JettySolrRunner jetty,+ @SuppressWarnings({"rawtypes"})Utils.InputStreamConsumer parser,+ @SuppressWarnings({"rawtypes"})Map expected) throws Exception {try(HttpSolrClient client = (HttpSolrClient) jetty.newClient()){TestDistribPackageStore.assertResponseValues(10,() -> {@@ -459,6 +463,7 @@ public class TestPackages extends SolrCloudTestCase {private void verifyCmponent(SolrClient client, String COLLECTION_NAME,String componentType, String componentName, String pkg, String version) throws Exception {+ @SuppressWarnings({"unchecked"})SolrParams params = new MapSolrParams((Map) Utils.makeMap("collection", COLLECTION_NAME,WT, JAVABIN,"componentName", componentName,diff --git a/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java b/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.javaindex 70575752a8b..15f5b7efafc 100644--- a/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java+++ b/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java@@ -524,6 +524,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {SchemaField sf = h.getCore().getLatestSchema().getField(field);String response = JQ(req("q", "*:*"));+ @SuppressWarnings({"rawtypes"})Map rsp = (Map) fromJSONString(response);Long numFound = (Long)(((Map)rsp.get("response")).get("numFound"));diff --git a/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java b/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.javaindex 7882dc0aab5..a581264c92b 100644--- a/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java+++ b/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java@@ -398,7 +398,7 @@ public class TestIntervalFaceting extends SolrTestCaseJ4 {try {SolrQueryResponse rsp = h.queryAndResponse("", req);NamedList<Object> facetQueries = (NamedList<Object>) ((NamedList<Object>) rsp.getValues().get("facet_counts")).get("facet_queries");- NamedList<Object> facetIntervals = (NamedList<Object>) ((NamedList<Object>) (NamedList<Object>) ((NamedList<Object>) rsp.getValues().get("facet_counts"))+ NamedList<Object> facetIntervals = (NamedList<Object>) ((NamedList<Object>) ((NamedList<Object>) rsp.getValues().get("facet_counts")).get("facet_intervals")).get(field);assertEquals("Responses don't have the same number of facets: \n" + facetQueries + "\n" + facetIntervals,facetQueries.size(), getCountDistinctIntervals(facetIntervals));diff --git a/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java b/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.javaindex 733b960930a..c6c60cb4481 100644--- a/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java+++ b/solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java@@ -121,6 +121,7 @@ public class TestMacroExpander extends SolrTestCase {request.put("expr", new String[] {"${one_ref}"}); // expr is for streaming expressions, no replacement by defaultrequest.put("one_ref",new String[] {"one"});request.put("three_ref",new String[] {"three"});+ @SuppressWarnings({"rawtypes"})Map expanded = MacroExpander.expand(request);assertEquals("zero", ((String[])expanded.get("fq"))[0]);assertEquals("one", ((String[])expanded.get("fq"))[1]);@@ -142,6 +143,7 @@ public class TestMacroExpander extends SolrTestCase {String oldVal = System.getProperty("StreamingExpressionMacros","false");System.setProperty("StreamingExpressionMacros", "true");try {+ @SuppressWarnings({"rawtypes"})Map expanded = MacroExpander.expand(request);assertEquals("zero", ((String[])expanded.get("fq"))[0]);assertEquals("one", ((String[])expanded.get("fq"))[1]);diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java b/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.javaindex 4e676532967..88b9d862e3a 100644--- a/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java+++ b/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java@@ -1195,7 +1195,7 @@ public class TestBulkSchemaAPI extends RestTestBase {* Executes each of the specified Similarity-accepting validators.*/@SafeVarargs- @SuppressWarnings({"unchecked"})+ @SuppressWarnings({"unchecked", "varargs"})private static <T extends Similarity> void assertFieldSimilarity(String fieldname, Class<T> expected, Consumer<T>... validators) {CoreContainer cc = jetty.getCoreContainer();try (SolrCore core = cc.getCore("collection1")) {diff --git a/solr/core/src/test/org/apache/solr/security/AuditLoggerIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/AuditLoggerIntegrationTest.javaindex c05b17651e7..1d538e2cb93 100644--- a/solr/core/src/test/org/apache/solr/security/AuditLoggerIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/security/AuditLoggerIntegrationTest.java@@ -435,6 +435,10 @@ public class AuditLoggerIntegrationTest extends SolrCloudAuthTestCase {/*** Listening for socket callbacks in background thread from the custom CallbackAuditLoggerPlugin*/+ // we don't really care about the InterruptedException that could be thrown from close in test code+ // This all goes back to MiniSolrCloudCluster.close, which really _can_ throw+ // an InterruptedException+ @SuppressWarnings({"try"})private class CallbackReceiver implements Runnable, AutoCloseable {private final ServerSocket serverSocket;private BlockingQueue<AuditEvent> queue = new LinkedBlockingDeque<>();@@ -491,6 +495,10 @@ public class AuditLoggerIntegrationTest extends SolrCloudAuthTestCase {}}+ // we don't really care about the InterruptedException that could be thrown from close in test code+ // This all goes back to MiniSolrCloudCluster.close, which really _can_ throw+ // an InterruptedException+ @SuppressWarnings({"try"})private class AuditTestHarness implements AutoCloseable {CallbackReceiver receiver;int callbackPort;diff --git a/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java b/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.javaindex 6106fb4bb78..972f00b3751 100644--- a/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java@@ -32,6 +32,7 @@ import org.junit.Test;* Simple tests for {@link DirectSolrSpellChecker}*/@SuppressTempFileChecks(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")+@SuppressWarnings({"rawtypes"})public class DirectSolrSpellCheckerTest extends SolrTestCaseJ4 {private static SpellingQueryConverter queryConverter;@@ -51,8 +52,10 @@ public class DirectSolrSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void test() throws Exception {DirectSolrSpellChecker checker = new DirectSolrSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", DirectSolrSpellChecker.class.getName());spellchecker.add(SolrSpellChecker.FIELD, "teststop");diff --git a/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java b/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.javaindex b52e411a442..8fd0b4b903e 100644--- a/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java@@ -39,6 +39,7 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {private static SpellingQueryConverter queryConverter;@BeforeClass+ @SuppressWarnings({"rawtypes"})public static void beforeClass() throws Exception {initCore("solrconfig.xml","schema.xml");//Index something with a title@@ -57,8 +58,10 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void test() throws Exception {FileBasedSpellChecker checker = new FileBasedSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", FileBasedSpellChecker.class.getName());@@ -94,8 +97,10 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testFieldType() throws Exception {FileBasedSpellChecker checker = new FileBasedSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", FileBasedSpellChecker.class.getName());spellchecker.add(SolrSpellChecker.DICTIONARY_NAME, "external");@@ -138,8 +143,10 @@ public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {* No indexDir location set*/@Test+ @SuppressWarnings({"unchecked"})public void testRAMDirectory() throws Exception {FileBasedSpellChecker checker = new FileBasedSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", FileBasedSpellChecker.class.getName());diff --git a/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java b/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.javaindex 328d8630038..1e6a864479d 100644--- a/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java@@ -101,9 +101,11 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testSpelling() throws Exception {IndexBasedSpellChecker checker = new IndexBasedSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", IndexBasedSpellChecker.class.getName());@@ -175,8 +177,10 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testExtendedResults() throws Exception {IndexBasedSpellChecker checker = new IndexBasedSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", IndexBasedSpellChecker.class.getName());@@ -229,8 +233,10 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testAlternateDistance() throws Exception {TestSpellChecker checker = new TestSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", IndexBasedSpellChecker.class.getName());@@ -256,6 +262,7 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked"})public void testAlternateLocation() throws Exception {String[] ALT_DOCS = new String[]{"jumpin jack flash",@@ -268,6 +275,7 @@ public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {};IndexBasedSpellChecker checker = new IndexBasedSpellChecker();+ @SuppressWarnings({"rawtypes"})NamedList spellchecker = new NamedList();spellchecker.add("classname", IndexBasedSpellChecker.class.getName());diff --git a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.javaindex efa7df23170..ebab4323185 100644--- a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java@@ -100,6 +100,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testCollationWithRangeQuery() throws Exception{SolrCore core = h.getCore();@@ -132,6 +133,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testCollationWithHypens() throws Exception{SolrCore core = h.getCore();@@ -222,6 +224,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testCollateWithFilter() throws Exception{SolrCore core = h.getCore();@@ -257,6 +260,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testCollateWithMultipleRequestHandlers() throws Exception{SolrCore core = h.getCore();@@ -304,6 +308,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testExtendedCollate() throws Exception {SolrCore core = h.getCore();SearchComponent speller = core.getSearchComponent("spellcheck");@@ -323,6 +328,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {// All words are "correct" per the dictionary, but this collation would// return no results if tried.SolrRequestHandler handler = core.getRequestHandler("/spellCheckCompRH");+ @SuppressWarnings({"rawtypes"})SolrQueryResponse rsp = new SolrQueryResponse();rsp.addResponseHeader(new SimpleOrderedMap());SolrQueryRequest req = new LocalSolrQueryRequest(core, params);@@ -410,6 +416,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testCollateWithGrouping() throws Exception{SolrCore core = h.getCore();@@ -590,6 +597,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testZeroTries() throws Exception{SolrCore core = h.getCore();@@ -617,6 +625,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {assertTrue(collations.size() == 2);}@Test+ @SuppressWarnings({"unchecked", "rawtypes"})public void testWithCursorMark() throws Exception{SolrCore core = h.getCore();diff --git a/solr/core/src/test/org/apache/solr/spelling/SpellingQueryConverterTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellingQueryConverterTest.javaindex 04e1da9cc90..d86f7c9156d 100644--- a/solr/core/src/test/org/apache/solr/spelling/SpellingQueryConverterTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/SpellingQueryConverterTest.java@@ -35,6 +35,7 @@ import org.junit.Test;public class SpellingQueryConverterTest extends SolrTestCase {@Test+ @SuppressWarnings({"rawtypes"})public void test() throws Exception {SpellingQueryConverter converter = new SpellingQueryConverter();converter.init(new NamedList());@@ -45,6 +46,7 @@ public class SpellingQueryConverterTest extends SolrTestCase {}@Test+ @SuppressWarnings({"rawtypes"})public void testNumeric() throws Exception {SpellingQueryConverter converter = new SpellingQueryConverter();converter.init(new NamedList());@@ -59,6 +61,7 @@ public class SpellingQueryConverterTest extends SolrTestCase {}@Test+ @SuppressWarnings({"rawtypes"})public void testSpecialChars() {SpellingQueryConverter converter = new SpellingQueryConverter();converter.init(new NamedList());@@ -115,6 +118,7 @@ public class SpellingQueryConverterTest extends SolrTestCase {}@Test+ @SuppressWarnings({"rawtypes"})public void testUnicode() {SpellingQueryConverter converter = new SpellingQueryConverter();converter.init(new NamedList());@@ -135,6 +139,7 @@ public class SpellingQueryConverterTest extends SolrTestCase {}@Test+ @SuppressWarnings({"rawtypes"})public void testMultipleClauses() {SpellingQueryConverter converter = new SpellingQueryConverter();converter.init(new NamedList());@@ -152,6 +157,7 @@ public class SpellingQueryConverterTest extends SolrTestCase {}@Test+ @SuppressWarnings({"rawtypes"})public void testRequiredOrProhibitedFlags() {SpellingQueryConverter converter = new SpellingQueryConverter();converter.init(new NamedList());diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.javaindex 9168741e520..dcfbe9e7313 100644--- a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java@@ -103,8 +103,10 @@ public class SuggesterTest extends SolrTestCaseJ4 {}// SOLR-2726+ @SuppressWarnings({"unchecked"})public void testAnalyzer() throws Exception {Suggester suggester = new Suggester();+ @SuppressWarnings({"rawtypes"})NamedList params = new NamedList();params.add("field", "test_field");params.add("lookupImpl", "org.apache.solr.spelling.suggest.tst.TSTLookupFactory");diff --git a/solr/core/src/test/org/apache/solr/store/blockcache/BlockCacheTest.java b/solr/core/src/test/org/apache/solr/store/blockcache/BlockCacheTest.javaindex 2ea3bf078fd..ea831d20cf0 100644--- a/solr/core/src/test/org/apache/solr/store/blockcache/BlockCacheTest.java+++ b/solr/core/src/test/org/apache/solr/store/blockcache/BlockCacheTest.java@@ -269,7 +269,7 @@ public class BlockCacheTest extends SolrTestCase {return;}}- assertEquals("cache key differs from value's key", (Long) k, (Long) v.key);+ assertEquals("cache key differs from value's key", k, (Long) v.key);if (!v.live.compareAndSet(true, false)) {throw new RuntimeException("listener called more than once! k=" + k + " v=" + v + " removalCause=" + removalCause);// return; // use this variant if listeners may be called more than once@@ -339,7 +339,7 @@ public class BlockCacheTest extends SolrTestCase {Val v = cache.getIfPresent(k);if (v != null) {hits.incrementAndGet();- assertEquals("cache key differs from value's key", (Long) k, (Long) v.key);+ assertEquals("cache key differs from value's key", k, (Long) v.key);}if (v == null || odds(updateAnywayOdds)) {diff --git a/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java b/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.javaindex baa328e88f0..093ba7bf0e9 100644--- a/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java+++ b/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java@@ -113,7 +113,7 @@ public class HdfsDirectoryTest extends SolrTestCaseJ4 {IndexInput input1 = directory.openInput("testing.test", new IOContext());- IndexInput input2 = (IndexInput) input1.clone();+ IndexInput input2 = input1.clone();assertEquals(12345, input2.readInt());input2.close();