SOLR-14573: Fix or suppress warnings in solrj/src/test

This commit is contained in:
Erick Erickson 2020-06-16 13:27:53 -04:00
parent 87a3bef50f
commit 6357b3bdaa
66 changed files with 561 additions and 78 deletions

View File

@ -350,6 +350,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.

View File

@ -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())

View File

@ -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")) {

View File

@ -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)");

View File

@ -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");

View File

@ -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();

View File

@ -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());

View File

@ -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));

View File

@ -92,13 +92,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");
@ -109,13 +112,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<>();
@ -140,6 +144,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testWithCollection() {
@SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.createFromCollectionMap(1,
(Map) loadFromResource("testWithCollection.json"),
ImmutableSet.of("node1", "node2", "node3", "node4", "node5"));
@ -181,9 +186,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'}," +
@ -194,6 +201,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) {
@ -209,6 +217,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);
@ -231,6 +240,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testWithCollectionSuggestions() {
@SuppressWarnings({"unchecked"})
ClusterState clusterState =
ClusterState.createFromCollectionMap(1,
(Map) loadFromResource("testWithCollectionSuggestions.json"),
@ -273,9 +283,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}," +
@ -287,6 +299,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" ]" +
"}");
@SuppressWarnings({"unchecked"})
List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(new AutoScalingConfig(policies),
new DelegatingCloudManager(null) {
@Override
@ -323,6 +336,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testWithCollectionMoveVsAddSuggestions() throws IOException {
@SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.createFromCollectionMap(1,
(Map) loadFromResource("testWithCollectionMoveVsAddSuggestions.json"),
ImmutableSet.of("node1", "node2", "node3", "node4", "node5", "node6"));
@ -364,9 +378,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}," +
@ -378,6 +394,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
" ]" +
"}");
@SuppressWarnings({"unchecked"})
List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(new AutoScalingConfig(policies),
new DelegatingCloudManager(null) {
@Override
@ -429,6 +446,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
public void testWithCollectionMoveReplica() {
@SuppressWarnings({"unchecked"})
ClusterState clusterState = ClusterState.createFromCollectionMap(1,
(Map) loadFromResource("testWithCollectionMoveReplica.json"),
ImmutableSet.of("node2", "node3", "node4", "node5"));
@ -470,9 +488,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'}," +
@ -483,6 +503,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) {
@ -499,6 +520,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",
@ -847,6 +869,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
};
@SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'minimize': 'cores', 'precision': 50}" +
@ -855,6 +878,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) {
@ -981,13 +1005,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':{" +
@ -1148,6 +1175,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) -> {
@ -1169,6 +1197,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) {
@ -1191,6 +1220,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@Override
@SuppressWarnings({"unchecked"})
public Set<String> getLiveNodes() {
return new HashSet<>((Collection<String>) m.get("liveNodes"));
}
@ -1202,12 +1232,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;
}
@ -1216,6 +1248,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
};
}
@SuppressWarnings({"unchecked", "rawtypes"})
public void testPolicyWithReplicaType() {
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
@ -1298,12 +1331,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)
@ -1311,6 +1346,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"));
@ -1342,6 +1378,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testMultipleCollections() {
@SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@ -1373,18 +1410,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;
@ -1441,6 +1481,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;
@ -1480,6 +1521,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
public void testMerge() {
@SuppressWarnings({"rawtypes"})
Map map = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@ -1517,6 +1559,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);
@ -1546,6 +1589,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);
@ -1553,6 +1597,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
assertEquals("sysprop.rack", clauses.get(0).tag.getName());
}
@SuppressWarnings({"unchecked", "rawtypes"})
public void testRules() {
String rules = "{" +
"cluster-policy:[" +
@ -1627,6 +1672,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 = " {" +
@ -1645,6 +1691,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
"}";
@SuppressWarnings({"rawtypes"})
Map policies = (Map) Utils.fromJSONString("{" +
" 'cluster-preferences': [" +
" { 'maximize': 'freedisk', 'precision': 50}," +
@ -1655,7 +1702,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
@ -1731,17 +1780,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();
@ -1774,6 +1826,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}," +
@ -1781,10 +1834,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();
@ -1807,6 +1862,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
assertEquals("node2", op.getParams().get("node"));
}
@SuppressWarnings({"unchecked", "rawtypes"})
public void testMoveReplica() {
String autoscaleJson = "{" +
" 'cluster-policy':[" +
@ -1838,6 +1894,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," +
@ -1846,9 +1903,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
@ -1868,6 +1927,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);
}
@ -1876,6 +1936,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);
}
@ -1927,12 +1988,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) {
@ -1976,11 +2039,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();
@ -2038,7 +2103,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@Override
public SolrResponse request(SolrRequest req) {
public SolrResponse request(@SuppressWarnings({"rawtypes"})SolrRequest req) {
return null;
}
@ -2054,6 +2119,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," +
@ -2089,6 +2155,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);
@ -2136,6 +2203,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}," +
@ -2171,6 +2239,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);
@ -2182,10 +2251,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()
@ -2218,10 +2289,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);
@ -2241,6 +2314,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());
@ -2258,6 +2332,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@SuppressWarnings({"unchecked", "rawtypes"})
public void testReplicaPercentage() {
List<Map> l = (List<Map>) loadFromResource("testReplicaPercentage.json");
String autoScalingjson = " { cluster-policy:[" +
@ -2300,6 +2375,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@SuppressWarnings({"unchecked"})
public void testReplicaZonesPercentage() {
String autoScalingjson = " { cluster-policy:[" +
" { replica :'33%', shard: '#EACH', sysprop.az : east}," +
@ -2317,6 +2393,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"))
@ -2347,7 +2424,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){
@ -2387,6 +2466,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@SuppressWarnings({"unchecked"})
public void testFreeDiskSuggestions() {
String autoScalingjson = " { cluster-policy:[" +
" { replica :'0', freedisk:'<1000'}," +
@ -2456,6 +2536,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());
@ -2495,6 +2576,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());
@ -2528,6 +2610,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());
@ -2544,6 +2627,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)
@ -2572,6 +2656,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}," +
@ -2591,6 +2676,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",
@ -2634,6 +2720,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);
@ -2675,6 +2762,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);
@ -2693,6 +2781,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);
@ -2711,6 +2800,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);
@ -2729,6 +2819,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}, " +
@ -2788,6 +2879,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();
@ -2808,6 +2900,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
}
@SuppressWarnings({"unchecked"})
public void testFreediskPercentage() {
String autoScalingjson = "{" +
@ -2845,6 +2938,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) -> {
@ -2887,6 +2981,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);
@ -2912,6 +3007,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) {
@ -2929,6 +3025,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"));
}
@ -2950,12 +3047,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;
}
@ -2981,10 +3080,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.createFromCollectionMap(1, clusterStateMap, ImmutableSet.of("node1", "node2"));
List<String> shards = Arrays.asList("shard1", "shard2", "shard3");
@ -3024,11 +3127,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;
@ -3057,6 +3162,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());

View File

@ -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.createFromCollectionMap(0, map, liveNodes);
@ -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");

View File

@ -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"));

View File

@ -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 {

View File

@ -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")

View File

@ -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) {

View File

@ -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));

View File

@ -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()) {

View File

@ -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) {

View File

@ -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)

View File

@ -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)));
@ -104,11 +107,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);

View File

@ -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));

View File

@ -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()) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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

View File

@ -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()) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
@ -2897,6 +2898,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"));
@ -3275,7 +3277,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);
@ -3663,13 +3665,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))) {
@ -3683,7 +3686,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);
}
@ -3719,7 +3722,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);
}

View File

@ -422,14 +422,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);
@ -532,14 +535,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);
@ -2323,6 +2329,7 @@ public void testParallelRankStream() throws Exception {
* streaming expression to only consider data found on the local node.
*/
@Test
@SuppressWarnings({"unchecked"})
public void streamLocalTests() throws Exception {
new UpdateRequest()
@ -2611,7 +2618,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) {
@ -2647,9 +2654,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) {
@ -2660,13 +2669,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))) {

View File

@ -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));

View File

@ -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 {

View File

@ -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));

View File

@ -63,6 +63,7 @@ public class TemporalEvaluatorsTest {
StreamFactory factory;
Map<String, Object> values;
@SuppressWarnings({"unchecked"})
public TemporalEvaluatorsTest() {
super();

View File

@ -37,6 +37,7 @@ public class ConcatOperationTest extends SolrTestCase {
StreamFactory factory;
Map<String, Object> values;
@SuppressWarnings({"unchecked"})
public ConcatOperationTest() {
super();

View File

@ -37,6 +37,7 @@ public class OperationsTest extends SolrTestCase {
StreamFactory factory;
Map<String, Object> values;
@SuppressWarnings({"unchecked"})
public OperationsTest() {
super();

View File

@ -63,9 +63,11 @@ public class SchemaTest extends RestTestBase {
private static void assertFailedSchemaResponse(ThrowingRunnable runnable, String expectedErrorMessage) {
BaseHttpSolrClient.RemoteExecutionException e = expectThrows(BaseHttpSolrClient.RemoteExecutionException.class, runnable);
@SuppressWarnings({"rawtypes"})
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));
}

View File

@ -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));

View File

@ -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) {

View File

@ -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")

View File

@ -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"));

View File

@ -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++) {

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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(

View File

@ -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();
}

View File

@ -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");

View File

@ -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());

View File

@ -132,7 +132,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");
@ -197,9 +197,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"));

View File

@ -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++) {

View File

@ -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) {

View File

@ -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");

View File

@ -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;

View File

@ -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));

View File

@ -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);

View File

@ -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