Update of /cvsroot/nutch/nutch/src/test/net/nutch/pagedb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31442/src/test/net/nutch/pagedb
Modified Files: TestPage.java Log Message: Fix Page constructors so that next fetch date is less likely to be misconstrued as a float. This patches a problem in WebDBInjector, where new pages were added to the db with nextScore set to the intended nextFetch date. This, in turn, confused link analysis. Index: TestPage.java =================================================================== RCS file: /cvsroot/nutch/nutch/src/test/net/nutch/pagedb/TestPage.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestPage.java 14 Apr 2003 19:24:16 -0000 1.7 --- TestPage.java 13 Dec 2004 19:20:40 -0000 1.8 *************** *** 5,8 **** --- 5,9 ---- import java.io.*; + import java.util.Random; import net.nutch.io.*; import net.nutch.db.*; *************** *** 20,23 **** TestWritable.testWritable(getTestPage()); } ! } --- 21,57 ---- TestWritable.testWritable(getTestPage()); } ! ! public void testPageCtors() throws Exception { ! Random random = new Random(); ! String urlString = "http://foo.com/"; ! MD5Hash md5 = MD5Hash.digest(urlString); ! long now = System.currentTimeMillis(); ! float score = random.nextFloat(); ! float nextScore = random.nextFloat(); ! ! Page page = new Page(urlString, md5); ! assertEquals(page.getURL().toString(), urlString); ! assertEquals(page.getMD5(), md5); ! ! page = new Page(urlString, score); ! assertEquals(page.getURL().toString(), urlString); ! assertEquals(page.getMD5(), md5); ! assertEquals(page.getScore(), score, 0.0f); ! assertEquals(page.getNextScore(), score, 0.0f); ! ! page = new Page(urlString, score, now); ! assertEquals(page.getURL().toString(), urlString); ! assertEquals(page.getMD5(), md5); ! assertEquals(page.getNextFetchTime(), now); ! assertEquals(page.getScore(), score, 0.0f); ! assertEquals(page.getNextScore(), score, 0.0f); ! ! page = new Page(urlString, score, nextScore, now); ! assertEquals(page.getURL().toString(), urlString); ! assertEquals(page.getMD5(), md5); ! assertEquals(page.getNextFetchTime(), now); ! assertEquals(page.getScore(), score, 0.0f); ! assertEquals(page.getNextScore(), nextScore, 0.0f); ! } ! } ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Nutch-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nutch-cvs