mirror of https://github.com/apache/lucene.git
SOLR-14542: Fix or suppress warnings in solr/handler/dataimport
This commit is contained in:
parent
aca95a1ec6
commit
f96488180c
|
@ -300,6 +300,8 @@ Other Changes
|
|||
* SOLR-13492: Ensure explicit GCs are concurrent by adding '+ExplicitGCInvokesConcurrent'.
|
||||
(Guna Sekhar Dora, Shawn Heisey, Munendra S N)
|
||||
|
||||
* SOLR-14542: Fix or suppress warnings in solr/handler/dataimport (Erick Erickson)
|
||||
|
||||
================== 8.5.2 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -253,6 +253,7 @@ public class MailEntityProcessor extends EntityProcessorBase {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void addPartToDocument(Part part, Map<String,Object> row, boolean outerMost) throws Exception {
|
||||
if (part instanceof Message) {
|
||||
addEnvelopeToDocument(part, row);
|
||||
|
|
|
@ -132,6 +132,7 @@ public class TikaEntityProcessor extends EntityProcessorBase {
|
|||
public Map<String, Object> nextRow() {
|
||||
if(done) return null;
|
||||
Map<String, Object> row = new HashMap<>();
|
||||
@SuppressWarnings({"unchecked"})
|
||||
DataSource<InputStream> dataSource = context.getDataSource();
|
||||
InputStream is = dataSource.getData(context.getResolvedEntityAttribute(URL));
|
||||
ContentHandler contentHandler = null;
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ClobTransformer extends Transformer {
|
|||
srcCol = column;
|
||||
Object o = aRow.get(srcCol);
|
||||
if (o instanceof List) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
List<Clob> inputs = (List<Clob>) o;
|
||||
List<String> results = new ArrayList<>();
|
||||
for (Object input : inputs) {
|
||||
|
|
|
@ -102,6 +102,7 @@ public abstract class Context {
|
|||
* @see org.apache.solr.handler.dataimport.DataSource
|
||||
* @see #getDataSource(String)
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public abstract DataSource getDataSource();
|
||||
|
||||
/**
|
||||
|
@ -112,6 +113,7 @@ public abstract class Context {
|
|||
* @return a new DataSource instance
|
||||
* @see org.apache.solr.handler.dataimport.DataSource
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public abstract DataSource getDataSource(String name);
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@ public class ContextImpl extends Context {
|
|||
|
||||
private VariableResolver resolver;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private DataSource ds;
|
||||
|
||||
private String currProcess;
|
||||
|
@ -57,7 +58,7 @@ public class ContextImpl extends Context {
|
|||
|
||||
|
||||
public ContextImpl(EntityProcessorWrapper epw, VariableResolver resolver,
|
||||
DataSource ds, String currProcess,
|
||||
@SuppressWarnings({"rawtypes"})DataSource ds, String currProcess,
|
||||
Map<String, Object> global, ContextImpl parentContext, DocBuilder docBuilder) {
|
||||
this.epw = epw;
|
||||
this.docBuilder = docBuilder;
|
||||
|
@ -83,6 +84,7 @@ public class ContextImpl extends Context {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public List<Map<String, String>> getAllEntityFields() {
|
||||
return epw==null || epw.getEntity() == null ? Collections.EMPTY_LIST : epw.getEntity().getAllFieldsList();
|
||||
}
|
||||
|
@ -93,6 +95,7 @@ public class ContextImpl extends Context {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public DataSource getDataSource() {
|
||||
if (ds != null) return ds;
|
||||
if(epw==null) { return null; }
|
||||
|
@ -108,6 +111,7 @@ public class ContextImpl extends Context {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public DataSource getDataSource(String name) {
|
||||
return dataImporter.getDataSourceInstance(epw==null ? null : epw.getEntity(), name, this);
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void init(NamedList args) {
|
||||
|
||||
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||
super.init(args);
|
||||
Map<String,String> macro = new HashMap<>();
|
||||
macro.put("expandMacros", "false");
|
||||
|
@ -131,6 +131,7 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
}
|
||||
}
|
||||
SolrParams params = req.getParams();
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList defaultParams = (NamedList) initArgs.get("defaults");
|
||||
RequestInfo requestParams = new RequestInfo(req, getParamsMap(params), contentStream);
|
||||
String command = requestParams.getCommand();
|
||||
|
@ -242,7 +243,7 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
SolrParams reqParams = req.getParams();
|
||||
String writerClassStr = null;
|
||||
if (reqParams != null && reqParams.get(PARAM_WRITER_IMPL) != null) {
|
||||
writerClassStr = (String) reqParams.get(PARAM_WRITER_IMPL);
|
||||
writerClassStr = reqParams.get(PARAM_WRITER_IMPL);
|
||||
}
|
||||
DIHWriter writer;
|
||||
if (writerClassStr != null
|
||||
|
@ -252,6 +253,7 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<DIHWriter> writerClass = DocBuilder.loadClass(writerClassStr, req.getCore());
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Constructor<DIHWriter> cnstr = writerClass.getConstructor(new Class[] {
|
||||
UpdateRequestProcessor.class, SolrQueryRequest.class});
|
||||
return cnstr.newInstance((Object) processor, (Object) req);
|
||||
|
|
|
@ -142,6 +142,7 @@ public class DataImporter {
|
|||
String name = defaultParams.getName(position);
|
||||
if (name.equals("datasource")) {
|
||||
success = true;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList dsConfig = (NamedList) defaultParams.getVal(position);
|
||||
log.info("Getting configuration for Global Datasource...");
|
||||
Map<String,String> props = new HashMap<>();
|
||||
|
@ -361,6 +362,7 @@ public class DataImporter {
|
|||
return store.get(key);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public DataSource getDataSourceInstance(Entity key, String name, Context ctx) {
|
||||
Map<String,String> p = requestLevelDataSourceProps.get(name);
|
||||
if (p == null)
|
||||
|
@ -373,6 +375,7 @@ public class DataImporter {
|
|||
throw new DataImportHandlerException(SEVERE,
|
||||
"No dataSource :" + name + " available for entity :" + key.getName());
|
||||
String type = p.get(TYPE);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
DataSource dataSrc = null;
|
||||
if (type == null) {
|
||||
dataSrc = new JdbcDataSource();
|
||||
|
@ -493,11 +496,13 @@ public class DataImporter {
|
|||
Map<String, String> getStatusMessages() {
|
||||
//this map object is a Collections.synchronizedMap(new LinkedHashMap()). if we
|
||||
// synchronize on the object it must be safe to iterate through the map
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map statusMessages = (Map) retrieve(STATUS_MSGS);
|
||||
Map<String, String> result = new LinkedHashMap<>();
|
||||
if (statusMessages != null) {
|
||||
synchronized (statusMessages) {
|
||||
for (Object o : statusMessages.entrySet()) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map.Entry e = (Map.Entry) o;
|
||||
//the toString is taken because some of the Objects create the data lazily when toString() is called
|
||||
result.put((String) e.getKey(), e.getValue().toString());
|
||||
|
@ -524,6 +529,7 @@ public class DataImporter {
|
|||
/**
|
||||
* used by tests.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Map<String, Evaluator> getEvaluators(List<Map<String,String>> fn) {
|
||||
Map<String, Evaluator> evaluators = new HashMap<>();
|
||||
evaluators.put(Evaluator.DATE_FORMAT_EVALUATOR, new DateFormatEvaluator());
|
||||
|
|
|
@ -68,6 +68,7 @@ public class DateFormatTransformer extends Transformer {
|
|||
try {
|
||||
Object o = aRow.get(srcCol);
|
||||
if (o instanceof List) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List inputs = (List) o;
|
||||
List<Date> results = new ArrayList<>();
|
||||
for (Object input : inputs) {
|
||||
|
|
|
@ -44,6 +44,7 @@ import java.util.Stack;
|
|||
class DebugLogger {
|
||||
private Stack<DebugInfo> debugStack;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList output;
|
||||
// private final SolrWriter writer1;
|
||||
|
||||
|
@ -54,6 +55,7 @@ class DebugLogger {
|
|||
|
||||
boolean enabled = true;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public DebugLogger() {
|
||||
// writer = solrWriter;
|
||||
output = new NamedList();
|
||||
|
@ -75,6 +77,7 @@ class DebugLogger {
|
|||
return debugStack.isEmpty() ? null : debugStack.peek();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void log(DIHLogLevels event, String name, Object row) {
|
||||
if (event == DIHLogLevels.DISABLE_LOGGING) {
|
||||
enabled = false;
|
||||
|
@ -150,9 +153,12 @@ class DebugLogger {
|
|||
}
|
||||
}
|
||||
|
||||
private void addToNamedList(NamedList nl, Object row) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void addToNamedList(@SuppressWarnings({"rawtypes"})NamedList nl, Object row) {
|
||||
if (row instanceof List) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List list = (List) row;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList l = new NamedList();
|
||||
nl.add(null, l);
|
||||
for (Object o : list) {
|
||||
|
@ -167,6 +173,7 @@ class DebugLogger {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
DataSource wrapDs(final DataSource ds) {
|
||||
return new DataSource() {
|
||||
@Override
|
||||
|
@ -236,6 +243,7 @@ class DebugLogger {
|
|||
}
|
||||
|
||||
static String getTransformerName(Transformer t) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Class transClass = t.getClass();
|
||||
if (t instanceof EntityProcessorWrapper.ReflectionTransformer) {
|
||||
return ((EntityProcessorWrapper.ReflectionTransformer) t).trans;
|
||||
|
@ -256,12 +264,14 @@ class DebugLogger {
|
|||
|
||||
int tCount, rowCount;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList lst;
|
||||
|
||||
DIHLogLevels type;
|
||||
|
||||
DebugInfo parent;
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public DebugInfo(String name, DIHLogLevels type, DebugInfo parent) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
|
|
|
@ -66,7 +66,7 @@ public class DocBuilder {
|
|||
|
||||
private EntityProcessorWrapper currentEntityProcessorWrapper;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private Map statusMessages = Collections.synchronizedMap(new LinkedHashMap());
|
||||
|
||||
public Statistics importStatistics = new Statistics();
|
||||
|
@ -157,6 +157,7 @@ public class DocBuilder {
|
|||
|
||||
private void invokeEventListener(String className, Exception lastException) {
|
||||
try {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
EventListener listener = (EventListener) loadClass(className, dataImporter.getCore()).getConstructor().newInstance();
|
||||
notifyListener(listener, lastException);
|
||||
} catch (Exception e) {
|
||||
|
@ -315,6 +316,7 @@ public class DocBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
void handleError(String message, Exception e) {
|
||||
if (!dataImporter.getCore().getCoreContainer().isZooKeeperAware()) {
|
||||
writer.rollback();
|
||||
|
@ -595,6 +597,7 @@ public class DocBuilder {
|
|||
Object value = arow.get(DELETE_DOC_BY_ID);
|
||||
if (value != null) {
|
||||
if (value instanceof Collection) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Collection collection = (Collection) value;
|
||||
for (Object o : collection) {
|
||||
writer.deleteDoc(o.toString());
|
||||
|
@ -608,6 +611,7 @@ public class DocBuilder {
|
|||
value = arow.get(DELETE_DOC_BY_QUERY);
|
||||
if (value != null) {
|
||||
if (value instanceof Collection) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Collection collection = (Collection) value;
|
||||
for (Object o : collection) {
|
||||
writer.deleteByQuery(o.toString());
|
||||
|
@ -691,6 +695,7 @@ public class DocBuilder {
|
|||
|
||||
private void addFieldToDoc(Object value, String name, boolean multiValued, DocWrapper doc) {
|
||||
if (value instanceof Collection) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Collection collection = (Collection) value;
|
||||
if (multiValued) {
|
||||
for (Object o : collection) {
|
||||
|
@ -716,6 +721,7 @@ public class DocBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public EntityProcessorWrapper getEntityProcessorWrapper(Entity entity) {
|
||||
EntityProcessor entityProcessor = null;
|
||||
if (entity.getProcessorName() == null) {
|
||||
|
@ -776,7 +782,7 @@ public class DocBuilder {
|
|||
*
|
||||
* @return an iterator to the list of keys for which Solr documents should be updated.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Set<Map<String, Object>> collectDelta(EntityProcessorWrapper epw, VariableResolver resolver,
|
||||
Set<Map<String, Object>> deletedRows) {
|
||||
//someone called abort
|
||||
|
@ -929,7 +935,7 @@ public class DocBuilder {
|
|||
return reqParams;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
static Class loadClass(String name, SolrCore core) throws ClassNotFoundException {
|
||||
try {
|
||||
return core != null ?
|
||||
|
|
|
@ -45,6 +45,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
|
||||
private EntityProcessor delegate;
|
||||
private Entity entity;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private DataSource datasource;
|
||||
private List<EntityProcessorWrapper> children = new ArrayList<>();
|
||||
private DocBuilder docBuilder;
|
||||
|
@ -68,7 +69,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
public void init(Context context) {
|
||||
rowcache = null;
|
||||
this.context = context;
|
||||
resolver = (VariableResolver) context.getVariableResolver();
|
||||
resolver = context.getVariableResolver();
|
||||
if (entityName == null) {
|
||||
onError = resolver.replaceTokens(context.getEntityAttribute(ON_ERROR));
|
||||
if (onError == null) onError = ABORT;
|
||||
|
@ -110,6 +111,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
continue;
|
||||
}
|
||||
try {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Class clazz = DocBuilder.loadClass(trans, context.getSolrCore());
|
||||
if (Transformer.class.isAssignableFrom(clazz)) {
|
||||
transformers.add((Transformer) clazz.getConstructor().newInstance());
|
||||
|
@ -153,13 +155,14 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
static class ReflectionTransformer extends Transformer {
|
||||
final Method meth;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
final Class clazz;
|
||||
|
||||
final String trans;
|
||||
|
||||
final Object o;
|
||||
|
||||
public ReflectionTransformer(Method meth, Class clazz, String trans)
|
||||
public ReflectionTransformer(Method meth, @SuppressWarnings({"rawtypes"})Class clazz, String trans)
|
||||
throws Exception {
|
||||
this.meth = meth;
|
||||
this.clazz = clazz;
|
||||
|
@ -195,7 +198,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
Map<String, Object> transformedRow = row;
|
||||
List<Map<String, Object>> rows = null;
|
||||
boolean stopTransform = checkStopTransform(row);
|
||||
VariableResolver resolver = (VariableResolver) context.getVariableResolver();
|
||||
VariableResolver resolver = context.getVariableResolver();
|
||||
for (Transformer t : transformers) {
|
||||
if (stopTransform) break;
|
||||
try {
|
||||
|
@ -207,6 +210,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
if (o == null)
|
||||
continue;
|
||||
if (o instanceof Map) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map oMap = (Map) o;
|
||||
stopTransform = checkStopTransform(oMap);
|
||||
tmpRows.add((Map) o);
|
||||
|
@ -223,6 +227,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
if (o == null)
|
||||
return null;
|
||||
if (o instanceof Map) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map oMap = (Map) o;
|
||||
stopTransform = checkStopTransform(oMap);
|
||||
transformedRow = (Map) o;
|
||||
|
@ -251,7 +256,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
|
||||
}
|
||||
|
||||
private boolean checkStopTransform(Map oMap) {
|
||||
private boolean checkStopTransform(@SuppressWarnings({"rawtypes"})Map oMap) {
|
||||
return oMap.get("$stopTransform") != null
|
||||
&& Boolean.parseBoolean(oMap.get("$stopTransform").toString());
|
||||
}
|
||||
|
@ -313,7 +318,7 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
}
|
||||
|
||||
public VariableResolver getVariableResolver() {
|
||||
return (VariableResolver) context.getVariableResolver();
|
||||
return context.getVariableResolver();
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
|
@ -333,11 +338,12 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
return children;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public DataSource getDatasource() {
|
||||
return datasource;
|
||||
}
|
||||
|
||||
public void setDatasource(DataSource datasource) {
|
||||
public void setDatasource(@SuppressWarnings({"rawtypes"})DataSource datasource) {
|
||||
this.datasource = datasource;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public class HTMLStripTransformer extends Transformer {
|
|||
|
||||
if (tmpVal instanceof List) {
|
||||
List<String> inputs = (List<String>) tmpVal;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List results = new ArrayList();
|
||||
for (String input : inputs) {
|
||||
if (input == null)
|
||||
|
|
|
@ -189,6 +189,7 @@ public class JdbcDataSource extends
|
|||
// the class loader of the class which is trying to make the connection.
|
||||
// This is a workaround for cases where the user puts the driver jar in the
|
||||
// solr.home/lib or solr.home/core/lib directories.
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Driver d = (Driver) DocBuilder.loadClass(driver, context.getSolrCore()).getConstructor().newInstance();
|
||||
c = d.connect(url, initProps);
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public class NumberFormatTransformer extends Transformer {
|
|||
|
||||
if (val instanceof List) {
|
||||
List<String> inputs = (List) val;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List results = new ArrayList();
|
||||
for (String input : inputs) {
|
||||
try {
|
||||
|
|
|
@ -45,6 +45,7 @@ public class PlainTextEntityProcessor extends EntityProcessorBase {
|
|||
@Override
|
||||
public Map<String, Object> nextRow() {
|
||||
if (ended) return null;
|
||||
@SuppressWarnings({"unchecked"})
|
||||
DataSource<Reader> ds = context.getDataSource();
|
||||
String url = context.replaceTokens(context.getEntityAttribute(URL));
|
||||
Reader r = null;
|
||||
|
|
|
@ -43,7 +43,7 @@ public class RegexTransformer extends Transformer {
|
|||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Object> transformRow(Map<String, Object> row,
|
||||
Context ctx) {
|
||||
List<Map<String, String>> fields = ctx.getAllEntityFields();
|
||||
|
@ -135,7 +135,7 @@ public class RegexTransformer extends Transformer {
|
|||
return l;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private Object readfromRegExp(String reStr, String value, String columnName, String gNames) {
|
||||
String[] groupNames = null;
|
||||
if(gNames != null && gNames.trim().length() >0){
|
||||
|
|
|
@ -94,6 +94,7 @@ public class TemplateTransformer extends Transformer {
|
|||
return row;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void addToRow(String key, Map<String, Object> row, Object value) {
|
||||
Object prevVal = row.get(key);
|
||||
if (prevVal != null) {
|
||||
|
|
|
@ -184,6 +184,7 @@ public class XPathEntityProcessor extends EntityProcessorBase {
|
|||
}
|
||||
}
|
||||
String url = context.getEntityAttribute(URL);
|
||||
@SuppressWarnings({"unchecked"})
|
||||
List<String> l = url == null ? Collections.EMPTY_LIST : resolver.getVariables(url);
|
||||
for (String s : l) {
|
||||
if (s.startsWith(entityName + ".")) {
|
||||
|
@ -268,7 +269,7 @@ public class XPathEntityProcessor extends EntityProcessorBase {
|
|||
Object val = context.getSessionAttribute(name, Context.SCOPE_ENTITY);
|
||||
if (val != null) namespace.put(name, val);
|
||||
}
|
||||
((VariableResolver)context.getVariableResolver()).addNamespace(entityName, namespace);
|
||||
context.getVariableResolver().addNamespace(entityName, namespace);
|
||||
}
|
||||
|
||||
private void addCommonFields(Map<String, Object> r) {
|
||||
|
@ -284,6 +285,7 @@ public class XPathEntityProcessor extends EntityProcessorBase {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void initQuery(String s) {
|
||||
Reader data = null;
|
||||
try {
|
||||
|
@ -358,6 +360,7 @@ public class XPathEntityProcessor extends EntityProcessorBase {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected Map<String, Object> readRow(Map<String, Object> record, String xpath) {
|
||||
if (useSolrAddXml) {
|
||||
List<String> names = (List<String>) record.get("name");
|
||||
|
@ -367,9 +370,11 @@ public class XPathEntityProcessor extends EntityProcessorBase {
|
|||
if (row.containsKey(names.get(i))) {
|
||||
Object existing = row.get(names.get(i));
|
||||
if (existing instanceof List) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List list = (List) existing;
|
||||
list.add(values.get(i));
|
||||
} else {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List list = new ArrayList();
|
||||
list.add(existing);
|
||||
list.add(values.get(i));
|
||||
|
|
|
@ -585,6 +585,7 @@ public class XPathRecordReader {
|
|||
* records values. If a fields value is a List then they have to be
|
||||
* deep-copied for thread safety
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static Map<String, Object> getDeepCopy(Map<String, Object> values) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : values.entrySet()) {
|
||||
|
|
|
@ -81,7 +81,7 @@ public class AbstractDIHCacheTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public int compareTo(ControlData cd) {
|
||||
Comparable c1 = (Comparable) data[0];
|
||||
Comparable c2 = (Comparable) cd.data[0];
|
||||
|
|
|
@ -115,6 +115,7 @@ public abstract class AbstractDataImportHandlerTestCase extends
|
|||
* @param extraParams any extra request parameters needed to be passed to DataImportHandler
|
||||
* @throws Exception in case of any error
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected void runFullImport(String dataConfig, Map<String, String> extraParams) throws Exception {
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("command", "full-import");
|
||||
|
@ -123,6 +124,7 @@ public abstract class AbstractDataImportHandlerTestCase extends
|
|||
params.put("clean", "true");
|
||||
params.put("commit", "true");
|
||||
params.putAll(extraParams);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList l = new NamedList();
|
||||
for (Map.Entry<String, String> e : params.entrySet()) {
|
||||
l.add(e.getKey(),e.getValue());
|
||||
|
@ -136,7 +138,7 @@ public abstract class AbstractDataImportHandlerTestCase extends
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static TestContext getContext(EntityProcessorWrapper parent,
|
||||
VariableResolver resolver, DataSource parentDataSource,
|
||||
VariableResolver resolver, @SuppressWarnings({"rawtypes"})DataSource parentDataSource,
|
||||
String currProcess, final List<Map<String, String>> entityFields,
|
||||
final Map<String, String> entityAttrs) {
|
||||
if (resolver == null) resolver = new VariableResolver();
|
||||
|
@ -150,7 +152,7 @@ public abstract class AbstractDataImportHandlerTestCase extends
|
|||
* Strings at even index are keys, odd-index strings are values in the
|
||||
* returned map
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static Map createMap(Object... args) {
|
||||
return Utils.makeMap(args);
|
||||
}
|
||||
|
@ -217,6 +219,7 @@ public abstract class AbstractDataImportHandlerTestCase extends
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public DataSource getDataSource() {
|
||||
return delegate.getDataSource();
|
||||
}
|
||||
|
@ -257,7 +260,7 @@ public abstract class AbstractDataImportHandlerTestCase extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource(String name) {
|
||||
@SuppressWarnings({"rawtypes"})public DataSource getDataSource(String name) {
|
||||
return delegate.getDataSource(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class MockInitialContextFactory implements InitialContextFactory {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public javax.naming.Context getInitialContext(Hashtable env) {
|
||||
public javax.naming.Context getInitialContext(@SuppressWarnings({"rawtypes"})Hashtable env) {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.*;
|
|||
* @see org.apache.solr.handler.dataimport.ClobTransformer
|
||||
* @since solr 1.4
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public class TestClobTransformer extends AbstractDataImportHandlerTestCase {
|
||||
@Test
|
||||
public void simple() throws Exception {
|
||||
|
@ -45,6 +46,7 @@ public class TestClobTransformer extends AbstractDataImportHandlerTestCase {
|
|||
Context ctx = getContext(null, new VariableResolver(), null, Context.FULL_DUMP, flds, Collections.EMPTY_MAP);
|
||||
Transformer t = new ClobTransformer();
|
||||
Map<String, Object> row = new HashMap<>();
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Clob clob = (Clob) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{Clob.class}, new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
|
|
|
@ -44,6 +44,7 @@ public class TestDataConfig extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDataConfigWithDataSource() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
|
|
@ -52,6 +52,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void singleEntityNoRows() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(dc_singleEntity);
|
||||
|
@ -71,6 +72,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testDeltaImportNoRows_MustNotCommit() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(dc_deltaConfig);
|
||||
|
@ -93,6 +95,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void singleEntityOneRow() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(dc_singleEntity);
|
||||
|
@ -122,6 +125,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testImportCommand() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(dc_singleEntity);
|
||||
|
@ -142,7 +146,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
assertEquals(1, di.getDocBuilder().importStatistics.rowsCount.get());
|
||||
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
Map<String, Object> map = (Map<String, Object>) l.get(i);
|
||||
Map<String, Object> map = l.get(i);
|
||||
SolrInputDocument doc = swi.docs.get(i);
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
assertEquals(entry.getValue(), doc.getFieldValue(entry.getKey()));
|
||||
|
@ -151,6 +155,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void singleEntityMultipleRows() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(dc_singleEntity);
|
||||
|
@ -170,7 +175,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
assertEquals(Boolean.TRUE, swi.finishCalled);
|
||||
assertEquals(3, swi.docs.size());
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
Map<String, Object> map = (Map<String, Object>) l.get(i);
|
||||
Map<String, Object> map = l.get(i);
|
||||
SolrInputDocument doc = swi.docs.get(i);
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
assertEquals(entry.getValue(), doc.getFieldValue(entry.getKey()));
|
||||
|
@ -183,6 +188,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void templateXPath() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(dc_variableXpath);
|
||||
|
|
|
@ -46,6 +46,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testSingleEntity() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -62,6 +63,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testSingleEntity_CaseInsensitive() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desC", "one"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -76,7 +78,9 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testErrorHandler() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "FORCE_ERROR", "true"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -90,6 +94,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDynamicFields() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -103,6 +108,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testRequestParamsAsVariable() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "101", "desc", "ApacheSolr"));
|
||||
MockDataSource.setIterator("select * from books where category='search'", rows.iterator());
|
||||
|
@ -118,6 +124,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDynamicFieldNames() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("mypk", "101", "text", "ApacheSolr"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -132,6 +139,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testRequestParamsAsFieldName() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("mypk", "101", "text", "ApacheSolr"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -147,6 +155,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testContext() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
@ -157,6 +166,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testSkipDoc() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
rows.add(createMap("id", "2", "desc", "two", DocBuilder.SKIP_DOC, "true"));
|
||||
|
@ -169,7 +179,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public void testSkipRow() throws Exception {
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
|
@ -206,6 +216,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testStopTransform() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
rows.add(createMap("id", "2", "desc", "two", "$stopTransform", "true"));
|
||||
|
@ -219,7 +230,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public void testDeleteDocs() throws Exception {
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
|
@ -269,6 +280,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
|||
public void testFileListEntityProcessor_lastIndexTime() throws Exception {
|
||||
File tmpdir = createTempDir().toFile();
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Map<String, String> params = createMap("baseDir", tmpdir.getAbsolutePath());
|
||||
|
||||
createFile(tmpdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), true);
|
||||
|
|
|
@ -46,6 +46,7 @@ public class TestEphemeralCache extends AbstractDataImportHandlerTestCase {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setupMockData() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List parentRows = new ArrayList();
|
||||
parentRows.add(createMap("id", new BigDecimal("1"), "parent_s", "one"));
|
||||
parentRows.add(createMap("id", new BigDecimal("2"), "parent_s", "two"));
|
||||
|
@ -53,6 +54,7 @@ public class TestEphemeralCache extends AbstractDataImportHandlerTestCase {
|
|||
parentRows.add(createMap("id", new BigDecimal("4"), "parent_s", "four"));
|
||||
parentRows.add(createMap("id", new BigDecimal("5"), "parent_s", "five"));
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List child1Rows = new ArrayList();
|
||||
child1Rows.add(createMap("id", new BigDecimal("6"), "child1a_mult_s", "this is the number six."));
|
||||
child1Rows.add(createMap("id", new BigDecimal("5"), "child1a_mult_s", "this is the number five."));
|
||||
|
@ -65,6 +67,7 @@ public class TestEphemeralCache extends AbstractDataImportHandlerTestCase {
|
|||
child1Rows.add(createMap("id", new BigDecimal("1"), "child1a_mult_s", "uno"));
|
||||
child1Rows.add(createMap("id", new BigDecimal("2"), "child1b_s", "CHILD1B", "child1a_mult_s", "this is the number two."));
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List child2Rows = new ArrayList();
|
||||
child2Rows.add(createMap("id", new BigDecimal("6"), "child2a_mult_s", "Child 2 says, 'this is the number six.'"));
|
||||
child2Rows.add(createMap("id", new BigDecimal("5"), "child2a_mult_s", "Child 2 says, 'this is the number five.'"));
|
||||
|
|
|
@ -80,6 +80,7 @@ public class TestErrorHandling extends AbstractDataImportHandlerTestCase {
|
|||
assertQ(req("*:*"), "//*[@numFound='0']");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testTransformerErrorContinue() throws Exception {
|
||||
StringDataSource.xml = wellformedXml;
|
||||
List<Map<String, Object>> rows = new ArrayList<>();
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.Map;
|
|||
public class TestFieldReader extends AbstractDataImportHandlerTestCase {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void simple() {
|
||||
DataImporter di = new DataImporter();
|
||||
di.loadAndInit(config);
|
||||
|
|
|
@ -50,6 +50,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
|||
createFile(tmpdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), false);
|
||||
createFile(tmpdir, "b.xml", "b.xml".getBytes(StandardCharsets.UTF_8), false);
|
||||
createFile(tmpdir, "c.props", "c.props".getBytes(StandardCharsets.UTF_8), false);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
FileListEntityProcessor.FILE_NAME, "xml$",
|
||||
FileListEntityProcessor.BASE_DIR, tmpdir.getAbsolutePath());
|
||||
|
@ -68,6 +69,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testBiggerSmallerFiles() throws IOException {
|
||||
File tmpdir = createTempDir().toFile();
|
||||
|
||||
|
@ -91,6 +93,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
|||
minLength = content.length;
|
||||
smallestFile = "c.props";
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
FileListEntityProcessor.FILE_NAME, ".*",
|
||||
FileListEntityProcessor.BASE_DIR, tmpdir.getAbsolutePath(),
|
||||
|
@ -120,7 +123,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static List<String> getFiles(VariableResolver resolver, Map attrs) {
|
||||
static List<String> getFiles(VariableResolver resolver, @SuppressWarnings({"rawtypes"})Map attrs) {
|
||||
Context c = getContext(null,
|
||||
resolver, null, Context.FULL_DUMP, Collections.EMPTY_LIST, attrs);
|
||||
FileListEntityProcessor fileListEntityProcessor = new FileListEntityProcessor();
|
||||
|
@ -137,12 +140,14 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
|||
|
||||
@SuppressForbidden(reason = "Needs currentTimeMillis to set last modified time")
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testNTOT() throws IOException {
|
||||
File tmpdir = createTempDir().toFile();
|
||||
|
||||
createFile(tmpdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), true);
|
||||
createFile(tmpdir, "b.xml", "b.xml".getBytes(StandardCharsets.UTF_8), true);
|
||||
createFile(tmpdir, "c.props", "c.props".getBytes(StandardCharsets.UTF_8), true);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
FileListEntityProcessor.FILE_NAME, "xml$",
|
||||
FileListEntityProcessor.BASE_DIR, tmpdir.getAbsolutePath(),
|
||||
|
@ -178,6 +183,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa
|
|||
createFile(childdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), true);
|
||||
createFile(childdir, "b.xml", "b.xml".getBytes(StandardCharsets.UTF_8), true);
|
||||
createFile(childdir, "c.props", "c.props".getBytes(StandardCharsets.UTF_8), true);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
FileListEntityProcessor.FILE_NAME, "^.*\\.xml$",
|
||||
FileListEntityProcessor.BASE_DIR, childdir.getAbsolutePath(),
|
||||
|
|
|
@ -48,7 +48,7 @@ public class TestJdbcDataSourceConvertType extends AbstractDataImportHandlerTest
|
|||
convertTypeTest("true", Long.class);
|
||||
}
|
||||
|
||||
private void convertTypeTest(String convertType, Class resultClass) throws Throwable {
|
||||
private void convertTypeTest(String convertType, @SuppressWarnings({"rawtypes"})Class resultClass) throws Throwable {
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
Properties p = new Properties();
|
||||
p.put("driver", "org.apache.derby.jdbc.EmbeddedDriver");
|
||||
|
|
|
@ -42,12 +42,14 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase {
|
|||
* />
|
||||
*/
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
LineEntityProcessor.URL, "dummy.lis",
|
||||
LineEntityProcessor.ACCEPT_LINE_REGEX, null,
|
||||
LineEntityProcessor.SKIP_LINE_REGEX, null
|
||||
);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Context c = getContext(
|
||||
null, //parentEntity
|
||||
new VariableResolver(), //resolver
|
||||
|
@ -82,12 +84,14 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase {
|
|||
* acceptLineRegex="xml"
|
||||
* />
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
LineEntityProcessor.URL, "dummy.lis",
|
||||
LineEntityProcessor.ACCEPT_LINE_REGEX, "xml",
|
||||
LineEntityProcessor.SKIP_LINE_REGEX, null
|
||||
);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Context c = getContext(
|
||||
null, //parentEntity
|
||||
new VariableResolver(), //resolver
|
||||
|
@ -120,12 +124,14 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase {
|
|||
* omitLineRegex="\\.xsd"
|
||||
* />
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
LineEntityProcessor.URL, "dummy.lis",
|
||||
LineEntityProcessor.ACCEPT_LINE_REGEX, "\\.xml",
|
||||
LineEntityProcessor.SKIP_LINE_REGEX, "\\.xsd"
|
||||
);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Context c = getContext(
|
||||
null, //parentEntity
|
||||
new VariableResolver(), //resolver
|
||||
|
@ -157,11 +163,13 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase {
|
|||
* omitLineRegex="\\.xsd"
|
||||
* />
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map attrs = createMap(
|
||||
LineEntityProcessor.URL, "dummy.lis",
|
||||
LineEntityProcessor.SKIP_LINE_REGEX, "\\.xsd"
|
||||
);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Context c = getContext(
|
||||
null, //parentEntity
|
||||
new VariableResolver(), //resolver
|
||||
|
|
|
@ -46,6 +46,7 @@ public class TestPlainTextEntityProcessor extends AbstractDataImportHandlerTestC
|
|||
redirectTempProperties(di);
|
||||
|
||||
TestDocBuilder.SolrWriterImpl sw = new TestDocBuilder.SolrWriterImpl();
|
||||
@SuppressWarnings({"unchecked"})
|
||||
RequestInfo rp = new RequestInfo(null, createMap("command", "full-import"), null);
|
||||
di.runCmd(rp, sw);
|
||||
assertEquals(DS.s, sw.docs.get(0).getFieldValue("x"));
|
||||
|
@ -142,12 +143,14 @@ public class TestPlainTextEntityProcessor extends AbstractDataImportHandlerTestC
|
|||
redirectTempProperties(di);
|
||||
|
||||
TestDocBuilder.SolrWriterImpl sw = new TestDocBuilder.SolrWriterImpl();
|
||||
@SuppressWarnings({"unchecked"})
|
||||
RequestInfo rp = new RequestInfo(null, createMap("command", "full-import"), null);
|
||||
di.runCmd(rp, sw);
|
||||
assertEquals(DS.s, sw.docs.get(0).getFieldValue("plainText"));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static class DS extends DataSource {
|
||||
static String s = "hello world";
|
||||
|
||||
|
|
|
@ -69,12 +69,15 @@ public class TestRegexTransformer extends AbstractDataImportHandlerTestCase {
|
|||
assertEquals("Noble", result.get("firstName"));
|
||||
assertEquals("Paul", result.get("lastName"));
|
||||
src= new HashMap<>();
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
List<String> l= new ArrayList();
|
||||
l.add("Mr Noble Paul") ;
|
||||
l.add("Mr Shalin Mangar") ;
|
||||
src.put("fullName", l);
|
||||
result = new RegexTransformer().transformRow(src, context);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List l1 = (List) result.get("firstName");
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List l2 = (List) result.get("lastName");
|
||||
assertEquals("Noble", l1.get(0));
|
||||
assertEquals("Shalin", l1.get(1));
|
||||
|
@ -150,6 +153,7 @@ public class TestRegexTransformer extends AbstractDataImportHandlerTestCase {
|
|||
|
||||
VariableResolver resolver = new VariableResolver();
|
||||
resolver.addNamespace("e", row);
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Map<String, String> eAttrs = createMap("name", "e");
|
||||
Context context = getContext(null, resolver, null, Context.FULL_DUMP, fields, eAttrs);
|
||||
|
||||
|
@ -175,6 +179,7 @@ public class TestRegexTransformer extends AbstractDataImportHandlerTestCase {
|
|||
ArrayList<String> strings = new ArrayList<>();
|
||||
strings.add("hello");
|
||||
strings.add("world");
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Map<String, Object> result = new RegexTransformer().transformRow(createMap("person", strings), context);
|
||||
assertEquals(strings,result.get("participant"));
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ public class TestScriptTransformer extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testCheckScript() throws Exception {
|
||||
try {
|
||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
|
||||
|
@ -137,13 +138,14 @@ public class TestScriptTransformer extends AbstractDataImportHandlerTestCase {
|
|||
DIHConfiguration dc = di.readFromXml(document);
|
||||
Context c = getContext("checkNextToken", dc.getScript().getText());
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map map = new HashMap();
|
||||
map.put("nextToken", "hello");
|
||||
EntityProcessorWrapper sep = new EntityProcessorWrapper(new SqlEntityProcessor(), null, null);
|
||||
sep.init(c);
|
||||
sep.applyTransformer(map);
|
||||
assertEquals("true", map.get("$hasMore"));
|
||||
map = new HashMap();
|
||||
map = new HashMap<>();
|
||||
map.put("nextToken", "");
|
||||
sep.applyTransformer(map);
|
||||
assertNull(map.get("$hasMore"));
|
||||
|
|
|
@ -87,7 +87,7 @@ public class TestSolrEntityProcessorUnit extends AbstractDataImportHandlerTestCa
|
|||
Map<String, Object> next = processor.nextRow();
|
||||
assertNotNull(next);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
List<Comparable> multiField = (List<Comparable>) next.get("description");
|
||||
assertEquals(testDoc.getValues("description").size(), multiField.size());
|
||||
assertEquals(testDoc.getValues("description"), multiField);
|
||||
|
@ -161,6 +161,7 @@ public class TestSolrEntityProcessorUnit extends AbstractDataImportHandlerTestCa
|
|||
types.add(new FldType(ID, ONE_ONE, new SVal('A', 'Z', 4, 40)));
|
||||
types.add(new FldType("description", new IRange(1, 3), new SVal('a', 'c', 1, 1)));
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Set<Comparable> previousIds = new HashSet<>();
|
||||
List<Doc> docs = new ArrayList<>(numDocs);
|
||||
for (int i = 0; i < numDocs; i++) {
|
||||
|
|
|
@ -36,6 +36,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testTransformRow() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List fields = new ArrayList();
|
||||
fields.add(createMap("column", "firstName"));
|
||||
fields.add(createMap("column", "lastName"));
|
||||
|
@ -52,6 +53,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase {
|
|||
TemplateTransformer.TEMPLATE,"Mr ${e.name}"));
|
||||
|
||||
List<String> mails = Arrays.asList("a@b.com", "c@d.com");
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map row = createMap(
|
||||
"firstName", "Shalin",
|
||||
"middleName", "Shekhar",
|
||||
|
@ -73,6 +75,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testTransformRowMultiValue() {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List fields = new ArrayList();
|
||||
fields.add(createMap("column", "year"));
|
||||
fields.add(createMap("column", "month"));
|
||||
|
@ -89,6 +92,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase {
|
|||
TemplateTransformer.TEMPLATE,
|
||||
"${e.year}-${e.month}-${e.day}" ));
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map row = createMap( "year", "2016",
|
||||
"month", "Apr",
|
||||
"day", "30" );
|
||||
|
|
|
@ -146,6 +146,7 @@ public class TestVariableResolver extends AbstractDataImportHandlerTestCase {
|
|||
m.put("class", E.class.getName());
|
||||
l.add(m);
|
||||
resolver.setEvaluators(new DataImporter().getEvaluators(l));
|
||||
@SuppressWarnings({"unchecked"})
|
||||
ContextImpl context = new ContextImpl(null, resolver, null,
|
||||
Context.FULL_DUMP, Collections.EMPTY_MAP, null, null);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public class TestWriterImpl extends AbstractDataImportHandlerTestCase {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDataConfigWithDataSource() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "desc", "one"));
|
||||
rows.add(createMap("id", "2", "desc", "two"));
|
||||
|
@ -51,6 +52,7 @@ public class TestWriterImpl extends AbstractDataImportHandlerTestCase {
|
|||
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map extraParams = createMap("writerImpl", TestSolrWriter.class.getName(),
|
||||
"commit", "true");
|
||||
runFullImport(loadDataConfig("data-config-with-datasource.xml"),
|
||||
|
|
|
@ -42,12 +42,15 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
|||
int rowsToRead = -1;
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void withFieldsAndXpath() throws Exception {
|
||||
File tmpdir = createTempDir().toFile();
|
||||
|
||||
createFile(tmpdir, "x.xsl", xsl.getBytes(StandardCharsets.UTF_8), false);
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map entityAttrs = createMap("name", "e", "url", "cd.xml",
|
||||
XPathEntityProcessor.FOR_EACH, "/catalog/cd");
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List fields = new ArrayList();
|
||||
fields.add(createMap("column", "title", "xpath", "/catalog/cd/title"));
|
||||
fields.add(createMap("column", "artist", "xpath", "/catalog/cd/artist"));
|
||||
|
@ -70,9 +73,12 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testMultiValued() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map entityAttrs = createMap("name", "e", "url", "testdata.xml",
|
||||
XPathEntityProcessor.FOR_EACH, "/root");
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List fields = new ArrayList();
|
||||
fields.add(createMap("column", "a", "xpath", "/root/a", DataImporter.MULTI_VALUED, "true"));
|
||||
Context c = getContext(null,
|
||||
|
@ -86,6 +92,7 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
|||
break;
|
||||
result.add(row);
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List l = (List)result.get(0).get("a");
|
||||
assertEquals(3, l.size());
|
||||
assertEquals("1", l.get(0));
|
||||
|
@ -216,9 +223,12 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testMultiValuedFlatten() throws Exception {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map entityAttrs = createMap("name", "e", "url", "testdata.xml",
|
||||
XPathEntityProcessor.FOR_EACH, "/root");
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List fields = new ArrayList();
|
||||
fields.add(createMap("column", "a", "xpath", "/root/a" ,"flatten","true"));
|
||||
Context c = getContext(null,
|
||||
|
@ -236,12 +246,15 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void withFieldsAndXpathStream() throws Exception {
|
||||
final Object monitor = new Object();
|
||||
final boolean[] done = new boolean[1];
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map entityAttrs = createMap("name", "e", "url", "cd.xml",
|
||||
XPathEntityProcessor.FOR_EACH, "/catalog/cd", "stream", "true", "batchSize","1");
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List fields = new ArrayList();
|
||||
fields.add(createMap("column", "title", "xpath", "/catalog/cd/title"));
|
||||
fields.add(createMap("column", "artist", "xpath", "/catalog/cd/artist"));
|
||||
|
@ -331,11 +344,13 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void withDefaultSolrAndXsl() throws Exception {
|
||||
File tmpdir = createTempDir().toFile();
|
||||
AbstractDataImportHandlerTestCase.createFile(tmpdir, "x.xsl", xsl.getBytes(StandardCharsets.UTF_8),
|
||||
false);
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map entityAttrs = createMap("name", "e",
|
||||
XPathEntityProcessor.USE_SOLR_ADD_SCHEMA, "true", "xsl", ""
|
||||
+ new File(tmpdir, "x.xsl").toURI(), "url", "cd.xml");
|
||||
|
|
|
@ -510,6 +510,7 @@ public class TestXPathRecordReader extends AbstractDataImportHandlerTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testPutNullTest(){
|
||||
String xml = "<root>\n" +
|
||||
" <i>\n" +
|
||||
|
|
|
@ -95,6 +95,7 @@ public class TestZKPropertiesWriter extends AbstractDataImportHandlerTestCase {
|
|||
|
||||
@SuppressForbidden(reason = "Needs currentTimeMillis to construct date stamps")
|
||||
@Test
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void testZKPropertiesWriter() throws Exception {
|
||||
// test using ZooKeeper
|
||||
assertTrue("Not using ZooKeeper", h.getCoreContainer().isZooKeeperAware());
|
||||
|
@ -121,6 +122,7 @@ public class TestZKPropertiesWriter extends AbstractDataImportHandlerTestCase {
|
|||
props.put("last_index_time", oneSecondAgo);
|
||||
spw.persist(props);
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("id", "1", "year_s", "2013"));
|
||||
MockDataSource.setIterator("select " + df.format(oneSecondAgo) + " from dummy", rows.iterator());
|
||||
|
|
Loading…
Reference in New Issue