SOLR-2739: try to clean up TestSqlEntityProcessorDelta

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1164287 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2011-09-01 22:06:21 +00:00
parent a0fc683f14
commit c20cbcf2f8
1 changed files with 17 additions and 15 deletions

View File

@ -105,23 +105,25 @@ public class TestSqlEntityProcessorDelta extends AbstractDataImportHandlerTestCa
filePath += File.separator;
filePath += "dataimport.properties";
File f = new File(filePath);
// execute the test only if we are able to set file to read only mode
if ((f.exists() || f.createNewFile()) && f.setReadOnly()) {
try {
List parentRow = new ArrayList();
parentRow.add(createMap("id", "1"));
MockDataSource.setIterator(FULLIMPORT_QUERY, parentRow.iterator());
List childRow = new ArrayList();
childRow.add(createMap("desc", "hello"));
MockDataSource.setIterator("select * from y where y.A='1'", childRow
.iterator());
try {
// execute the test only if we are able to set file to read only mode
assumeTrue("No dataimport.properties file", f.exists() || f.createNewFile());
assumeTrue("dataimport.proprties can't be set read only", f.setReadOnly());
runFullImport(dataConfig_delta);
assertQ(req("id:1"), "//*[@numFound='0']");
} finally {
f.delete();
}
List parentRow = new ArrayList();
parentRow.add(createMap("id", "1"));
MockDataSource.setIterator(FULLIMPORT_QUERY, parentRow.iterator());
List childRow = new ArrayList();
childRow.add(createMap("desc", "hello"));
MockDataSource.setIterator("select * from y where y.A='1'",
childRow.iterator());
runFullImport(dataConfig_delta);
assertQ(req("id:1"), "//*[@numFound='0']");
} finally {
f.delete();
}
}