upd parser calls in test cases

pull/159/head
reger 10 years ago
parent 579303a04e
commit 71bf95af8a

@ -36,7 +36,7 @@ public class ParserTest {
final AnchorURL url = new AnchorURL("http://localhost/"+filename);
AbstractParser p = new ooxmlParser();
final Document[] docs = p.parse(url, mimetype, null, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, null, new VocabularyScraper(), 0, new FileInputStream(file));
for (final Document doc: docs) {
final Reader content = new InputStreamReader(doc.getTextStream(), doc.getCharset());
final StringBuilder str = new StringBuilder();
@ -70,7 +70,7 @@ public class ParserTest {
final AnchorURL url = new AnchorURL("http://localhost/"+filename);
AbstractParser p = new odtParser();
final Document[] docs = p.parse(url, mimetype, null, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, null, new VocabularyScraper(), 0, new FileInputStream(file));
for (final Document doc: docs) {
final Reader content = new InputStreamReader(doc.getTextStream(), doc.getCharset());
final StringBuilder str = new StringBuilder();
@ -102,7 +102,7 @@ public class ParserTest {
final AnchorURL url = new AnchorURL("http://localhost/"+filename);
AbstractParser p = new pdfParser();
final Document[] docs = p.parse(url, mimetype, null, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, null, new VocabularyScraper(), 0, new FileInputStream(file));
for (final Document doc: docs) {
final Reader content = new InputStreamReader(doc.getTextStream(), doc.getCharset());
final StringBuilder str = new StringBuilder();
@ -134,7 +134,7 @@ public class ParserTest {
final AnchorURL url = new AnchorURL("http://localhost/"+filename);
AbstractParser p = new docParser();
final Document[] docs = p.parse(url, mimetype, null, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, null, new VocabularyScraper(), 0, new FileInputStream(file));
for (final Document doc: docs) {
final Reader content = new InputStreamReader(doc.getTextStream(), doc.getCharset());
final StringBuilder str = new StringBuilder();
@ -172,7 +172,7 @@ public class ParserTest {
final AnchorURL url = new AnchorURL("http://localhost/" + filename);
AbstractParser p = new pptParser();
final Document[] docs = p.parse(url, mimetype, null, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, null, new VocabularyScraper(), 0, new FileInputStream(file));
for (final Document doc : docs) {
final Reader content = new InputStreamReader(doc.getTextStream(), doc.getCharset());
final StringBuilder str = new StringBuilder();

@ -75,7 +75,7 @@ public class htmlParserTest extends TestCase {
System.out.println("parse file: " + filename);
htmlParser p = new htmlParser();
final Document[] docs = p.parse(url, mimetype, null, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, null, new VocabularyScraper(), 0, new FileInputStream(file));
Document doc = docs[0];
String txt = doc.getCharset();
@ -101,7 +101,7 @@ public class htmlParserTest extends TestCase {
+ "<figure><img width=\"550px\" title=\"image as exemple\" alt=\"image as exemple\" src=\"./img/my_image.png\"></figrue>" // + img width 550 (+html5 figure)
+ "</body></html>";
ContentScraper scraper = parseToScraper(url, mimetype, new VocabularyScraper(), testhtml, 10);
ContentScraper scraper = parseToScraper(url, mimetype, new VocabularyScraper(), 0, testhtml, 10);
List<AnchorURL> anchorlist = scraper.getAnchors();
String linktxt = anchorlist.get(0).getTextProperty();

@ -5,6 +5,7 @@ import java.io.File;
import java.io.FileInputStream;
import net.yacy.cora.document.id.AnchorURL;
import net.yacy.document.Document;
import net.yacy.document.VocabularyScraper;
import org.junit.Test;
import static org.junit.Assert.*;
@ -28,7 +29,7 @@ public class genericImageParserTest {
System.out.println("parse file: " + filename);
genericImageParser p = new genericImageParser();
final Document[] docs = p.parse(url, mimetype, charset, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, charset, new VocabularyScraper(), 0, new FileInputStream(file));
Document doc = docs[0];
assertEquals("YaCy Logo",doc.dc_title());

@ -5,6 +5,7 @@ import java.io.File;
import java.io.FileInputStream;
import net.yacy.cora.document.id.AnchorURL;
import net.yacy.document.Document;
import net.yacy.document.VocabularyScraper;
import org.junit.Test;
import static org.junit.Assert.*;
@ -29,7 +30,7 @@ public class metadataImageParserTest {
System.out.println("parse file: " + filename);
metadataImageParser p = new metadataImageParser();
final Document[] docs = p.parse(url, mimetype, charset, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, charset, new VocabularyScraper(), 0, new FileInputStream(file));
Document doc = docs[0];
assertEquals("YaCy Logo",doc.dc_title());

@ -6,6 +6,7 @@ import java.util.Collection;
import static junit.framework.TestCase.assertEquals;
import net.yacy.cora.document.id.AnchorURL;
import net.yacy.document.Document;
import net.yacy.document.VocabularyScraper;
import org.junit.Test;
public class pdfParserTest {
@ -29,7 +30,7 @@ public class pdfParserTest {
System.out.println("parse file: " + filename);
pdfParser p = new pdfParser();
final Document[] docs = p.parse(url, mimetype, charset, null, new FileInputStream(file));
final Document[] docs = p.parse(url, mimetype, charset, new VocabularyScraper(), 0, new FileInputStream(file));
Document doc = docs[0];
int ilinks = doc.getAnchors().size();

Loading…
Cancel
Save