diff options
| author | reger <reger18@arcor.de> | 2014-10-05 20:05:03 +0200 |
|---|---|---|
| committer | reger <reger18@arcor.de> | 2014-10-05 20:05:03 +0200 |
| commit | aa2e15d846cdee90b70ea882747148b14f257c49 (patch) | |
| tree | 0549fda554fb71f633901f824b772f8fa59a8fe5 /test/net | |
| parent | b31db000106fc3ee3faecf540863068ecc13ae48 (diff) | |
allow url parameter in worktable apicall
allow url=wwwl?param=a¶m=b (with ?, & encoded)
fix: http://mantis.tokeek.de/view.php?id=100
fix double adding of '&' in MultiProtocolURL.escape()
Diffstat (limited to 'test/net')
| -rw-r--r-- | test/net/yacy/document/parser/pdfParserTest.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/net/yacy/document/parser/pdfParserTest.java b/test/net/yacy/document/parser/pdfParserTest.java new file mode 100644 index 000000000..e2c419035 --- /dev/null +++ b/test/net/yacy/document/parser/pdfParserTest.java @@ -0,0 +1,46 @@ +package net.yacy.document.parser;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Collection;
+import static junit.framework.TestCase.assertEquals;
+import net.yacy.cora.document.id.AnchorURL;
+import net.yacy.document.Document;
+import org.junit.Test;
+
+public class pdfParserTest {
+
+ /**
+ * Test extraction of links in parse method, of class pdfParser.
+ */
+ @Test
+ public void testParse() throws Exception {
+ System.out.println("pdfParser.parse");
+
+ final String testFiles = "umlaute_linux.pdf";
+ final String mimetype = "application/pdf";
+ final String charset = null;
+
+ //final String resulttxt = "In München steht ein Hofbräuhaus. Dort gibt es Bier aus Maßkrügen.";
+ final String filename = "test/parsertest/" + testFiles;
+ final File file = new File(filename);
+
+ final AnchorURL url = new AnchorURL("http://localhost/" + filename);
+ System.out.println("parse file: " + filename);
+
+ pdfParser p = new pdfParser();
+ final Document[] docs = p.parse(url, mimetype, charset, new FileInputStream(file));
+
+ Document doc = docs[0];
+ int ilinks = doc.getAnchors().size();
+ assertEquals("number of links in pdf", 1, ilinks);
+
+ Collection<AnchorURL> links = doc.getAnchors();
+ System.out.println("number of links detected = " + ilinks);
+ for (AnchorURL aurl : links) {
+ System.out.println(" found: " + aurl.toString());
+ }
+
+ }
+
+}
|
