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