You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/06/16 17:28:17 UTC
[lucene-solr] branch branch_8x updated: SOLR-14573: Fix or suppress
warnings in solrj/src/test
This is an automated email from the ASF dual-hosted git repository.
erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new c5a2916 SOLR-14573: Fix or suppress warnings in solrj/src/test
c5a2916 is described below
commit c5a29169c5de71e9eb6916139243d5530800d050
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Tue Jun 16 13:23:38 2020 -0400
SOLR-14573: Fix or suppress warnings in solrj/src/test
---
solr/CHANGES.txt | 2 +
.../TestEmbeddedSolrServerAdminHandler.java | 1 +
.../TestEmbeddedSolrServerConstructors.java | 1 +
.../ref_guide_examples/JsonRequestApiTest.java | 2 +-
.../UsingSolrJRefGuideExamplesTest.java | 5 +-
.../apache/solr/client/solrj/SolrExampleTests.java | 11 +-
.../client/solrj/SolrSchemalessExampleTest.java | 2 +
.../solrj/beans/TestDocumentObjectBinder.java | 1 +
.../client/solrj/cloud/autoscaling/TestPolicy.java | 118 +++++++++++-
.../solrj/cloud/autoscaling/TestPolicy2.java | 24 ++-
.../solrj/embedded/SolrExampleJettyTest.java | 1 +
.../solrj/embedded/TestEmbeddedSolrServer.java | 2 +-
.../client/solrj/impl/BasicHttpSolrClientTest.java | 6 +-
.../impl/CloudHttp2SolrClientBadInputTest.java | 4 +-
.../solrj/impl/CloudHttp2SolrClientRetryTest.java | 1 +
.../solrj/impl/CloudHttp2SolrClientTest.java | 10 ++
.../solrj/impl/CloudSolrClientBadInputTest.java | 4 +-
.../solrj/impl/CloudSolrClientBuilderTest.java | 2 +-
.../solrj/impl/CloudSolrClientCacheTest.java | 8 +-
.../solrj/impl/CloudSolrClientRetryTest.java | 1 +
.../client/solrj/impl/CloudSolrClientTest.java | 6 +
...oncurrentUpdateHttp2SolrClientBadInputTest.java | 4 +-
.../ConcurrentUpdateSolrClientBadInputTest.java | 4 +-
.../ConcurrentUpdateSolrClientBuilderTest.java | 2 +-
.../client/solrj/impl/Http2SolrClientTest.java | 3 +-
.../solrj/impl/HttpSolrClientBadInputTest.java | 4 +-
.../solrj/impl/LBHttpSolrClientBadInputTest.java | 4 +-
.../org/apache/solr/client/solrj/io/TestLang.java | 2 +-
.../client/solrj/io/graph/GraphExpressionTest.java | 11 +-
.../solr/client/solrj/io/graph/GraphTest.java | 10 +-
.../apache/solr/client/solrj/io/sql/JdbcTest.java | 2 +
.../solrj/io/stream/CloudAuthStreamTest.java | 1 +
.../client/solrj/io/stream/MathExpressionTest.java | 198 +++++++++++++++++++--
.../client/solrj/io/stream/RecordCountStream.java | 2 +-
.../solrj/io/stream/SelectWithEvaluatorsTest.java | 6 +-
.../solrj/io/stream/StreamDecoratorTest.java | 10 +-
.../solrj/io/stream/StreamExpressionTest.java | 15 +-
.../solr/client/solrj/io/stream/StreamingTest.java | 27 ++-
.../solrj/io/stream/eval/AscEvaluatorTest.java | 6 +
.../io/stream/eval/ConversionEvaluatorsTest.java | 24 +--
.../solrj/io/stream/eval/ReverseEvaluatorTest.java | 1 +
.../io/stream/eval/TemporalEvaluatorsTest.java | 1 +
.../solrj/io/stream/ops/ConcatOperationTest.java | 1 +
.../client/solrj/io/stream/ops/OperationsTest.java | 1 +
.../solr/client/solrj/request/SchemaTest.java | 1 +
.../solrj/request/TestConfigSetAdminRequest.java | 3 +-
.../solrj/request/TestUpdateRequestCodec.java | 6 +-
.../solr/client/solrj/request/TestV2Request.java | 4 +-
.../client/solrj/request/json/DomainMapTest.java | 7 +
.../solrj/response/AnlysisResponseBaseTest.java | 6 +-
.../response/DocumentAnalysisResponseTest.java | 2 +
.../solrj/response/FieldAnalysisResponseTest.java | 2 +
.../solrj/response/NoOpResponseParserTest.java | 2 +
.../client/solrj/response/QueryResponseTest.java | 1 +
.../response/TestDelegationTokenResponse.java | 2 +-
.../org/apache/solr/common/SolrDocumentTest.java | 5 +-
.../solr/common/TestToleratedUpdateError.java | 2 +
.../apache/solr/common/util/JsonValidatorTest.java | 3 +
.../org/apache/solr/common/util/NamedListTest.java | 5 +-
.../solr/common/util/TestFastJavabinDecoder.java | 13 ++
.../apache/solr/common/util/TestJavaBinCodec.java | 9 +-
.../solr/common/util/TestJsonRecordReader.java | 5 +
.../solr/common/util/TestNamedListCodec.java | 15 ++
.../org/apache/solr/common/util/TestPathTrie.java | 2 +
.../solr/common/util/TestValidatingJsonMap.java | 1 +
.../solr/common/util/Utf8CharSequenceTest.java | 6 +
66 files changed, 567 insertions(+), 86 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 626376f..f1c44f5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -273,6 +273,8 @@ Other Changes
* SOLR-14556: Fix or suppress warnings in solrj/cloud/autoscaling (Erick Erickson)
+* SOLR-14573: Fix or suppress warnings in solrj/src/test (Erick Erickson)
+
================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerAdminHandler.java b/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerAdminHandler.java
index 6df6a6b..b5faba2 100644
--- a/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerAdminHandler.java
+++ b/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerAdminHandler.java
@@ -32,6 +32,7 @@ import org.junit.Test;
public class TestEmbeddedSolrServerAdminHandler extends SolrTestCaseJ4 {
@Test
+ @SuppressWarnings({"rawtypes"})
public void testPathIsAddedToContext() throws IOException, SolrServerException {
final NodeConfig config = new NodeConfig.NodeConfigBuilder("testnode", TEST_PATH())
diff --git a/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerConstructors.java b/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerConstructors.java
index 9518532..912a35c 100644
--- a/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerConstructors.java
+++ b/solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerConstructors.java
@@ -30,6 +30,7 @@ import org.junit.Test;
public class TestEmbeddedSolrServerConstructors extends SolrTestCaseJ4 {
@Test
+ @SuppressWarnings({"try"})
public void testPathConstructor() throws IOException {
Path path = Paths.get(TEST_HOME());
try (EmbeddedSolrServer server = new EmbeddedSolrServer(path, "collection1")) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/JsonRequestApiTest.java b/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/JsonRequestApiTest.java
index 5d78d06..86a0d8f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/JsonRequestApiTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/JsonRequestApiTest.java
@@ -284,7 +284,7 @@ public class JsonRequestApiTest extends SolrCloudTestCase {
//tag::solrj-ipod-query-boosted-dsl-2[]
final Map<String, Object> queryTopLevel = new HashMap<>();
final Map<String, Object> boostProperties = new HashMap<>();
- final Map<String, Object> luceneTopLevel = new HashMap();
+ final Map<String, Object> luceneTopLevel = new HashMap<>();
final Map<String, Object> luceneProperties = new HashMap<>();
queryTopLevel.put("boost", boostProperties);
boostProperties.put("b", "log(popularity)");
diff --git a/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java b/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java
index c87bb87..5efa215 100644
--- a/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java
@@ -58,7 +58,7 @@ public class UsingSolrJRefGuideExamplesTest extends SolrCloudTestCase {
private static final int NUM_INDEXED_DOCUMENTS = 3;
private static final int NUM_LIVE_NODES = 1;
- private Queue<String> expectedLines = new ArrayDeque();
+ private Queue<String> expectedLines = new ArrayDeque<>();
@BeforeClass
public static void setUpCluster() throws Exception {
@@ -219,10 +219,13 @@ public class UsingSolrJRefGuideExamplesTest extends SolrCloudTestCase {
// tag::solrj-other-apis[]
final SolrClient client = getSolrClient();
+ @SuppressWarnings({"rawtypes"})
final SolrRequest request = new CollectionAdminRequest.ClusterStatus();
final NamedList<Object> response = client.request(request);
+ @SuppressWarnings({"unchecked"})
final NamedList<Object> cluster = (NamedList<Object>) response.get("cluster");
+ @SuppressWarnings({"unchecked"})
final List<String> liveNodes = (List<String>) cluster.get("live_nodes");
print("Found " + liveNodes.size() + " live nodes");
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
index bab0726..773e695 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
@@ -154,6 +154,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
* query the example
*/
@Test
+ @SuppressWarnings({"rawtypes"})
public void testExampleConfig() throws Exception
{
SolrClient client = getSolrClient();
@@ -602,6 +603,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertTrue( "should be bigger ["+id1+","+id2+"]", id2 > id1 );
// The score from explain should be the same as the score
+ @SuppressWarnings({"rawtypes"})
NamedList explain = (NamedList)out1.getFieldValue( "[explain]" );
assertEquals( out1.get( "score"), explain.get( "value" ) );
@@ -787,6 +789,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
}
@Test
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testMultiContentWriterRequest() throws Exception {
SolrClient client = getSolrClient();
client.deleteByQuery("*:*");// delete everything!
@@ -811,7 +814,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
}
- private ByteBuffer getFileContent(NamedList nl, String name) throws IOException {
+ private ByteBuffer getFileContent(@SuppressWarnings({"rawtypes"})NamedList nl, String name) throws IOException {
try (InputStream is = new FileInputStream(getFile(name))) {
return MultiContentWriterRequest.readByteBuffer(is);
}
@@ -1305,6 +1308,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
}
@Test
+ @SuppressWarnings({"rawtypes"})
public void testPivotFacetsRanges() throws Exception {
SolrClient client = getSolrClient();
@@ -1391,6 +1395,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertEquals(0, ((Float)range.getStart()).intValue());
assertEquals(200, ((Float)range.getEnd()).intValue());
assertEquals(50, ((Float)range.getGap()).intValue());
+ @SuppressWarnings({"unchecked"})
List<Count> counts = range.getCounts();
assertEquals(4, counts.size());
for (Count count : counts) {
@@ -1406,6 +1411,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertEquals(0, ((Float) range.getStart()).intValue());
assertEquals(200, ((Float) range.getEnd()).intValue());
assertEquals(50, ((Float) range.getGap()).intValue());
+ @SuppressWarnings({"unchecked"})
List<Count> counts = range.getCounts();
assertEquals(4, counts.size());
for (Count count : counts) {
@@ -1429,6 +1435,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertEquals(0, ((Float)range.getStart()).intValue());
assertEquals(200, ((Float)range.getEnd()).intValue());
assertEquals(50, ((Float)range.getGap()).intValue());
+ @SuppressWarnings({"unchecked"})
List<Count> counts = range.getCounts();
assertEquals(4, counts.size());
for (Count count : counts) {
@@ -1444,6 +1451,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertEquals(0, ((Float)range.getStart()).intValue());
assertEquals(200, ((Float)range.getEnd()).intValue());
assertEquals(50, ((Float)range.getGap()).intValue());
+ @SuppressWarnings({"unchecked"})
List<Count> counts = range.getCounts();
assertEquals(4, counts.size());
for (Count count : counts) {
@@ -1827,6 +1835,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testUpdateMultiValuedField() throws Exception {
SolrClient solrClient = getSolrClient();
SolrInputDocument doc = new SolrInputDocument();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java
index b59d5c1..bb41dd5 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java
@@ -91,6 +91,7 @@ public class SolrSchemalessExampleTest extends SolrExampleTestsBase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testFieldMutating() throws Exception {
HttpSolrClient client = (HttpSolrClient) getSolrClient();
client.deleteByQuery("*:*");
@@ -121,6 +122,7 @@ public class SolrSchemalessExampleTest extends SolrExampleTestsBase {
"p_q",
"p.q",
"x_y");
+ @SuppressWarnings({"rawtypes"})
HashSet set = new HashSet();
QueryResponse rsp = assertNumFound("*:*", expected.size());
for (SolrDocument doc : rsp.getResults()) set.addAll(doc.getFieldNames());
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/beans/TestDocumentObjectBinder.java b/solr/solrj/src/test/org/apache/solr/client/solrj/beans/TestDocumentObjectBinder.java
index e3631b8..4894c74 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/beans/TestDocumentObjectBinder.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/beans/TestDocumentObjectBinder.java
@@ -57,6 +57,7 @@ public class TestDocumentObjectBinder extends SolrTestCase {
SolrInputField catfield = out.getField("cat");
assertEquals(3, catfield.getValueCount());
+ @SuppressWarnings({"unchecked"})
List<String> catValues = (List<String>) catfield.getValue();
assertEquals("aaa", catValues.get(0));
assertEquals("bbb", catValues.get(1));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
index 0b3c31e..fc8eefa 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
@@ -93,13 +93,16 @@ public class TestPolicy extends SolrTestCaseJ4 {
public TestPolicy(){
useNodeset = true;
}
- static Suggester createSuggester(SolrCloudManager cloudManager, Map jsonObj, Suggester seed) throws IOException, InterruptedException {
+ @SuppressWarnings({"unchecked"})
+ static Suggester createSuggester(SolrCloudManager cloudManager,
+ @SuppressWarnings({"rawtypes"})Map jsonObj, Suggester seed) throws IOException, InterruptedException {
Policy.Session session = null;
if (seed != null) session = seed.session;
else {
session = cloudManager.getDistribStateManager().getAutoScalingConfig().getPolicy().createSession(cloudManager);
}
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) jsonObj.get("suggester");
Suggester result = session.getSuggester(CollectionParams.CollectionAction.get((String) m.get("action")));
m = (Map) m.get("hints");
@@ -110,13 +113,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
return result;
}
- static SolrCloudManager createCloudManager(Map jsonObj) {
+ static SolrCloudManager createCloudManager(@SuppressWarnings({"rawtypes"})Map jsonObj) {
return cloudManagerWithData(jsonObj);
}
public static String clusterState = Utils.toJSONString(loadFromResource("testPolicy.json"));
- public static Map<String, Map<String, List<ReplicaInfo>>> getReplicaDetails(String node, Map clusterState) {
+ public static Map<String, Map<String, List<ReplicaInfo>>> getReplicaDetails(String node,
+ @SuppressWarnings({"rawtypes"})Map clusterState) {
ValidatingJsonMap m = ValidatingJsonMap
.getDeepCopy(clusterState, 6, true);
Map<String, Map<String, List<ReplicaInfo>>> result = new LinkedHashMap<>();
@@ -141,6 +145,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testWithCollection() {
+ @SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.load(1,
(Map) loadFromResource("testWithCollection.json"),
ImmutableSet.of("node1", "node2", "node3", "node4", "node5"), CLUSTER_STATE);
@@ -182,9 +187,11 @@ public class TestPolicy extends SolrTestCaseJ4 {
return clusterStateProvider;
}
};
+ @SuppressWarnings({"rawtypes"})
Map m = solrClientNodeStateProvider.getNodeValues("node1", ImmutableSet.of("cores", "withCollection"));
assertNotNull(m.get("withCollection"));
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'minimize': 'cores'}," +
@@ -195,6 +202,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" { 'replica': '<2', 'shard': '#EACH', 'node': '#ANY'}," +
" ]" +
"}");
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig config = new AutoScalingConfig(policies);
Policy policy = config.getPolicy();
Policy.Session session = policy.createSession(new DelegatingCloudManager(null) {
@@ -210,6 +218,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
});
Suggester suggester = session.getSuggester(CollectionAction.ADDREPLICA);
suggester.hint(Hint.COLL_SHARD, new Pair<>("comments_coll", "shard1"));
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester.getSuggestion();
assertNotNull(op);
Set<String> nodes = new HashSet<>(2);
@@ -232,6 +241,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testWithCollectionSuggestions() {
+ @SuppressWarnings({"unchecked"})
ClusterState clusterState =
ClusterState.load(1,
(Map) loadFromResource("testWithCollectionSuggestions.json"),
@@ -274,9 +284,11 @@ public class TestPolicy extends SolrTestCaseJ4 {
return clusterStateProvider;
}
};
+ @SuppressWarnings({"rawtypes"})
Map m = solrClientNodeStateProvider.getNodeValues("node1", ImmutableSet.of("cores", "withCollection"));
assertNotNull(m.get("withCollection"));
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@@ -288,6 +300,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" ]" +
"}");
+ @SuppressWarnings({"unchecked"})
List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(new AutoScalingConfig(policies),
new DelegatingCloudManager(null) {
@Override
@@ -324,6 +337,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testWithCollectionMoveVsAddSuggestions() throws IOException {
+ @SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.load(1,
(Map) loadFromResource("testWithCollectionMoveVsAddSuggestions.json"),
ImmutableSet.of("node1", "node2", "node3", "node4", "node5", "node6"),
@@ -367,9 +381,11 @@ public class TestPolicy extends SolrTestCaseJ4 {
return clusterStateProvider;
}
};
+ @SuppressWarnings({"rawtypes"})
Map m = solrClientNodeStateProvider.getNodeValues("node1", ImmutableSet.of("cores", "withCollection"));
assertNotNull(m.get("withCollection"));
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@@ -381,6 +397,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" ]" +
"}");
+ @SuppressWarnings({"unchecked"})
List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(new AutoScalingConfig(policies),
new DelegatingCloudManager(null) {
@Override
@@ -432,6 +449,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testWithCollectionMoveReplica() {
+ @SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.load(1,
(Map) loadFromResource("testWithCollectionMoveReplica.json"),
ImmutableSet.of("node2", "node3", "node4", "node5"), CLUSTER_STATE);
@@ -473,9 +491,11 @@ public class TestPolicy extends SolrTestCaseJ4 {
return clusterStateProvider;
}
};
+ @SuppressWarnings({"rawtypes"})
Map m = solrClientNodeStateProvider.getNodeValues("node1", ImmutableSet.of("cores", "withCollection"));
assertNotNull(m.get("withCollection"));
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'minimize': 'cores'}," +
@@ -486,6 +506,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" { 'replica': '<2', 'shard': '#EACH', 'node': '#ANY'}," +
" ]" +
"}");
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig config = new AutoScalingConfig(policies);
Policy policy = config.getPolicy();
Policy.Session session = policy.createSession(new DelegatingCloudManager(null) {
@@ -502,6 +523,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
Suggester suggester = session.getSuggester(CollectionAction.MOVEREPLICA);
suggester.hint(Hint.COLL_SHARD, new Pair<>("comments_coll", "shard1"));
suggester.hint(Hint.SRC_NODE, "node1");
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester.getSuggestion();
assertNotNull(op);
assertEquals("node2 should have been selected by move replica", "node2",
@@ -807,7 +829,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" }" +
"}";
-
+ @SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.load(1, clusterStateStr.getBytes(UTF_8),
ImmutableSet.of("node1", "node2", "node3", "node4", "node5"));
DelegatingClusterStateProvider clusterStateProvider = new DelegatingClusterStateProvider(null) {
@@ -850,6 +872,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
};
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'minimize': 'cores', 'precision': 50}" +
@@ -858,6 +881,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" { 'replica': '#EQUAL', 'node': '#ANY'}," +
" ]" +
"}");
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig config = new AutoScalingConfig(policies);
Policy policy = config.getPolicy();
Policy.Session session = policy.createSession(new DelegatingCloudManager(null) {
@@ -984,13 +1008,16 @@ public class TestPolicy extends SolrTestCaseJ4 {
" 'maximize':'freedisk'," +
" 'precision':100}]}";
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
Policy.Session session = policy.createSession(cloudManagerWithData(dataproviderdata));
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = session.getSuggester(MOVEREPLICA).hint(Hint.SRC_NODE, "127.0.0.1:65427_solr").getSuggestion();
assertNotNull(op);
assertEquals("127.0.0.1:65434_solr", op.getParams().get("targetNode"));
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testNodeLostMultipleReplica() {
String nodeValues = " {" +
" 'node4':{" +
@@ -1151,6 +1178,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
return cloudManagerWithData((Map) Utils.fromJSONString(data));
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
static SolrCloudManager cloudManagerWithData(Map m) {
Map replicaInfo = (Map) m.get("replicaInfo");
replicaInfo.forEach((node, val) -> {
@@ -1172,6 +1200,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
});
});
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig asc = m.containsKey("autoscalingJson") ? new AutoScalingConfig((Map<String, Object>) m.get("autoscalingJson")) : null;
return new DelegatingCloudManager(null) {
@@ -1194,6 +1223,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@Override
+ @SuppressWarnings({"unchecked"})
public Set<String> getLiveNodes() {
return new HashSet<>((Collection<String>) m.get("liveNodes"));
}
@@ -1205,12 +1235,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
return new DelegatingNodeStateProvider(null) {
@Override
public Map<String, Object> getNodeValues(String node, Collection<String> tags) {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> result = (Map<String, Object>) Utils.getObjectByPath(m, false, Arrays.asList("nodeValues", node));
return result == null ? new HashMap<>() : result;
}
@Override
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
+ @SuppressWarnings({"unchecked"})
Map<String, Map<String, List<ReplicaInfo>>> result = (Map<String, Map<String, List<ReplicaInfo>>>) Utils.getObjectByPath(m, false, Arrays.asList("replicaInfo", node));
return result == null ? new HashMap<>() : result;
}
@@ -1219,6 +1251,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
};
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testPolicyWithReplicaType() {
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
@@ -1301,12 +1334,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testMoveReplicasInMultipleCollections() throws IOException {
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:2}," +
"node3:{cores:4}" +
"node2:{cores:2}" +
"}");
Policy policy = new Policy(new HashMap<>());
+ @SuppressWarnings({"unchecked"})
Suggester suggester = policy.createSession(getSolrCloudManager(nodeValues,
(Map<String, Object>) loadFromResource("testMoveReplicasInMultipleCollections.json")))
.getSuggester(MOVEREPLICA)
@@ -1314,6 +1349,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
.hint(Hint.COLL, "collection2")
.hint(Suggester.Hint.SRC_NODE, "node2")
.forceOperation(true);
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester.getSuggestion();
assertNotNull(op);
assertEquals("collection2", op.getParams().get("collection"));
@@ -1345,6 +1381,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testMultipleCollections() {
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@@ -1376,18 +1413,21 @@ public class TestPolicy extends SolrTestCaseJ4 {
"}");
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:12, freedisk: 334, heapUsage:10480, rack: rack4, sysprop.fs: slowdisk}," +
"node2:{cores:4, freedisk: 749, heapUsage:6873, rack: rack3, sysprop.fs: unknown}," +
"node3:{cores:7, freedisk: 262, heapUsage:7834, rack: rack2, sysprop.fs : ssd}," +
"node4:{cores:8, freedisk: 375, heapUsage:16900, nodeRole:overseer, rack: rack1, sysprop.fs: unknown}" +
"}");
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy(policies);
Suggester suggester = policy.createSession(getSolrCloudManager(nodeValues, clusterState))
.getSuggester(ADDREPLICA)
.hint(Hint.REPLICATYPE, Replica.Type.PULL)
.hint(Hint.COLL_SHARD, new Pair<>("newColl", "shard1"))
.hint(Hint.COLL_SHARD, new Pair<>("newColl2", "shard1"));
+ @SuppressWarnings({"rawtypes"})
SolrRequest op;
int countOp = 0;
int countNewCollOp = 0;
@@ -1444,6 +1484,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
return new DelegatingNodeStateProvider(null) {
@Override
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
+ @SuppressWarnings({"unchecked"})
Map<String, Map<String, List<ReplicaInfo>>> o = (Map<String, Map<String, List<ReplicaInfo>>>) Utils.fromJSONString("{c1: {s0:[{}]}}");
Utils.setObjectByPath(o, "c1/s0[0]", new ReplicaInfo("r0", "c1.s0", "c1", "s0", Replica.Type.NRT, "nodex", new HashMap<>()));
return o;
@@ -1483,6 +1524,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testMerge() {
+ @SuppressWarnings({"rawtypes"})
Map map = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@@ -1520,6 +1562,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
"}");
}
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy(map);
List<Clause> clauses = Policy.mergePolicies("mycoll", policy.getPolicies().get("policy1"), policy.getClusterPolicy());
Collections.sort(clauses);
@@ -1549,6 +1592,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" }";
}
+ @SuppressWarnings({"unchecked"})
Policy p = new Policy((Map<String, Object>) Utils.fromJSONString(rules));
List<Clause> clauses = new ArrayList<>(p.getClusterPolicy());
Collections.sort(clauses);
@@ -1556,6 +1600,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
assertEquals("sysprop.rack", clauses.get(0).tag.getName());
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testRules() {
String rules = "{" +
"cluster-policy:[" +
@@ -1630,6 +1675,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" { 'replica':'<2', 'shard':'#EACH', 'node':'#ANY'}," +
" { 'nodeRole':'overseer','replica':0}]," +
" 'cluster-preferences':[{'minimize':'cores'}]}";
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
// PolicyHelper.SESSION_REF.set(ref1);
String nodeValues = " {" +
@@ -1648,6 +1694,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
"}";
+ @SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@@ -1658,7 +1705,9 @@ public class TestPolicy extends SolrTestCaseJ4 {
" { 'replica': '<2', 'shard': '#EACH', 'node': '#ANY'}," +
" ]" +
"}");
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig config = new AutoScalingConfig(policies);
+ @SuppressWarnings({"unchecked", "rawtypes"})
final SolrCloudManager solrCloudManager = new DelegatingCloudManager(getSolrCloudManager((Map<String, Map>) Utils.fromJSONString(nodeValues),
clusterState)) {
@Override
@@ -1734,17 +1783,20 @@ public class TestPolicy extends SolrTestCaseJ4 {
" 'cluster-preferences':[" +
" {'minimize':'cores', 'precision':3}," +
" {'maximize':'freedisk','precision':100}]}";
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:12, freedisk: 334, heapUsage:10480, rack: rack4, sysprop.fs: slowdisk}," +
"node2:{cores:4, freedisk: 749, heapUsage:6873, rack: rack3, sysprop.fs: slowdisk}," +
"node3:{cores:7, freedisk: 262, heapUsage:7834, rack: rack2, sysprop.fs : ssd}," +
"node4:{cores:8, freedisk: 375, heapUsage:16900, nodeRole:overseer, rack: rack1, sysprop.fs: slowdisk}" +
"}");
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoscaleJson));
SolrCloudManager cloudManager = getSolrCloudManager(nodeValues, clusterState);
Policy.Session session = policy.createSession(cloudManager);
for (int i = 0; i < 3; i++) {
Suggester suggester = session.getSuggester(ADDREPLICA);
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester
.hint(Hint.COLL_SHARD, new Pair<>("newColl", "shard1"))
.getSuggestion();
@@ -1777,6 +1829,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" {'maximize':'freedisk','precision':100}]}";
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:12, freedisk: 334, heapUsage:10480, rack: rack4}," +
"node2:{cores:4, freedisk: 749, heapUsage:6873, rack: rack3}," +
@@ -1784,10 +1837,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
"node4:{cores:8, freedisk: 375, heapUsage:16900, nodeRole:overseer, rack: rack1}" +
"}");
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoscaleJson));
SolrCloudManager cloudManager = getSolrCloudManager(nodeValues, clusterState);
Policy.Session session = policy.createSession(cloudManager);
Suggester suggester = session.getSuggester(ADDREPLICA);
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester
.hint(Hint.COLL_SHARD, new Pair<>("newColl", "shard1"))
.getSuggestion();
@@ -1810,6 +1865,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
assertEquals("node2", op.getParams().get("node"));
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testMoveReplica() {
String autoscaleJson = "{" +
" 'cluster-policy':[" +
@@ -1841,6 +1897,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
new ReplicaInfo("core_node1", "core_node1", "compute_plan_action_test", "shard1", Replica.Type.NRT, "127.0.0.1:60089_solr", Collections.emptyMap()),
new ReplicaInfo("core_node2", "core_node2", "compute_plan_action_test", "shard1", Replica.Type.NRT, "127.0.0.1:60089_solr", Collections.emptyMap())));
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map<String, Object>> tagsMap = (Map) Utils.fromJSONString("{" +
" '127.0.0.1:60099_solr':{" +
" 'cores':0," +
@@ -1849,9 +1906,11 @@ public class TestPolicy extends SolrTestCaseJ4 {
" 'cores':2," +
" 'freedisk':918005641216}}");
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoscaleJson));
Policy.Session session = policy.createSession(new DelegatingCloudManager(null) {
@Override
+ @SuppressWarnings({"unchecked"})
public ClusterStateProvider getClusterStateProvider() {
return new DelegatingClusterStateProvider(null) {
@Override
@@ -1871,6 +1930,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@Override
+ @SuppressWarnings({"unchecked"})
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
return (Map<String, Map<String, List<ReplicaInfo>>>) replicaInfoMap.get(node);
}
@@ -1879,6 +1939,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
});
Suggester suggester = session.getSuggester(MOVEREPLICA)
.hint(Hint.TARGET_NODE, "127.0.0.1:60099_solr");
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester.getSuggestion();
assertNotNull("expect a non null operation", op);
}
@@ -1930,12 +1991,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:12, freedisk: 334, heapUsage:10480, rack: rack4}," +
"node2:{cores:4, freedisk: 749, heapUsage:6873, rack: rack3}," +
"node3:{cores:7, freedisk: 262, heapUsage:7834, rack: rack2}," +
"node4:{cores:8, freedisk: 375, heapUsage:16900, nodeRole:overseer, sysprop.rack: rack1}" +
"}");
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(rules));
SolrCloudManager cloudManager = getSolrCloudManager(nodeValues, clusterState);
SolrCloudManager cdp = new DelegatingCloudManager(null) {
@@ -1979,11 +2042,13 @@ public class TestPolicy extends SolrTestCaseJ4 {
assertNotNull(op);
assertEquals("node2", op.getNode());
}
+ @SuppressWarnings({"rawtypes"})
static SolrCloudManager getSolrCloudManager(final Map<String, Map> nodeValues, String clusterS) {
return getSolrCloudManager(nodeValues,(Map) Utils.fromJSONString(clusterS));
}
- private static SolrCloudManager getSolrCloudManager(final Map<String, Map> nodeValues, Map clusterS) {
+ private static SolrCloudManager getSolrCloudManager(@SuppressWarnings({"rawtypes"})final Map<String, Map> nodeValues,
+ @SuppressWarnings({"rawtypes"})Map clusterS) {
return new SolrCloudManager() {
ObjectCache objectCache = new ObjectCache();
@@ -2041,7 +2106,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@Override
- public SolrResponse request(SolrRequest req) {
+ public SolrResponse request(@SuppressWarnings({"rawtypes"})SolrRequest req) {
return null;
}
@@ -2057,6 +2122,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" 'replica':1," +
" 'shard':'#EACH'," +
" 'port':'50096'}]}}";
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
" '127.0.0.1:50097_solr':{" +
" 'cores':0," +
@@ -2092,6 +2158,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
};
}
};
+ @SuppressWarnings({"unchecked"})
List<ReplicaPosition> locations = PolicyHelper.getReplicaLocations(
"newColl", new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScaleJson)),
dataProvider, Collections.singletonMap("newColl", "c1"), Arrays.asList("shard1", "shard2"), 1, 0, 0, null);
@@ -2139,6 +2206,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:12, freedisk: 334, heap:10480, sysprop.rack:rack3}," +
"node2:{cores:4, freedisk: 749, heap:6873, sysprop.fs : ssd, sysprop.rack:rack1}," +
@@ -2174,6 +2242,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
};
}
};
+ @SuppressWarnings({"unchecked"})
List<ReplicaPosition> locations = PolicyHelper.getReplicaLocations(
"newColl", new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScaleJson)),
cloudManager, Collections.singletonMap("newColl", "policy1"), Arrays.asList("shard1", "shard2"), 3, 0, 0, null);
@@ -2185,10 +2254,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
"{'cores':'<10', 'node':'#ANY'}," +
"{'replica':'<2', 'shard':'#EACH','node':'#ANY'}]," +
"'cluster-preferences':[{'minimize':'cores'}]}";
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
Policy.Session session = policy.createSession(cloudManagerWithData((Map) loadFromResource("testMoveReplicaSuggester.json")));
Suggester suggester = session.getSuggester(MOVEREPLICA)
.hint(Hint.TARGET_NODE, "10.0.0.6:7574_solr");
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester.getSuggestion();
assertNotNull(op);
suggester = suggester.getSession()
@@ -2221,10 +2292,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
" {nodeset:{ nodeRole:overseer},replica:0}]}";
}
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
Policy.Session session = policy.createSession(cloudManagerWithData((Map) loadFromResource("testComputePlanAfterNodeAdded.json")));
Suggester suggester = session.getSuggester(CollectionParams.CollectionAction.MOVEREPLICA)
.hint(Hint.TARGET_NODE, "127.0.0.1:51147_solr");
+ @SuppressWarnings({"rawtypes"})
SolrRequest op = suggester.getSuggestion();
log.info("{}", op);
assertNotNull("operation expected ", op);
@@ -2244,6 +2317,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" cluster-preferences :[{ minimize : cores }]}";
}
+ @SuppressWarnings({"unchecked"})
List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson)),
cloudManagerWithData((Map) loadFromResource("testReplicaCountSuggestions.json")));
assertFalse(l.isEmpty());
@@ -2261,6 +2335,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testReplicaPercentage() {
List<Map> l = (List<Map>) loadFromResource("testReplicaPercentage.json");
String autoScalingjson = " { cluster-policy:[" +
@@ -2303,6 +2378,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked"})
public void testReplicaZonesPercentage() {
String autoScalingjson = " { cluster-policy:[" +
" { replica :'33%', shard: '#EACH', sysprop.az : east}," +
@@ -2320,6 +2396,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
int westCount = 0, eastCount = 0;
for (int i = 0; i < 12; i++) {
+ @SuppressWarnings({"rawtypes"})
SolrRequest suggestion = txn.getCurrentSession()
.getSuggester(ADDREPLICA)
.hint(Hint.COLL_SHARD, new Pair<>(COLL_NAME, "shard1"))
@@ -2350,7 +2427,9 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked"})
public void testFreeDiskDeviation() {
+ @SuppressWarnings({"rawtypes"})
Map map = (Map) loadFromResource("testFreeDiskDeviation.json");
AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) map.get("config"));
if(useNodeset){
@@ -2390,6 +2469,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked"})
public void testFreeDiskSuggestions() {
String autoScalingjson = " { cluster-policy:[" +
" { replica :'0', freedisk:'<1000'}," +
@@ -2459,6 +2539,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
String autoScalingjson = " { cluster-policy:[" +
" { cores :'<3', node :'#ANY'}]," +
" cluster-preferences :[{ minimize : cores }]}";
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testCoresSuggestions.json"))).getViolations();
assertFalse(violations.isEmpty());
@@ -2498,6 +2579,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testSyspropSuggestions1.json"))).getViolations();
assertEquals("expected 2 violations", 2, violations.size());
@@ -2531,6 +2613,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
"}";
}
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testPortSuggestions.json"))).getViolations();
assertEquals(2, violations.size());
@@ -2547,6 +2630,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" cluster-policy:[{cores:'<10',node:'#ANY'}," +
" {replica:'<2', shard:'#EACH',node:'#ANY'}," +
" { nodeRole:overseer,replica:0}]}";
+ @SuppressWarnings({"unchecked"})
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
Policy.Session session = policy.createSession(cloudManagerWithData((Map) loadFromResource("testDiskSpaceHint.json")));
Suggester suggester = session.getSuggester(CollectionAction.ADDREPLICA)
@@ -2575,6 +2659,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
"}";
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map<String, Map> nodeValues = (Map<String, Map>) Utils.fromJSONString("{" +
"node1:{cores:12, freedisk: 334, heap:10480, sysprop.rack:rack3}," +
"node2:{cores:4, freedisk: 262, heap:6873, sysprop.fs : ssd, sysprop.rack:rack1}," +
@@ -2594,6 +2679,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
if (node.equals("node1")) {
Map m = Utils.makeMap("newColl",
@@ -2637,6 +2723,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
};
}
};
+ @SuppressWarnings({"unchecked"})
List<ReplicaPosition> locations = PolicyHelper.getReplicaLocations(
"newColl", new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScaleJson)),
cloudManager, null, Arrays.asList("shard1", "shard2"), 1, 0, 0, null);
@@ -2678,6 +2765,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testScheduledTriggerFailure() throws Exception {
+ @SuppressWarnings({"rawtypes"})
Map jsonObj = (Map) loadFromResource("testScheduledTriggerFailure.json");
SolrCloudManager cloudManager = createCloudManager(jsonObj);
Suggester suggester = createSuggester(cloudManager, jsonObj, null);
@@ -2696,6 +2784,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testUtilizeNodeFailure() throws Exception {
+ @SuppressWarnings({"rawtypes"})
Map jsonObj = (Map) loadFromResource("testUtilizeNodeFailure.json"); //(Map) Utils.fromJSONString(state);
SolrCloudManager cloudManager = createCloudManager(jsonObj);
Suggester suggester = createSuggester(cloudManager, jsonObj, null);
@@ -2714,6 +2803,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testUtilizeNodeFailure2() throws Exception {
+ @SuppressWarnings({"rawtypes"})
Map jsonObj = (Map) loadFromResource("testUtilizeNodeFailure2.json");
SolrCloudManager cloudManager = createCloudManager(jsonObj);
Suggester suggester = createSuggester(cloudManager, jsonObj, null);
@@ -2732,6 +2822,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
//SOLR-12358
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testSortError() {
Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString("{cluster-preferences: [{minimize : cores, precision:1}, " +
"{maximize : freedisk, precision: 50}, " +
@@ -2791,6 +2882,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" ]" +
"}";
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testViolationOutput.json"))).getViolations();
StringWriter writer = new StringWriter();
@@ -2811,6 +2903,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked"})
public void testFreediskPercentage() {
String autoScalingjson = "{" +
@@ -2848,6 +2941,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static void fixRequiredProps(Map<String, Object> testData) {
Map<String, Object> clusterState = (Map<String, Object>) testData.get("clusterstate");
clusterState.forEach((collection, val) -> {
@@ -2890,6 +2984,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
});
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testAutoscalingPreferencesUsedWithNoPolicy() throws IOException, InterruptedException {
Map<String, Object> m = (Map<String, Object>) loadFromResource("testAutoscalingPreferencesUsedWithNoPolicy.json");
fixRequiredProps(m);
@@ -2915,6 +3010,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
});
});
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig asc = m.containsKey("autoscalingJson") ? new AutoScalingConfig((Map<String, Object>) m.get("autoscalingJson")) : new AutoScalingConfig(Collections.emptyMap());
DelegatingCloudManager cloudManager = new DelegatingCloudManager(null) {
@@ -2932,6 +3028,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public ClusterStateProvider getClusterStateProvider() {
return new DelegatingClusterStateProvider(null) {
@Override
+ @SuppressWarnings({"unchecked"})
public Set<String> getLiveNodes() {
return new HashSet<>((Collection<String>) m.get("liveNodes"));
}
@@ -2953,12 +3050,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
return new DelegatingNodeStateProvider(null) {
@Override
public Map<String, Object> getNodeValues(String node, Collection<String> tags) {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> result = (Map<String, Object>) Utils.getObjectByPath(m, false, Arrays.asList("nodeValues", node));
return result == null ? new HashMap<>() : result;
}
@Override
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
+ @SuppressWarnings({"unchecked"})
Map<String, Map<String, List<ReplicaInfo>>> result = (Map<String, Map<String, List<ReplicaInfo>>>) Utils.getObjectByPath(m, false, Arrays.asList("replicaInfo", node));
return result == null ? new HashMap<>() : result;
}
@@ -2984,10 +3083,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testPolicyForEmptyCollection() throws IOException, InterruptedException {
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) loadFromResource("testEmptyCollection.json");
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map clusterStateMap = (Map) m.remove("clusterstate");
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map replicaInfoMap = (Map) m.remove("replicaInfo");
+ @SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.load(1, clusterStateMap, ImmutableSet.of("node1", "node2"), CLUSTER_STATE);
List<String> shards = Arrays.asList("shard1", "shard2", "shard3");
@@ -3027,11 +3130,13 @@ public class TestPolicy extends SolrTestCaseJ4 {
public NodeStateProvider getNodeStateProvider() {
return new DelegatingNodeStateProvider(null) {
@Override
+ @SuppressWarnings({"unchecked"})
public Map<String, Object> getNodeValues(String node, Collection<String> keys) {
return Collections.EMPTY_MAP;
}
@Override
+ @SuppressWarnings({"unchecked"})
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
//return Collections.EMPTY_MAP;
return replicaInfoMap;
@@ -3060,6 +3165,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
* @see Assign#usePolicyFramework(DocCollection, SolrCloudManager)
*/
public void testPolicyMapWriterWithEmptyPreferences() throws IOException {
+ @SuppressWarnings({"rawtypes"})
List<Map> defaultPreferences = Policy.DEFAULT_PREFERENCES
.stream().map(preference -> preference.getOriginal()).collect(Collectors.toList());
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
index 63b7da4..9b64198 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
@@ -60,6 +60,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testEqualOnNonNode() {
List<Map> l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
String autoScalingjson = "{cluster-policy:[" +
@@ -174,6 +175,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
static SolrCloudManager createCloudManager(Map m, Map meta) {
Map nodeVals = (Map) meta.get("nodeValues");
List<Map> replicaVals = (List<Map>) meta.get("replicaValues");
@@ -228,6 +230,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
@Override
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
+ @SuppressWarnings({"unchecked"})
Map<String, Map<String, List<ReplicaInfo>>> result = nodeVsCollectionVsShardVsReplicaInfo.computeIfAbsent(node, Utils.NEW_HASHMAP_FUN);
if (!keys.isEmpty()) {
Row.forEachReplica(result, replicaInfo -> {
@@ -248,6 +251,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
};
}
+ @SuppressWarnings({"unchecked"})
public void testAutoScalingHandlerFailure() {
Map<String, Object> m = (Map<String, Object>) loadFromResource("testAutoScalingHandlerFailure.json");
@@ -260,6 +264,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
static SolrCloudManager createCloudManagerFromDiagnostics(Map<String, Object> m) {
List<Map> sortedNodes = (List<Map>) getObjectByPath(m, false, "diagnostics/sortedNodes");
Set<String> liveNodes = new HashSet<>();
@@ -290,6 +295,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
@Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Object> getNodeValues(String node, Collection<String> tags) {
for (Map n : sortedNodes) if (n.get("node").equals(node)) return n;
return Collections.emptyMap();
@@ -305,6 +311,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
@Override
public ClusterStateProvider getClusterStateProvider() {
if (clusterState == null) {
+ @SuppressWarnings({"rawtypes"})
Map map = (Map) getObjectByPath(m, false, "cluster/collections");
if (map == null) map = new HashMap<>();
clusterState = ClusterState.load(0, map, liveNodes, "/clusterstate.json");
@@ -332,7 +339,9 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
public void testHostAttribute() {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> m = (Map<String, Object>) loadFromResource("testHostAttribute.json");
+ @SuppressWarnings({"unchecked"})
Map<String, Object> conf = (Map<String, Object>) getObjectByPath(m, false, "diagnostics/config");
Policy policy = new Policy(conf);
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
@@ -349,6 +358,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
suggestion._get("operation/command/move-replica/targetNode", null)));
}
}
+ @SuppressWarnings({"unchecked"})
public void testSysPropSuggestions() {
Map<String, Object> m = (Map<String, Object>) loadFromResource("testSysPropSuggestions.json");
@@ -411,8 +421,10 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
"{'replica':'<5','shard':'#EACH', nodeset:{'sysprop.zone':['east','west']}}]}";
}
+ @SuppressWarnings({"unchecked"})
Map<String, Object> m = (Map<String, Object>) loadFromResource("testSuggestionsRebalanceOnly.json");
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(conf));
List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(autoScalingConfig, cloudManagerFromDiagnostics);
@@ -424,9 +436,11 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
public void testSuggestionsRebalance2() {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> m = (Map<String, Object>) loadFromResource("testSuggestionsRebalance2.json");
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map<String, Object>) getObjectByPath(m, false, "diagnostics/config"));
List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(autoScalingConfig, cloudManagerFromDiagnostics);
@@ -440,8 +454,10 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
public void testAddMissingReplica() {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> m = (Map<String, Object>) loadFromResource("testAddMissingReplica.json");
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
+ @SuppressWarnings({"unchecked"})
AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map<String, Object>) getObjectByPath(m, false, "diagnostics/config"));
List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(autoScalingConfig, cloudManagerFromDiagnostics);
@@ -455,10 +471,13 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
public void testCreateCollectionWithEmptyPolicy() {
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) loadFromResource("testCreateCollectionWithEmptyPolicy.json");
+ @SuppressWarnings({"unchecked"})
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
- AutoScalingConfig autoScalingConfig = new AutoScalingConfig(new HashMap());
+ AutoScalingConfig autoScalingConfig = new AutoScalingConfig(new HashMap<>());
//POSITIONS : [shard1:1[NRT] @127.0.0.1:49469_solr, shard1:2[NRT] @127.0.0.1:49469_solr]
+ @SuppressWarnings({"unchecked"})
List<ReplicaPosition> positions = PolicyHelper.getReplicaLocations("coll_new", autoScalingConfig, cloudManagerFromDiagnostics,
EMPTY_MAP, Collections.singletonList("shard1"), 2, 0, 0, null);
@@ -470,9 +489,11 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
}
public void testUnresolvedSuggestion() {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> m = (Map<String, Object>) loadFromResource("testUnresolvedSuggestion.json");
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);
+ @SuppressWarnings({"unchecked"})
List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(new AutoScalingConfig((Map<String, Object>) getObjectByPath(m, false, "diagnostics/config"))
, cloudManagerFromDiagnostics);
for (Suggester.SuggestionInfo suggestion : suggestions) {
@@ -483,6 +504,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
@Ignore("This takes too long to run. enable it for perf testing")
+ @SuppressWarnings({"unchecked"})
public void testInfiniteLoop() {
Row.cacheStats.clear();
Map<String, Object> m = (Map<String, Object>) loadFromResource("testInfiniteLoop.json");
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
index ee747e3..d48c65f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
@@ -91,6 +91,7 @@ public class SolrExampleJettyTest extends SolrExampleTests {
SolrDocument doc = rsp.getResults().get(0);
String src = (String) doc.getFieldValue("_src_");
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) fromJSONString(src);
assertEquals("abc1",m.get("id"));
assertEquals("name1",m.get("name"));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServer.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServer.java
index 3214488..d8cfb59 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServer.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServer.java
@@ -45,7 +45,7 @@ public class TestEmbeddedSolrServer extends AbstractEmbeddedSolrServerTestCase {
public void testGetCoreContainer() {
Assert.assertEquals(cores, ((EmbeddedSolrServer)getSolrCore0()).getCoreContainer());
- Assert.assertEquals(cores, ((EmbeddedSolrServer)getSolrCore1()).getCoreContainer());
+ Assert.assertEquals(cores, (getSolrCore1()).getCoreContainer());
}
public void testClose() throws IOException {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
index 22c27eb..4832af9 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
@@ -558,6 +558,7 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
HttpSolrClient solrClient = getHttpSolrClient(jetty.getBaseUrl().toString() + "/collection1",
client, null);
QueryRequest req = new QueryRequest();
+ @SuppressWarnings({"rawtypes"})
NamedList response = solrClient.request(req);
InputStream stream = (InputStream) response.get("stream");
assertNotNull(stream);
@@ -674,7 +675,8 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
}
}
- private void verifyServletState(HttpSolrClient client, SolrRequest request) {
+ private void verifyServletState(HttpSolrClient client,
+ @SuppressWarnings({"rawtypes"})SolrRequest request) {
// check query String
Iterator<String> paramNames = request.getParams().getParameterNamesIterator();
while (paramNames.hasNext()) {
@@ -742,6 +744,7 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
}
@Test
+ @SuppressWarnings({"try"})
public void testInvariantParams() throws IOException {
try(HttpSolrClient createdClient = new HttpSolrClient.Builder()
.withBaseSolrUrl(jetty.getBaseUrl().toString())
@@ -757,6 +760,7 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
assertEquals(2, createdClient.getInvariantParams().getParams("fq").length);
}
+
try(HttpSolrClient createdClient = new HttpSolrClient.Builder()
.withBaseSolrUrl(jetty.getBaseUrl().toString())
.withKerberosDelegationToken("mydt")
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java
index 6206d4d..1c9196c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBadInputTest.java
@@ -61,7 +61,9 @@ public class CloudHttp2SolrClientBadInputTest extends SolrCloudTestCase {
}
}
- private void assertExceptionThrownWithMessageContaining(Class expectedType, List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,
+ List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ @SuppressWarnings({"unchecked"})
Throwable thrown = expectThrows(expectedType, runnable);
if (expectedStrings != null) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java
index 52a4b84..d0266e8 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientRetryTest.java
@@ -60,6 +60,7 @@ public class CloudHttp2SolrClientRetryTest extends SolrCloudTestCase {
QueryResponse response = solrClient.query(collectionName, params, SolrRequest.METHOD.GET);
NamedList<Object> namedList = response.getResponse();
System.out.println(namedList);
+ @SuppressWarnings({"rawtypes"})
NamedList metrics = (NamedList) namedList.get("metrics");
assertEquals(1L, metrics.get(updateRequestCountKey));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
index 84fbefb..bd2c289 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
@@ -239,6 +239,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testRouting() throws Exception {
CollectionAdminRequest.createCollection("routing_collection", "conf", 2, 1).process(cluster.getSolrClient());
cluster.waitForActiveCollection("routing_collection", 2, 2);
@@ -253,6 +254,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
if (getRandomClient().isDirectUpdatesToLeadersOnly()) {
checkSingleServer(response);
}
+ @SuppressWarnings({"rawtypes"})
RouteResponse rr = (RouteResponse) response;
Map<String,LBSolrClient.Req> routes = rr.getRoutes();
Iterator<Map.Entry<String,LBSolrClient.Req>> it = routes.entrySet()
@@ -468,6 +470,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
// Iterate over shards-info and check what cores responded
SimpleOrderedMap<?> shardsInfoMap = (SimpleOrderedMap<?>)shardsInfo;
+ @SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String, ?>> itr = shardsInfoMap.asMap(100).entrySet().iterator();
List<String> shardAddresses = new ArrayList<String>();
while (itr.hasNext()) {
@@ -544,6 +547,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
// Iterate over shards-info and check what cores responded
SimpleOrderedMap<?> shardsInfoMap = (SimpleOrderedMap<?>)shardsInfo;
+ @SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String, ?>> itr = shardsInfoMap.asMap(100).entrySet().iterator();
List<String> shardAddresses = new ArrayList<String>();
while (itr.hasNext()) {
@@ -586,6 +590,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
} else {
name = category + "." + (scope != null ? scope : key) + ".requests";
}
+ @SuppressWarnings({"unchecked"})
Map<String,Object> map = (Map<String,Object>)resp.findRecursive("solr-mbeans", category, key, "stats");
if (map == null) {
return null;
@@ -720,6 +725,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
q.setParam(CloudSolrClient.STATE_VERSION, COLLECTION + ":" + (coll.getZNodeVersion() - 1)); //an older version expect error
QueryResponse rsp = solrClient.query(q);
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) rsp.getResponse().get(CloudSolrClient.STATE_VERSION, rsp.getResponse().size()-1);
assertNotNull("Expected an extra information from server with the list of invalid collection states", m);
assertNotNull(m.get(COLLECTION));
@@ -845,6 +851,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
response = deleteRequest.commit(getRandomClient(), "versions_collection").getResponse();
Object deletesObject = response.get("deletes");
assertNotNull("There must be a deletes parameter", deletesObject);
+ @SuppressWarnings({"rawtypes"})
NamedList deletes = (NamedList) deletesObject;
assertEquals("There must be 1 version", 1, deletes.size());
}
@@ -939,7 +946,9 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
private static void checkSingleServer(NamedList<Object> response) {
+ @SuppressWarnings({"rawtypes"})
final RouteResponse rr = (RouteResponse) response;
+ @SuppressWarnings({"unchecked"})
final Map<String,LBSolrClient.Req> routes = rr.getRoutes();
final Iterator<Map.Entry<String,LBSolrClient.Req>> it =
routes.entrySet().iterator();
@@ -1050,6 +1059,7 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
// Iterate over shards-info and check that replicas of correct type responded
SimpleOrderedMap<?> shardsInfoMap = (SimpleOrderedMap<?>)shardsInfo;
+ @SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String, ?>> itr = shardsInfoMap.asMap(100).entrySet().iterator();
List<String> shardAddresses = new ArrayList<String>();
while (itr.hasNext()) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java
index 61f8ceb..acace0d 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBadInputTest.java
@@ -61,7 +61,9 @@ public class CloudSolrClientBadInputTest extends SolrCloudTestCase {
}
}
- private void assertExceptionThrownWithMessageContaining(Class expectedType, List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,
+ List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ @SuppressWarnings({"unchecked"})
Throwable thrown = expectThrows(expectedType, runnable);
if (expectedStrings != null) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java
index 4051b85..3be5d83 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java
@@ -95,7 +95,7 @@ public class CloudSolrClientBuilderTest extends SolrTestCase {
}
@Test
- // commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
+ @SuppressWarnings({"try"})
public void test0Timeouts() throws IOException {
try(CloudSolrClient createdClient = new Builder(Collections.singletonList(ANY_ZK_HOST), Optional.empty())
.withSocketTimeout(0)
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
index 92c5c62..1757ea1 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
@@ -49,6 +49,7 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
assumeWorkingMockito();
}
+ @SuppressWarnings({"unchecked"})
public void testCaching() throws Exception {
String collName = "gettingstarted";
Set<String> livenodes = new HashSet<>();
@@ -74,7 +75,9 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
return colls.get(c);
}
}
+ @SuppressWarnings({"rawtypes"})
Map<String, Function> responses = new HashMap<>();
+ @SuppressWarnings({"rawtypes"})
NamedList okResponse = new NamedList();
okResponse.add("responseHeader", new NamedList<>(Collections.singletonMap("status", 0)));
@@ -105,11 +108,14 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
}
- private LBHttpSolrClient getMockLbHttpSolrClient(Map<String, Function> responses) throws Exception {
+ @SuppressWarnings({"unchecked"})
+ private LBHttpSolrClient getMockLbHttpSolrClient(
+ @SuppressWarnings({"rawtypes"})Map<String, Function> responses) throws Exception {
LBHttpSolrClient mockLbclient = mock(LBHttpSolrClient.class);
when(mockLbclient.request(any(LBSolrClient.Req.class))).then(invocationOnMock -> {
LBHttpSolrClient.Req req = invocationOnMock.getArgument(0);
+ @SuppressWarnings({"rawtypes"})
Function f = responses.get("request");
if (f == null) return null;
Object res = f.apply(null);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java
index 900ae71..9dc1524 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientRetryTest.java
@@ -57,6 +57,7 @@ public class CloudSolrClientRetryTest extends SolrCloudTestCase {
QueryResponse response = solrClient.query(collectionName, params, SolrRequest.METHOD.GET);
NamedList<Object> namedList = response.getResponse();
System.out.println(namedList);
+ @SuppressWarnings({"rawtypes"})
NamedList metrics = (NamedList) namedList.get("metrics");
assertEquals(1L, metrics.get(updateRequestCountKey));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
index 5328cb5..1212821 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
@@ -456,6 +456,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
// Iterate over shards-info and check what cores responded
SimpleOrderedMap<?> shardsInfoMap = (SimpleOrderedMap<?>)shardsInfo;
+ @SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String, ?>> itr = shardsInfoMap.asMap(100).entrySet().iterator();
List<String> shardAddresses = new ArrayList<String>();
while (itr.hasNext()) {
@@ -530,6 +531,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
// Iterate over shards-info and check what cores responded
SimpleOrderedMap<?> shardsInfoMap = (SimpleOrderedMap<?>)shardsInfo;
+ @SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String, ?>> itr = shardsInfoMap.asMap(100).entrySet().iterator();
List<String> shardAddresses = new ArrayList<String>();
while (itr.hasNext()) {
@@ -572,6 +574,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
} else {
name = category + "." + (scope != null ? scope : key) + ".requests";
}
+ @SuppressWarnings({"unchecked"})
Map<String,Object> map = (Map<String,Object>)resp.findRecursive("solr-mbeans", category, key, "stats");
if (map == null) {
return null;
@@ -706,6 +709,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
q.setParam(CloudSolrClient.STATE_VERSION, COLLECTION + ":" + (coll.getZNodeVersion() - 1)); //an older version expect error
QueryResponse rsp = solrClient.query(q);
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) rsp.getResponse().get(CloudSolrClient.STATE_VERSION, rsp.getResponse().size()-1);
assertNotNull("Expected an extra information from server with the list of invalid collection states", m);
assertNotNull(m.get(COLLECTION));
@@ -825,6 +829,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
response = deleteRequest.commit(getRandomClient(), "versions_collection").getResponse();
Object deletesObject = response.get("deletes");
assertNotNull("There must be a deletes parameter", deletesObject);
+ @SuppressWarnings({"rawtypes"})
NamedList deletes = (NamedList) deletesObject;
assertEquals("There must be 1 version", 1, deletes.size());
}
@@ -1022,6 +1027,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
// Iterate over shards-info and check that replicas of correct type responded
SimpleOrderedMap<?> shardsInfoMap = (SimpleOrderedMap<?>)shardsInfo;
+ @SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String, ?>> itr = shardsInfoMap.asMap(100).entrySet().iterator();
List<String> shardAddresses = new ArrayList<String>();
while (itr.hasNext()) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java
index 7b271ca..6c2728b 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClientBadInputTest.java
@@ -86,7 +86,9 @@ public class ConcurrentUpdateHttp2SolrClientBadInputTest extends SolrJettyTestBa
}
}
- private void assertExceptionThrownWithMessageContaining(Class expectedType, List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,
+ List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ @SuppressWarnings({"unchecked"})
Throwable thrown = expectThrows(expectedType, runnable);
if (expectedStrings != null) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java
index 2bc7eab..9db0e4d 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBadInputTest.java
@@ -79,7 +79,9 @@ public class ConcurrentUpdateSolrClientBadInputTest extends SolrJettyTestBase {
}
}
- private void assertExceptionThrownWithMessageContaining(Class expectedType, List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,
+ List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ @SuppressWarnings({"unchecked"})
Throwable thrown = expectThrows(expectedType, runnable);
if (expectedStrings != null) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBuilderTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBuilderTest.java
index 282b88d..0080198 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBuilderTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientBuilderTest.java
@@ -38,7 +38,7 @@ public class ConcurrentUpdateSolrClientBuilderTest extends SolrTestCase {
}
@Test
- // commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
+ @SuppressWarnings({"try"})
public void testMissingQueueSize() {
try (ConcurrentUpdateSolrClient client = new Builder("someurl").build()){
// Do nothing as we just need to test that the only mandatory parameter for building the client
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java
index 53df0ca..8b6b339 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java
@@ -524,7 +524,8 @@ public class Http2SolrClientTest extends SolrJettyTestBase {
}
}
- private void verifyServletState(Http2SolrClient client, SolrRequest request) {
+ private void verifyServletState(Http2SolrClient client,
+ @SuppressWarnings({"rawtypes"})SolrRequest request) {
// check query String
Iterator<String> paramNames = request.getParams().getParameterNamesIterator();
while (paramNames.hasNext()) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
index 29535c0..4b1eccc 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
@@ -45,7 +45,9 @@ public class HttpSolrClientBadInputTest extends SolrJettyTestBase {
createAndStartJetty(legacyExampleCollection1SolrHome(), jettyConfig);
}
- private void assertExceptionThrownWithMessageContaining(Class expectedType, List<String> expectedStrings, ThrowingRunnable runnable) {
+ private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,
+ List<String> expectedStrings, ThrowingRunnable runnable) {
+ @SuppressWarnings({"unchecked"})
Throwable thrown = expectThrows(expectedType, runnable);
if (expectedStrings != null) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
index 9875b16..6ce46f0 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
@@ -77,7 +77,9 @@ public class LBHttpSolrClientBadInputTest extends SolrJettyTestBase {
}
}
- private void assertExceptionThrownWithMessageContaining(Class expectedType, List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ private void assertExceptionThrownWithMessageContaining(@SuppressWarnings({"rawtypes"})Class expectedType,
+ List<String> expectedStrings, LuceneTestCase.ThrowingRunnable runnable) {
+ @SuppressWarnings({"unchecked"})
Throwable thrown = expectThrows(expectedType, runnable);
if (expectedStrings != null) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java
index 2c6cbc1..160b108 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java
@@ -89,7 +89,7 @@ public class TestLang extends SolrTestCase {
@Test
public void testLang() {
- List<String> functions = new ArrayList();
+ List<String> functions = new ArrayList<>();
for(String f : allFunctions) {
functions.add(f);
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java
index 8bb508c..f5f757d 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java
@@ -100,6 +100,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
@Test
// commented 4-Sep-2018 @LuceneTestCase.BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 2-Aug-2018
+ @SuppressWarnings({"unchecked"})
public void testShortestPathStream() throws Exception {
new UpdateRequest()
@@ -131,6 +132,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
.withCollectionZkHost("collection1", cluster.getZkServer().getZkAddress())
.withFunctionName("shortestPath", ShortestPathStream.class);
+ @SuppressWarnings({"rawtypes"})
Map params = new HashMap();
params.put("fq", "predicate_s:knows");
@@ -144,7 +146,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
"maxDepth=\"6\")");
stream.setStreamContext(context);
- paths = new HashSet();
+ paths = new HashSet<>();
tuples = getTuples(stream);
assertTrue(tuples.size() == 2);
@@ -170,7 +172,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
"maxDepth=\"6\")");
stream.setStreamContext(context);
- paths = new HashSet();
+ paths = new HashSet<>();
tuples = getTuples(stream);
assertTrue(tuples.size() == 2);
@@ -195,7 +197,6 @@ public class GraphExpressionTest extends SolrCloudTestCase {
"maxDepth=\"6\")");
stream.setStreamContext(context);
- paths = new HashSet();
tuples = getTuples(stream);
assertTrue(tuples.size() == 0);
@@ -231,7 +232,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
stream.setStreamContext(context);
- paths = new HashSet();
+ paths = new HashSet<>();
tuples = getTuples(stream);
assertTrue(tuples.size() == 1);
@@ -931,7 +932,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
protected List<Tuple> getTuples(TupleStream tupleStream) throws IOException {
tupleStream.open();
- List<Tuple> tuples = new ArrayList();
+ List<Tuple> tuples = new ArrayList<>();
for(Tuple t = tupleStream.read(); !t.EOF; t = tupleStream.read()) {
tuples.add(t);
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java
index 1edc0e9..038bd0e 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java
@@ -114,7 +114,7 @@ public class GraphTest extends SolrCloudTestCase {
stream.setStreamContext(context);
- paths = new HashSet();
+ paths = new HashSet<>();
tuples = getTuples(stream);
assertTrue(tuples.size() == 2);
@@ -142,7 +142,7 @@ public class GraphTest extends SolrCloudTestCase {
6);
stream.setStreamContext(context);
- paths = new HashSet();
+ paths = new HashSet<>();
tuples = getTuples(stream);
assertTrue(tuples.size() == 2);
@@ -170,7 +170,6 @@ public class GraphTest extends SolrCloudTestCase {
6);
stream.setStreamContext(context);
- paths = new HashSet();
tuples = getTuples(stream);
assertTrue(tuples.size() == 0);
@@ -191,7 +190,6 @@ public class GraphTest extends SolrCloudTestCase {
2);
stream.setStreamContext(context);
- paths = new HashSet();
tuples = getTuples(stream);
assertTrue(tuples.size() == 0);
@@ -213,7 +211,7 @@ public class GraphTest extends SolrCloudTestCase {
6);
stream.setStreamContext(context);
- paths = new HashSet();
+ paths = new HashSet<>();
tuples = getTuples(stream);
assertTrue(tuples.size() == 1);
@@ -228,7 +226,7 @@ public class GraphTest extends SolrCloudTestCase {
protected List<Tuple> getTuples(TupleStream tupleStream) throws IOException {
tupleStream.open();
- List<Tuple> tuples = new ArrayList();
+ List<Tuple> tuples = new ArrayList<>();
for(;;) {
Tuple t = tupleStream.read();
if(t.EOF) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java
index 9ae7aa9..066b47e 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java
@@ -417,6 +417,7 @@ public class JdbcTest extends SolrCloudTestCase {
@Ignore("Fix error checking")
@Test
+ @SuppressWarnings({"try"})
public void testErrorPropagation() throws Exception {
//Test error propagation
Properties props = new Properties();
@@ -434,6 +435,7 @@ public class JdbcTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"try"})
public void testSQLExceptionThrownWhenQueryAndConnUseDiffCollections() throws Exception {
String badCollection = COLLECTIONORALIAS + "bad";
String connectionString = "jdbc:solr://" + zkHost + "?collection=" + badCollection;
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java
index a139a34..e8aef51 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java
@@ -75,6 +75,7 @@ public class CloudAuthStreamTest extends SolrCloudTestCase {
*
* @see SolrRequest#setBasicAuthCredentials
*/
+ @SuppressWarnings({"rawtypes"})
private static <T extends SolrRequest> T setBasicAuthCredentials(T req, String user) {
assert null != user;
req.setBasicAuthCredentials(user, user);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
index 82f7443..edef269 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java
@@ -137,6 +137,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"rawtypes"})
List terms = (List)tuples.get(0).get("return-value");
assertTrue(terms.get(0).equals("hello"));
assertTrue(terms.get(1).equals("world"));
@@ -201,6 +202,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
List l = (List)tuples.get(0).get("test1_t");
assertTrue(l.get(0).equals("l"));
assertTrue(l.get(1).equals("b"));
@@ -288,6 +290,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<String> l1 = (List<String>)tuples.get(0).get("field2");
assertEquals(l1.get(0), "aaa");
assertEquals(l1.get(1), "bbb");
@@ -307,13 +310,16 @@ public class MathExpressionTest extends SolrCloudTestCase {
StreamContext context = new StreamContext();
solrStream.setStreamContext(context);
+ @SuppressWarnings({"unchecked"})
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<String> l1 = (List<String>)tuples.get(0).get("field3");
assertEquals(l1.get(0), "A");
assertEquals(l1.get(1), "B");
assertEquals(l1.get(2), "C");
+ @SuppressWarnings({"unchecked"})
List<String> l2 = (List<String>)tuples.get(0).get("field4");
assertEquals(l2.get(0), "x");
assertEquals(l2.get(1), "y");
@@ -335,6 +341,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<String> l1 = (List<String>)tuples.get(0).get("field2");
assertEquals(l1.get(0), "a");
assertEquals(l1.get(1), "b");
@@ -439,6 +446,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
Map<String, List<Number>> mem = (Map)tuples.get(0).get("return-value");
List<Number> array = mem.get("a");
assertEquals(array.get(0).intValue(), 100);
@@ -477,6 +485,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>>locVectors = (List<List<Number>>)tuples.get(0).get("b");
int v=1;
for(List<Number> row : locVectors) {
@@ -556,6 +565,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> points = (List<List<Number>>)tuples.get(0).get("e");
assertTrue(points.size() == 6);
List<Number> point1 = points.get(0);
@@ -598,11 +608,13 @@ public class MathExpressionTest extends SolrCloudTestCase {
double boundarySize = tuples.get(0).getDouble("g");
assertEquals(boundarySize, 122.73784789223708, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> baryCenter = (List<Number>)tuples.get(0).get("h");
assertEquals(baryCenter.size(), 2);
assertEquals(baryCenter.get(0).doubleValue(), 101.3021125450865, 0.0);
assertEquals(baryCenter.get(1).doubleValue(), 100.07343616615786, 0.0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> borderPoints = (List<List<Number>>)tuples.get(0).get("i");
assertEquals(borderPoints.get(0).get(0).doubleValue(), 100.31316833934775, 0);
assertEquals(borderPoints.get(0).get(1).doubleValue(), 115.6639686234851, 0);
@@ -632,6 +644,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> center = (List<Number>)tuples.get(0).get("e");
assertEquals(center.get(0).doubleValue(), 97.40659699625388, 0.0);
assertEquals(center.get(1).doubleValue(), 101.57826559647323, 0.0);
@@ -639,6 +652,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
double radius =tuples.get(0).getDouble("f");
assertEquals(radius, 22.814029299535, 0.0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> supportPoints = (List<List<Number>>)tuples.get(0).get("g");
List<Number> support1 = supportPoints.get(0);
assertEquals(support1.get(0).doubleValue(), 95.71563821370013, 0.0);
@@ -833,6 +847,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
Number f = (Number)tuples.get(0).get("f");
assertEquals(f.doubleValue(), 2.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> h = (List<List<Number>>)tuples.get(0).get("h");
assertEquals(h.size(), 3);
assertEquals(h.get(0).size(), 3);
@@ -858,6 +873,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
Number k = (Number)tuples.get(0).get("k");
assertEquals(k.doubleValue(), 4.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> m = (List<List<Number>>)tuples.get(0).get("m");
assertEquals(m.size(), 3);
assertEquals(m.get(0).size(), 3);
@@ -883,6 +899,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
Number p = (Number)tuples.get(0).get("p");
assertEquals(p.doubleValue(), 0.544877, 0.0001);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> r = (List<List<Number>>)tuples.get(0).get("r");
assertEquals(r.size(), 3);
assertEquals(r.get(0).size(), 3);
@@ -909,6 +926,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
Number u = (Number)tuples.get(0).get("u");
assertEquals(u.doubleValue(), 10.0, 0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> x = (List<List<Number>>)tuples.get(0).get("x");
assertEquals(x.size(), 3);
assertEquals(x.get(0).size(), 3);
@@ -970,6 +988,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> reverse = (List<Number>)tuples.get(0).get("reverse");
assertTrue(reverse.size() == 4);
assertTrue(reverse.get(0).doubleValue() == 400D);
@@ -1020,6 +1039,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> copy1 = (List<Number>)tuples.get(0).get("copy1");
assertTrue(copy1.size() == 4);
assertTrue(copy1.get(0).doubleValue() == 100D);
@@ -1027,6 +1047,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertTrue(copy1.get(2).doubleValue() == 300D);
assertTrue(copy1.get(3).doubleValue() == 400D);
+ @SuppressWarnings({"unchecked"})
List<Number> copy2 = (List<Number>)tuples.get(0).get("copy2");
assertTrue(copy2.size() == 4);
assertTrue(copy2.get(0).doubleValue() == 100D);
@@ -1034,6 +1055,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertTrue(copy2.get(2).doubleValue() == 300D);
assertTrue(copy2.get(3).doubleValue() == 400D);
+ @SuppressWarnings({"unchecked"})
List<Number> copy3 = (List<Number>)tuples.get(0).get("copy3");
assertTrue(copy3.size() == 2);
assertTrue(copy3.get(0).doubleValue() == 100D);
@@ -1082,11 +1104,13 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> copy1 = (List<Number>)tuples.get(0).get("copy");
assertTrue(copy1.size() == 2);
assertTrue(copy1.get(0).doubleValue() == 500D);
assertTrue(copy1.get(1).doubleValue() == 300D);
+ @SuppressWarnings({"unchecked"})
List<Number> copy2 = (List<Number>)tuples.get(0).get("copy2");
assertTrue(copy2.size() == 2);
assertTrue(copy2.get(0).doubleValue() == 300D);
@@ -1159,6 +1183,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
tuple = tuples.get(0);
+ @SuppressWarnings({"unchecked"})
List<Number> percentiles = (List<Number>)tuple.get("return-value");
assertEquals(percentiles.get(0).doubleValue(), 2.4, 0.001);
assertEquals(percentiles.get(1).doubleValue(), 6.0, 0.001);
@@ -1179,6 +1204,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
Tuple tuple = tuples.get(0);
+ @SuppressWarnings({"unchecked"})
List<Number> asort = (List<Number>)tuple.get("return-value");
assertEquals(asort.size(), 10);
assertEquals(asort.get(0).intValue(), 2);
@@ -1225,6 +1251,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
Tuple tuple = tuples.get(0);
+ @SuppressWarnings({"unchecked"})
List<Number> asort = (List<Number>)tuple.get("return-value");
assertEquals(asort.size(), 6);
assertEquals(asort.get(0).doubleValue(), 0, 0.0);
@@ -1277,6 +1304,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> reverse = (List<Number>)tuples.get(0).get("reverse");
assertTrue(reverse.size() == 4);
assertTrue(reverse.get(0).doubleValue() == 400D);
@@ -1284,6 +1312,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertTrue(reverse.get(2).doubleValue() == 500D);
assertTrue(reverse.get(3).doubleValue() == 100D);
+ @SuppressWarnings({"unchecked"})
List<Number> ranked = (List<Number>)tuples.get(0).get("ranked");
assertTrue(ranked.size() == 4);
assertTrue(ranked.get(0).doubleValue() == 1D);
@@ -1293,6 +1322,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testArray() throws Exception {
String cexpr = "array(1, 2, 3, 300, 2, 500)";
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
@@ -1345,6 +1375,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> out = (List<List<Number>>)tuples.get(0).get("c");
assertEquals(out.size(), 2);
List<Number> row1 = out.get(0);
@@ -1375,6 +1406,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertEquals(out.size(), 6);
assertEquals(out.get(0).intValue(), 1);
@@ -1397,6 +1429,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertEquals(out.size(), 6);
assertEquals(out.get(0).intValue(), 0);
@@ -1420,6 +1453,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertEquals(out.size(), 6);
assertEquals(out.get(0).doubleValue(), 6.5, 0);
@@ -1443,6 +1477,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertEquals(out.size(), 4);
assertEquals(out.get(0).intValue(), 3);
@@ -1463,6 +1498,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertEquals(out.size(), 4);
assertEquals(out.get(0).intValue(), 1);
@@ -1484,6 +1520,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertEquals(out.size(), 6);
assertEquals(out.get(0).intValue(), 0);
@@ -1517,6 +1554,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> out = (List<List<Number>>)tuples.get(0).get("a");
List<Number> array1 = out.get(0);
@@ -1531,6 +1569,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(array2.get(1).doubleValue(), 5.0, 0.0);
assertEquals(array2.get(2).doubleValue(), 4.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> row = (List<Number>)tuples.get(0).get("b");
assertEquals(row.size(), 3);
@@ -1538,17 +1577,20 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(array2.get(1).doubleValue(), 5.0, 0.0);
assertEquals(array2.get(2).doubleValue(), 4.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> col = (List<Number>)tuples.get(0).get("c");
assertEquals(col.size(), 2);
assertEquals(col.get(0).doubleValue(), 3.0, 0.0);
assertEquals(col.get(1).doubleValue(), 4.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<String> colLabels = (List<String>)tuples.get(0).get("d");
assertEquals(colLabels.size(), 3);
assertEquals(colLabels.get(0), "col1");
assertEquals(colLabels.get(1), "col2");
assertEquals(colLabels.get(2), "col3");
+ @SuppressWarnings({"unchecked"})
List<List<String>> features = (List<List<String>>)tuples.get(0).get("e");
assertEquals(features.size(), 2);
assertEquals(features.get(0).size(), 1);
@@ -1564,6 +1606,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
@Test
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testZplot() throws Exception {
String url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString()+"/"+COLLECTIONORALIAS;
@@ -1863,6 +1906,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
@Test
+ @SuppressWarnings({"unchecked"})
public void testMatrixMath() throws Exception {
String cexpr = "let(echo=true, a=matrix(array(1.5, 2.5, 3.5), array(4.5,5.5,6.5)), " +
"b=grandSum(a), " +
@@ -1986,6 +2030,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> out = (List<List<Number>>)tuples.get(0).get("b");
assertEquals(out.size(), 3);
List<Number> array1 = out.get(0);
@@ -2016,6 +2061,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> out = (List<List<Number>>)tuples.get(0).get("a");
assertEquals(out.size(), 2);
List<Number> array1 = out.get(0);
@@ -2030,6 +2076,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(array2.get(1).doubleValue(), 0.5698028822981898, 0.0);
assertEquals(array2.get(2).doubleValue(), 0.6837634587578276, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> array3 = (List<Number>)tuples.get(0).get("b");
assertEquals(array3.size(), 3);
assertEquals(array3.get(0).doubleValue(), 0.4558423058385518, 0.0);
@@ -2052,6 +2099,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> out = (List<List<Number>>)tuples.get(0).get("a");
assertEquals(out.size(), 2);
List<Number> array1 = out.get(0);
@@ -2066,12 +2114,14 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(array2.get(1).doubleValue(), 0.3333333333333333, 0.0001);
assertEquals(array2.get(2).doubleValue(), 0.4, 0.0001);
+ @SuppressWarnings({"unchecked"})
List<Number> array3 = (List<Number>)tuples.get(0).get("b");
assertEquals(array3.size(), 3);
assertEquals(array3.get(0).doubleValue(), 0.16666666666666666, 0.0001);
assertEquals(array3.get(1).doubleValue(), 0.3333333333333333, 0.0001);
assertEquals(array3.get(2).doubleValue(), 0.5, 0.0001);
+ @SuppressWarnings({"unchecked"})
List<Number> array4 = (List<Number>)tuples.get(0).get("c");
assertEquals(array4.size(), 3);
assertEquals(array4.get(0).doubleValue(), 16.666666666666666, 0.0001);
@@ -2091,6 +2141,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> out = (List<List<Number>>)tuples.get(0).get("a");
assertEquals(out.size(), 2);
List<Number> array1 = out.get(0);
@@ -2105,12 +2156,14 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(array2.get(1).doubleValue(), 0, 0.0);
assertEquals(array2.get(2).doubleValue(), 1, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> array3 = (List<Number>)tuples.get(0).get("b");
assertEquals(array3.size(), 3);
assertEquals(array3.get(0).doubleValue(), -1, 0.0);
assertEquals(array3.get(1).doubleValue(), 0, 0.0);
assertEquals(array3.get(2).doubleValue(), 1, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> array4 = (List<Number>)tuples.get(0).get("c");
assertEquals(array4.size(), 3);
assertEquals(array4.get(0).doubleValue(), -1, 0.0);
@@ -2156,6 +2209,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 9);
assertTrue(out.get(0).intValue() == 1);
@@ -2226,10 +2280,14 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>) tuples.get(0).get("sample");
+ @SuppressWarnings({"rawtypes"})
Map ks = (Map) tuples.get(0).get("ks");
+ @SuppressWarnings({"rawtypes"})
Map ks2 = (Map) tuples.get(0).get("ks2");
+ @SuppressWarnings({"rawtypes"})
Map ks3 = (Map) tuples.get(0).get("ks3");
assertTrue(out.size() == 250);
@@ -2436,6 +2494,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
Tuple tuple = tuples.get(0);
+ @SuppressWarnings({"unchecked"})
List<Number> logs = (List<Number>)tuple.get("b");
assertEquals(logs.size(), 3);
assertEquals(logs.get(0).doubleValue(), 1, 0.0);
@@ -2460,6 +2519,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
Tuple tuple = tuples.get(0);
+ @SuppressWarnings({"unchecked"})
List<Number> logs = (List<Number>)tuple.get("b");
assertEquals(logs.size(), 3);
assertEquals(logs.get(0).doubleValue(), .1, 0.0);
@@ -2472,6 +2532,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
@Test
+ @SuppressWarnings({"unchecked"})
public void testPow() throws Exception {
String cexpr = "let(echo=true, a=array(10, 20, 30), b=pow(a, 2), c=pow(2, a), d=pow(10, 3), e=pow(a, array(1, 2, 3)))";
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
@@ -2508,6 +2569,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testTermVectors() throws Exception {
// Test termVectors with only documents and default termVector settings
String cexpr = "let(echo=true," +
@@ -2829,6 +2891,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> matrix = (List<List<Number>>)tuples.get(0).get("b");
List<Number> row1 = matrix.get(0);
assertEquals(row1.get(0).doubleValue(), 2.0,0);
@@ -2843,10 +2906,12 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(row3.get(1).doubleValue(), 0,0);
assertEquals(row3.get(2).doubleValue(), 8.0,0);
+ @SuppressWarnings({"unchecked"})
List<String> rowLabels = (List<String>)tuples.get(0).get("c");
assertEquals(rowLabels.get(0), "x1");
assertEquals(rowLabels.get(1), "x2");
assertEquals(rowLabels.get(2), "x3");
+ @SuppressWarnings({"unchecked"})
List<String> columnLabels = (List<String>)tuples.get(0).get("d");
assertEquals(columnLabels.get(0), "f1");
assertEquals(columnLabels.get(1), "f2");
@@ -2873,6 +2938,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("c");
assertEquals(out.size(), 6);
assertEquals(out.get(0).doubleValue(), 1.0, 0.0);
@@ -2882,6 +2948,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(out.get(4).doubleValue(), 5.0, 0.0);
assertEquals(out.get(5).doubleValue(), 6.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> mout = (List<List<Number>>)tuples.get(0).get("h");
assertEquals(mout.size(), 2);
List<Number> row1 = mout.get(0);
@@ -2904,6 +2971,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testMatrixMult() throws Exception {
String cexpr = "let(echo=true," +
" a=array(1,2,3)," +
@@ -3006,10 +3074,15 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cluster1 = (List<List<Number>>)tuples.get(0).get("g");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cluster2 = (List<List<Number>>)tuples.get(0).get("h");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> centroids = (List<List<Number>>)tuples.get(0).get("i");
+ @SuppressWarnings({"unchecked"})
List<String> labels1 = (List<String>)tuples.get(0).get("j");
+ @SuppressWarnings({"unchecked"})
List<String> labels2 = (List<String>)tuples.get(0).get("k");
assertEquals(cluster1.size(), 2);
@@ -3169,10 +3242,15 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cluster1 = (List<List<Number>>)tuples.get(0).get("g");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cluster2 = (List<List<Number>>)tuples.get(0).get("h");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> centroids = (List<List<Number>>)tuples.get(0).get("i");
+ @SuppressWarnings({"unchecked"})
List<String> labels1 = (List<String>)tuples.get(0).get("j");
+ @SuppressWarnings({"unchecked"})
List<String> labels2 = (List<String>)tuples.get(0).get("k");
assertEquals(cluster1.size(), 2);
@@ -3249,12 +3327,18 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cluster1 = (List<List<Number>>)tuples.get(0).get("g");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cluster2 = (List<List<Number>>)tuples.get(0).get("h");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> centroids = (List<List<Number>>)tuples.get(0).get("i");
+ @SuppressWarnings({"unchecked"})
List<List<Number>> membership = (List<List<Number>>)tuples.get(0).get("l");
+ @SuppressWarnings({"unchecked"})
List<String> labels1 = (List<String>)tuples.get(0).get("j");
+ @SuppressWarnings({"unchecked"})
List<String> labels2 = (List<String>)tuples.get(0).get("k");
assertEquals(cluster1.size(), 2);
@@ -3340,6 +3424,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 6);
assertTrue(out.get(0).intValue() == 2);
@@ -3371,14 +3456,15 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> wave = (List<Number>)tuples.get(0).get("a");
assertEquals(wave.size(), 128);
- Map desc = (Map)tuples.get(0).get("b");
Number min = (Number)tuples.get(0).get("c");
Number max = (Number)tuples.get(0).get("d");
assertEquals(min.doubleValue(), -9.9, .1);
assertEquals(max.doubleValue(), 9.9, .1);
+ @SuppressWarnings({"unchecked"})
List<Number> wave1 = (List<Number>)tuples.get(0).get("e");
assertEquals(wave1.size(), 128);
@@ -3390,6 +3476,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(freq.doubleValue(), .3, .1);
assertEquals(pha.doubleValue(), 2.9, .1);
+ @SuppressWarnings({"unchecked"})
List<Number> der = (List<Number>)tuples.get(0).get("i");
assertEquals(der.size(), 128);
assertEquals(der.get(0).doubleValue(), -0.7177479876419472, 0);
@@ -3416,6 +3503,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("c");
assertEquals(out.size(), 6);
assertEquals(out.get(0).doubleValue(), 3.0, 0.0);
@@ -3425,6 +3513,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(out.get(4).doubleValue(), 15.0, 0.0);
assertEquals(out.get(5).doubleValue(), 18.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> mout = (List<List<Number>>)tuples.get(0).get("h");
assertEquals(mout.size(), 2);
List<Number> row1 = mout.get(0);
@@ -3470,6 +3559,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(mean.doubleValue(), 3.3800151591412964, 0.0);
Number mean1 = (Number)tuples.get(0).get("d");
assertEquals(mean1.doubleValue(), 4.3800151591412964, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> vals = (List<Number>)tuples.get(0).get("f");
assertEquals(vals.size(), 3);
assertEquals(vals.get(0).doubleValue(), 8.11, 0);
@@ -3490,6 +3580,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 6);
assertTrue(out.get(0).intValue() == 2);
@@ -3552,6 +3643,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> fft = (List<List<Number>>)tuples.get(0).get("a");
assertEquals(fft.size(), 2);
List<Number> reals = fft.get(0);
@@ -3577,6 +3669,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(imaginary.get(i).doubleValue(), 0.0, 0.0);
}
+ @SuppressWarnings({"unchecked"})
List<Number> ifft = (List<Number>)tuples.get(0).get("b");
assertEquals(ifft.get(0).doubleValue(), 1, 0.0);
assertEquals(ifft.get(1).doubleValue(), 4, 0.0);
@@ -3647,6 +3740,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map map = (Map)tuples.get(0).get("d");
Number mean = (Number)map.get("mean");
Number var = (Number)map.get("var");
@@ -3681,17 +3775,23 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> listg = (List<Map>)tuples.get(0).get("g");
+ @SuppressWarnings({"rawtypes"})
Map mapg = listg.get(0);
double pctg = (double) mapg.get("pct");
assertEquals(pctg, .2, .02);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> listh = (List<Map>)tuples.get(0).get("h");
+ @SuppressWarnings({"rawtypes"})
Map maph = listh.get(0);
double pcth = (double)maph.get("pct");
assertEquals(pcth, .5, .02);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> listi = (List<Map>)tuples.get(0).get("i");
+ @SuppressWarnings({"rawtypes"})
Map mapi = listi.get(0);
double pcti = (double)mapi.get("pct");
assertEquals(pcti, .8, .02);
@@ -3737,6 +3837,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map map = (Map)tuples.get(0).get("d");
Number N = (Number)map.get("N");
assertEquals(N.intValue(), 10000);
@@ -3758,6 +3859,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> counts = (List<Number>)tuples.get(0).get("c");
assertTrue(counts.size() == 10);
@@ -3799,6 +3901,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
@Test
+ @SuppressWarnings({"unchecked"})
public void testBetaDistribution() throws Exception {
String cexpr = "let(a=sample(betaDistribution(1, 5), 50000), b=hist(a, 11), c=col(b, N))";
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
@@ -3862,6 +3965,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map map = (Map)tuples.get(0).get("d");
Number N = (Number)map.get("N");
assertEquals(N.intValue(), 10000);
@@ -3884,6 +3988,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> freqs = (List<Number>)tuples.get(0).get("y");
assertEquals(freqs.get(0).doubleValue(), .40, .03);
assertEquals(freqs.get(1).doubleValue(), .30, .03);
@@ -3929,7 +4034,8 @@ public class MathExpressionTest extends SolrCloudTestCase {
// the same node where the replica that executes
// the stream is located
@Test
- public void testCache() throws Exception {
+ @SuppressWarnings({"unchecked"})
+public void testCache() throws Exception {
String cexpr = "putCache(\"space1\", \"key1\", dotProduct(array(2,4,6,8,10,12),array(1,2,3,4,5,6)))";
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
paramsLoc.set("expr", cexpr);
@@ -4037,6 +4143,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 21);
assertEquals((double) out.get(0), 22.22, 0.009);
@@ -4079,7 +4186,9 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> matrix = (List<List<Number>>)tuples.get(0).get("c");
+ @SuppressWarnings({"unchecked"})
List<String> columnsLabels = (List<String>)tuples.get(0).get("d");
assertEquals(columnsLabels.size(), 3);
assertEquals(columnsLabels.get(0), "c");
@@ -4110,6 +4219,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 19);
assertEquals(out.get(0).doubleValue(),-88.0, 0.01);
@@ -4145,6 +4255,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 8);
assertEquals(out.get(0).doubleValue(), -94.0, 0.01);
@@ -4169,6 +4280,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 7);
assertEquals(out.get(0).doubleValue(), 30.0, 0.01);
@@ -4181,6 +4293,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testPolyfit() throws Exception {
String cexpr = "let(echo=true," +
" a=array(0,1,2,3,4,5,6,7)," +
@@ -4237,18 +4350,21 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map testResult = (Map)tuples.get(0).get("ttest");
Number tstat = (Number)testResult.get("t-statistic");
Number pval = (Number)testResult.get("p-value");
assertEquals(tstat.doubleValue(), 2.3666107120397575, .0001);
assertEquals(pval.doubleValue(), 0.029680704317867967, .0001);
+ @SuppressWarnings({"rawtypes"})
Map testResult2 = (Map)tuples.get(0).get("onesamplettest");
Number tstat2 = (Number)testResult2.get("t-statistic");
Number pval2 = (Number)testResult2.get("p-value");
assertEquals(tstat2.doubleValue(), 0, .0001);
assertEquals(pval2.doubleValue(), 1, .0001);
+ @SuppressWarnings({"rawtypes"})
Map testResult3 = (Map)tuples.get(0).get("pairedttest");
Number tstat3 = (Number)testResult3.get("t-statistic");
Number pval3 = (Number)testResult3.get("p-value");
@@ -4272,6 +4388,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map testResult = (Map)tuples.get(0).get("chisquare");
Number tstat = (Number)testResult.get("chisquare-statistic");
Number pval = (Number)testResult.get("p-value");
@@ -4295,6 +4412,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map testResult = (Map)tuples.get(0).get("gtest");
Number gstat = (Number)testResult.get("G-statistic");
Number pval = (Number)testResult.get("p-value");
@@ -4327,6 +4445,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cov = (List<List<Number>>)tuples.get(0).get("h");
assertEquals(cov.size(), 2);
List<Number> row1 = cov.get(0);
@@ -4344,6 +4463,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(c, 56.66666666666667, 7);
assertEquals(d, 723.8095238095239, 50);
+ @SuppressWarnings({"unchecked"})
List<Number> sample = (List<Number>)tuples.get(0).get("i");
assertEquals(sample.size(), 2);
Number sample1 = sample.get(0);
@@ -4356,6 +4476,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testKnn() throws Exception {
String cexpr = "let(echo=true," +
" a=setRowLabels(matrix(array(1,1,1,0,0,0),"+
@@ -4399,6 +4520,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(row2.get(4).doubleValue(), 1.0, 0.0);
assertEquals(row2.get(5).doubleValue(), 1.0, 0.0);
+ @SuppressWarnings({"rawtypes"})
Map atts = (Map)tuples.get(0).get("e");
List<Number> dists = (List<Number>)atts.get("distances");
assertEquals(dists.size(), 2);
@@ -4441,6 +4563,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(integral.doubleValue(), 20, 0.0);
integral = (Number)tuples.get(0).get("e");
assertEquals(integral.doubleValue(), 29, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> integrals = (List<Number>)tuples.get(0).get("f");
assertEquals(integrals.size(), 50);
assertEquals(integrals.get(49).intValue(), 49);
@@ -4462,6 +4585,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("fit");
assertTrue(out.size() == 8);
assertEquals(out.get(0).doubleValue(), 0.0, 0.0);
@@ -4473,6 +4597,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(out.get(6).doubleValue(), 6.0, 0.0);
assertEquals(out.get(7).doubleValue(), 7.0, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> out1 = (List<Number>)tuples.get(0).get("der");
assertTrue(out1.size() == 8);
assertEquals(out1.get(0).doubleValue(), 1.0, 0.0);
@@ -4503,6 +4628,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("fit");
assertTrue(out.size() == 8);
assertEquals(out.get(0).doubleValue(), 1.0, 0.0001);
@@ -4514,6 +4640,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(out.get(6).doubleValue(), 1.0, 0.0001);
assertEquals(out.get(7).doubleValue(), 9.0, 0.0001);
+ @SuppressWarnings({"unchecked"})
List<Number> out1 = (List<Number>)tuples.get(0).get("der");
assertTrue(out1.size() == 8);
@@ -4559,6 +4686,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(p2.doubleValue(), 536.8916383774491, 0.0);
Number p3 = (Number)tuples.get(0).get("p3");
assertEquals(p3.doubleValue(), 659.921875, 0.0);
+ @SuppressWarnings({"unchecked"})
List<Number> p4 = (List<Number>)tuples.get(0).get("p4");
assertEquals(p4.get(0).doubleValue(), 449.7837701612903, 0.0);
assertEquals(p4.get(1).doubleValue(), 536.8916383774491, 0.0);
@@ -4582,6 +4710,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("fit");
assertTrue(out.size() == 8);
assertEquals(out.get(0).doubleValue(), 1.0, 0.0001);
@@ -4593,6 +4722,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(out.get(6).doubleValue(), 1.0, 0.0001);
assertEquals(out.get(7).doubleValue(), 9.0, 0.0001);
+ @SuppressWarnings({"unchecked"})
List<Number> out1 = (List<Number>)tuples.get(0).get("der");
assertTrue(out1.size() == 8);
assertEquals(out1.get(0).doubleValue(), 93.5, 0.0001);
@@ -4624,8 +4754,10 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> out = (List<Map>)tuples.get(0).get("e");
assertEquals(out.size(), 2);
+ @SuppressWarnings({"rawtypes"})
Map high = out.get(0);
assertEquals(((String)high.get("id")), "1");
@@ -4633,20 +4765,24 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(((Number)high.get("highOutlierValue_d")).doubleValue(), 110.0, 0.0);
+ @SuppressWarnings({"rawtypes"})
Map low = out.get(1);
assertEquals(((String)low.get("id")), "2");
assertEquals(((Number)low.get("cumulativeProbablity_d")).doubleValue(), 0.022750131948179167, 0.0 );
assertEquals(((Number)low.get("lowOutlierValue_d")).doubleValue(), 90, 0.0);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> out1 = (List<Map>)tuples.get(0).get("f");
assertEquals(out1.size(), 2);
+ @SuppressWarnings({"rawtypes"})
Map high1 = out1.get(0);
assert(high1.get("id") == null);
assertEquals(((Number)high1.get("cumulativeProbablity_d")).doubleValue(), 0.9772498680518208, 0.0 );
assertEquals(((Number)high1.get("highOutlierValue_d")).doubleValue(), 110.0, 0.0);
+ @SuppressWarnings({"rawtypes"})
Map low1 = out1.get(1);
assert(low1.get("id") == null);
assertEquals(((Number)low1.get("cumulativeProbablity_d")).doubleValue(), 0.022750131948179167, 0.0 );
@@ -4672,6 +4808,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("fit");
assertTrue(out.size() == 8);
assertEquals(out.get(0).doubleValue(), 1.0, 0.0001);
@@ -4683,6 +4820,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(out.get(6).doubleValue(), 1.0, 0.0001);
assertEquals(out.get(7).doubleValue(), 9.0, 0.0001);
+ @SuppressWarnings({"unchecked"})
List<Number> out1 = (List<Number>)tuples.get(0).get("der");
assertTrue(out1.size() == 8);
assertEquals(out1.get(0).doubleValue(), 69.0, 0.0001);
@@ -4708,6 +4846,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("s");
assertTrue(out.size() == 100);
for(Number n : out) {
@@ -4750,12 +4889,14 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map regression = (Map)tuples.get(0).get("f");
Number rsquared = (Number)regression.get("RSquared");
assertEquals(rsquared.doubleValue(), 0.9667887860584002, .000001);
+ @SuppressWarnings({"unchecked"})
List<Number> regressionParameters = (List<Number>)regression.get("regressionParameters");
assertEquals(regressionParameters.get(0).doubleValue(), 7.676028542255028, .0001);
@@ -4763,6 +4904,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertEquals(regressionParameters.get(2).doubleValue(), 7.621051256504592, .0001);
assertEquals(regressionParameters.get(3).doubleValue(), 0.8284680662898674, .0001);
+ @SuppressWarnings({"unchecked"})
List<Number> predictions = (List<Number>)tuples.get(0).get("g");
assertEquals(predictions.get(0).doubleValue(), 81.56082305847914, .0001);
@@ -4778,6 +4920,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testKnnRegress() throws Exception {
String cexpr = "let(echo=true, a=array(8.5, 12.89999962, 5.199999809, 10.69999981, 3.099999905, 3.5, 9.199999809, 9, 15.10000038, 10.19999981), " +
"b=array(5.099999905, 5.800000191, 2.099999905, 8.399998665, 2.900000095, 1.200000048, 3.700000048, 7.599999905, 7.699999809, 4.5)," +
@@ -4976,6 +5119,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<Double> doubles = (List<Double>)tuples.get(0).get("doubles");
assertEquals(doubles.get(0), 1.1, 0);
assertEquals(doubles.get(1), 1.3, 0);
@@ -4998,6 +5142,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> predictions = (List<Number>)tuples.get(0).get("g");
assertEquals(predictions.size(), 25);
assertEquals(predictions.get(0).doubleValue(), 1.5217511259930976, 0);
@@ -5042,6 +5187,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertTrue(tuples.size() == 1);
String plot = tuples.get(0).getString("plot");
assertTrue(plot.equals("scatter"));
+ @SuppressWarnings({"unchecked"})
List<List<Number>> data = (List<List<Number>>)tuples.get(0).get("data");
assertTrue(data.size() == 3);
List<Number> pair1 = data.get(0);
@@ -5067,6 +5213,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size()==4);
assertEquals((double) out.get(0), 2.5, .0);
@@ -5087,13 +5234,14 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size()==4);
System.out.println("MAD:"+out);
- assertEquals((double) out.get(0).doubleValue(), 1, .0);
- assertEquals((double) out.get(1).doubleValue(), 1, .0);
- assertEquals((double) out.get(2).doubleValue(), 1, .0);
- assertEquals((double) out.get(3).doubleValue(), 1.59375, .0);
+ assertEquals(out.get(0).doubleValue(), 1, .0);
+ assertEquals(out.get(1).doubleValue(), 1, .0);
+ assertEquals(out.get(2).doubleValue(), 1, .0);
+ assertEquals(out.get(3).doubleValue(), 1.59375, .0);
}
@Test
@@ -5126,6 +5274,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("return-value");
assertTrue(out.size() == 3);
assertEquals(out.get(0).doubleValue(), 6.0, .0);
@@ -5161,6 +5310,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("c");
assertTrue(out.size()==10);
assertEquals(out.get(0).doubleValue(), 30.0, .0);
@@ -5192,6 +5342,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> out = (List<Number>)tuples.get(0).get("c");
assertTrue(out.size()==10);
assertEquals(out.get(0).doubleValue(), 40.0, .0);
@@ -5226,9 +5377,13 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map a = (Map)tuples.get(0).get("a");
+ @SuppressWarnings({"rawtypes"})
Map b = (Map)tuples.get(0).get("b");
+ @SuppressWarnings({"rawtypes"})
Map c = (Map)tuples.get(0).get("c");
+ @SuppressWarnings({"rawtypes"})
Map d = (Map)tuples.get(0).get("d");
Number sa = (Number)a.get("skewness");
@@ -5270,6 +5425,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertEquals(tuples.size(), 1);
+ @SuppressWarnings({"unchecked"})
List<Number> b = (List<Number>)tuples.get(0).get("b");
assertEquals(10, b.size());
Number c = (Number)tuples.get(0).get("c");
@@ -5297,8 +5453,11 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map a = (Map)tuples.get(0).get("a");
+ @SuppressWarnings({"rawtypes"})
Map b = (Map)tuples.get(0).get("b");
+ @SuppressWarnings({"rawtypes"})
Map c = (Map)tuples.get(0).get("c");
Number sa = (Number)a.get("skewness");
@@ -5331,7 +5490,9 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"rawtypes"})
Map a = (Map)tuples.get(0).get("a");
+ @SuppressWarnings({"rawtypes"})
Map b = (Map)tuples.get(0).get("b");
Number sa = (Number)a.get("skewness");
@@ -5358,6 +5519,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> cm = (List<List<Number>>)tuples.get(0).get("f");
assertEquals(cm.size(), 3);
List<Number> row1 = cm.get(0);
@@ -5380,6 +5542,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testCorrMatrix() throws Exception {
String cexpr = "let(echo=true," +
"a=array(1,2,3), " +
@@ -5509,6 +5672,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> nums = (List<Number>)tuples.get(0).get("a");
assertTrue(nums.size() == 3);
assertEquals(nums.get(0).doubleValue(), 1.4445, 0.0);
@@ -5532,6 +5696,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<List<Number>> rows = (List<List<Number>>)tuples.get(0).get("b");
assertTrue(rows.size() == 2);
List<Number> row1 = rows.get(0);
@@ -5546,6 +5711,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void testMinMaxScale() throws Exception {
String cexpr = "let(echo=true, a=minMaxScale(matrix(array(1,2,3,4,5), array(10,20,30,40,50))), " +
"b=minMaxScale(matrix(array(1,2,3,4,5), array(10,20,30,40,50)), 0, 100)," +
@@ -5698,6 +5864,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> reverse = (List<Number>)tuples.get(0).get("reverse");
assertTrue(reverse.size() == 4);
assertTrue(reverse.get(0).doubleValue() == 400D);
@@ -5705,6 +5872,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertTrue(reverse.get(2).doubleValue() == 500D);
assertTrue(reverse.get(3).doubleValue() == 100D);
+ @SuppressWarnings({"unchecked"})
List<Number> ranked = (List<Number>)tuples.get(0).get("scaled");
assertTrue(ranked.size() == 4);
assertTrue(ranked.get(0).doubleValue() == 200D);
@@ -5755,6 +5923,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked"})
List<Number> convolution = (List<Number>)(tuples.get(0)).get("conv");
assertTrue(convolution.size() == 7);
assertTrue(convolution.get(0).equals(20000D));
@@ -5804,6 +5973,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
Tuple tuple = tuples.get(0);
+ @SuppressWarnings({"rawtypes"})
Map regression = (Map)tuple.get("regress");
double slope = (double)regression.get("slope");
double intercept= (double) regression.get("intercept");
@@ -5813,6 +5983,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
assertTrue(rSquare == 1.0D);
double prediction = tuple.getDouble("p");
assertTrue(prediction == 600.0D);
+ @SuppressWarnings({"unchecked"})
List<Number> predictions = (List<Number>)tuple.get("pl");
assertList(predictions, 200D, 400D, 600D, 200D, 400D, 800D, 1200D);
}
@@ -5998,6 +6169,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
Tuple tuple = tuples.get(0);
+ @SuppressWarnings({"rawtypes"})
Map regression = (Map)tuple.get("regress");
double slope = (double)regression.get("slope");
double intercept= (double) regression.get("intercept");
@@ -6033,7 +6205,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
double d = (double)tuples.get(0).get("kilometers");
- assertTrue(d == (double)(10*1.61));
+ assertTrue(d == (10*1.61));
expr = "select(search("+COLLECTIONORALIAS+", q=\"*:*\", sort=\"miles_i asc\", fl=\"miles_i\"), convert(miles, kilometers, miles_i) as kilometers)";
@@ -6047,9 +6219,9 @@ public class MathExpressionTest extends SolrCloudTestCase {
tuples = getTuples(solrStream);
assertTrue(tuples.size() == 2);
d = (double)tuples.get(0).get("kilometers");
- assertTrue(d == (double)(50*1.61));
+ assertTrue(d == (50*1.61));
d = (double)tuples.get(1).get("kilometers");
- assertTrue(d == (double)(70*1.61));
+ assertTrue(d == (70*1.61));
expr = "parallel("+COLLECTIONORALIAS+", workers=2, sort=\"miles_i asc\", select(search("+COLLECTIONORALIAS+", q=\"*:*\", partitionKeys=miles_i, sort=\"miles_i asc\", fl=\"miles_i\", qt=\"/export\"), convert(miles, kilometers, miles_i) as kilometers))";
paramsLoc = new ModifiableSolrParams();
@@ -6061,9 +6233,9 @@ public class MathExpressionTest extends SolrCloudTestCase {
tuples = getTuples(solrStream);
assertTrue(tuples.size() == 2);
d = (double)tuples.get(0).get("kilometers");
- assertTrue(d == (double)(50*1.61));
+ assertTrue(d == (50*1.61));
d = (double)tuples.get(1).get("kilometers");
- assertTrue(d == (double)(70*1.61));
+ assertTrue(d == (70*1.61));
expr = "select(stats("+COLLECTIONORALIAS+", q=\"*:*\", sum(miles_i)), convert(miles, kilometers, sum(miles_i)) as kilometers)";
paramsLoc = new ModifiableSolrParams();
@@ -6075,7 +6247,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
d = (double)tuples.get(0).get("kilometers");
- assertTrue(d == (double)(120*1.61));
+ assertTrue(d == (120*1.61));
}
protected List<Tuple> getTuples(TupleStream tupleStream) throws IOException {
@@ -6113,7 +6285,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
return true;
}
- private boolean assertList(List list, Object... vals) throws Exception {
+ private boolean assertList(@SuppressWarnings({"rawtypes"})List list, Object... vals) throws Exception {
if(list.size() != vals.length) {
throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/RecordCountStream.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/RecordCountStream.java
index fb93d86..f1974bd 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/RecordCountStream.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/RecordCountStream.java
@@ -103,7 +103,7 @@ public class RecordCountStream extends TupleStream implements Expressible, Seria
}
public List<TupleStream> children() {
- List<TupleStream> l = new ArrayList();
+ List<TupleStream> l = new ArrayList<>();
l.add(stream);
return l;
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java
index 744632b..add4331 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java
@@ -154,6 +154,7 @@ public class SelectWithEvaluatorsTest extends SolrCloudTestCase {
int i = 0;
for(int val : ids) {
Tuple t = tuples.get(i);
+ @SuppressWarnings({"rawtypes"})
List<Map> tip = t.getMaps("group");
int id = (int)tip.get(0).get("id");
if(id != val) {
@@ -229,13 +230,14 @@ public class SelectWithEvaluatorsTest extends SolrCloudTestCase {
return true;
}
- protected boolean assertMaps(List<Map> maps, int... ids) throws Exception {
+ protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {
if(maps.size() != ids.length) {
throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());
}
int i=0;
for(int val : ids) {
+ @SuppressWarnings({"rawtypes"})
Map t = maps.get(i);
String tip = (String)t.get("id");
if(!tip.equals(Integer.toString(val))) {
@@ -246,7 +248,7 @@ public class SelectWithEvaluatorsTest extends SolrCloudTestCase {
return true;
}
- private boolean assertList(List list, Object... vals) throws Exception {
+ private boolean assertList(@SuppressWarnings({"rawtypes"})List list, Object... vals) throws Exception {
if(list.size() != vals.length) {
throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java
index f57f655..6c88ffe 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java
@@ -493,6 +493,7 @@ public class StreamDecoratorTest extends SolrCloudTestCase {
TupleStream stream;
List<Tuple> tuples;
Tuple t0, t1, t2;
+ @SuppressWarnings({"rawtypes"})
List<Map> maps0, maps1, maps2;
StreamContext streamContext = new StreamContext();
SolrClientCache solrClientCache = new SolrClientCache();
@@ -1564,14 +1565,17 @@ public class StreamDecoratorTest extends SolrCloudTestCase {
assert (tuples.size() == 3);
Tuple t0 = tuples.get(0);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps0 = t0.getMaps("group");
assertMaps(maps0, 0, 1, 2, 9);
Tuple t1 = tuples.get(1);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps1 = t1.getMaps("group");
assertMaps(maps1, 3, 5, 7, 8);
Tuple t2 = tuples.get(2);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps2 = t2.getMaps("group");
assertMaps(maps2, 4, 6);
@@ -3798,6 +3802,7 @@ public class StreamDecoratorTest extends SolrCloudTestCase {
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
Tuple tuple1 = tuples.get(0);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> results = (List<Map>)tuple1.get("results");
assertTrue(results.size() == 2);
assertTrue(results.get(0).get("id").equals("hello1"));
@@ -4520,13 +4525,14 @@ public class StreamDecoratorTest extends SolrCloudTestCase {
return true;
}
- protected boolean assertMaps(List<Map> maps, int... ids) throws Exception {
+ protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {
if(maps.size() != ids.length) {
throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());
}
int i=0;
for(int val : ids) {
+ @SuppressWarnings({"rawtypes"})
Map t = maps.get(i);
String tip = (String)t.get("id");
if(!tip.equals(Integer.toString(val))) {
@@ -4537,7 +4543,7 @@ public class StreamDecoratorTest extends SolrCloudTestCase {
return true;
}
- private boolean assertList(List list, Object... vals) throws Exception {
+ private boolean assertList(@SuppressWarnings({"rawtypes"})List list, Object... vals) throws Exception {
if(list.size() != vals.length) {
throw new Exception("Lists are not the same size:"+list.size() +" : "+vals.length);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
index c9658a8..4245a85 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
@@ -195,7 +195,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
List<String> shardUrls = TupleStream.getShards(cluster.getZkServer().getZkAddress(), COLLECTIONORALIAS, streamContext);
- Map<String, List<String>> shardsMap = new HashMap();
+ Map<String, List<String>> shardsMap = new HashMap<>();
shardsMap.put("myCollection", shardUrls);
StreamContext context = new StreamContext();
context.put("shards", shardsMap);
@@ -674,6 +674,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
solrStream = new SolrStream(jetty.getBaseUrl().toString() + "/collection1", sParams);
tuples4 = getTuples(solrStream);
assert(tuples4.size() == 500);
+ @SuppressWarnings({"rawtypes"})
Map fields = tuples4.get(0).getFields();
assert(fields.containsKey("id"));
assert(fields.containsKey("a_f"));
@@ -863,7 +864,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
//Test with shards parameter
List<String> shardUrls = TupleStream.getShards(cluster.getZkServer().getZkAddress(), COLLECTIONORALIAS, streamContext);
expr = "stats(myCollection, q=*:*, sum(a_i), sum(a_f), min(a_i), min(a_f), max(a_i), max(a_f), avg(a_i), avg(a_f), std(a_i), std(a_f), per(a_i, 50), per(a_f, 50), count(*))";
- Map<String, List<String>> shardsMap = new HashMap();
+ Map<String, List<String>> shardsMap = new HashMap<>();
shardsMap.put("myCollection", shardUrls);
StreamContext context = new StreamContext();
context.put("shards", shardsMap);
@@ -2895,6 +2896,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
solrStream.setStreamContext(context);
List<Tuple> tuples = getTuples(solrStream);
assertTrue(tuples.size() == 1);
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<Map> results = (List<Map>)tuples.get(0).get("results");
assertTrue(results.get(0).get("id").equals("hello1"));
assertTrue(results.get(0).get("test_t").equals("l b c d c"));
@@ -3273,7 +3275,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
//Test with shards parameter
List<String> shardUrls = TupleStream.getShards(cluster.getZkServer().getZkAddress(), COLLECTIONORALIAS, streamContext);
- Map<String, List<String>> shardsMap = new HashMap();
+ Map<String, List<String>> shardsMap = new HashMap<>();
shardsMap.put("myCollection", shardUrls);
StreamContext context = new StreamContext();
context.put("shards", shardsMap);
@@ -3661,13 +3663,14 @@ public class StreamExpressionTest extends SolrCloudTestCase {
return true;
}
- protected boolean assertMaps(List<Map> maps, int... ids) throws Exception {
+ protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {
if(maps.size() != ids.length) {
throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());
}
int i=0;
for(int val : ids) {
+ @SuppressWarnings({"rawtypes"})
Map t = maps.get(i);
String tip = (String)t.get("id");
if(!tip.equals(Integer.toString(val))) {
@@ -3681,7 +3684,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
private void assertTopicRun(TupleStream stream, String... idArray) throws Exception {
long version = -1;
int count = 0;
- List<String> ids = new ArrayList();
+ List<String> ids = new ArrayList<>();
for(String id : idArray) {
ids.add(id);
}
@@ -3717,7 +3720,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
private void assertTopicSubject(TupleStream stream, String... textArray) throws Exception {
long version = -1;
int count = 0;
- List<String> texts = new ArrayList();
+ List<String> texts = new ArrayList<>();
for(String text : textArray) {
texts.add(text);
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
index 475b74d..0826269 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
@@ -420,14 +420,17 @@ public void testParallelRankStream() throws Exception {
assertEquals(3, tuples.size());
Tuple t0 = tuples.get(0);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps0 = t0.getMaps("group");
assertMaps(maps0, 0, 2, 1, 9);
Tuple t1 = tuples.get(1);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps1 = t1.getMaps("group");
assertMaps(maps1, 3, 5, 7, 8);
Tuple t2 = tuples.get(2);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps2 = t2.getMaps("group");
assertMaps(maps2, 4, 6);
@@ -530,14 +533,17 @@ public void testParallelRankStream() throws Exception {
assertEquals(3, tuples.size());
Tuple t0 = tuples.get(0);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps0 = t0.getMaps("group");
assertMaps(maps0, 9, 1, 2, 0);
Tuple t1 = tuples.get(1);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps1 = t1.getMaps("group");
assertMaps(maps1, 8, 7, 5, 3);
Tuple t2 = tuples.get(2);
+ @SuppressWarnings({"rawtypes"})
List<Map> maps2 = t2.getMaps("group");
assertMaps(maps2, 6, 4);
@@ -2400,14 +2406,14 @@ public void testParallelRankStream() throws Exception {
tryWithQt("/export");
tryWithQt("/select");
}
-
+
// We should be getting the exact same thing back with both the export and select handlers, so test
private void tryWithQt(String which) throws IOException {
StreamContext streamContext = new StreamContext();
SolrClientCache solrClientCache = new SolrClientCache();
streamContext.setSolrClientCache(solrClientCache);
- SolrParams sParams = StreamingTest.mapParams("q", "*:*", "qt", which, "fl",
- "id,i_sing,i_multi,l_sing,l_multi,f_sing,f_multi,d_sing,d_multi,dt_sing,dt_multi,s_sing,s_multi,b_sing,b_multi",
+ SolrParams sParams = StreamingTest.mapParams("q", "*:*", "qt", which, "fl",
+ "id,i_sing,i_multi,l_sing,l_multi,f_sing,f_multi,d_sing,d_multi,dt_sing,dt_multi,s_sing,s_multi,b_sing,b_multi",
"sort", "i_sing asc");
try (CloudSolrStream stream = new CloudSolrStream(zkHost, COLLECTIONORALIAS, sParams)) {
@@ -2445,7 +2451,7 @@ public void testParallelRankStream() throws Exception {
assertTrue("MV dates should be returned as Dates for dt_multi", tuple.getDates("dt_multi").get(0).equals(dt));
dt = new Date(Instant.parse("1981-05-24T04:05:06.990Z").toEpochMilli());
assertTrue("MV dates should be returned as Dates for dt_multi", tuple.getDates("dt_multi").get(1).equals(dt));
-
+
assertTrue("Booleans should be returned", tuple.getBool("b_sing"));
assertFalse("MV boolean should be returned for b_multi", tuple.getBools("b_multi").get(0));
assertTrue("MV boolean should be returned for b_multi", tuple.getBools("b_multi").get(1));
@@ -2493,7 +2499,7 @@ public void testParallelRankStream() throws Exception {
protected List<Tuple> getTuples(TupleStream tupleStream) throws IOException {
tupleStream.open();
- List<Tuple> tuples = new ArrayList();
+ List<Tuple> tuples = new ArrayList<>();
for(;;) {
Tuple t = tupleStream.read();
if(t.EOF) {
@@ -2528,9 +2534,11 @@ public void testParallelRankStream() throws Exception {
}
protected boolean assertGroupOrder(Tuple tuple, int... ids) throws Exception {
+ @SuppressWarnings({"rawtypes"})
List group = (List)tuple.get("tuples");
int i=0;
for(int val : ids) {
+ @SuppressWarnings({"rawtypes"})
Map t = (Map)group.get(i);
Long tip = (Long)t.get("id");
if(tip.intValue() != val) {
@@ -2541,13 +2549,14 @@ public void testParallelRankStream() throws Exception {
return true;
}
- protected boolean assertMaps(List<Map> maps, int... ids) throws Exception {
+ protected boolean assertMaps(@SuppressWarnings({"rawtypes"})List<Map> maps, int... ids) throws Exception {
if(maps.size() != ids.length) {
throw new Exception("Expected id count != actual map count:"+ids.length+":"+maps.size());
}
int i=0;
for(int val : ids) {
+ @SuppressWarnings({"rawtypes"})
Map t = maps.get(i);
String tip = (String)t.get("id");
if(!tip.equals(Integer.toString(val))) {
@@ -2566,7 +2575,7 @@ public void testParallelRankStream() throws Exception {
return true;
}
-
+
private void attachStreamFactory(TupleStream tupleStream) {
StreamContext streamContext = new StreamContext();
streamContext.setStreamFactory(streamFactory);
@@ -2582,10 +2591,10 @@ public void testParallelRankStream() throws Exception {
if(random().nextBoolean()) params.add("wt","javabin");
return params;
}
-
+
private ParallelStream parallelStream(TupleStream stream, FieldComparator comparator) throws IOException {
ParallelStream pstream = new ParallelStream(zkHost, COLLECTIONORALIAS, stream, numWorkers, comparator);
return pstream;
- }
+ }
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AscEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AscEvaluatorTest.java
index 8029712..fb0a35a 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AscEvaluatorTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AscEvaluatorTest.java
@@ -44,6 +44,7 @@ public class AscEvaluatorTest extends SolrTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void integerSortTest() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("asc(a)");
Object result;
@@ -57,6 +58,7 @@ public class AscEvaluatorTest extends SolrTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void doubleSortTest() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("asc(a)");
Object result;
@@ -70,6 +72,7 @@ public class AscEvaluatorTest extends SolrTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void doubleWithIntegersSortTest() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("asc(a)");
Object result;
@@ -83,6 +86,7 @@ public class AscEvaluatorTest extends SolrTestCase {
}
@Test
+ @SuppressWarnings({"unchecked"})
public void stringSortTest() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("asc(a)");
Object result;
@@ -98,7 +102,9 @@ public class AscEvaluatorTest extends SolrTestCase {
private <T> void checkOrder(List<?> expected, List<?> actual){
Assert.assertEquals(expected.size(), actual.size());
for(int idx = 0; idx < expected.size(); ++idx){
+ @SuppressWarnings({"unchecked"})
Comparable<Object> expectedValue = (Comparable<Object>)expected.get(idx);
+ @SuppressWarnings({"unchecked"})
Comparable<Object> actualValue = (Comparable<Object>)actual.get(idx);
Assert.assertEquals(0, expectedValue.compareTo(actualValue));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java
index 2194b8f..4997902 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java
@@ -42,6 +42,7 @@ public class ConversionEvaluatorsTest {
StreamFactory factory;
Map<String, Object> values;
+ @SuppressWarnings({"unchecked"})
public ConversionEvaluatorsTest() {
super();
@@ -69,6 +70,7 @@ public class ConversionEvaluatorsTest {
evaluator = factory.constructEvaluator("convert(inches, yards, 3)");
StreamContext streamContext = new StreamContext();
evaluator.setStreamContext(streamContext);
+ @SuppressWarnings({"rawtypes"})
Tuple tuple = new Tuple(new HashMap());
evaluator.evaluate(tuple);
assertTrue(false);
@@ -79,41 +81,41 @@ public class ConversionEvaluatorsTest {
@Test
public void testInches() throws Exception {
- testFunction("convert(inches, centimeters, 2)", (double)(2*2.54));
- testFunction("convert(inches, meters, 2)", (double)(2*0.0254));
- testFunction("convert(inches, millimeters, 2)", (double)(2*25.40));
+ testFunction("convert(inches, centimeters, 2)", (2*2.54));
+ testFunction("convert(inches, meters, 2)", (2*0.0254));
+ testFunction("convert(inches, millimeters, 2)", (2*25.40));
}
@Test
public void testYards() throws Exception {
- testFunction("convert(yards, meters, 2)", (double)(2*.91));
- testFunction("convert(yards, kilometers, 2)", (double)(2*.00091));
+ testFunction("convert(yards, meters, 2)", (2*.91));
+ testFunction("convert(yards, kilometers, 2)", (2*.00091));
}
@Test
public void testMiles() throws Exception {
- testFunction("convert(miles, kilometers, 2)", (double)(2*1.61));
+ testFunction("convert(miles, kilometers, 2)", (2*1.61));
}
@Test
public void testMillimeters() throws Exception {
- testFunction("convert(millimeters, inches, 2)", (double)(2*.039));
+ testFunction("convert(millimeters, inches, 2)", (2*.039));
}
@Test
public void testCentimeters() throws Exception {
- testFunction("convert(centimeters, inches, 2)", (double)(2*.39));
+ testFunction("convert(centimeters, inches, 2)", (2*.39));
}
@Test
public void testMeters() throws Exception {
- testFunction("convert(meters, feet, 2)", (double)(2*3.28));
+ testFunction("convert(meters, feet, 2)", (2*3.28));
}
@Test
public void testKiloMeters() throws Exception {
- testFunction("convert(kilometers, feet, 2)", (double)(2*3280.8));
- testFunction("convert(kilometers, miles, 2)", (double)(2*.62));
+ testFunction("convert(kilometers, feet, 2)", (2*3280.8));
+ testFunction("convert(kilometers, miles, 2)", (2*.62));
}
public void testFunction(String expression, Number expected) throws Exception {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java
index 66f45a7..e70a865 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ReverseEvaluatorTest.java
@@ -47,6 +47,7 @@ public class ReverseEvaluatorTest extends SolrTestCase {
values.clear();
values.put("l1", l1);
+ @SuppressWarnings({"rawtypes"})
List result = ((List<?>)factory.constructEvaluator("reverse(l1)").evaluate(new Tuple(values)));
Assert.assertEquals(4.5, result.get(0));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TemporalEvaluatorsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TemporalEvaluatorsTest.java
index fbf99ab..38b912c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TemporalEvaluatorsTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TemporalEvaluatorsTest.java
@@ -63,6 +63,7 @@ public class TemporalEvaluatorsTest {
StreamFactory factory;
Map<String, Object> values;
+ @SuppressWarnings({"unchecked"})
public TemporalEvaluatorsTest() {
super();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java
index bbc6755..d6d9093 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java
@@ -37,6 +37,7 @@ public class ConcatOperationTest extends SolrTestCase {
StreamFactory factory;
Map<String, Object> values;
+ @SuppressWarnings({"unchecked"})
public ConcatOperationTest() {
super();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/OperationsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/OperationsTest.java
index 91129b7..22a0bc1 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/OperationsTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/OperationsTest.java
@@ -37,6 +37,7 @@ public class OperationsTest extends SolrTestCase {
StreamFactory factory;
Map<String, Object> values;
+ @SuppressWarnings({"unchecked"})
public OperationsTest() {
super();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
index 09235bc..284d2e6 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
@@ -66,6 +66,7 @@ public class SchemaTest extends RestTestBase {
SimpleOrderedMap errorMap = (SimpleOrderedMap)e.getMetaData().get("error");
assertEquals("org.apache.solr.api.ApiBag$ExceptionWithErrObject",
((NamedList)errorMap.get("metadata")).get("error-class"));
+ @SuppressWarnings({"rawtypes"})
List details = (List)errorMap.get("details");
assertTrue(((List)((Map)details.get(0)).get("errorMessages")).get(0).toString().contains(expectedErrorMessage));
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java
index 345a165..5c78159 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java
@@ -28,6 +28,7 @@ public class TestConfigSetAdminRequest extends SolrTestCaseJ4 {
@Test
public void testNoAction() {
+ @SuppressWarnings({"rawtypes"})
ConfigSetAdminRequest request = new MyConfigSetAdminRequest();
verifyException(request, "action");
}
@@ -46,7 +47,7 @@ public class TestConfigSetAdminRequest extends SolrTestCaseJ4 {
verifyException(delete, "ConfigSet");
}
- private void verifyException(ConfigSetAdminRequest request, String errorContains) {
+ private void verifyException(@SuppressWarnings({"rawtypes"})ConfigSetAdminRequest request, String errorContains) {
Exception e = expectThrows(Exception.class, request::getParams);
assertTrue("Expected exception message to contain: " + errorContains,
e.getMessage().contains(errorContains));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
index e5f2cce..a44a668 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
@@ -157,7 +157,9 @@ public class TestUpdateRequestCodec extends SolrTestCase {
}
//this format accepts a 1:1 mapping of the json format and javabin format
+ @SuppressWarnings({"unchecked"})
public void testStreamableInputDocFormat() throws IOException {
+ @SuppressWarnings({"rawtypes"})
Map m = Utils.makeMap("id","1","desc" ,"The desc 1");
m.put(CHILDDOC, (MapWriter) ew -> {
ew.put("id","1.1");
@@ -175,13 +177,14 @@ public class TestUpdateRequestCodec extends SolrTestCase {
ew.put("des", "The desc 2");
};
+ @SuppressWarnings({"rawtypes"})
List l = new ArrayList();
l.add(m);
l.add(m2);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new JavaBinCodec().marshal(l.iterator(), baos);
- List<SolrInputDocument> l2 = new ArrayList();
+ List<SolrInputDocument> l2 = new ArrayList<>();
new JavaBinUpdateRequestCodec().unmarshal(new ByteArrayInputStream(baos.toByteArray()), (document, req, commitWithin, override) -> l2.add(document));
@@ -261,6 +264,7 @@ public class TestUpdateRequestCodec extends SolrTestCase {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private void compareDocs(String m,
SolrInputDocument expectedDoc,
SolrInputDocument actualDoc) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
index 5d8954d..3e36f7d 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java
@@ -53,6 +53,7 @@ public class TestV2Request extends SolrCloudTestCase {
.forceV2(true)
.withMethod(SolrRequest.METHOD.GET).build()
.process(cluster.getSolrClient());
+ @SuppressWarnings({"rawtypes"})
List l = (List) rsp._get("nodes",null);
assertNotNull(l);
assertFalse(l.isEmpty());
@@ -119,9 +120,10 @@ public class TestV2Request extends SolrCloudTestCase {
assertSuccess(client, new V2Request.Builder("/c/test").withMethod(SolrRequest.METHOD.DELETE).build());
NamedList<Object> res = client.request(new V2Request.Builder("/c").build());
- List collections = (List) res.get("collections");
+
// TODO: this is not guaranteed now - beast test if you try to fix
+ //List collections = (List) res.get("collections");
// assertFalse( collections.contains("test"));
try{
NamedList<Object> res1 = client.request(new V2Request.Builder("/collections")
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java
index 5b46514..da8b89d 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java
@@ -40,6 +40,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
public void testStoresFilterWithCorrectKey() {
final DomainMap domain = new DomainMap()
.withFilter("name:Solr");
+ @SuppressWarnings({"unchecked"})
final List<String> filterList = (List<String>) domain.get("filter");
assertTrue("Expected filter list to contain provided filter", filterList.contains("name:Solr"));
@@ -50,6 +51,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
final DomainMap domain = new DomainMap()
.withFilter("name:Solr")
.withFilter("cat:search");
+ @SuppressWarnings({"unchecked"})
final List<String> filterList = (List<String>) domain.get("filter");
assertTrue("Expected filter list to contain 1st provided filter", filterList.contains("name:Solr"));
@@ -69,6 +71,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
public void testStoresQueryWithCorrectKey() {
final DomainMap domain = new DomainMap()
.withQuery("name:Solr");
+ @SuppressWarnings({"unchecked"})
final List<String> queryList = (List<String>) domain.get("query");
assertTrue("Expected query list to contain provided query", queryList.contains("name:Solr"));
@@ -79,6 +82,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
final DomainMap domain = new DomainMap()
.withQuery("name:Solr")
.withQuery("cat:search");
+ @SuppressWarnings({"unchecked"})
final List<String> queryList = (List<String>) domain.get("query");
assertTrue("Expected query list to contain 1st provided query", queryList.contains("name:Solr"));
@@ -98,6 +102,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
public void testStoresTagsToExcludeWithCorrectKey() {
final DomainMap domain = new DomainMap()
.withTagsToExclude("BRAND");
+ @SuppressWarnings({"unchecked"})
final List<String> exclusionList = (List<String>) domain.get("excludeTags");
assertTrue("Expected tag-exclusion list to contain provided tag", exclusionList.contains("BRAND"));
@@ -108,6 +113,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
final DomainMap domain = new DomainMap()
.withTagsToExclude("BRAND")
.withTagsToExclude("COLOR");
+ @SuppressWarnings({"unchecked"})
final List<String> exclusionList = (List<String>) domain.get("excludeTags");
assertTrue("Expected tag-exclusion list to contain provided 1st tag", exclusionList.contains("BRAND"));
@@ -170,6 +176,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {
.setJoinTransformation("any-from-field", "any-to-field");
assertTrue(domain.containsKey("join"));
+ @SuppressWarnings({"unchecked"})
final Map<String, Object> joinParams = (Map<String, Object>) domain.get("join");
assertEquals("any-from-field", joinParams.get("from"));
assertEquals("any-to-field", joinParams.get("to"));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java
index da7f7ed..803769f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/AnlysisResponseBaseTest.java
@@ -38,6 +38,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {
@Test
public void testBuildTokenInfo() throws Exception {
+ @SuppressWarnings({"rawtypes"})
NamedList tokenNL = new NamedList();
tokenNL.add("text", "JUMPING");
tokenNL.add("type", "word");
@@ -76,6 +77,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {
public void testBuildPhases() throws Exception {
final AnalysisResponseBase.TokenInfo tokenInfo = new AnalysisResponseBase.TokenInfo("text", null, "type", 0, 3, 1, false);
+ @SuppressWarnings({"rawtypes"})
NamedList nl = new NamedList();
nl.add("Tokenizer", buildFakeTokenInfoList(6));
nl.add("Filter1", buildFakeTokenInfoList(5));
@@ -84,7 +86,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {
AnalysisResponseBase response = new AnalysisResponseBase() {
@Override
- protected TokenInfo buildTokenInfo(NamedList tokenNL) {
+ protected TokenInfo buildTokenInfo(@SuppressWarnings({"rawtypes"})NamedList tokenNL) {
return tokenInfo;
}
};
@@ -104,6 +106,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {
*/
@Test
public void testCharFilterBuildPhases() throws Exception {
+ @SuppressWarnings({"rawtypes"})
NamedList nl = new NamedList();
nl.add("CharFilter1", "CharFilterOutput"); //not list of tokens
AnalysisResponseBase response = new AnalysisResponseBase();
@@ -113,6 +116,7 @@ public class AnlysisResponseBaseTest extends SolrTestCase {
//================================================ Helper Methods ==================================================
+ @SuppressWarnings({"rawtypes"})
private List<NamedList> buildFakeTokenInfoList(int numberOfTokens) {
List<NamedList> list = new ArrayList<>(numberOfTokens);
for (int i = 0; i < numberOfTokens; i++) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java
index 1c970a2..546cd03 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/DocumentAnalysisResponseTest.java
@@ -35,6 +35,7 @@ public class DocumentAnalysisResponseTest extends SolrTestCase {
* Tests the {@link DocumentAnalysisResponse#setResponse(org.apache.solr.common.util.NamedList)} method
*/
@Test
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testSetResponse() throws Exception {
// the parsing of the analysis phases is already tested in the AnalysisResponseBaseTest. So we can just fake
@@ -96,6 +97,7 @@ public class DocumentAnalysisResponseTest extends SolrTestCase {
//================================================ Helper Methods ==================================================
+ @SuppressWarnings({"unchecked", "rawtypes"})
private NamedList buildResponse() {
NamedList response = new NamedList();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java
index 6ce7e4b..b609dfb 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/FieldAnalysisResponseTest.java
@@ -45,6 +45,7 @@ public class FieldAnalysisResponseTest extends SolrTestCase {
AnalysisResponseBase.AnalysisPhase expectedPhase = new AnalysisResponseBase.AnalysisPhase("Tokenizer");
phases.add(expectedPhase);
+ @SuppressWarnings({"rawtypes"})
NamedList responseNL = buildResponse();
FieldAnalysisResponse response = new FieldAnalysisResponse() {
@Override
@@ -79,6 +80,7 @@ public class FieldAnalysisResponseTest extends SolrTestCase {
//================================================ Helper Methods ==================================================
+ @SuppressWarnings({"rawtypes"})
private NamedList buildResponse() {
NamedList response = new NamedList();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
index 1aa80ad..cc1e8ad 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
@@ -87,7 +87,9 @@ public class NoOpResponseParserTest extends SolrJettyTestBase {
private void assertResponse(String responseString) throws IOException {
ResponseParser xmlResponseParser = new XMLResponseParser();
+ @SuppressWarnings({"rawtypes"})
NamedList expectedResponse = xmlResponseParser.processResponse(IOUtils.toInputStream(responseString, "UTF-8"), "UTF-8");
+ @SuppressWarnings({"unchecked"})
List<SolrDocument> documentList = (List<SolrDocument>) expectedResponse.getAll("response").get(0);
assertEquals(1, documentList.size());
SolrDocument solrDocument = documentList.get(0);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
index af9da26..174b24a 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java
@@ -42,6 +42,7 @@ import org.junit.Test;
* @since solr 1.3
*/
@Limit(bytes=20000)
+@SuppressWarnings({"rawtypes"})
public class QueryResponseTest extends SolrTestCase {
@Test
// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java
index b5508df..54b8e6c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestDelegationTokenResponse.java
@@ -34,7 +34,7 @@ import org.noggit.JSONWriter;
public class TestDelegationTokenResponse extends SolrTestCase {
- private void delegationTokenResponse(DelegationTokenRequest request,
+ private void delegationTokenResponse(@SuppressWarnings({"rawtypes"})DelegationTokenRequest request,
DelegationTokenResponse response, String responseBody) throws Exception {
ResponseParser parser = request.getResponseParser();
response.setResponse(parser.processResponse(
diff --git a/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java b/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java
index d6a2b2e..1bcfd35 100644
--- a/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/SolrDocumentTest.java
@@ -29,7 +29,8 @@ import org.apache.solr.SolrTestCase;
*/
public class SolrDocumentTest extends SolrTestCase
{
- public void testSimple()
+ @SuppressWarnings({"unchecked"})
+ public void testSimple()
{
Float fval = 10.01f;
Boolean bval = Boolean.TRUE;
@@ -127,8 +128,10 @@ public class SolrDocumentTest extends SolrTestCase
doc.clear();
assertEquals( 0, doc.getFieldNames().size() );
+ @SuppressWarnings({"rawtypes"})
Iterable iter = new Iterable() {
@Override
+ @SuppressWarnings({"rawtypes"})
public Iterator iterator() {
return c0.iterator();
}
diff --git a/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java b/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java
index 7dd3427..8e4a24e 100644
--- a/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java
+++ b/solr/solrj/src/test/org/apache/solr/common/TestToleratedUpdateError.java
@@ -67,8 +67,10 @@ public class TestToleratedUpdateError extends SolrTestCase {
assertTrue(e.toString(), e.getMessage().contains("Invalid type"));
}
+ @SuppressWarnings({"unchecked"})
public void testParseMap() {
// trivial
+ @SuppressWarnings({"rawtypes"})
SimpleOrderedMap valid = new SimpleOrderedMap<String>();
valid.add("type", CmdType.ADD.toString());
valid.add("id", "some id");
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/JsonValidatorTest.java b/solr/solrj/src/test/org/apache/solr/common/util/JsonValidatorTest.java
index 8c06266..404661a 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/JsonValidatorTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/JsonValidatorTest.java
@@ -46,6 +46,7 @@ public class JsonValidatorTest extends SolrTestCaseJ4 {
public void testSchemaValidation() {
ValidatingJsonMap spec = Utils.getSpec("collections.Commands").getSpec();
+ @SuppressWarnings({"rawtypes"})
Map createSchema = spec.getMap("commands", NOT_NULL).getMap("create-alias", NOT_NULL);
JsonSchemaValidator validator = new JsonSchemaValidator(createSchema);
List<String> errs = validator.validateJson(Utils.fromJSONString("{name : x, collections: [ c1 , c2]}"));
@@ -181,8 +182,10 @@ public class JsonValidatorTest extends SolrTestCaseJ4 {
private void checkSchema(String name) {
ValidatingJsonMap spec = Utils.getSpec(name).getSpec();
+ @SuppressWarnings({"rawtypes"})
Map commands = (Map) spec.get("commands");
for (Object o : commands.entrySet()) {
+ @SuppressWarnings({"rawtypes"})
Map.Entry cmd = (Map.Entry) o;
try {
JsonSchemaValidator validator = new JsonSchemaValidator((Map) cmd.getValue());
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
index 644257b..e9dca27 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
@@ -122,7 +122,7 @@ public class NamedListTest extends SolrTestCase {
NamedList<Object> nl2 = new NamedList<>();
nl2.add("key2a", "value2a");
nl2.add("key2b", nl2b);
- nl2.add("k2int1", (int) 5);
+ nl2.add("k2int1", 5);
NamedList<Object> nl3 = new NamedList<>();
nl3.add("key3a", nl3a);
nl3.add("key3b", "value3b");
@@ -187,9 +187,12 @@ public class NamedListTest extends SolrTestCase {
@Test
// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
+ @SuppressWarnings({"unchecked"})
public void testShallowMap() {
+ @SuppressWarnings({"rawtypes"})
NamedList nl = new NamedList();
nl.add("key1", "Val1");
+ @SuppressWarnings({"rawtypes"})
Map m = nl.asShallowMap();
m.put("key1", "Val1_");
assertEquals("Val1_", nl.get("key1"));
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java b/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java
index ecbdf44..5e7d774 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java
@@ -77,32 +77,38 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
"}";
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) Utils.fromJSONString(sampleObj);
BinaryRequestWriter.BAOS baos = new BinaryRequestWriter.BAOS();
try (JavaBinCodec jbc = new JavaBinCodec()) {
jbc.marshal(m, baos);
}
+ @SuppressWarnings({"rawtypes"})
Map m2;
try (JavaBinCodec jbc = new JavaBinCodec()) {
m2 = (Map) jbc.unmarshal(new FastInputStream(null, baos.getbuf(), 0, baos.size()));
}
+ @SuppressWarnings({"rawtypes"})
LinkedHashMap fastMap = (LinkedHashMap) new FastJavaBinDecoder()
.withInputStream(new FastInputStream(null, baos.getbuf(), 0, baos.size()))
.decode(FastJavaBinDecoder.getEntryListener());
assertEquals(Utils.writeJson(m2, new StringWriter(), true).toString(),
Utils.writeJson(fastMap, new StringWriter(), true).toString());
+ @SuppressWarnings({"unchecked"})
Object newMap = new FastJavaBinDecoder()
.withInputStream(new FastInputStream(null, baos.getbuf(), 0, baos.size()))
.decode(e -> {
e.listenContainer(new LinkedHashMap<>(), e_ -> {
+ @SuppressWarnings({"rawtypes"})
Map rootMap = (Map) e_.ctx();
if (e_.type() == DataEntry.Type.ENTRY_ITER) {
e_.listenContainer(rootMap.computeIfAbsent(e_.name(), NEW_ARRAYLIST_FUN),
FastJavaBinDecoder.getEntryListener());
} else if (e_.type() == DataEntry.Type.KEYVAL_ITER) {
e_.listenContainer(rootMap.computeIfAbsent(e_.name(), NEW_LINKED_HASHMAP_FUN), e1 -> {
+ @SuppressWarnings({"rawtypes"})
Map m1 = (Map) e1.ctx();
if ("k1".equals(e1.name())) {
m1.put(e1.name(), e1.val().toString());
@@ -128,6 +134,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
SolrDocumentList list;
try (JavaBinCodec jbc = new JavaBinCodec()) {
+ @SuppressWarnings({"rawtypes"})
SimpleOrderedMap o = (SimpleOrderedMap) jbc.unmarshal(baos.toByteArray());
list = (SolrDocumentList) o.get("response");
}
@@ -138,6 +145,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
CharSequence id;
boolean inStock;
float price;
+ @SuppressWarnings({"rawtypes"})
List<NamedList> children;
}
StreamingBinaryResponseParser parser = new StreamingBinaryResponseParser(new FastStreamingDocsCallback() {
@@ -184,6 +192,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
parser.processResponse(new FastInputStream(null, baos.getbuf(), 0, baos.size()), null);
}
+ @SuppressWarnings({"unchecked"})
public void testParsingWithChildDocs() throws IOException {
SolrDocument d1 = TestJavaBinCodec.generateSolrDocumentWithChildDocs();
d1.setField("id", "101");
@@ -197,6 +206,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
sdocs.add(d1);
sdocs.add(d2);
+ @SuppressWarnings({"rawtypes"})
SimpleOrderedMap orderedMap = new SimpleOrderedMap();
orderedMap.add("response", sdocs);
@@ -219,6 +229,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
assertEquals(subject, d.getFieldValue("subject"));
assertEquals(cat, d.getFieldValue("cat"));
assertEquals(d.getChildDocumentCount(), children.size());
+ @SuppressWarnings({"unchecked"})
List<Long> l = (List<Long>) d.getFieldValue("longs");
if(l != null){
assertNotNull(longs);
@@ -245,6 +256,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
}
@Override
+ @SuppressWarnings({"unchecked"})
public Object startDoc(Object docListObj) {
Pojo pojo = new Pojo();
((List) docListObj).add(pojo);
@@ -264,6 +276,7 @@ public class TestFastJavabinDecoder extends SolrTestCaseJ4 {
if(useListener[0]){
field.listenContainer(pojo.longs = new long[field.length()], READLONGS);
} else {
+ @SuppressWarnings({"unchecked"})
List<Long> longList = (List<Long>) field.val();
pojo.longs = new long[longList.size()];
for (int i = 0; i < longList.size(); i++) {
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
index d6cd3dc..b9db14f 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
@@ -105,6 +105,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
return parentDocument;
}
+ @SuppressWarnings({"unchecked"})
private List<Object> generateAllDataTypes() {
List<Object> types = new ArrayList<>();
@@ -172,6 +173,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
types.add(1);
types.add((long) 2);
+ @SuppressWarnings({"rawtypes"})
SimpleOrderedMap simpleOrderedMap = new SimpleOrderedMap();
simpleOrderedMap.add("bar", "barbar");
types.add(simpleOrderedMap);
@@ -192,6 +194,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
}
};)
{
+ @SuppressWarnings({"unchecked"})
List<Object> unmarshaledObj = (List<Object>) javabin.unmarshal(is);
List<Object> matchObj = generateAllDataTypes();
compareObjects(unmarshaledObj, matchObj);
@@ -201,7 +204,8 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
}
- private void compareObjects(List unmarshaledObj, List matchObj) {
+ private void compareObjects(@SuppressWarnings({"rawtypes"})List unmarshaledObj,
+ @SuppressWarnings({"rawtypes"})List matchObj) {
assertEquals(unmarshaledObj.size(), matchObj.size());
for (int i = 0; i < unmarshaledObj.size(); i++) {
@@ -394,6 +398,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
assertNull(grandChildDocuments.get(0).getChildDocuments());
}
@Test
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testStringCaching() throws Exception {
Map<String, Object> m = Utils.makeMap("key1", "val1", "key2", "val2");
byte[] b1 = getBytes(m);//copy 1
@@ -558,6 +563,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
}
+ @SuppressWarnings({"unchecked"})
public static void doDecodePerf(String[] args) throws Exception {
int arg=0;
int nThreads = Integer.parseInt(args[arg++]);
@@ -597,6 +603,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {
int ret = 0;
final RTimer timer = new RTimer();
+ @SuppressWarnings({"rawtypes"})
ConcurrentLRUCache underlyingCache = cacheSz > 0 ? new ConcurrentLRUCache<>(cacheSz,cacheSz-cacheSz/10,cacheSz,cacheSz/10,false,true,null) : null; // the cache in the first version of the patch was 10000,9000,10000,1000,false,true,null
final JavaBinCodec.StringCache stringCache = underlyingCache==null ? null : new JavaBinCodec.StringCache(underlyingCache);
if (nThreads <= 0) {
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java
index 58ddb53..adda675 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java
@@ -162,6 +162,7 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 {
String buf = parser.getBuf();
parser.resetBuf();
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) Utils.fromJSONString(buf);
if (count == 1) {
assertEquals(m.get("id"), "123");
@@ -285,7 +286,9 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 {
"}}";
streamer.streamRecords(new StringReader(json), (record, path) -> {
assertEquals(record.get("x"), "y");
+ @SuppressWarnings({"rawtypes"})
List l = (List) record.get("b");
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) l.get(0);
assertEquals(m.get("c"), "c1");
assertEquals(m.get("e"), "e1");
@@ -296,7 +299,9 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 {
streamer = JsonRecordReader.getInst("/|/a/b", Arrays.asList("$FQN:/**"));
streamer.streamRecords(new StringReader(json), (record, path) -> {
assertEquals(record.get("a.x"), "y");
+ @SuppressWarnings({"rawtypes"})
List l = (List) record.get("b");
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) l.get(0);
assertEquals(m.get("c"), "c1");
assertEquals(m.get("e"), "e1");
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
index b68b789..070dfe6 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestNamedListCodec.java
@@ -33,6 +33,7 @@ import java.util.HashMap;
public class TestNamedListCodec extends SolrTestCase {
@Test
// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void testSimple() throws Exception{
NamedList nl = new NamedList();
@@ -97,15 +98,19 @@ public class TestNamedListCodec extends SolrTestCase {
@Test
// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
+ @SuppressWarnings({"unchecked"})
public void testIterator() throws Exception{
+ @SuppressWarnings({"rawtypes"})
NamedList nl = new NamedList();
Float fval = 10.01f;
Boolean bval = Boolean.TRUE;
String sval = "12qwaszx";
// Set up a simple document
+ @SuppressWarnings({"rawtypes"})
NamedList r = new NamedList();
+ @SuppressWarnings({"rawtypes"})
List list = new ArrayList();
SolrDocument doc = new SolrDocument();
@@ -132,15 +137,18 @@ public class TestNamedListCodec extends SolrTestCase {
nl = (NamedList) jbc.unmarshal(bais);
}
+ @SuppressWarnings({"rawtypes"})
List l = (List) nl.get("zzz");
assertEquals(list.size(), l.size());
}
@Test
// commented out on: 24-Dec-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 20-Sep-2018
+ @SuppressWarnings({"unchecked"})
public void testIterable() throws Exception {
+ @SuppressWarnings({"rawtypes"})
NamedList r = new NamedList();
Map<String, String> map = new HashMap<>();
@@ -159,14 +167,17 @@ public class TestNamedListCodec extends SolrTestCase {
}
try (JavaBinCodec jbc = new JavaBinCodec(); ByteArrayInputStream bais = new ByteArrayInputStream(arr)) {
+ @SuppressWarnings({"rawtypes"})
NamedList result = (NamedList) jbc.unmarshal(bais);
assertTrue("result is null and it shouldn't be", result != null);
+ @SuppressWarnings({"rawtypes"})
List keys = (List) result.get("keys");
assertTrue("keys is null and it shouldn't be", keys != null);
assertTrue("keys Size: " + keys.size() + " is not: " + 3, keys.size() == 3);
String less = (String) result.get("more");
assertTrue("less is null and it shouldn't be", less != null);
assertTrue(less + " is not equal to " + "less", less.equals("less") == true);
+ @SuppressWarnings({"rawtypes"})
List values = (List) result.get("values");
assertTrue("values is null and it shouldn't be", values != null);
assertTrue("values Size: " + values.size() + " is not: " + 3, values.size() == 3);
@@ -199,6 +210,7 @@ public class TestNamedListCodec extends SolrTestCase {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public NamedList rNamedList(int lev) {
int sz = lev<= 0 ? 0 : r.nextInt(3);
NamedList nl = new NamedList();
@@ -208,6 +220,7 @@ public class TestNamedListCodec extends SolrTestCase {
return nl;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public List rList(int lev) {
int sz = lev<= 0 ? 0 : r.nextInt(3);
ArrayList lst = new ArrayList();
@@ -259,7 +272,9 @@ public class TestNamedListCodec extends SolrTestCase {
// let's keep it deterministic since just the wrong
// random stuff could cause failure because of an OOM (too big)
+ @SuppressWarnings({"rawtypes"})
NamedList nl;
+ @SuppressWarnings({"rawtypes"})
NamedList res;
String cmp;
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java b/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java
index 52a661f..5a56821 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestPathTrie.java
@@ -30,6 +30,7 @@ import static org.apache.solr.api.ApiBag.HANDLER_NAME;
public class TestPathTrie extends SolrTestCaseJ4 {
+ @SuppressWarnings({"unchecked"})
public void testPathTrie() {
PathTrie<String> pathTrie = new PathTrie<>(ImmutableSet.of("_introspect"));
pathTrie.insert("/", emptyMap(), "R");
@@ -39,6 +40,7 @@ public class TestPathTrie extends SolrTestCaseJ4 {
pathTrie.insert("/aa/bb/{cc}/{xx}", emptyMap(), "b");
pathTrie.insert("/aa/bb", emptyMap(), "c");
+ @SuppressWarnings({"rawtypes"})
HashMap templateValues = new HashMap<>();
assertEquals("R", pathTrie.lookup("/", templateValues, null));
assertEquals("d", pathTrie.lookup("/aa", templateValues, null));
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java b/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java
index b53488a..7c04ff4 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestValidatingJsonMap.java
@@ -42,6 +42,7 @@ public class TestValidatingJsonMap extends SolrTestCaseJ4 {
expectThrows(RuntimeException.class, () -> m.getList("l", ENUM_OF, ImmutableSet.of("X", "Z")));
+ @SuppressWarnings({"rawtypes"})
List l = m.getList("l", ENUM_OF, ImmutableSet.of("X", "Y", "Z"));
assertEquals(2,l.size());
m.getList("l", NOT_NULL);
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java b/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java
index bd45da9..c3bfbed 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java
@@ -27,6 +27,7 @@ import org.apache.solr.SolrTestCaseJ4;
public class Utf8CharSequenceTest extends SolrTestCaseJ4 {
+ @SuppressWarnings({"unchecked"})
public void testLargeString() throws IOException {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 100; i++) {
@@ -48,6 +49,7 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {
utf81 = new ByteArrayUtf8CharSequence(result, 0, result.length);
assertTrue(utf81.equals(utf8));
+ @SuppressWarnings({"rawtypes"})
Map m0 = new HashMap();
m0.put("str", utf8);
baos.reset();
@@ -56,6 +58,7 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {
}
result = baos.toByteArray();
try (JavaBinCodec jbc = new JavaBinCodec()) {
+ @SuppressWarnings({"rawtypes"})
Map m1 = (Map) jbc
.setReadStringAsCharSeq(true)
.unmarshal(new ByteArrayInputStream(result));
@@ -64,7 +67,9 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {
}
}
+ @SuppressWarnings({"unchecked"})
public void testUnMarshal() throws IOException {
+ @SuppressWarnings({"rawtypes"})
NamedList nl = new NamedList();
String str = " The value!";
for (int i = 0; i < 5; i++) {
@@ -88,6 +93,7 @@ public class Utf8CharSequenceTest extends SolrTestCaseJ4 {
}
byte[] bytes = baos.toByteArray();
+ @SuppressWarnings({"rawtypes"})
NamedList nl1;
try (JavaBinCodec jbc = new JavaBinCodec()) {
nl1 = (NamedList) jbc