You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jd...@apache.org on 2012/03/22 15:11:17 UTC
svn commit: r1303792 [2/2] - in /lucene/dev/branches/branch_3x/solr:
contrib/dataimporthandler-extras/src/test/org/apache/solr/handler/dataimport/
contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/
contrib/dataimporthandler/src/test...
Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrWriter.java?rev=1303792&r1=1303791&r2=1303792&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrWriter.java (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrWriter.java Thu Mar 22 14:11:16 2012
@@ -26,43 +26,36 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
-import java.util.Properties;
+import java.util.Map;
+import java.util.Set;
/**
- * <p> Writes documents to SOLR as well as provides methods for loading and persisting last index time. </p>
+ * <p> Writes documents to SOLR. </p>
* <p/>
* <b>This API is experimental and may change in the future.</b>
*
* @version $Id$
* @since solr 1.3
*/
-public class SolrWriter {
+public class SolrWriter extends DIHWriterBase implements DIHWriter {
private static final Logger log = LoggerFactory.getLogger(SolrWriter.class);
- static final String IMPORTER_PROPERTIES = "dataimport.properties";
-
static final String LAST_INDEX_KEY = "last_index_time";
private final UpdateRequestProcessor processor;
- private final String configDir;
-
- private String persistFilename = IMPORTER_PROPERTIES;
-
- DebugLogger debugLogger;
-
- public SolrWriter(UpdateRequestProcessor processor, String confDir) {
+ public SolrWriter(UpdateRequestProcessor processor) {
this.processor = processor;
- configDir = confDir;
- }
- public SolrWriter(UpdateRequestProcessor processor, String confDir, String filePrefix) {
- this.processor = processor;
- configDir = confDir;
- if(filePrefix != null){
- persistFilename = filePrefix+".properties";
- }
}
+ public void close() {
+ try {
+ processor.finish();
+ } catch (IOException e) {
+ throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
+ "Unable to call finish() on UpdateRequestProcessor", e);
+ }
+ }
public boolean upload(SolrInputDocument d) {
try {
AddUpdateCommand command = new AddUpdateCommand();
@@ -78,7 +71,7 @@ public class SolrWriter {
return true;
}
-
+
public void deleteDoc(Object id) {
try {
log.info("Deleting document: " + id);
@@ -91,76 +84,8 @@ public class SolrWriter {
log.error("Exception while deleteing: " + id, e);
}
}
-
-
- void persist(Properties p) {
- OutputStream propOutput = null;
-
- Properties props = readIndexerProperties();
-
- try {
- props.putAll(p);
- File persistFile = getPersistFile();
- propOutput = new FileOutputStream(persistFile);
- props.store(propOutput, null);
- log.info("Wrote last indexed time to " + persistFile.getAbsolutePath());
- } catch (FileNotFoundException e) {
- throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
- "Unable to persist Index Start Time", e);
- } catch (IOException e) {
- throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
- "Unable to persist Index Start Time", e);
- } finally {
- try {
- if (propOutput != null)
- propOutput.close();
- } catch (IOException e) {
- propOutput = null;
- }
- }
- }
-
- File getPersistFile() {
- String filePath = configDir;
- if (configDir != null && !configDir.endsWith(File.separator))
- filePath += File.separator;
- filePath += persistFilename;
- return new File(filePath);
- }
-
- void finish() {
- try {
- processor.finish();
- } catch (IOException e) {
- throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
- "Unable to call finish() on UpdateRequestProcessor", e);
- }
- }
-
- Properties readIndexerProperties() {
- Properties props = new Properties();
- InputStream propInput = null;
-
- try {
- propInput = new FileInputStream(configDir
- + persistFilename);
- props.load(propInput);
- log.info("Read " + persistFilename);
- } catch (Exception e) {
- log.warn("Unable to read: " + persistFilename);
- } finally {
- try {
- if (propInput != null)
- propInput.close();
- } catch (IOException e) {
- propInput = null;
- }
- }
-
- return props;
- }
-
- public void deleteByQuery(String query) {
+
+ public void deleteByQuery(String query) {
try {
log.info("Deleting documents from Solr with query: " + query);
DeleteUpdateCommand delCmd = new DeleteUpdateCommand();
@@ -173,7 +98,7 @@ public class SolrWriter {
}
}
- public void commit(boolean optimize) {
+ public void commit(boolean optimize) {
try {
CommitUpdateCommand commit = new CommitUpdateCommand(optimize);
processor.processCommit(commit);
@@ -182,7 +107,7 @@ public class SolrWriter {
}
}
- public void rollback() {
+ public void rollback() {
try {
RollbackUpdateCommand rollback = new RollbackUpdateCommand();
processor.processRollback(rollback);
@@ -191,7 +116,7 @@ public class SolrWriter {
}
}
- public void doDeleteAll() {
+ public void doDeleteAll() {
try {
DeleteUpdateCommand deleteCommand = new DeleteUpdateCommand();
deleteCommand.query = "*:*";
@@ -230,28 +155,7 @@ public class SolrWriter {
return null;
}
}
-
- public DebugLogger getDebugLogger() {
- if (debugLogger == null) {
- debugLogger = new DebugLogger(this);
- }
- return debugLogger;
- }
-
- /**
- * This method is used for verbose debugging
- *
- * @param event The event name start.entity ,end.entity ,transformer.row
- * @param name Name of the entity/transformer
- * @param row The actual data . Can be a Map<String,object> or a List<Map<String,object>>
- */
- public void log(int event, String name, Object row) {
- getDebugLogger().log(event, name, row);
- }
-
- public static final int START_ENTITY = 1, END_ENTITY = 2,
- TRANSFORMED_ROW = 3, ENTITY_META = 4, PRE_TRANSFORMER_ROW = 5,
- START_DOC = 6, END_DOC = 7, ENTITY_OUT = 8, ROW_END = 9,
- TRANSFORMER_EXCEPTION = 10, ENTITY_EXCEPTION = 11, DISABLE_LOGGING = 12,
- ENABLE_LOGGING = 13;
+ public void init(Context context) {
+ /* NO-OP */
+ }
}
Added: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SortedMapBackedCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SortedMapBackedCache.java?rev=1303792&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SortedMapBackedCache.java (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SortedMapBackedCache.java Thu Mar 22 14:11:16 2012
@@ -0,0 +1,186 @@
+package org.apache.solr.handler.dataimport;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+public class SortedMapBackedCache implements DIHCache {
+ private SortedMap<Object,List<Map<String,Object>>> theMap = null;
+ private boolean isOpen = false;
+ private boolean isReadOnly = false;
+ String primaryKeyName = null;
+
+ @SuppressWarnings("unchecked")
+ public void add(Map<String,Object> rec) {
+ checkOpen(true);
+ checkReadOnly();
+
+ if (rec == null || rec.size() == 0) {
+ return;
+ }
+
+ if (primaryKeyName == null) {
+ primaryKeyName = rec.keySet().iterator().next();
+ }
+
+ Object pk = rec.get(primaryKeyName);
+ if (pk instanceof Collection<?>) {
+ Collection<Object> c = (Collection<Object>) pk;
+ if (c.size() != 1) {
+ throw new RuntimeException(
+ "The primary key must have exactly 1 element.");
+ }
+ pk = c.iterator().next();
+ }
+ List<Map<String,Object>> thisKeysRecs = theMap.get(pk);
+ if (thisKeysRecs == null) {
+ thisKeysRecs = new ArrayList<Map<String,Object>>();
+ theMap.put(pk, thisKeysRecs);
+ }
+ thisKeysRecs.add(rec);
+ }
+
+ private void checkOpen(boolean shouldItBe) {
+ if (!isOpen && shouldItBe) {
+ throw new IllegalStateException(
+ "Must call open() before using this cache.");
+ }
+ if (isOpen && !shouldItBe) {
+ throw new IllegalStateException("The cache is already open.");
+ }
+ }
+
+ private void checkReadOnly() {
+ if (isReadOnly) {
+ throw new IllegalStateException("Cache is read-only.");
+ }
+ }
+
+ public void close() {
+ isOpen = false;
+ }
+
+ public void delete(Object key) {
+ checkOpen(true);
+ checkReadOnly();
+ theMap.remove(key);
+ }
+
+ public void deleteAll() {
+ deleteAll(false);
+ }
+
+ private void deleteAll(boolean readOnlyOk) {
+ if (!readOnlyOk) {
+ checkReadOnly();
+ }
+ if (theMap != null) {
+ theMap.clear();
+ }
+ }
+
+ public void destroy() {
+ deleteAll(true);
+ theMap = null;
+ isOpen = false;
+ }
+
+ public void flush() {
+ checkOpen(true);
+ checkReadOnly();
+ }
+
+ public Iterator<Map<String,Object>> iterator(Object key) {
+ checkOpen(true);
+ List<Map<String,Object>> val = theMap.get(key);
+ if (val == null) {
+ return null;
+ }
+ return val.iterator();
+ }
+
+ public Iterator<Map<String,Object>> iterator() {
+ return new Iterator<Map<String,Object>>() {
+ private Iterator<Map.Entry<Object,List<Map<String,Object>>>> theMapIter;
+ private List<Map<String,Object>> currentKeyResult = null;
+ private Iterator<Map<String,Object>> currentKeyResultIter = null;
+
+ {
+ theMapIter = theMap.entrySet().iterator();
+ }
+
+ public boolean hasNext() {
+ if (currentKeyResultIter != null) {
+ if (currentKeyResultIter.hasNext()) {
+ return true;
+ } else {
+ currentKeyResult = null;
+ currentKeyResultIter = null;
+ }
+ }
+
+ Map.Entry<Object,List<Map<String,Object>>> next = null;
+ if (theMapIter.hasNext()) {
+ next = theMapIter.next();
+ currentKeyResult = next.getValue();
+ currentKeyResultIter = currentKeyResult.iterator();
+ if (currentKeyResultIter.hasNext()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Map<String,Object> next() {
+ if (currentKeyResultIter != null) {
+ if (currentKeyResultIter.hasNext()) {
+ return currentKeyResultIter.next();
+ } else {
+ currentKeyResult = null;
+ currentKeyResultIter = null;
+ }
+ }
+
+ Map.Entry<Object,List<Map<String,Object>>> next = null;
+ if (theMapIter.hasNext()) {
+ next = theMapIter.next();
+ currentKeyResult = next.getValue();
+ currentKeyResultIter = currentKeyResult.iterator();
+ if (currentKeyResultIter.hasNext()) {
+ return currentKeyResultIter.next();
+ }
+ }
+ return null;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ public void open(Context context) {
+ checkOpen(false);
+ isOpen = true;
+ if (theMap == null) {
+ theMap = new TreeMap<Object,List<Map<String,Object>>>();
+ }
+
+ String pkName = CachePropertyUtil.getAttributeValueAsString(context,
+ DIHCacheSupport.CACHE_PRIMARY_KEY);
+ if (pkName != null) {
+ primaryKeyName = pkName;
+ }
+ isReadOnly = false;
+ String readOnlyStr = CachePropertyUtil.getAttributeValueAsString(context,
+ DIHCacheSupport.CACHE_READ_ONLY);
+ if ("true".equalsIgnoreCase(readOnlyStr)) {
+ isReadOnly = true;
+ }
+ }
+
+}
Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ThreadedContext.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ThreadedContext.java?rev=1303792&r1=1303791&r2=1303792&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ThreadedContext.java (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ThreadedContext.java Thu Mar 22 14:11:16 2012
@@ -24,17 +24,19 @@ package org.apache.solr.handler.dataimpo
*/
public class ThreadedContext extends ContextImpl{
private DocBuilder.EntityRunner entityRunner;
+ private VariableResolverImpl resolver;
private boolean limitedContext = false;
- public ThreadedContext(DocBuilder.EntityRunner entityRunner, DocBuilder docBuilder) {
+ public ThreadedContext(DocBuilder.EntityRunner entityRunner, DocBuilder docBuilder, VariableResolverImpl resolver) {
super(entityRunner.entity,
- null,//to be fethed realtime
+ resolver,
null,
null,
docBuilder.session,
null,
docBuilder);
this.entityRunner = entityRunner;
+ this.resolver = resolver;
}
@Override
@@ -45,7 +47,7 @@ public class ThreadedContext extends Con
@Override
public Context getParentContext() {
- ThreadedContext ctx = new ThreadedContext(entityRunner.parent, docBuilder);
+ ThreadedContext ctx = new ThreadedContext(entityRunner.parent, docBuilder, resolver);
ctx.limitedContext = true;
return ctx;
}
Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-schema.xml?rev=1303792&r1=1303791&r2=1303792&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-schema.xml (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-schema.xml Thu Mar 22 14:11:16 2012
@@ -274,14 +274,15 @@
EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
Longer patterns will be matched first. if equal size patterns
both match, the first appearing in the schema will be used. -->
- <dynamicField name="*_i" type="sint" indexed="true" stored="true"/>
- <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
- <dynamicField name="*_l" type="slong" indexed="true" stored="true"/>
- <dynamicField name="*_t" type="text" indexed="true" stored="true"/>
- <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
- <dynamicField name="*_f" type="sfloat" indexed="true" stored="true"/>
- <dynamicField name="*_d" type="sdouble" indexed="true" stored="true"/>
- <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
+ <dynamicField name="*_i" type="sint" indexed="true" stored="true"/>
+ <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
+ <dynamicField name="*_mult_s" type="string" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_l" type="slong" indexed="true" stored="true"/>
+ <dynamicField name="*_t" type="text" indexed="true" stored="true"/>
+ <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
+ <dynamicField name="*_f" type="sfloat" indexed="true" stored="true"/>
+ <dynamicField name="*_d" type="sdouble" indexed="true" stored="true"/>
+ <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="random*" type="random" />
Added: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java?rev=1303792&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java Thu Mar 22 14:11:16 2012
@@ -0,0 +1,217 @@
+package org.apache.solr.handler.dataimport;
+
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.rowset.serial.SerialClob;
+
+import org.apache.solr.handler.dataimport.AbstractDataImportHandlerTestCase.TestContext;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+
+public class AbstractDIHCacheTestCase {
+ protected static final Date Feb21_2011 = new Date(1298268000000l);
+ protected final String[] fieldTypes = { "INTEGER", "BIGDECIMAL", "STRING", "STRING", "FLOAT", "DATE", "CLOB" };
+ protected final String[] fieldNames = { "a_id", "PI", "letter", "examples", "a_float", "a_date", "DESCRIPTION" };
+ protected List<ControlData> data = new ArrayList<ControlData>();
+ protected Clob APPLE = null;
+
+ @Before
+ public void setup() {
+ try {
+ APPLE = new SerialClob(new String("Apples grow on trees and they are good to eat.").toCharArray());
+ } catch (SQLException sqe) {
+ Assert.fail("Could not Set up Test");
+ }
+
+ // The first row needs to have all non-null fields,
+ // otherwise we would have to always send the fieldTypes & fieldNames as CacheProperties when building.
+ data = new ArrayList<ControlData>();
+ data.add(new ControlData(new Object[] { new Integer(1), new BigDecimal(Math.PI), "A", "Apple", new Float(1.11), Feb21_2011, APPLE }));
+ data.add(new ControlData(new Object[] { new Integer(2), new BigDecimal(Math.PI), "B", "Ball", new Float(2.22), Feb21_2011, null }));
+ data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Dog", new Float(4.44), Feb21_2011, null }));
+ data.add(new ControlData(new Object[] { new Integer(3), new BigDecimal(Math.PI), "C", "Cookie", new Float(3.33), Feb21_2011, null }));
+ data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Daisy", new Float(4.44), Feb21_2011, null }));
+ data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Drawing", new Float(4.44), Feb21_2011, null }));
+ data.add(new ControlData(new Object[] { new Integer(5), new BigDecimal(Math.PI), "E",
+ Arrays.asList(new String[] { "Eggplant", "Ear", "Elephant", "Engine" }), new Float(5.55), Feb21_2011, null }));
+ }
+
+ @After
+ public void teardown() {
+ APPLE = null;
+ data = null;
+ }
+
+ //A limitation of this test class is that the primary key needs to be the first one in the list.
+ //DIHCaches, however, can handle any field being the primary key.
+ class ControlData implements Comparable<ControlData>, Iterable<Object> {
+ Object[] data;
+
+ ControlData(Object[] data) {
+ this.data = data;
+ }
+
+ @SuppressWarnings("unchecked")
+ public int compareTo(ControlData cd) {
+ Comparable c1 = (Comparable) data[0];
+ Comparable c2 = (Comparable) cd.data[0];
+ return c1.compareTo(c2);
+ }
+
+ public Iterator<Object> iterator() {
+ return Arrays.asList(data).iterator();
+ }
+ }
+
+ protected void loadData(DIHCache cache, List<ControlData> theData, String[] theFieldNames, boolean keepOrdered) {
+ for (ControlData cd : theData) {
+ cache.add(controlDataToMap(cd, theFieldNames, keepOrdered));
+ }
+ }
+
+ protected List<ControlData> extractDataInKeyOrder(DIHCache cache, String[] theFieldNames) {
+ List<Object[]> data = new ArrayList<Object[]>();
+ Iterator<Map<String, Object>> cacheIter = cache.iterator();
+ while (cacheIter.hasNext()) {
+ data.add(mapToObjectArray(cacheIter.next(), theFieldNames));
+ }
+ return listToControlData(data);
+ }
+
+ //This method assumes that the Primary Keys are integers and that the first id=1.
+ //It will look for id's sequentially until one is skipped, then will stop.
+ protected List<ControlData> extractDataByKeyLookup(DIHCache cache, String[] theFieldNames) {
+ int recId = 1;
+ List<Object[]> data = new ArrayList<Object[]>();
+ while (true) {
+ Iterator<Map<String, Object>> listORecs = cache.iterator(recId);
+ if (listORecs == null || !listORecs.hasNext()) {
+ break;
+ }
+
+ while(listORecs.hasNext()) {
+ data.add(mapToObjectArray(listORecs.next(), theFieldNames));
+ }
+ recId++;
+ }
+ return listToControlData(data);
+ }
+
+ protected List<ControlData> listToControlData(List<Object[]> data) {
+ List<ControlData> returnData = new ArrayList<ControlData>(data.size());
+ for (int i = 0; i < data.size(); i++) {
+ returnData.add(new ControlData(data.get(i)));
+ }
+ return returnData;
+ }
+
+ protected Object[] mapToObjectArray(Map<String, Object> rec, String[] theFieldNames) {
+ Object[] oos = new Object[theFieldNames.length];
+ for (int i = 0; i < theFieldNames.length; i++) {
+ oos[i] = rec.get(theFieldNames[i]);
+ }
+ return oos;
+ }
+
+ protected void compareData(List<ControlData> theControl, List<ControlData> test) {
+ // The test data should come back primarily in Key order and secondarily in insertion order.
+ List<ControlData> control = new ArrayList<ControlData>(theControl);
+ Collections.sort(control);
+
+ StringBuilder errors = new StringBuilder();
+ if (test.size() != control.size()) {
+ errors.append("-Returned data has " + test.size() + " records. expected: " + control.size() + "\n");
+ }
+ for (int i = 0; i < control.size() && i < test.size(); i++) {
+ Object[] controlRec = control.get(i).data;
+ Object[] testRec = test.get(i).data;
+ if (testRec.length != controlRec.length) {
+ errors.append("-Record indexAt=" + i + " has " + testRec.length + " data elements. extpected: " + controlRec.length + "\n");
+ }
+ for (int j = 0; j < controlRec.length && j < testRec.length; j++) {
+ Object controlObj = controlRec[j];
+ Object testObj = testRec[j];
+ if (controlObj == null && testObj != null) {
+ errors.append("-Record indexAt=" + i + ", Data Element indexAt=" + j + " is not NULL as expected.\n");
+ } else if (controlObj != null && testObj == null) {
+ errors.append("-Record indexAt=" + i + ", Data Element indexAt=" + j + " is NULL. Expected: " + controlObj + " (class="
+ + controlObj.getClass().getName() + ")\n");
+ } else if (controlObj != null && testObj != null && controlObj instanceof Clob) {
+ String controlString = clobToString((Clob) controlObj);
+ String testString = clobToString((Clob) testObj);
+ if (!controlString.equals(testString)) {
+ errors.append("-Record indexAt=" + i + ", Data Element indexAt=" + j + " has: " + testString + " (class=Clob) ... Expected: " + controlString
+ + " (class=Clob)\n");
+ }
+ } else if (controlObj != null && !controlObj.equals(testObj)) {
+ errors.append("-Record indexAt=" + i + ", Data Element indexAt=" + j + " has: " + testObj + " (class=" + testObj.getClass().getName()
+ + ") ... Expected: " + controlObj + " (class=" + controlObj.getClass().getName() + ")\n");
+ }
+ }
+ }
+ if (errors.length() > 0) {
+ Assert.fail(errors.toString());
+ }
+ }
+
+ protected Map<String, Object> controlDataToMap(ControlData cd, String[] theFieldNames, boolean keepOrdered) {
+ Map<String, Object> rec = null;
+ if (keepOrdered) {
+ rec = new LinkedHashMap<String, Object>();
+ } else {
+ rec = new HashMap<String, Object>();
+ }
+ for (int i = 0; i < cd.data.length; i++) {
+ String fieldName = theFieldNames[i];
+ Object data = cd.data[i];
+ rec.put(fieldName, data);
+ }
+ return rec;
+ }
+
+ protected String stringArrayToCommaDelimitedList(String[] strs) {
+ StringBuilder sb = new StringBuilder();
+ for (String a : strs) {
+ if (sb.length() > 0) {
+ sb.append(",");
+ }
+ sb.append(a);
+ }
+ return sb.toString();
+ }
+
+ protected String clobToString(Clob cl) {
+ StringBuilder sb = new StringBuilder();
+ try {
+ Reader in = cl.getCharacterStream();
+ char[] cbuf = new char[1024];
+ int numGot = -1;
+ while ((numGot = in.read(cbuf)) != -1) {
+ sb.append(String.valueOf(cbuf, 0, numGot));
+ }
+ } catch (Exception e) {
+ Assert.fail(e.toString());
+ }
+ return sb.toString();
+ }
+
+ public static Context getContext(final Map<String, String> entityAttrs) {
+ VariableResolverImpl resolver = new VariableResolverImpl();
+ final Context delegate = new ContextImpl(null, resolver, null, null, new HashMap<String, Object>(), null, null);
+ return new TestContext(entityAttrs, delegate, null, true);
+ }
+
+}
Added: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/DestroyCountCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/DestroyCountCache.java?rev=1303792&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/DestroyCountCache.java (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/DestroyCountCache.java Thu Mar 22 14:11:16 2012
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.dataimport;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+
+public class DestroyCountCache extends SortedMapBackedCache {
+ static Map<DIHCache,DIHCache> destroyed = new IdentityHashMap<DIHCache,DIHCache>();
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ Assert.assertThat(destroyed.put(this, this), nullValue());
+ }
+
+ public DestroyCountCache() {}
+
+}
\ No newline at end of file
Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java?rev=1303792&r1=1303791&r2=1303792&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java Thu Mar 22 14:11:16 2012
@@ -190,7 +190,7 @@ public class TestCachedSqlEntityProcesso
fields.add(createMap("column", "desc"));
String q = "select * from x";
Map<String, String> entityAttrs = createMap(
- "query", q, EntityProcessorBase.CACHE_KEY,"id", EntityProcessorBase.CACHE_LOOKUP ,"x.id");
+ "query", q, DIHCacheSupport.CACHE_PRIMARY_KEY,"id", DIHCacheSupport.CACHE_FOREIGN_KEY ,"x.id");
MockDataSource ds = new MockDataSource();
VariableResolverImpl vr = new VariableResolverImpl();
Map xNamespace = createMap("id", 0);
Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContextImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContextImpl.java?rev=1303792&r1=1303791&r2=1303792&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContextImpl.java (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestContextImpl.java Thu Mar 22 14:11:16 2012
@@ -38,7 +38,7 @@ public class TestContextImpl extends Abs
public void testCoreScope() {
DataImporter di = new DataImporter();
di.loadAndInit("<dataConfig><document /></dataConfig>");
- DocBuilder db = new DocBuilder(di, new SolrWriter(null, null), new RequestParams());
+ DocBuilder db = new DocBuilder(di, new SolrWriter(null),new SimplePropertiesWriter(), new RequestParams());
ContextImpl ctx = new ContextImpl(new Entity(), new VariableResolverImpl(), null, "something", new HashMap<String,Object>(), null, db);
String lala = new String("lala");
ctx.setSessionAttribute("huhu", lala, Context.SCOPE_SOLR_CORE);
Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java?rev=1303792&r1=1303791&r2=1303792&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java Thu Mar 22 14:11:16 2012
@@ -198,7 +198,7 @@ public class TestDocBuilder extends Abst
Boolean finishCalled = Boolean.FALSE;
public SolrWriterImpl() {
- super(null, ".");
+ super(null);
}
@Override
@@ -207,11 +207,6 @@ public class TestDocBuilder extends Abst
}
@Override
- public void log(int event, String name, Object row) {
- // Do nothing
- }
-
- @Override
public void doDeleteAll() {
deleteAllCalled = Boolean.TRUE;
}
@@ -222,7 +217,7 @@ public class TestDocBuilder extends Abst
}
@Override
- public void finish() {
+ public void close() {
finishCalled = Boolean.TRUE;
}
}
Added: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java?rev=1303792&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java Thu Mar 22 14:11:16 2012
@@ -0,0 +1,156 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.dataimport;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.*;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TestEphemeralCache extends AbstractDataImportHandlerTestCase {
+
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ initCore("dataimport-solrconfig.xml", "dataimport-schema.xml");
+ }
+
+ @Before
+ public void reset() {
+ DestroyCountCache.destroyed.clear();
+ setupMockData();
+ }
+
+ @Test
+ public void testSingleThreaded() throws Exception {
+ assertFullImport(getDataConfigDotXml(0));
+ }
+
+ @Test
+ public void testWithThreadedParamEqualOne() throws Exception {
+ assertFullImport(getDataConfigDotXml(1));
+ }
+
+ @Ignore("TODO: fix included in SOLR-3011")
+ @Test
+ public void testMultiThreaded() throws Exception {
+ // Try between 2 and 6 threads
+ int numThreads = random.nextInt(4) + 2;
+ System.out.println("TRYING " + numThreads);
+ assertFullImport(getDataConfigDotXml(numThreads));
+ }
+
+ @SuppressWarnings("unchecked")
+ private void setupMockData() {
+ List parentRows = new ArrayList();
+ 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("3"), "parent_s", "three"));
+ parentRows.add(createMap("id", new BigDecimal("4"), "parent_s", "four"));
+ parentRows.add(createMap("id", new BigDecimal("5"), "parent_s", "five"));
+
+ 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."));
+ child1Rows.add(createMap("id", new BigDecimal("6"), "child1a_mult_s", "let's sing a song of six."));
+ child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "three"));
+ child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "III"));
+ child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "3"));
+ child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "|||"));
+ child1Rows.add(createMap("id", new BigDecimal("1"), "child1a_mult_s", "one"));
+ 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."));
+
+ 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.'"));
+ child2Rows.add(createMap("id", new BigDecimal("6"), "child2a_mult_s", "Child 2 says, 'let's sing a song of six.'"));
+ child2Rows.add(createMap("id", new BigDecimal("3"), "child2a_mult_s", "Child 2 says, 'three'"));
+ child2Rows.add(createMap("id", new BigDecimal("3"), "child2a_mult_s", "Child 2 says, 'III'"));
+ child2Rows.add(createMap("id", new BigDecimal("3"), "child2b_s", "CHILD2B", "child2a_mult_s", "Child 2 says, '3'"));
+ child2Rows.add(createMap("id", new BigDecimal("3"), "child2a_mult_s", "Child 2 says, '|||'"));
+ child2Rows.add(createMap("id", new BigDecimal("1"), "child2a_mult_s", "Child 2 says, 'one'"));
+ child2Rows.add(createMap("id", new BigDecimal("1"), "child2a_mult_s", "Child 2 says, 'uno'"));
+ child2Rows.add(createMap("id", new BigDecimal("2"), "child2a_mult_s", "Child 2 says, 'this is the number two.'"));
+
+ MockDataSource.setIterator("SELECT * FROM PARENT", parentRows.iterator());
+ MockDataSource.setIterator("SELECT * FROM CHILD_1", child1Rows.iterator());
+ MockDataSource.setIterator("SELECT * FROM CHILD_2", child2Rows.iterator());
+
+ }
+ private String getDataConfigDotXml(int numThreads) {
+ return
+ "<dataConfig>" +
+ " <dataSource type=\"MockDataSource\" />" +
+ " <document>" +
+ " <entity " +
+ " name=\"PARENT\"" +
+ " processor=\"SqlEntityProcessor\"" +
+ " cacheImpl=\"org.apache.solr.handler.dataimport.DestroyCountCache\"" +
+ " cacheName=\"PARENT\"" +
+ " query=\"SELECT * FROM PARENT\" " +
+ (numThreads==0 ? "" : "threads=\"" + numThreads + "\" ") +
+ " >" +
+ " <entity" +
+ " name=\"CHILD_1\"" +
+ " processor=\"SqlEntityProcessor\"" +
+ " cacheImpl=\"org.apache.solr.handler.dataimport.DestroyCountCache\"" +
+ " cacheName=\"CHILD\"" +
+ " cachePk=\"id\"" +
+ " cacheLookup=\"PARENT.id\"" +
+ " fieldNames=\"id, child1a_mult_s, child1b_s\"" +
+ " fieldTypes=\"BIGDECIMAL, STRING, STRING\"" +
+ " query=\"SELECT * FROM CHILD_1\" " +
+ " />" +
+ " <entity" +
+ " name=\"CHILD_2\"" +
+ " processor=\"SqlEntityProcessor\"" +
+ " cacheImpl=\"org.apache.solr.handler.dataimport.DestroyCountCache\"" +
+ " cachePk=\"id\"" +
+ " cacheLookup=\"PARENT.id\"" +
+ " query=\"SELECT * FROM CHILD_2\" " +
+ " />" +
+ " </entity>" +
+ " </document>" +
+ "</dataConfig>"
+ ;
+ }
+
+ private void assertFullImport(String dataConfig) throws Exception {
+ runFullImport(dataConfig);
+
+ assertQ(req("*:*"), "//*[@numFound='5']");
+ assertQ(req("id:1"), "//*[@numFound='1']");
+ assertQ(req("id:6"), "//*[@numFound='0']");
+ assertQ(req("parent_s:four"), "//*[@numFound='1']");
+ assertQ(req("child1a_mult_s:this\\ is\\ the\\ numbe*"), "//*[@numFound='2']");
+ assertQ(req("child2a_mult_s:Child\\ 2\\ say*"), "//*[@numFound='4']");
+ assertQ(req("child1b_s:CHILD1B"), "//*[@numFound='1']");
+ assertQ(req("child2b_s:CHILD2B"), "//*[@numFound='1']");
+ assertQ(req("child1a_mult_s:one"), "//*[@numFound='1']");
+ assertQ(req("child1a_mult_s:uno"), "//*[@numFound='1']");
+ assertQ(req("child1a_mult_s:(uno OR one)"), "//*[@numFound='1']");
+
+ assertThat(DestroyCountCache.destroyed.size(), is(3));
+ }
+
+}
Added: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSortedMapBackedCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSortedMapBackedCache.java?rev=1303792&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSortedMapBackedCache.java (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSortedMapBackedCache.java Thu Mar 22 14:11:16 2012
@@ -0,0 +1,142 @@
+package org.apache.solr.handler.dataimport;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestSortedMapBackedCache extends AbstractDIHCacheTestCase {
+
+ public static Logger log = LoggerFactory.getLogger(TestSortedMapBackedCache.class);
+
+ @Test
+ public void testCacheWithKeyLookup() {
+ DIHCache cache = null;
+ try {
+ cache = new SortedMapBackedCache();
+ cache.open(getContext(new HashMap<String,String>()));
+ loadData(cache, data, fieldNames, true);
+ List<ControlData> testData = extractDataByKeyLookup(cache, fieldNames);
+ compareData(data, testData);
+ } catch (Exception e) {
+ log.warn("Exception thrown: " + e.toString());
+ Assert.fail();
+ } finally {
+ try {
+ cache.destroy();
+ } catch (Exception ex) {
+ }
+ }
+ }
+
+ @Test
+ public void testCacheWithOrderedLookup() {
+ DIHCache cache = null;
+ try {
+ cache = new SortedMapBackedCache();
+ cache.open(getContext(new HashMap<String,String>()));
+ loadData(cache, data, fieldNames, true);
+ List<ControlData> testData = extractDataInKeyOrder(cache, fieldNames);
+ compareData(data, testData);
+ } catch (Exception e) {
+ log.warn("Exception thrown: " + e.toString());
+ Assert.fail();
+ } finally {
+ try {
+ cache.destroy();
+ } catch (Exception ex) {
+ }
+ }
+ }
+
+ @Test
+ public void testCacheReopensWithUpdate() {
+ DIHCache cache = null;
+ try {
+ Map<String, String> cacheProps = new HashMap<String, String>();
+ cacheProps.put(DIHCacheSupport.CACHE_PRIMARY_KEY, "a_id");
+
+ cache = new SortedMapBackedCache();
+ cache.open(getContext(cacheProps));
+ // We can let the data hit the cache with the fields out of order because
+ // we've identified the pk up-front.
+ loadData(cache, data, fieldNames, false);
+
+ // Close the cache.
+ cache.close();
+
+ List<ControlData> newControlData = new ArrayList<ControlData>();
+ Object[] newIdEqualsThree = null;
+ int j = 0;
+ for (int i = 0; i < data.size(); i++) {
+ // We'll be deleting a_id=1 so remove it from the control data.
+ if (data.get(i).data[0].equals(new Integer(1))) {
+ continue;
+ }
+
+ // We'll be changing "Cookie" to "Carrot" in a_id=3 so change it in the control data.
+ if (data.get(i).data[0].equals(new Integer(3))) {
+ newIdEqualsThree = new Object[data.get(i).data.length];
+ System.arraycopy(data.get(i).data, 0, newIdEqualsThree, 0, newIdEqualsThree.length);
+ newIdEqualsThree[3] = "Carrot";
+ newControlData.add(new ControlData(newIdEqualsThree));
+ }
+ // Everything else can just be copied over.
+ else {
+ newControlData.add(data.get(i));
+ }
+
+ j++;
+ }
+
+ // These new rows of data will get added to the cache, so add them to the control data too.
+ Object[] newDataRow1 = new Object[] { new Integer(99), new BigDecimal(Math.PI), "Z", "Zebra", new Float(99.99), Feb21_2011, null };
+ Object[] newDataRow2 = new Object[] { new Integer(2), new BigDecimal(Math.PI), "B", "Ballerina", new Float(2.22), Feb21_2011, null };
+
+ newControlData.add(new ControlData(newDataRow1));
+ newControlData.add(new ControlData(newDataRow2));
+
+ // Re-open the cache
+ cache.open(getContext(new HashMap<String,String>()));
+
+ // Delete a_id=1 from the cache.
+ cache.delete(new Integer(1));
+
+ // Because the cache allows duplicates, the only way to update is to
+ // delete first then add.
+ cache.delete(new Integer(3));
+ cache.add(controlDataToMap(new ControlData(newIdEqualsThree), fieldNames, false));
+
+ // Add this row with a new Primary key.
+ cache.add(controlDataToMap(new ControlData(newDataRow1), fieldNames, false));
+
+ // Add this row, creating two records in the cache with a_id=2.
+ cache.add(controlDataToMap(new ControlData(newDataRow2), fieldNames, false));
+
+ // Read the cache back and compare to the newControlData
+ List<ControlData> testData = extractDataInKeyOrder(cache, fieldNames);
+ compareData(newControlData, testData);
+
+ // Now try reading the cache read-only.
+ cache.close();
+ cache.open(getContext(new HashMap<String,String>()));
+ testData = extractDataInKeyOrder(cache, fieldNames);
+ compareData(newControlData, testData);
+
+ } catch (Exception e) {
+ log.warn("Exception thrown: " + e.toString());
+ Assert.fail();
+ } finally {
+ try {
+ cache.destroy();
+ } catch (Exception ex) {
+ }
+ }
+ }
+}
Added: lucene/dev/branches/branch_3x/solr/webapp/web/WEB-INF/jboss-web.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/webapp/web/WEB-INF/jboss-web.xml?rev=1303792&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/webapp/web/WEB-INF/jboss-web.xml (added)
+++ lucene/dev/branches/branch_3x/solr/webapp/web/WEB-INF/jboss-web.xml Thu Mar 22 14:11:16 2012
@@ -0,0 +1,3 @@
+<jboss-web>
+ <context-root>solr</context-root>
+</jboss-web>
\ No newline at end of file