Example #1
0
  @Test
  public void test() {
    String url1 = "http://nba.hupu.com/";
    String url2 = "http://www.google.com/";

    WebURL a = new WebURL();
    a.setURL(url1);
    a.setDepth((short) 3);

    WebURL b = new WebURL();
    b.setURL(url2);
    b.setDepth((short) 2);

    scheduler.schedule(a);
    assertEquals(1, scheduler.getQueueLength());

    scheduler.schedule(a);
    assertEquals(1, scheduler.getQueueLength());

    scheduler.schedule(b);
    assertEquals(2, scheduler.getQueueLength());

    List<WebURL> l = new ArrayList<WebURL>();
    scheduler.getNextURLs(1, l);
    assertEquals(url2, l.get(0).getURL());

    assertEquals(1, scheduler.getQueueLength());
    assertEquals(2, scheduler.getScheduledNum());
  }
Example #2
0
 @Override
 public WebURL entryToObject(TupleInput input) {
   WebURL webURL = new WebURL();
   webURL.setPrimeKey(input.readString());
   webURL.setURL(input.readString());
   webURL.setDocid(input.readInt());
   webURL.setParentDocid(input.readInt());
   webURL.setParentUrl(input.readString());
   webURL.setDepth(input.readShort());
   webURL.setCookie(input.readString());
   webURL.setFormParams(input.readString());
   webURL.setMethod(input.readString());
   return webURL;
 }