FileDocCategorySizeDatePackage
LinkTest.javaAPI DocExample2303Wed Feb 18 10:12:50 GMT 2004com.develop.ss

LinkTest

public class LinkTest extends TestCase

(Omit source code)

Fields Summary
private com.meterware.httpunit.WebConversation
conversation
private LinkTestSuite
suite
static Logger
log
Constructors Summary
public LinkTest(String name, com.meterware.httpunit.WebConversation conversation, LinkTestSuite suite)


         
    super(name);
    if ((name == null) || (conversation == null) || (suite == null)) {
      throw new IllegalArgumentException("LinkTest constructor requires non-null args");
    }
    this.conversation = conversation;
    this.suite = suite;
  
Methods Summary
private voidaddToIndex(com.meterware.httpunit.WebResponse response)

    Document d = new Document();
    HTMLParser parser = new HTMLParser(response.getInputStream());
    d.add(Field.UnIndexed("url", response.getURL().toExternalForm()));
    d.add(Field.UnIndexed("summary", parser.getSummary()));
    d.add(Field.Text("title", parser.getTitle()));
    d.add(Field.Text("contents", parser.getReader()));
    suite.getWriter().addDocument(d);
  
private booleanisHTML(com.meterware.httpunit.WebResponse response)

    return response.getContentType().equals("text/html");
  
protected voidrunTest()

    WebResponse response = null;
    try {
      response = conversation.getResponse(getName());
    } catch (HttpNotFoundException hnfe) {
      fail("HTTP " + hnfe.getResponseCode() + " " + getName());
    }
    if (!isHTML(response)) {
      return;
    }
    addToIndex(response);
    WebLink[] links = response.getLinks();
    for (int i = 0; i < links.length; i++) {
      WebLink link = links[i];
      suite.considerNewLink(getName(), link);
    }