diff options
| author | Roman Szarowski <roman.szarowski@gmail.com> | 2025-08-25 23:36:10 +0200 |
|---|---|---|
| committer | Roman Szarowski <roman.szarowski@gmail.com> | 2025-08-25 23:36:10 +0200 |
| commit | ab095b868678f5d614aff2f17c303611979618f4 (patch) | |
| tree | 0339282d16eabf964c8c12ffc6383e7bcaaa49b1 /test/java/net | |
| parent | c2060cc15d95a2870af910b489ac3a1d042d2257 (diff) | |
support for /date search to be sorted by date published - https://github.com/yacy/yacy_search_server/issues/622
Diffstat (limited to 'test/java/net')
6 files changed, 23 insertions, 21 deletions
diff --git a/test/java/net/yacy/document/parser/GenericXMLParserTest.java b/test/java/net/yacy/document/parser/GenericXMLParserTest.java index e49509780..0607e36c3 100644 --- a/test/java/net/yacy/document/parser/GenericXMLParserTest.java +++ b/test/java/net/yacy/document/parser/GenericXMLParserTest.java @@ -386,7 +386,8 @@ public class GenericXMLParserTest { final String charsetFromHttpHeader = HeaderFramework.getCharacterEncoding(contentTypeHeader); final DigestURL location = new DigestURL("http://localhost/testfile.xml"); try { - final Document[] documents = this.parser.parseWithLimits(location, contentTypeHeader, charsetFromHttpHeader, new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, Long.MAX_VALUE); + final Document[] documents = this.parser.parseWithLimits(location, contentTypeHeader, charsetFromHttpHeader, + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, Long.MAX_VALUE, null); assertEquals(1, documents.length); assertFalse(documents[0].isPartiallyParsed()); @@ -407,7 +408,7 @@ public class GenericXMLParserTest { inStream = new ByteArrayInputStream(xhtml.getBytes(StandardCharsets.UTF_8.name())); try { final Document[] documents = this.parser.parseWithLimits(location, contentTypeHeader, charsetFromHttpHeader, - new VocabularyScraper(), 0, inStream, 2, Long.MAX_VALUE); + new VocabularyScraper(), 0, inStream, 2, Long.MAX_VALUE, null); assertEquals(1, documents.length); assertTrue(documents[0].isPartiallyParsed()); @@ -447,7 +448,8 @@ public class GenericXMLParserTest { .append("</body></html>"); inStream = new ByteArrayInputStream(xhtmlBuilder.toString().getBytes(StandardCharsets.UTF_8.name())); try { - final Document[] documents = this.parser.parseWithLimits(location, contentTypeHeader, charsetFromHttpHeader, new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, firstBytes); + final Document[] documents = this.parser.parseWithLimits(location, contentTypeHeader, charsetFromHttpHeader, + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, firstBytes, null); assertEquals(1, documents.length); assertTrue(documents[0].isPartiallyParsed()); diff --git a/test/java/net/yacy/document/parser/XZParserTest.java b/test/java/net/yacy/document/parser/XZParserTest.java index 5392bf21a..ecdec7146 100644 --- a/test/java/net/yacy/document/parser/XZParserTest.java +++ b/test/java/net/yacy/document/parser/XZParserTest.java @@ -141,7 +141,7 @@ public class XZParserTest { final DigestURL location = new DigestURL("http://localhost/" + fileName); try (final FileInputStream inStream = new FileInputStream(new File(TEST_FOLER, fileName));) { final Document[] documents = parser.parseWithLimits(location, "application/x-xz", - StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 10000, 10000); + StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 10000, 10000, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -175,7 +175,7 @@ public class XZParserTest { final DigestURL location = new DigestURL("http://localhost/" + fileName); try (final FileInputStream inStream = new FileInputStream(new File(TEST_FOLER, fileName));) { final Document[] documents = parser.parseWithLimits(location, "application/x-xz", - StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 0, Long.MAX_VALUE); + StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 0, Long.MAX_VALUE, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -211,7 +211,7 @@ public class XZParserTest { */ final long maxBytes = 258; final Document[] documents = parser.parseWithLimits(location, "application/x-xz", - StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -231,7 +231,7 @@ public class XZParserTest { */ final long maxBytes = 65; final Document[] documents = parser.parseWithLimits(location, "application/x-xz", - StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, diff --git a/test/java/net/yacy/document/parser/bzipParserTest.java b/test/java/net/yacy/document/parser/bzipParserTest.java index 2f491d51d..a056d93ca 100644 --- a/test/java/net/yacy/document/parser/bzipParserTest.java +++ b/test/java/net/yacy/document/parser/bzipParserTest.java @@ -149,7 +149,7 @@ public class bzipParserTest { try (final FileInputStream inStream = new FileInputStream(new File(TEST_FOLER, fileName));) { final Document[] documents = parser.parseWithLimits(location, "application/x-bzip2", StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 10000, - 10000); + 10000, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -185,7 +185,7 @@ public class bzipParserTest { final DigestURL location = new DigestURL("http://localhost/" + fileName); try (final FileInputStream inStream = new FileInputStream(new File(TEST_FOLER, fileName));) { final Document[] documents = parser.parseWithLimits(location, "application/x-bzip2", - StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 0, Long.MAX_VALUE); + StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 0, Long.MAX_VALUE, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -220,7 +220,7 @@ public class bzipParserTest { /* The bytes limit is set to let parsing the beginning text part, but stop before reaching the <a> tag */ final long maxBytes = 258; final Document[] documents = parser.parseWithLimits(location, "application/x-bzip2", StandardCharsets.UTF_8.name(), - new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -237,7 +237,7 @@ public class bzipParserTest { /* The bytes limit is set to let parsing the beginning of the text, but stop before reaching the URL */ final long maxBytes = 65; final Document[] documents = parser.parseWithLimits(location, "application/x-bzip2", StandardCharsets.UTF_8.name(), - new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, diff --git a/test/java/net/yacy/document/parser/gzipParserTest.java b/test/java/net/yacy/document/parser/gzipParserTest.java index ffca1c195..d42b21cea 100644 --- a/test/java/net/yacy/document/parser/gzipParserTest.java +++ b/test/java/net/yacy/document/parser/gzipParserTest.java @@ -155,7 +155,7 @@ public class gzipParserTest { try { Document[] documents = parser.parseWithLimits(location, "application/gzip", StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 10000, - 10000); + 10000, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -195,7 +195,7 @@ public class gzipParserTest { DigestURL location = new DigestURL("http://localhost/" + fileName); try { Document[] documents = parser.parseWithLimits(location, "application/gzip", - StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 0, Long.MAX_VALUE); + StandardCharsets.UTF_8.name(), new VocabularyScraper(), 0, inStream, 0, Long.MAX_VALUE, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -233,7 +233,7 @@ public class gzipParserTest { /* The bytes limit is set to let parsing the beginning text part, but stop before reaching the <a> tag */ final long maxBytes = 258; Document[] documents = parser.parseWithLimits(location, "application/gzip", StandardCharsets.UTF_8.name(), - new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, @@ -253,7 +253,7 @@ public class gzipParserTest { /* The bytes limit is set to let parsing the beginning of the text, but stop before reaching the URL */ final long maxBytes = 65; Document[] documents = parser.parseWithLimits(location, "application/gzip", StandardCharsets.UTF_8.name(), - new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); assertNotNull("Parsed text must not be empty for file " + fileName, documents[0].getTextString()); assertTrue("Parsed text must contain test word with umlaut char" + fileName, diff --git a/test/java/net/yacy/document/parser/htmlParserTest.java b/test/java/net/yacy/document/parser/htmlParserTest.java index d2a113c88..4e638b52a 100644 --- a/test/java/net/yacy/document/parser/htmlParserTest.java +++ b/test/java/net/yacy/document/parser/htmlParserTest.java @@ -267,7 +267,7 @@ public class htmlParserTest extends TestCase { try (final FileInputStream inStream = new FileInputStream(file);) { - final Document[] docs = parser.parseWithLimits(url, mimetype, null, new VocabularyScraper(), 0, inStream, 1000, 10000); + final Document[] docs = parser.parseWithLimits(url, mimetype, null, new VocabularyScraper(), 0, inStream, 1000, 10000, null); final Document doc = docs[0]; assertNotNull("Parser result must not be null for file " + fileName, docs); final String parsedText = doc.getTextString(); @@ -305,7 +305,7 @@ public class htmlParserTest extends TestCase { try (InputStream sourceStream = new ByteArrayInputStream( testHtml.toString().getBytes(StandardCharsets.UTF_8));) { final Document[] docs = parser.parseWithLimits(url, mimetype, charset, new VocabularyScraper(), 0, - sourceStream, maxLinks, Long.MAX_VALUE); + sourceStream, maxLinks, Long.MAX_VALUE, null); final Document doc = docs[0]; assertEquals(maxLinks, doc.getAnchors().size()); assertEquals("The parsed document should be marked as partially parsed only when the limit is exceeded", @@ -344,7 +344,7 @@ public class htmlParserTest extends TestCase { try (InputStream sourceStream = new ByteArrayInputStream( testHtml.toString().getBytes(StandardCharsets.UTF_8));) { final Document[] docs = parser.parseWithLimits(url, mimetype, charset, new VocabularyScraper(), 0, - sourceStream, maxLinks, Long.MAX_VALUE); + sourceStream, maxLinks, Long.MAX_VALUE, null); final Document doc = docs[0]; assertEquals(maxLinks, doc.getRSS().size()); assertEquals("The parsed document should be marked as partially parsed only when the limit is exceeded", diff --git a/test/java/net/yacy/document/parser/tarParserTest.java b/test/java/net/yacy/document/parser/tarParserTest.java index 124ac5ffd..19c7813f0 100644 --- a/test/java/net/yacy/document/parser/tarParserTest.java +++ b/test/java/net/yacy/document/parser/tarParserTest.java @@ -126,7 +126,7 @@ public class tarParserTest { /* Content within limits */ try { Document[] documents = this.parser.parseWithLimits(location, "application/tar", null, - new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, Long.MAX_VALUE); + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, Long.MAX_VALUE, null); assertNotNull("Parser result must not be null for file " + fileName, documents); final String parsedText = documents[0].getTextString(); @@ -169,7 +169,7 @@ public class tarParserTest { /* Links limit exceeded from the third included file */ try { Document[] documents = this.parser.parseWithLimits(location, "application/tar", null, - new VocabularyScraper(), 0, inStream, 2, Long.MAX_VALUE); + new VocabularyScraper(), 0, inStream, 2, Long.MAX_VALUE, null); assertNotNull("Parser result must not be null for file " + fileName, documents); final String parsedText = documents[0].getTextString(); @@ -224,7 +224,7 @@ public class tarParserTest { } try { Document[] documents = this.parser.parseWithLimits(location, "application/tar", null, - new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes); + new VocabularyScraper(), 0, inStream, Integer.MAX_VALUE, maxBytes, null); assertNotNull("Parser result must not be null for file " + fileName, documents); final String parsedText = documents[0].getTextString(); |
