1 23 package org.archive.crawler.selftest; 24 25 import java.io.File ; 26 import java.util.Arrays ; 27 import java.util.List ; 28 29 import javax.management.AttributeNotFoundException ; 30 import javax.management.MBeanException ; 31 import javax.management.ReflectionException ; 32 33 import org.archive.crawler.framework.CrawlScope; 34 import org.archive.crawler.scope.ClassicScope; 35 36 37 43 public class MaxLinkHopsSelfTest 44 extends SelfTestCase 45 { 46 49 private static final List <File > FILES_TO_FIND = 50 Arrays.asList(new File [] {new File ("2.html"), 51 new File ("3.html"), new File ("4.html"), new File ("5.html")}); 52 53 56 private static final List FILES_NOT_TO_FIND = 57 Arrays.asList(new File [] {new File ("1.html"), new File ("6.html")}); 58 59 63 private static final int MAXLINKHOPS = 5; 64 65 66 69 public void testMaxLinkHops() 70 throws AttributeNotFoundException , MBeanException , ReflectionException 71 { 72 CrawlScope scope = 73 (CrawlScope)getCrawlJob().getSettingsHandler() 74 .getModule(CrawlScope.ATTR_NAME); 75 int maxLinkHops = 76 ((Integer )scope.getAttribute(ClassicScope.ATTR_MAX_LINK_HOPS)) 77 .intValue(); 78 assertTrue("max-link-hops incorrect", MAXLINKHOPS == maxLinkHops); 79 80 assertTrue("File present on disk", filesExist(FILES_NOT_TO_FIND)); 82 83 testFilesInArc(FILES_TO_FIND); 85 } 86 } 87 88 | Popular Tags |