mirror of https://github.com/apache/lucene.git
SOLR-14455: Fix or suppress warnings in solr/test-framework
This commit is contained in:
parent
9728f4ef20
commit
07a203628e
|
@ -325,7 +325,9 @@ Other Changes
|
|||
|
||||
* SOLR-14548: Address warning: static member should be qualified by type name (Mike Drob)
|
||||
|
||||
* SOLR-14547: Fix or suppress warnings in solr/client/solrj/io/stream
|
||||
* SOLR-14547: Fix or suppress warnings in solr/client/solrj/io/stream (Erick Erickson)
|
||||
|
||||
* SOLR-14455: Fix or suppress warnings in solr/test-framework (Erick Erickson)
|
||||
|
||||
================== 8.5.2 ==================
|
||||
|
||||
|
|
|
@ -737,17 +737,21 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
return f == null ? 0 : f;
|
||||
}
|
||||
|
||||
public static String compare(NamedList a, NamedList b, int flags, Map<String, Integer> handle) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static String compare(@SuppressWarnings({"rawtypes"})NamedList a,
|
||||
@SuppressWarnings({"rawtypes"})NamedList b, int flags, Map<String, Integer> handle) {
|
||||
// System.out.println("resp a:" + a);
|
||||
// System.out.println("resp b:" + b);
|
||||
boolean ordered = (flags & UNORDERED) == 0;
|
||||
|
||||
if (!ordered) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map mapA = new HashMap(a.size());
|
||||
for (int i=0; i<a.size(); i++) {
|
||||
Object prev = mapA.put(a.getName(i), a.getVal(i));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map mapB = new HashMap(b.size());
|
||||
for (int i=0; i<b.size(); i++) {
|
||||
Object prev = mapB.put(b.getName(i), b.getVal(i));
|
||||
|
@ -814,7 +818,9 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static String compare1(Map a, Map b, int flags, Map<String, Integer> handle) {
|
||||
public static String compare1(@SuppressWarnings({"rawtypes"})Map a,
|
||||
@SuppressWarnings({"rawtypes"})Map b,
|
||||
int flags, Map<String, Integer> handle) {
|
||||
String cmp;
|
||||
|
||||
for (Object keya : a.keySet()) {
|
||||
|
@ -832,7 +838,9 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static String compare(Map a, Map b, int flags, Map<String, Integer> handle) {
|
||||
public static String compare(@SuppressWarnings({"rawtypes"})Map a,
|
||||
@SuppressWarnings({"rawtypes"})Map b,
|
||||
int flags, Map<String, Integer> handle) {
|
||||
String cmp;
|
||||
cmp = compare1(a, b, flags, handle);
|
||||
if (cmp != null) return cmp;
|
||||
|
@ -1071,6 +1079,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void callStatement() throws Throwable {
|
||||
RandVal.uniqueValues = new HashSet(); // reset random values
|
||||
fixShardCount(numShards);
|
||||
|
@ -1098,6 +1107,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void callStatement() throws Throwable {
|
||||
|
||||
for (shardCount = min; shardCount <= max; shardCount++) {
|
||||
|
@ -1155,7 +1165,9 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
/* no-op */
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static abstract class RandVal {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static Set uniqueValues = new HashSet();
|
||||
|
||||
public abstract Object val();
|
||||
|
|
|
@ -105,6 +105,7 @@ public class JSONTestUtil {
|
|||
|
||||
@Override
|
||||
public void addKeyVal(Object map, Object key, Object val) throws IOException {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Object prev = ((Map<Object, Object>) map).put(key, val);
|
||||
if (prev != null) {
|
||||
throw new RuntimeException("REPEATED JSON OBJECT KEY: key=" + key + " prevValue=" + prev + " thisValue" + val);
|
||||
|
@ -259,7 +260,9 @@ class CollectionTester {
|
|||
}
|
||||
|
||||
boolean matchList() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List expectedList = (List)expected;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List v = asList();
|
||||
if (v == null) return false;
|
||||
int a = 0;
|
||||
|
@ -290,6 +293,7 @@ class CollectionTester {
|
|||
|
||||
private static Set<String> reserved = new HashSet<>(Arrays.asList("_SKIP_","_MATCH_","_ORDERED_","_UNORDERED_"));
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
boolean matchMap() {
|
||||
Map<String,Object> expectedMap = (Map<String,Object>)expected;
|
||||
Map<String,Object> v = asMap();
|
||||
|
@ -397,6 +401,7 @@ class CollectionTester {
|
|||
return seek(pathList);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List asList() {
|
||||
// TODO: handle native arrays
|
||||
if (val instanceof List) {
|
||||
|
@ -406,6 +411,7 @@ class CollectionTester {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Map<String,Object> asMap() {
|
||||
// TODO: handle NamedList
|
||||
if (val instanceof Map) {
|
||||
|
@ -420,6 +426,7 @@ class CollectionTester {
|
|||
String seg = seekPath.get(0);
|
||||
|
||||
if (seg.charAt(0)=='[') {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List listVal = asList();
|
||||
if (listVal==null) return false;
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ public class SolrTestCaseHS extends SolrTestCaseJ4 {
|
|||
return s;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static <T> T rand(T... vals) {
|
||||
return vals[ random().nextInt(vals.length) ];
|
||||
}
|
||||
|
@ -109,9 +110,13 @@ public class SolrTestCaseHS extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
|
||||
public static Object createDocObjects(Map<Comparable, Doc> fullModel, Comparator sort, int rows, Collection<String> fieldNames) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static Object createDocObjects(@SuppressWarnings({"rawtypes"})Map<Comparable, Doc> fullModel,
|
||||
@SuppressWarnings({"rawtypes"})Comparator sort, int rows,
|
||||
Collection<String> fieldNames) {
|
||||
List<Doc> docList = new ArrayList<>(fullModel.values());
|
||||
Collections.sort(docList, sort);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List sortedDocs = new ArrayList(rows);
|
||||
for (Doc doc : docList) {
|
||||
if (sortedDocs.size() >= rows) break;
|
||||
|
@ -122,7 +127,8 @@ public class SolrTestCaseHS extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
|
||||
public static void compare(SolrQueryRequest req, String path, Object model, Map<Comparable, Doc> fullModel) throws Exception {
|
||||
public static void compare(SolrQueryRequest req, String path, Object model,
|
||||
@SuppressWarnings({"rawtypes"})Map<Comparable, Doc> fullModel) throws Exception {
|
||||
String strResponse = h.query(req);
|
||||
|
||||
Object realResponse = ObjectBuilder.fromJSON(strResponse);
|
||||
|
|
|
@ -446,7 +446,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
private static Map<String, Level> savedClassLogLevels = new HashMap<>();
|
||||
|
||||
public static void initClassLogLevels() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Class currentClass = RandomizedContext.current().getTargetClass();
|
||||
@SuppressWarnings({"unchecked"})
|
||||
LogLevel annotation = (LogLevel) currentClass.getAnnotation(LogLevel.class);
|
||||
if (annotation == null) {
|
||||
return;
|
||||
|
@ -1292,6 +1294,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
return msp;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static Map map(Object... params) {
|
||||
LinkedHashMap ret = new LinkedHashMap();
|
||||
for (int i=0; i<params.length; i+=2) {
|
||||
|
@ -1442,6 +1445,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
* Appends to the <code>out</code> array with JSON from the <code>doc</code>.
|
||||
* Doesn't currently handle boosts, but does recursively handle child documents
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static void json(SolrInputDocument doc, CharArr out) {
|
||||
try {
|
||||
out.append('{');
|
||||
|
@ -1576,7 +1580,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
params = mparams;
|
||||
}
|
||||
String response = updateJ(jsonAdd(sdoc), params);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map rsp = (Map)ObjectBuilder.fromJSON(response);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List lst = (List)rsp.get("adds");
|
||||
if (lst == null || lst.size() == 0) return null;
|
||||
return (Long) lst.get(1);
|
||||
|
@ -1589,7 +1595,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
params = mparams;
|
||||
}
|
||||
String response = updateJ(jsonDelId(id), params);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map rsp = (Map)ObjectBuilder.fromJSON(response);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List lst = (List)rsp.get("deletes");
|
||||
if (lst == null || lst.size() == 0) return null;
|
||||
return (Long) lst.get(1);
|
||||
|
@ -1602,7 +1610,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
params = mparams;
|
||||
}
|
||||
String response = updateJ(jsonDelQ(q), params);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map rsp = (Map)ObjectBuilder.fromJSON(response);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List lst = (List)rsp.get("deleteByQuery");
|
||||
if (lst == null || lst.size() == 0) return null;
|
||||
return (Long) lst.get(1);
|
||||
|
@ -1613,8 +1623,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public abstract static class Vals {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public abstract Comparable get();
|
||||
public String toJSON(Comparable val) {
|
||||
public String toJSON(@SuppressWarnings({"rawtypes"})Comparable val) {
|
||||
return JSONUtil.toJSON(val);
|
||||
}
|
||||
|
||||
|
@ -1641,6 +1652,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable get() {
|
||||
return getInt();
|
||||
}
|
||||
|
@ -1667,6 +1679,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable get() {
|
||||
return getInt();
|
||||
}
|
||||
|
@ -1686,6 +1699,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable get() {
|
||||
return getFloat();
|
||||
}
|
||||
|
@ -1694,6 +1708,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
public static class BVal extends Vals {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable get() {
|
||||
return random().nextBoolean();
|
||||
}
|
||||
|
@ -1717,6 +1732,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable get() {
|
||||
char[] arr = new char[between(minLength,maxLength)];
|
||||
for (int i=0; i<arr.length; i++) {
|
||||
|
@ -1730,6 +1746,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
public static final IRange ZERO_TWO = new IRange(0,2);
|
||||
public static final IRange ONE_ONE = new IRange(1,1);
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static class Doc implements Comparable {
|
||||
public Comparable id;
|
||||
public List<Fld> fields;
|
||||
|
@ -1754,12 +1771,14 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public int compareTo(Object o) {
|
||||
if (!(o instanceof Doc)) return this.getClass().hashCode() - o.getClass().hashCode();
|
||||
Doc other = (Doc)o;
|
||||
return this.id.compareTo(other.id);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public List<Comparable> getValues(String field) {
|
||||
for (Fld fld : fields) {
|
||||
if (fld.ftype.fname.equals(field)) return fld.vals;
|
||||
|
@ -1767,6 +1786,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable getFirstValue(String field) {
|
||||
List<Comparable> vals = getValues(field);
|
||||
return vals==null || vals.size()==0 ? null : vals.get(0);
|
||||
|
@ -1789,6 +1809,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
|
||||
public static class Fld {
|
||||
public FldType ftype;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public List<Comparable> vals;
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -1811,10 +1832,12 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
this.vals = vals;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Comparable createValue() {
|
||||
return vals.get();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public List<Comparable> createValues() {
|
||||
int nVals = numValues.getInt();
|
||||
if (nVals <= 0) return null;
|
||||
|
@ -1825,6 +1848,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
public Fld createField() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List<Comparable> vals = createValues();
|
||||
if (vals == null) return null;
|
||||
|
||||
|
@ -1846,6 +1870,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
});
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Map<Comparable,Doc> indexDocs(List<FldType> descriptor, Map<Comparable,Doc> model, int nDocs) throws Exception {
|
||||
if (model == null) {
|
||||
model = new LinkedHashMap<>();
|
||||
|
@ -1890,6 +1915,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
|
||||
response = ((Map)response).get("response");
|
||||
response = ((Map)response).get("docs");
|
||||
@SuppressWarnings({"unchecked"})
|
||||
List<Map> docList = (List<Map>)response;
|
||||
int order = 0;
|
||||
for (Map doc : docList) {
|
||||
|
@ -1966,6 +1992,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
return new Comparator<Doc>() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private Comparable zeroVal(Comparable template) {
|
||||
if (template == null) return null;
|
||||
if (template instanceof String) return null; // fast-path for string
|
||||
|
@ -1980,8 +2007,11 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public int compare(Doc o1, Doc o2) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Comparable v1 = o1.getFirstValue(field);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Comparable v2 = o2.getFirstValue(field);
|
||||
|
||||
v1 = v1 == null ? zeroVal(v2) : v1;
|
||||
|
@ -2035,7 +2065,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
out.append('[');
|
||||
}
|
||||
boolean firstVal = true;
|
||||
for (Comparable val : fld.vals) {
|
||||
for (@SuppressWarnings({"rawtypes"})Comparable val : fld.vals) {
|
||||
if (firstVal) firstVal=false;
|
||||
else out.append(',');
|
||||
out.append(JSONUtil.toJSON(val));
|
||||
|
@ -2052,6 +2082,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
/** Return a Map from field value to a list of document ids */
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public Map<Comparable, List<Comparable>> invertField(Map<Comparable, Doc> model, String field) {
|
||||
Map<Comparable, List<Comparable>> value_to_id = new HashMap<>();
|
||||
|
||||
|
@ -2344,12 +2375,16 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
if (!(sdoc2.get(key2).getFirstValue() instanceof SolrInputDocument)) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Collection col1 = (Collection) val1;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Collection col2 = (Collection) val2;
|
||||
if (col1.size() != col2.size()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Iterator<SolrInputDocument> colIter1 = col1.iterator();
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Iterator<SolrInputDocument> colIter2 = col2.iterator();
|
||||
while (colIter1.hasNext()) {
|
||||
if (!compareSolrInputDocument(colIter1.next(), colIter2.next())) {
|
||||
|
@ -2552,7 +2587,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
}
|
||||
|
||||
public static CloudSolrClientBuilder newCloudSolrClient(String zkHost) {
|
||||
return (CloudSolrClientBuilder) new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty());
|
||||
return new CloudSolrClientBuilder(Collections.singletonList(zkHost), Optional.empty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2916,6 +2951,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
System.clearProperty(SYSTEM_PROPERTY_SOLR_DISABLE_SHARDS_WHITELIST);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected <T> T pickRandom(T... options) {
|
||||
return options[random().nextInt(options.length)];
|
||||
}
|
||||
|
@ -2980,6 +3016,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
* @lucene.experimental
|
||||
* @lucene.internal
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static void randomizeNumericTypesProperties() {
|
||||
|
||||
final boolean useDV = random().nextBoolean();
|
||||
|
@ -3043,7 +3080,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
org.apache.solr.schema.PointField.TEST_HACK_IGNORE_USELESS_TRIEFIELD_ARGS = false;
|
||||
System.clearProperty("solr.tests.numeric.points");
|
||||
System.clearProperty("solr.tests.numeric.points.dv");
|
||||
for (Class c : RANDOMIZED_NUMERIC_FIELDTYPES.keySet()) {
|
||||
for (@SuppressWarnings({"rawtypes"})Class c : RANDOMIZED_NUMERIC_FIELDTYPES.keySet()) {
|
||||
System.clearProperty("solr.tests." + c.getSimpleName() + "FieldType");
|
||||
}
|
||||
private_RANDOMIZED_NUMERIC_FIELDTYPES.clear();
|
||||
|
@ -3059,6 +3096,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
|
||||
private static boolean isChildDoc(Object o) {
|
||||
if(o instanceof Collection) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Collection col = (Collection) o;
|
||||
if(col.size() == 0) {
|
||||
return false;
|
||||
|
@ -3068,6 +3106,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
return o instanceof SolrInputDocument;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static final Map<Class,String> private_RANDOMIZED_NUMERIC_FIELDTYPES = new HashMap<>();
|
||||
|
||||
/**
|
||||
|
@ -3079,6 +3118,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
|
|||
*
|
||||
* @see #randomizeNumericTypesProperties
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected static final Map<Class,String> RANDOMIZED_NUMERIC_FIELDTYPES
|
||||
= Collections.unmodifiableMap(private_RANDOMIZED_NUMERIC_FIELDTYPES);
|
||||
|
||||
|
|
|
@ -386,7 +386,9 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
protected List<JettySolrRunner> createJettys(int numJettys) throws Exception {
|
||||
List<JettySolrRunner> jettys = Collections.synchronizedList(new ArrayList<>());
|
||||
List<SolrClient> clients = Collections.synchronizedList(new ArrayList<>());
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List<CollectionAdminRequest> createReplicaRequests = Collections.synchronizedList(new ArrayList<>());
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List<CollectionAdminRequest> createPullReplicaRequests = Collections.synchronizedList(new ArrayList<>());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
@ -522,7 +524,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
|
||||
customThreadPool = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrNamedThreadFactory("createReplicaRequests"));
|
||||
|
||||
for (CollectionAdminRequest r : createReplicaRequests) {
|
||||
for (@SuppressWarnings({"rawtypes"})CollectionAdminRequest r : createReplicaRequests) {
|
||||
customThreadPool.submit(() -> {
|
||||
CollectionAdminResponse response;
|
||||
try {
|
||||
|
@ -540,7 +542,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
|
||||
customThreadPool = ExecutorUtil
|
||||
.newMDCAwareCachedThreadPool(new SolrNamedThreadFactory("createPullReplicaRequests"));
|
||||
for (CollectionAdminRequest r : createPullReplicaRequests) {
|
||||
for (@SuppressWarnings({"rawtypes"})CollectionAdminRequest r : createPullReplicaRequests) {
|
||||
customThreadPool.submit(() -> {
|
||||
CollectionAdminResponse response;
|
||||
try {
|
||||
|
@ -1801,6 +1803,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
collectionInfos.put(collectionName, list);
|
||||
}
|
||||
params.set("name", collectionName);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
SolrRequest request = new QueryRequest(params);
|
||||
request.setPath("/admin/collections");
|
||||
|
||||
|
@ -2403,6 +2406,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
static RequestStatusState getRequestState(String requestId, SolrClient client) throws IOException, SolrServerException {
|
||||
CollectionAdminResponse response = getStatusResponse(requestId, client);
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList innerResponse = (NamedList) response.getResponse().get("status");
|
||||
return RequestStatusState.fromKey((String) innerResponse.get("state"));
|
||||
}
|
||||
|
|
|
@ -48,23 +48,28 @@ public class CloudInspectUtil {
|
|||
* @param bDeleteFails null or list of the ids of deletes that failed for b
|
||||
* @return true if the difference in a and b is legal
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static boolean checkIfDiffIsLegal(SolrDocumentList a,
|
||||
SolrDocumentList b, String aName, String bName, Set<String> bAddFails,
|
||||
Set<String> bDeleteFails) {
|
||||
boolean legal = true;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Set<Map> setA = new HashSet<>();
|
||||
for (SolrDocument sdoc : a) {
|
||||
setA.add(new HashMap(sdoc));
|
||||
setA.add(new HashMap<>(sdoc));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Set<Map> setB = new HashSet<>();
|
||||
for (SolrDocument sdoc : b) {
|
||||
setB.add(new HashMap(sdoc));
|
||||
setB.add(new HashMap<>(sdoc));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Set<Map> onlyInA = new HashSet<>(setA);
|
||||
onlyInA.removeAll(setB);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Set<Map> onlyInB = new HashSet<>(setB);
|
||||
onlyInB.removeAll(setA);
|
||||
|
||||
|
@ -75,7 +80,7 @@ public class CloudInspectUtil {
|
|||
System.err.println("###### Only in " + aName + ": " + onlyInA);
|
||||
System.err.println("###### Only in " + bName + ": " + onlyInB);
|
||||
|
||||
for (Map doc : onlyInA) {
|
||||
for (@SuppressWarnings({"rawtypes"})Map doc : onlyInA) {
|
||||
if (bAddFails == null || !bAddFails.contains(doc.get("id"))) {
|
||||
legal = false;
|
||||
// System.err.println("###### Only in " + aName + ": " + doc.get("id"));
|
||||
|
@ -86,7 +91,7 @@ public class CloudInspectUtil {
|
|||
}
|
||||
}
|
||||
|
||||
for (Map doc : onlyInB) {
|
||||
for (@SuppressWarnings({"rawtypes"})Map doc : onlyInB) {
|
||||
if (bDeleteFails == null || !bDeleteFails.contains(doc.get("id"))) {
|
||||
legal = false;
|
||||
// System.err.println("###### Only in " + bName + ": " + doc.get("id"));
|
||||
|
@ -109,6 +114,7 @@ public class CloudInspectUtil {
|
|||
* @param bName label for the second list
|
||||
* @return the documents only in list a
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static Set<Map> showDiff(SolrDocumentList a, SolrDocumentList b,
|
||||
String aName, String bName) {
|
||||
System.err.println("######" + aName + ": " + toStr(a, 10));
|
||||
|
@ -203,6 +209,7 @@ public class CloudInspectUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Set<Map> differences = CloudInspectUtil.showDiff(controlDocList, cloudDocList,
|
||||
"controlDocList", "cloudDocList");
|
||||
|
||||
|
@ -213,7 +220,7 @@ public class CloudInspectUtil {
|
|||
// use filter() to allow being parsed as 'terms in set' query instead of a (weighted/scored)
|
||||
// BooleanQuery so we don't trip too many boolean clauses
|
||||
StringBuilder ids = new StringBuilder("filter(id:(");
|
||||
for (Map doc : differences) {
|
||||
for (@SuppressWarnings({"rawtypes"})Map doc : differences) {
|
||||
ids.append(" ").append(doc.get("id"));
|
||||
foundId = true;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.solr.common.params.SolrParams;
|
|||
* e.g. to add custom components, handlers, parsers, etc. to an otherwise
|
||||
* generic configset.
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public class ConfigRequest extends SolrRequest {
|
||||
|
||||
protected final String message;
|
||||
|
|
|
@ -64,6 +64,7 @@ public class SolrCloudAuthTestCase extends SolrCloudTestCase {
|
|||
private static final List<String> AUTH_METRICS_TIMER_KEYS = Collections.singletonList("requestTimes");
|
||||
private static final String METRICS_PREFIX_PKI = "SECURITY./authentication/pki.";
|
||||
private static final String METRICS_PREFIX = "SECURITY./authentication.";
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static final Predicate NOT_NULL_PREDICATE = o -> o != null;
|
||||
private static final List<String> AUDIT_METRICS_KEYS = Arrays.asList("count");
|
||||
private static final List<String> AUTH_METRICS_TO_COMPARE = Arrays.asList("requests", "authenticated", "passThrough", "failWrongCredentials", "failMissingCredentials", "errors");
|
||||
|
@ -188,6 +189,7 @@ public class SolrCloudAuthTestCase extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private static void verifySecurityStatus(HttpClient cl, String url, String objPath,
|
||||
Object expected, int count, String authHeader) throws IOException, InterruptedException {
|
||||
boolean success = false;
|
||||
|
@ -198,6 +200,7 @@ public class SolrCloudAuthTestCase extends SolrCloudTestCase {
|
|||
if (authHeader != null) setAuthorizationHeader(get, authHeader);
|
||||
HttpResponse rsp = cl.execute(get);
|
||||
s = EntityUtils.toString(rsp.getEntity());
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map m = null;
|
||||
try {
|
||||
m = (Map) Utils.fromJSONString(s);
|
||||
|
@ -207,6 +210,7 @@ public class SolrCloudAuthTestCase extends SolrCloudTestCase {
|
|||
Utils.consumeFully(rsp.getEntity());
|
||||
Object actual = Utils.getObjectByPath(m, true, hierarchy);
|
||||
if (expected instanceof Predicate) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Predicate predicate = (Predicate) expected;
|
||||
if (predicate.test(actual)) {
|
||||
success = true;
|
||||
|
|
|
@ -234,11 +234,13 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
public Builder withDefaultClusterProperty(String key, String value) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
HashMap<String, Object> defaults = (HashMap<String, Object>) this.clusterProperties.get(CollectionAdminParams.DEFAULTS);
|
||||
if (defaults == null) {
|
||||
defaults = new HashMap<>();
|
||||
this.clusterProperties.put(CollectionAdminParams.DEFAULTS, defaults);
|
||||
}
|
||||
@SuppressWarnings({"unchecked"})
|
||||
HashMap<String, Object> cluster = (HashMap<String, Object>) defaults.get(CollectionAdminParams.CLUSTER);
|
||||
if (cluster == null) {
|
||||
cluster = new HashMap<>();
|
||||
|
@ -447,6 +449,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected NamedList waitForResponse(Predicate<NamedList> predicate, SolrRequest request, int intervalInMillis, int numRetries, String messageOnFail) {
|
||||
log.info("waitForResponse: {}", request);
|
||||
int i = 0;
|
||||
|
|
|
@ -29,7 +29,7 @@ public class MockTracerConfigurator extends TracerConfigurator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,8 +135,9 @@ public @interface RandomizeSSL {
|
|||
/**
|
||||
* Returns an SSLRandomizer suitable for the specified (test) class
|
||||
*/
|
||||
public static final SSLRandomizer getSSLRandomizerForClass(Class clazz) {
|
||||
public static final SSLRandomizer getSSLRandomizerForClass(@SuppressWarnings({"rawtypes"})Class clazz) {
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
final SuppressSSL suppression = (SuppressSSL) clazz.getAnnotation(SuppressSSL.class);
|
||||
if (null != suppression) {
|
||||
// Even if this class has a RandomizeSSL annotation, any usage of SuppressSSL -- even in a
|
||||
|
@ -147,6 +148,7 @@ public @interface RandomizeSSL {
|
|||
return new SSLRandomizer(0.0D, 0.0D, suppression.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
final RandomizeSSL annotation = (RandomizeSSL) clazz.getAnnotation(RandomizeSSL.class);
|
||||
|
||||
if (null == annotation) {
|
||||
|
|
|
@ -274,7 +274,7 @@ public class TestHarness extends BaseTestHarness {
|
|||
}
|
||||
return connection.request(handler, null, xml);
|
||||
} catch (SolrException e) {
|
||||
throw (SolrException)e;
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
|
||||
}
|
||||
|
@ -436,6 +436,7 @@ public class TestHarness extends BaseTestHarness {
|
|||
* Perhaps the best we could do is increment the core reference count
|
||||
* and decrement it in the request close() method?
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public LocalSolrQueryRequest makeRequest(String ... q) {
|
||||
if (q.length==1) {
|
||||
return new LocalSolrQueryRequest(TestHarness.this.getCore(),
|
||||
|
@ -444,10 +445,12 @@ public class TestHarness extends BaseTestHarness {
|
|||
if (q.length%2 != 0) {
|
||||
throw new RuntimeException("The length of the string array (query arguments) needs to be even");
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map.Entry<String, String> [] entries = new NamedListEntry[q.length / 2];
|
||||
for (int i = 0; i < q.length; i += 2) {
|
||||
entries[i/2] = new NamedListEntry<>(q[i], q[i+1]);
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList nl = new NamedList(entries);
|
||||
if(nl.get("wt" ) == null) nl.add("wt","xml");
|
||||
return new LocalSolrQueryRequest(TestHarness.this.getCore(), nl);
|
||||
|
|
Loading…
Reference in New Issue