Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-3775: Add a test for Office 2003 file (.doc)

Uwe Schindler90e692e18098
diff --git a/solr/contrib/extraction/src/test-files/extraction/word2003.doc b/solr/contrib/extraction/src/test-files/extraction/word2003.doc
new file mode 100644
index 00000000000..e55827ba100
Binary files /dev/null and b/solr/contrib/extraction/src/test-files/extraction/word2003.doc differ
diff --git a/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java b/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java
index cde7793315c..dbdb370348d 100644
--- a/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java
+++ b/solr/contrib/extraction/src/test/org/apache/solr/handler/extraction/ExtractingRequestHandlerTest.java
@@ -145,7 +145,22 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {
assertU(commit());
assertQ(req("stream_name:version_control.xml"), "//*[@numFound='1']");
-
+ loadLocal("extraction/word2003.doc", "fmap.created", "extractedDate", "fmap.producer", "extractedProducer",
+ "fmap.creator", "extractedCreator", "fmap.Keywords", "extractedKeywords",
+ "fmap.Author", "extractedAuthor",
+ "literal.id", "four",
+ "uprefix", "ignored_",
+ "fmap.content", "extractedContent",
+ "fmap.language", "extractedLanguage",
+ "fmap.Last-Modified", "extractedDate"
+ );
+ assertQ(req("title:\"Word 2003 Title\""), "//*[@numFound='0']");
+ // There is already a PDF file with this content:
+ assertQ(req("extractedContent:\"This is a test of PDF and Word extraction in Solr, it is only a test\""), "//*[@numFound='1']");
+ assertU(commit());
+ assertQ(req("title:\"Word 2003 Title\""), "//*[@numFound='1']");
+ // now 2 of them:
+ assertQ(req("extractedContent:\"This is a test of PDF and Word extraction in Solr, it is only a test\""), "//*[@numFound='2']");
}
@@ -163,8 +178,7 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {
//"fmap.content_type", "abcxyz",
"commit", "true" // test immediate commit
);
- assertTrue(false);
-
+ fail("Should throw SolrException");
} catch (SolrException e) {
//do nothing
} finally {