commit
f384fd624b
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
>
|
||||
<!-- YaCy Search Engine; http://yacy.net -->
|
||||
|
||||
<title>#[promoteSearchPageGreeting]#: #[rss_query]#</title>
|
||||
<description>Search for #[rss_query]#</description>
|
||||
<link>#[searchBaseURL]#?query=#[rss_queryenc]#&resource=#[resource]#&contentdom=#[contentdom]#&verify=#[search.verify]#</link>
|
||||
<logo>#[rssYacyImageURL]#</logo>
|
||||
<opensearch:startIndex>#[num-results_offset]#</opensearch:startIndex>
|
||||
<opensearch:itemsPerPage>#[num-results_itemsPerPage]#</opensearch:itemsPerPage>
|
||||
<link rel="search" href="http://#[thisaddress]#/opensearchdescription.xml" type="application/opensearchdescription+xml"/>
|
||||
<opensearch:Query role="request" searchTerms="#[rss_queryenc]#" />
|
||||
|
||||
#{results}#
|
||||
<!--#include virtual="yacysearchitem.atom?item=#[item]#&eventID=#[eventID]#" -->
|
||||
#{/results}#
|
||||
|
||||
</feed>
|
@ -0,0 +1,11 @@
|
||||
#(content)#::<entry>
|
||||
<title type="html">#[title-xml]#</title>
|
||||
<link href="#[link]#" />
|
||||
<summary type="html">#[description-xml]#</summary>
|
||||
<updated>#[date822]#</updated>
|
||||
<dc:publisher><![CDATA[#[publisher]#]]></dc:publisher>
|
||||
<author><name><![CDATA[#[creator]#]]></name></author>
|
||||
<dc:subject><![CDATA[#[subject]#]]></dc:subject>
|
||||
<id>#[urlhash]#</id>
|
||||
</entry>
|
||||
#(/content)#
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,62 @@
|
||||
|
||||
package net.yacy.crawler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import net.yacy.cora.document.id.DigestURL;
|
||||
import net.yacy.cora.util.SpaceExceededException;
|
||||
import net.yacy.crawler.retrieval.Request;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* test HostQueue
|
||||
* directorylayout is
|
||||
*
|
||||
* stackDir (dir)
|
||||
* +-- hostDir (dir)
|
||||
* +-- crawldepth.stack (file)
|
||||
*/
|
||||
public class HostQueueTest {
|
||||
final String stackDir = "test/DATA/INDEX/QUEUE/CrawlerCoreStacks";
|
||||
|
||||
/**
|
||||
* Test of clear method, of class HostQueue.
|
||||
*/
|
||||
@Test
|
||||
public void testClear() throws MalformedURLException, IOException, SpaceExceededException {
|
||||
File stackDirFile = new File(stackDir);
|
||||
String hostDir = "a.com";
|
||||
int hostPort = 80;
|
||||
|
||||
// open queue
|
||||
HostQueue testhq = new HostQueue(stackDirFile, hostDir, hostPort, true, true);
|
||||
|
||||
// add a url
|
||||
String urlstr = "http://" + hostDir + "/test.html";
|
||||
DigestURL url = new DigestURL(urlstr);
|
||||
Request req = new Request(url, null);
|
||||
testhq.push(req, null, null);
|
||||
|
||||
int sizeA = testhq.size();
|
||||
assertTrue (sizeA > 0);
|
||||
|
||||
testhq.clear(); // clear the complete host queue (should delete all files in stackDir)
|
||||
|
||||
int sizeB = testhq.size();
|
||||
assertEquals (0,sizeB);
|
||||
|
||||
// verify stackDir empty (double check)
|
||||
String[] filelist = stackDirFile.list();
|
||||
assertEquals ("host files in queue dir",0,filelist.length);
|
||||
|
||||
testhq.close();
|
||||
|
||||
// verify stackDir empty
|
||||
filelist = stackDirFile.list();
|
||||
assertEquals ("host files in queue dir",0,filelist.length);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
|
||||
package net.yacy.kelondro.io;
|
||||
|
||||
import java.io.File;
|
||||
import net.yacy.cora.document.encoding.ASCII;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class RecordsTest {
|
||||
|
||||
final String tesDir = "test/DATA/INDEX/QUEUE";
|
||||
|
||||
/**
|
||||
* Test of cleanLast method, of class Records.
|
||||
*/
|
||||
@Test
|
||||
public void testCleanLast_byteArr_int() throws Exception {
|
||||
|
||||
File tablefile = new File(tesDir, "test.stack");
|
||||
|
||||
byte[] b = ASCII.getBytes("testDataString");
|
||||
Records rec = new Records(tablefile, b.length);
|
||||
|
||||
rec.add(b, 0); // add some data
|
||||
|
||||
for (int i = 0; i < 5; i++) { // multiple cleanlast
|
||||
rec.cleanLast(b, 0);
|
||||
}
|
||||
assertEquals(0,rec.size());
|
||||
rec.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of cleanLast method, of class Records.
|
||||
*/
|
||||
@Test
|
||||
public void testCleanLast() throws Exception {
|
||||
|
||||
File tablefile = new File (tesDir,"test.stack");
|
||||
|
||||
byte[] b = ASCII.getBytes("testdata");
|
||||
Records rec = new Records(tablefile, b.length);
|
||||
|
||||
rec.add(b, 0); // add data
|
||||
for (int i = 0; i < 5; i++) { // multiple cleanLast
|
||||
rec.cleanLast();
|
||||
}
|
||||
assertEquals(0,rec.size());
|
||||
rec.close();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue