You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by le...@apache.org on 2014/03/29 01:54:41 UTC

svn commit: r1582928 [4/4] - in /nutch/trunk: ./ ivy/ src/plugin/creativecommons/src/test/org/creativecommons/nutch/ src/plugin/feed/src/test/org/apache/nutch/parse/feed/ src/plugin/index-anchor/src/test/org/apache/nutch/indexer/anchor/ src/plugin/inde...

Modified: nutch/trunk/src/test/org/apache/nutch/plugin/TestPluginSystem.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/plugin/TestPluginSystem.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/plugin/TestPluginSystem.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/plugin/TestPluginSystem.java Sat Mar 29 00:54:40 2014
@@ -26,272 +26,283 @@ import java.util.LinkedList;
 import java.util.Locale;
 import java.util.Properties;
 
-import junit.framework.TestCase;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.nutch.util.NutchConfiguration;
 import org.apache.nutch.util.NutchJob;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Unit tests for the plugin system
  */
-public class TestPluginSystem extends TestCase {
-    private int fPluginCount;
-
-    private LinkedList<File> fFolders = new LinkedList<File>();
-    private Configuration conf ;
-    private PluginRepository repository;
-
-    protected void setUp() throws Exception {
-        this.conf = NutchConfiguration.create();
-        conf.set("plugin.includes", ".*");
-//        String string = this.conf.get("plugin.includes", "");
-//        conf.set("plugin.includes", string + "|Dummy*");
-        fPluginCount = 5;
-        createDummyPlugins(fPluginCount);
-        this.repository = PluginRepository.get(conf);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see junit.framework.TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        for (int i = 0; i < fFolders.size(); i++) {
-            File folder = fFolders.get(i);
-            delete(folder);
-            folder.delete();
-        }
-    }
-
-    /**
-     */
-    public void testPluginConfiguration() {
-        String string = getPluginFolder();
-        File file = new File(string);
-        if (!file.exists()) {
-            file.mkdir();
-        }
-        assertTrue(file.exists());
-    }
-
-    /**
-     */
-    public void testLoadPlugins() {
-        PluginDescriptor[] descriptors = repository
-                .getPluginDescriptors();
-        int k = descriptors.length;
-        assertTrue(fPluginCount <= k);
-        for (int i = 0; i < descriptors.length; i++) {
-            PluginDescriptor descriptor = descriptors[i];
-            if (!descriptor.getPluginId().startsWith("getPluginFolder()")) {
-                continue;
-            }
-            assertEquals(1, descriptor.getExportedLibUrls().length);
-            assertEquals(1, descriptor.getNotExportedLibUrls().length);
-        }
-    }
-
-    public void testRepositoryCache() {
-      Configuration config = NutchConfiguration.create();
-      PluginRepository repo = PluginRepository.get(config);
-      JobConf job = new NutchJob(config);
-      PluginRepository repo1 = PluginRepository.get(job);
-      assertTrue(repo == repo1);
-      // now construct a config without UUID
-      config = new Configuration();
-      config.addResource("nutch-default.xml");
-      config.addResource("nutch-site.xml");
-      repo = PluginRepository.get(config);
-      job = new NutchJob(config);
-      repo1 = PluginRepository.get(job);
-      assertTrue(repo1 != repo);
-    }
-
-    /**
-     *  
-     */
-    public void testGetExtensionAndAttributes() {
-        String xpId = " sdsdsd";
-        ExtensionPoint extensionPoint =repository
-                .getExtensionPoint(xpId);
-        assertEquals(extensionPoint, null);
-        Extension[] extension1 = repository
-                .getExtensionPoint(getGetExtensionId()).getExtensions();
-        assertEquals(extension1.length, fPluginCount);
-        for (int i = 0; i < extension1.length; i++) {
-            Extension extension2 = extension1[i];
-            String string = extension2.getAttribute(getGetConfigElementName());
-            assertEquals(string, getParameterValue());
-        }
-    }
-
-    /**
-     * @throws PluginRuntimeException
-     */
-    public void testGetExtensionInstances() throws PluginRuntimeException {
-        Extension[] extensions = repository
-                .getExtensionPoint(getGetExtensionId()).getExtensions();
-        assertEquals(extensions.length, fPluginCount);
-        for (int i = 0; i < extensions.length; i++) {
-            Extension extension = extensions[i];
-            Object object = extension.getExtensionInstance();
-            if (!(object instanceof HelloWorldExtension))
-                fail(" object is not a instance of HelloWorldExtension");
-            ((ITestExtension) object).testGetExtension("Bla ");
-            String string = ((ITestExtension) object).testGetExtension("Hello");
-            assertEquals("Hello World", string);
-        }
-    }
-
-    /**
-     * 
-     *  
-     */
-    public void testGetClassLoader() {
-        PluginDescriptor[] descriptors = repository
-                .getPluginDescriptors();
-        for (int i = 0; i < descriptors.length; i++) {
-            PluginDescriptor descriptor = descriptors[i];
-            assertNotNull(descriptor.getClassLoader());
-        }
-    }
-
-    /**
-     * @throws IOException
-     */
-    public void testGetResources() throws IOException {
-        PluginDescriptor[] descriptors = repository
-                .getPluginDescriptors();
-        for (int i = 0; i < descriptors.length; i++) {
-            PluginDescriptor descriptor = descriptors[i];
-            if (!descriptor.getPluginId().startsWith("getPluginFolder()")) {
-                continue;
-            }
-            String value = descriptor.getResourceString("key", Locale.UK);
-            assertEquals("value", value);
-            value = descriptor.getResourceString("key",
-                    Locale.TRADITIONAL_CHINESE);
-            assertEquals("value", value);
-
-        }
-    }
-
-    /**
-     * @return a PluginFolderPath
-     */
-    private String getPluginFolder() {
-        String[] strings = conf.getStrings("plugin.folders");
-        if (strings == null || strings.length == 0)
-            fail("no plugin directory setuped..");
-
-        String name = strings[0];
-        return new PluginManifestParser(conf, this.repository).getPluginFolder(name).toString();
-    }
-
-    /**
-     * Creates some Dummy Plugins
-     * 
-     * @param pCount
-     */
-    private void createDummyPlugins(int pCount) {
-        String string = getPluginFolder();
-        try {
-            File folder = new File(string);
-            folder.mkdir();
-            for (int i = 0; i < pCount; i++) {
-                String pluginFolder = string + File.separator + "DummyPlugin"
-                        + i;
-                File file = new File(pluginFolder);
-                file.mkdir();
-                fFolders.add(file);
-                createPluginManifest(i, file.getAbsolutePath());
-                createResourceFile(file.getAbsolutePath());
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Creates an ResourceFile
-     * 
-     * @param pFolderPath
-     * @throws FileNotFoundException
-     * @throws IOException
-     */
-    private void createResourceFile(String pFolderPath)
-            throws FileNotFoundException, IOException {
-        Properties properties = new Properties();
-        properties.setProperty("key", "value");
-        properties.store(new FileOutputStream(pFolderPath + File.separator
-                + "messages" + ".properties"), "");
-    }
-
-    /**
-     * Deletes files in path
-     * 
-     * @param path
-     * @throws IOException
-     */
-    private void delete(File path) throws IOException {
-        File[] files = path.listFiles();
-        for (int i = 0; i < files.length; ++i) {
-            if (files[i].isDirectory())
-                delete(files[i]);
-            files[i].delete();
-        }
-    }
+public class TestPluginSystem {
+  private int fPluginCount;
 
-    /**
-     * Creates an Plugin Manifest File
-     * 
-     * @param i
-     * @param pFolderPath
-     * @throws IOException
-     */
-    private void createPluginManifest(int i, String pFolderPath)
-            throws IOException {
-        FileWriter out = new FileWriter(pFolderPath + File.separator
-                + "plugin.xml");
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 
-                + "<!--this is just a simple plugin for testing issues.-->"
-                + "<plugin id=\"org.apache.nutch.plugin."
-                + i
-                + "\" name=\""
-                + i
-                + "\" version=\"1.0\" provider-name=\"joa23\" "
-                + "class=\"org.apache.nutch.plugin.SimpleTestPlugin\">"
-                + "<extension-point id=\"aExtensioID\" "
-                + "name=\"simple Parser Extension\" "
-                + "schema=\"schema/testExtensionPoint.exsd\"/>"
-                + "<runtime><library name=\"libs/exported.jar\"><extport/></library>"
-                + "<library name=\"libs/not_exported.jar\"/></runtime>"
-                + "<extension point=\"aExtensioID\">"
-                + "<implementation name=\"simple Parser Extension\" "
-                + "id=\"aExtensionId.\" class=\"org.apache.nutch.plugin.HelloWorldExtension\">"
-                + "<parameter name=\"dummy-name\" value=\"a simple param value\"/>"
-                + "</implementation></extension></plugin>";
-        out.write(xml);
-        out.flush();
-        out.close();
-    }
-
-    private String getParameterValue() {
-        return "a simple param value";
-    }
-
-    private static String getGetExtensionId() {
-        return "aExtensioID";
-    }
-
-    private static String getGetConfigElementName() {
-        return "dummy-name";
-    }
-
-    public static void main(String[] args) throws IOException {
-        new TestPluginSystem().createPluginManifest(1, "/");
-    }
+  private LinkedList<File> fFolders = new LinkedList<File>();
+  private Configuration conf ;
+  private PluginRepository repository;
+
+  @Before
+  public void setUp() throws Exception {
+    this.conf = NutchConfiguration.create();
+    conf.set("plugin.includes", ".*");
+    //        String string = this.conf.get("plugin.includes", "");
+    //        conf.set("plugin.includes", string + "|Dummy*");
+    fPluginCount = 5;
+    createDummyPlugins(fPluginCount);
+    this.repository = PluginRepository.get(conf);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see junit.framework.TestCase#tearDown()
+   */
+  @After
+  public void tearDown() throws Exception {
+    for (int i = 0; i < fFolders.size(); i++) {
+      File folder = fFolders.get(i);
+      delete(folder);
+      folder.delete();
+    }
+  }
+
+  /**
+   */
+  @Test
+  public void testPluginConfiguration() {
+    String string = getPluginFolder();
+    File file = new File(string);
+    if (!file.exists()) {
+      file.mkdir();
+    }
+    Assert.assertTrue(file.exists());
+  }
+
+  /**
+   */
+  @Test
+  public void testLoadPlugins() {
+    PluginDescriptor[] descriptors = repository
+        .getPluginDescriptors();
+    int k = descriptors.length;
+    Assert.assertTrue(fPluginCount <= k);
+    for (int i = 0; i < descriptors.length; i++) {
+      PluginDescriptor descriptor = descriptors[i];
+      if (!descriptor.getPluginId().startsWith("getPluginFolder()")) {
+        continue;
+      }
+      Assert.assertEquals(1, descriptor.getExportedLibUrls().length);
+      Assert.assertEquals(1, descriptor.getNotExportedLibUrls().length);
+    }
+  }
+
+  @Test
+  public void testRepositoryCache() {
+    Configuration config = NutchConfiguration.create();
+    PluginRepository repo = PluginRepository.get(config);
+    JobConf job = new NutchJob(config);
+    PluginRepository repo1 = PluginRepository.get(job);
+    Assert.assertTrue(repo == repo1);
+    // now construct a config without UUID
+    config = new Configuration();
+    config.addResource("nutch-default.xml");
+    config.addResource("nutch-site.xml");
+    repo = PluginRepository.get(config);
+    job = new NutchJob(config);
+    repo1 = PluginRepository.get(job);
+    Assert.assertTrue(repo1 != repo);
+  }
+
+  /**
+   *  
+   */
+  @Test
+  public void testGetExtensionAndAttributes() {
+    String xpId = " sdsdsd";
+    ExtensionPoint extensionPoint =repository
+        .getExtensionPoint(xpId);
+    Assert.assertEquals(extensionPoint, null);
+    Extension[] extension1 = repository
+        .getExtensionPoint(getGetExtensionId()).getExtensions();
+    Assert.assertEquals(extension1.length, fPluginCount);
+    for (int i = 0; i < extension1.length; i++) {
+      Extension extension2 = extension1[i];
+      String string = extension2.getAttribute(getGetConfigElementName());
+      Assert.assertEquals(string, getParameterValue());
+    }
+  }
+
+  /**
+   * @throws PluginRuntimeException
+   */
+  @Test
+  public void testGetExtensionInstances() throws PluginRuntimeException {
+    Extension[] extensions = repository
+        .getExtensionPoint(getGetExtensionId()).getExtensions();
+    Assert.assertEquals(extensions.length, fPluginCount);
+    for (int i = 0; i < extensions.length; i++) {
+      Extension extension = extensions[i];
+      Object object = extension.getExtensionInstance();
+      if (!(object instanceof HelloWorldExtension))
+        Assert.fail(" object is not a instance of HelloWorldExtension");
+      ((ITestExtension) object).testGetExtension("Bla ");
+      String string = ((ITestExtension) object).testGetExtension("Hello");
+      Assert.assertEquals("Hello World", string);
+    }
+  }
+
+  /**
+   * 
+   *  
+   */
+  @Test
+  public void testGetClassLoader() {
+    PluginDescriptor[] descriptors = repository
+        .getPluginDescriptors();
+    for (int i = 0; i < descriptors.length; i++) {
+      PluginDescriptor descriptor = descriptors[i];
+      Assert.assertNotNull(descriptor.getClassLoader());
+    }
+  }
+
+  /**
+   * @throws IOException
+   */
+  @Test
+  public void testGetResources() throws IOException {
+    PluginDescriptor[] descriptors = repository
+        .getPluginDescriptors();
+    for (int i = 0; i < descriptors.length; i++) {
+      PluginDescriptor descriptor = descriptors[i];
+      if (!descriptor.getPluginId().startsWith("getPluginFolder()")) {
+        continue;
+      }
+      String value = descriptor.getResourceString("key", Locale.UK);
+      Assert.assertEquals("value", value);
+      value = descriptor.getResourceString("key",
+          Locale.TRADITIONAL_CHINESE);
+      Assert.assertEquals("value", value);
+
+    }
+  }
+
+  /**
+   * @return a PluginFolderPath
+   */
+  private String getPluginFolder() {
+    String[] strings = conf.getStrings("plugin.folders");
+    if (strings == null || strings.length == 0)
+      Assert.fail("no plugin directory setuped..");
+
+    String name = strings[0];
+    return new PluginManifestParser(conf, this.repository).getPluginFolder(name).toString();
+  }
+
+  /**
+   * Creates some Dummy Plugins
+   * 
+   * @param pCount
+   */
+  private void createDummyPlugins(int pCount) {
+    String string = getPluginFolder();
+    try {
+      File folder = new File(string);
+      folder.mkdir();
+      for (int i = 0; i < pCount; i++) {
+        String pluginFolder = string + File.separator + "DummyPlugin"
+            + i;
+        File file = new File(pluginFolder);
+        file.mkdir();
+        fFolders.add(file);
+        createPluginManifest(i, file.getAbsolutePath());
+        createResourceFile(file.getAbsolutePath());
+      }
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
+
+  /**
+   * Creates an ResourceFile
+   * 
+   * @param pFolderPath
+   * @throws FileNotFoundException
+   * @throws IOException
+   */
+  private void createResourceFile(String pFolderPath)
+      throws FileNotFoundException, IOException {
+    Properties properties = new Properties();
+    properties.setProperty("key", "value");
+    properties.store(new FileOutputStream(pFolderPath + File.separator
+        + "messages" + ".properties"), "");
+  }
+
+  /**
+   * Deletes files in path
+   * 
+   * @param path
+   * @throws IOException
+   */
+  private void delete(File path) throws IOException {
+    File[] files = path.listFiles();
+    for (int i = 0; i < files.length; ++i) {
+      if (files[i].isDirectory())
+        delete(files[i]);
+      files[i].delete();
+    }
+  }
+
+  /**
+   * Creates an Plugin Manifest File
+   * 
+   * @param i
+   * @param pFolderPath
+   * @throws IOException
+   */
+  private void createPluginManifest(int i, String pFolderPath)
+      throws IOException {
+    FileWriter out = new FileWriter(pFolderPath + File.separator
+        + "plugin.xml");
+    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 
+        + "<!--this is just a simple plugin for testing issues.-->"
+        + "<plugin id=\"org.apache.nutch.plugin."
+        + i
+        + "\" name=\""
+        + i
+        + "\" version=\"1.0\" provider-name=\"joa23\" "
+        + "class=\"org.apache.nutch.plugin.SimpleTestPlugin\">"
+        + "<extension-point id=\"aExtensioID\" "
+        + "name=\"simple Parser Extension\" "
+        + "schema=\"schema/testExtensionPoint.exsd\"/>"
+        + "<runtime><library name=\"libs/exported.jar\"><extport/></library>"
+        + "<library name=\"libs/not_exported.jar\"/></runtime>"
+        + "<extension point=\"aExtensioID\">"
+        + "<implementation name=\"simple Parser Extension\" "
+        + "id=\"aExtensionId.\" class=\"org.apache.nutch.plugin.HelloWorldExtension\">"
+        + "<parameter name=\"dummy-name\" value=\"a simple param value\"/>"
+        + "</implementation></extension></plugin>";
+    out.write(xml);
+    out.flush();
+    out.close();
+  }
+
+  private String getParameterValue() {
+    return "a simple param value";
+  }
+
+  private static String getGetExtensionId() {
+    return "aExtensioID";
+  }
+
+  private static String getGetConfigElementName() {
+    return "dummy-name";
+  }
+
+  public static void main(String[] args) throws IOException {
+    new TestPluginSystem().createPluginManifest(1, "/");
+  }
 }

Modified: nutch/trunk/src/test/org/apache/nutch/protocol/TestContent.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/protocol/TestContent.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/protocol/TestContent.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/protocol/TestContent.java Sat Mar 29 00:54:40 2014
@@ -23,18 +23,16 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.nutch.util.NutchConfiguration;
 import org.apache.nutch.util.WritableTestUtils;
 import org.apache.tika.mime.MimeTypes;
-
-import junit.framework.TestCase;
-
+import org.junit.Assert;
+import org.junit.Test;
 
 /** Unit tests for Content. */
 
-public class TestContent extends TestCase {
+public class TestContent {
 
   private static Configuration conf = NutchConfiguration.create();
 
-  public TestContent(String name) { super(name); }
-
+  @Test
   public void testContent() throws Exception {
 
     String page = "<HTML><BODY><H1>Hello World</H1><P>The Quick Brown Fox Jumped Over the Lazy Fox.</BODY></HTML>";
@@ -46,66 +44,67 @@ public class TestContent extends TestCas
     metaData.add("Content-Type", "text/html");
 
     Content r = new Content(url, url, page.getBytes("UTF8"), "text/html",
-                            metaData, conf);
+        metaData, conf);
 
     WritableTestUtils.testWritable(r);
-    assertEquals("text/html", r.getMetadata().get("Content-Type"));
-    assertEquals("text/html", r.getMetadata().get("content-type"));
-    assertEquals("text/html", r.getMetadata().get("CONTENTYPE"));
+    Assert.assertEquals("text/html", r.getMetadata().get("Content-Type"));
+    Assert.assertEquals("text/html", r.getMetadata().get("content-type"));
+    Assert.assertEquals("text/html", r.getMetadata().get("CONTENTYPE"));
   }
 
   /** Unit tests for getContentType(String, String, byte[]) method. */
+  @Test
   public void testGetContentType() throws Exception {
     Content c = null;
     Metadata p = new Metadata();
 
     c = new Content("http://www.foo.com/",
-                    "http://www.foo.com/",
-                    "".getBytes("UTF8"),
-                    "text/html; charset=UTF-8", p, conf);
-    assertEquals("text/html", c.getContentType());
+        "http://www.foo.com/",
+        "".getBytes("UTF8"),
+        "text/html; charset=UTF-8", p, conf);
+    Assert.assertEquals("text/html", c.getContentType());
 
     c = new Content("http://www.foo.com/foo.html",
-                    "http://www.foo.com/",
-                    "".getBytes("UTF8"),
-                    "", p, conf);
-    assertEquals("text/html", c.getContentType());
+        "http://www.foo.com/",
+        "".getBytes("UTF8"),
+        "", p, conf);
+    Assert.assertEquals("text/html", c.getContentType());
 
     c = new Content("http://www.foo.com/foo.html",
-                    "http://www.foo.com/",
-                    "".getBytes("UTF8"),
-                    null, p, conf);
-    assertEquals("text/html", c.getContentType());
+        "http://www.foo.com/",
+        "".getBytes("UTF8"),
+        null, p, conf);
+    Assert.assertEquals("text/html", c.getContentType());
 
     c = new Content("http://www.foo.com/",
-                    "http://www.foo.com/",
-                    "<html></html>".getBytes("UTF8"),
-                    "", p, conf);
-    assertEquals("text/html", c.getContentType());
+        "http://www.foo.com/",
+        "<html></html>".getBytes("UTF8"),
+        "", p, conf);
+    Assert.assertEquals("text/html", c.getContentType());
 
     c = new Content("http://www.foo.com/foo.html",
-                    "http://www.foo.com/",
-                    "<html></html>".getBytes("UTF8"),
-                    "text/plain", p, conf);
-    assertEquals("text/html", c.getContentType());
+        "http://www.foo.com/",
+        "<html></html>".getBytes("UTF8"),
+        "text/plain", p, conf);
+    Assert.assertEquals("text/html", c.getContentType());
 
     c = new Content("http://www.foo.com/foo.png",
-                    "http://www.foo.com/",
-                    "<html></html>".getBytes("UTF8"),
-                    "text/plain", p, conf);
-    assertEquals("text/html", c.getContentType());
+        "http://www.foo.com/",
+        "<html></html>".getBytes("UTF8"),
+        "text/plain", p, conf);
+    Assert.assertEquals("text/html", c.getContentType());
 
     c = new Content("http://www.foo.com/",
-                    "http://www.foo.com/",
-                    "".getBytes("UTF8"),
-                    "", p, conf);
-    assertEquals(MimeTypes.OCTET_STREAM, c.getContentType());
+        "http://www.foo.com/",
+        "".getBytes("UTF8"),
+        "", p, conf);
+    Assert.assertEquals(MimeTypes.OCTET_STREAM, c.getContentType());
 
     c = new Content("http://www.foo.com/",
-                    "http://www.foo.com/",
-                    "".getBytes("UTF8"),
-                    null, p, conf);
-    assertNotNull(c.getContentType());
+        "http://www.foo.com/",
+        "".getBytes("UTF8"),
+        null, p, conf);
+    Assert.assertNotNull(c.getContentType());
   }
 
 }

Modified: nutch/trunk/src/test/org/apache/nutch/protocol/TestProtocolFactory.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/protocol/TestProtocolFactory.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/protocol/TestProtocolFactory.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/protocol/TestProtocolFactory.java Sat Mar 29 00:54:40 2014
@@ -19,31 +19,34 @@ package org.apache.nutch.protocol;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.nutch.util.NutchConfiguration;
 import org.apache.nutch.util.ObjectCache;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class TestProtocolFactory extends TestCase {
+public class TestProtocolFactory {
 
   Configuration conf;
   ProtocolFactory factory;
   
-  protected void setUp() throws Exception {
+  @Before
+  public void setUp() throws Exception {
     conf = NutchConfiguration.create();
     conf.set("plugin.includes", ".*");
     conf.set("http.agent.name", "test-bot");
     factory=new ProtocolFactory(conf);
   }
 
+  @Test
   public void testGetProtocol(){
 
     //non existing protocol
     try {
       factory.getProtocol("xyzxyz://somehost");
-      fail("Must throw ProtocolNotFound");
+      Assert.fail("Must throw ProtocolNotFound");
     } catch (ProtocolNotFound e) {
       //all is ok
     } catch (Exception ex){
-      fail("Must not throw any other exception");
+      Assert.fail("Must not throw any other exception");
     }
     
     Protocol httpProtocol=null;
@@ -51,30 +54,31 @@ public class TestProtocolFactory extends
     //existing protocol
     try {
       httpProtocol=factory.getProtocol("http://somehost");
-      assertNotNull(httpProtocol);
+      Assert.assertNotNull(httpProtocol);
     } catch (Exception ex){
-      fail("Must not throw any other exception");
+      Assert.fail("Must not throw any other exception");
     }
 
     //cache key
     Object protocol = ObjectCache.get(conf).getObject(Protocol.X_POINT_ID + "http");
-    assertNotNull(protocol);
-    assertEquals(httpProtocol, protocol);
+    Assert.assertNotNull(protocol);
+    Assert.assertEquals(httpProtocol, protocol);
     
     //test same object instance
     try {
-      assertTrue(httpProtocol==factory.getProtocol("http://somehost"));
+      Assert.assertTrue(httpProtocol==factory.getProtocol("http://somehost"));
     } catch (ProtocolNotFound e) {
-      fail("Must not throw any exception");
+      Assert.fail("Must not throw any exception");
     }
   }
   
+  @Test
   public void testContains(){
-    assertTrue(factory.contains("http", "http"));
-    assertTrue(factory.contains("http", "http,ftp"));
-    assertTrue(factory.contains("http", "   http ,   ftp"));
-    assertTrue(factory.contains("smb", "ftp,smb,http"));
-    assertFalse(factory.contains("smb", "smbb"));
+    Assert.assertTrue(factory.contains("http", "http"));
+    Assert.assertTrue(factory.contains("http", "http,ftp"));
+    Assert.assertTrue(factory.contains("http", "   http ,   ftp"));
+    Assert.assertTrue(factory.contains("smb", "ftp,smb,http"));
+    Assert.assertFalse(factory.contains("smb", "smbb"));
   }
   
 }

Modified: nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMerger.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMerger.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMerger.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMerger.java Sat Mar 29 00:54:40 2014
@@ -27,10 +27,12 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.MapFileOutputFormat;
 import org.apache.nutch.parse.ParseText;
 import org.apache.nutch.util.NutchConfiguration;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class TestSegmentMerger extends TestCase {
+public class TestSegmentMerger {
   Configuration conf;
   FileSystem fs;
   Path testDir;
@@ -39,6 +41,7 @@ public class TestSegmentMerger extends T
   Path out;
   int countSeg1, countSeg2;
   
+  @Before
   public void setUp() throws Exception {
     conf = NutchConfiguration.create();
     fs = FileSystem.get(conf);
@@ -81,17 +84,19 @@ public class TestSegmentMerger extends T
     System.err.println(" - done: " + countSeg2 + " records.");
   }
   
+  @After
   public void tearDown() throws Exception {
     fs.delete(testDir, true);
   }
   
+  @Test
   public void testLargeMerge() throws Exception {
     SegmentMerger merger = new SegmentMerger(conf);
     merger.merge(out, new Path[]{seg1, seg2}, false, false, -1);
     // verify output
     FileStatus[] stats = fs.listStatus(out);
     // there should be just one path
-    assertEquals(1, stats.length);
+    Assert.assertEquals(1, stats.length);
     Path outSeg = stats[0].getPath();
     Text k = new Text();
     ParseText v = new ParseText();
@@ -103,16 +108,16 @@ public class TestSegmentMerger extends T
         String vs = v.getText();
         if (ks.startsWith("seg1-")) {
           cnt1++;
-          assertTrue(vs.startsWith("seg1 "));
+          Assert.assertTrue(vs.startsWith("seg1 "));
         } else if (ks.startsWith("seg2-")) {
           cnt2++;
-          assertTrue(vs.startsWith("seg2 "));
+          Assert.assertTrue(vs.startsWith("seg2 "));
         }
       }
       r.close();
     }
-    assertEquals(countSeg1, cnt1);
-    assertEquals(countSeg2, cnt2);
+    Assert.assertEquals(countSeg1, cnt1);
+    Assert.assertEquals(countSeg2, cnt2);
   }
 
 }

Modified: nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java Sat Mar 29 00:54:40 2014
@@ -28,13 +28,14 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.MapFileOutputFormat;
 import org.apache.nutch.crawl.CrawlDatum;
 import org.apache.nutch.util.NutchConfiguration;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import junit.framework.TestCase;
-
 /**
- * New SegmentMerger unit test focussing on several crappy issues with the segment
+ * New SegmentMerger unit test focusing on several crappy issues with the segment
  * merger. The general problem is disappearing records and incorrect CrawlDatum
  * status values. This unit test performs random sequences of segment merging where
  * we're looking for an expected status.
@@ -49,7 +50,7 @@ import junit.framework.TestCase;
  *
  * Cheers!
  */
-public class TestSegmentMergerCrawlDatums extends TestCase {
+public class TestSegmentMergerCrawlDatums {
   Configuration conf;
   FileSystem fs;
   Random rnd;
@@ -57,6 +58,7 @@ public class TestSegmentMergerCrawlDatum
   private static final Logger LOG = LoggerFactory
       .getLogger(TestSegmentMergerCrawlDatums.class);
   
+  @Before
   public void setUp() throws Exception {
     conf = NutchConfiguration.create();
     fs = FileSystem.get(conf);
@@ -66,8 +68,9 @@ public class TestSegmentMergerCrawlDatum
   /**
    *
    */
+  @Test
   public void testSingleRandomSequence() throws Exception {
-    assertEquals(
+    Assert.assertEquals(
         new Byte(CrawlDatum.STATUS_FETCH_SUCCESS),
         new Byte(executeSequence(CrawlDatum.STATUS_FETCH_GONE,
             CrawlDatum.STATUS_FETCH_SUCCESS, 256, false)));
@@ -76,6 +79,7 @@ public class TestSegmentMergerCrawlDatum
   /**
    *
    */
+  @Test
   public void testMostlyRedirects() throws Exception {
     // Our test directory
     Path testDir = new Path(conf.get("hadoop.tmp.dir"), "merge-" + System.currentTimeMillis());
@@ -102,12 +106,13 @@ public class TestSegmentMergerCrawlDatum
     Path mergedSegment = merge(testDir, new Path[]{segment1, segment2, segment3, segment4, segment5, segment6, segment7, segment8});
     Byte status = new Byte(status = checkMergedSegment(testDir, mergedSegment));
     
-    assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
+    Assert.assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
   }
   
   /**
    *
    */
+  @Test
   public void testRandomizedSequences() throws Exception {
     for (int i = 0; i < rnd.nextInt(16) + 16; i++) {
       byte expectedStatus = (byte)(rnd.nextInt(6) + 0x21);
@@ -122,7 +127,7 @@ public class TestSegmentMergerCrawlDatum
       
       byte resultStatus = executeSequence(randomStatus, expectedStatus,
           rounds, withRedirects);
-      assertEquals(
+      Assert.assertEquals(
           "Expected status = " + CrawlDatum.getStatusName(expectedStatus)
               + ", but got " + CrawlDatum.getStatusName(resultStatus)
               + " when merging " + rounds + " segments"
@@ -134,13 +139,15 @@ public class TestSegmentMergerCrawlDatum
   /**
    *
    */
+  @Test
   public void testRandomTestSequenceWithRedirects() throws Exception {
-    assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), new Byte(executeSequence(CrawlDatum.STATUS_FETCH_GONE, CrawlDatum.STATUS_FETCH_SUCCESS, 128, true)));
+    Assert.assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), new Byte(executeSequence(CrawlDatum.STATUS_FETCH_GONE, CrawlDatum.STATUS_FETCH_SUCCESS, 128, true)));
   }
   
   /**
    * Check a fixed sequence!
    */
+  @Test
   public void testFixedSequence() throws Exception {
     // Our test directory
     Path testDir = new Path(conf.get("hadoop.tmp.dir"), "merge-" + System.currentTimeMillis());
@@ -157,12 +164,13 @@ public class TestSegmentMergerCrawlDatum
     Path mergedSegment = merge(testDir, new Path[]{segment1, segment2, segment3});
     Byte status = new Byte(status = checkMergedSegment(testDir, mergedSegment));
     
-    assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
+    Assert.assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
   }
   
   /**
    * Check a fixed sequence!
    */
+  @Test
   public void testRedirFetchInOneSegment() throws Exception {
     // Our test directory
     Path testDir = new Path(conf.get("hadoop.tmp.dir"), "merge-" + System.currentTimeMillis());
@@ -175,12 +183,13 @@ public class TestSegmentMergerCrawlDatum
     Path mergedSegment = merge(testDir, new Path[]{segment});
     Byte status = new Byte(status = checkMergedSegment(testDir, mergedSegment));
     
-    assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
+    Assert.assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
   }
   
   /**
    * Check a fixed sequence!
    */
+  @Test
   public void testEndsWithRedirect() throws Exception {
     // Our test directory
     Path testDir = new Path(conf.get("hadoop.tmp.dir"), "merge-" + System.currentTimeMillis());
@@ -195,7 +204,7 @@ public class TestSegmentMergerCrawlDatum
     Path mergedSegment = merge(testDir, new Path[]{segment1, segment2});
     Byte status = new Byte(status = checkMergedSegment(testDir, mergedSegment));
     
-    assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
+    Assert.assertEquals(new Byte(CrawlDatum.STATUS_FETCH_SUCCESS), status);
   }
   
   /**
@@ -303,7 +312,7 @@ public class TestSegmentMergerCrawlDatum
     merger.merge(out, segments, false, false, -1);
 
     FileStatus[] stats = fs.listStatus(out);
-    assertEquals(1, stats.length);
+    Assert.assertEquals(1, stats.length);
     
     return stats[0].getPath();
   }

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestEncodingDetector.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestEncodingDetector.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestEncodingDetector.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestEncodingDetector.java Sat Mar 29 00:54:40 2014
@@ -22,10 +22,10 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.nutch.metadata.Metadata;
 import org.apache.nutch.net.protocols.Response;
 import org.apache.nutch.protocol.Content;
+import org.junit.Assert;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class TestEncodingDetector extends TestCase {
+public class TestEncodingDetector {
   private static Configuration conf = NutchConfiguration.create();
 
   private static byte[] contentInOctets;
@@ -38,10 +38,7 @@ public class TestEncodingDetector extend
     }
   }
 
-  public TestEncodingDetector(String name) {
-    super(name);
-  }
-
+  @Test
   public void testGuessing() {
     // first disable auto detection
     conf.setInt(EncodingDetector.MIN_CONFIDENCE_KEY, -1);
@@ -57,7 +54,7 @@ public class TestEncodingDetector extend
     detector.autoDetectClues(content, true);
     encoding = detector.guessEncoding(content, "windows-1252");
     // no information is available, so it should return default encoding
-    assertEquals("windows-1252", encoding.toLowerCase());
+    Assert.assertEquals("windows-1252", encoding.toLowerCase());
 
     metadata.clear();
     metadata.set(Response.CONTENT_TYPE, "text/plain; charset=UTF-16");
@@ -66,7 +63,7 @@ public class TestEncodingDetector extend
     detector = new EncodingDetector(conf);
     detector.autoDetectClues(content, true);
     encoding = detector.guessEncoding(content, "windows-1252");
-    assertEquals("utf-16", encoding.toLowerCase());
+    Assert.assertEquals("utf-16", encoding.toLowerCase());
 
     metadata.clear();
     content = new Content("http://www.example.com", "http://www.example.com/",
@@ -75,7 +72,7 @@ public class TestEncodingDetector extend
     detector.autoDetectClues(content, true);
     detector.addClue("windows-1254", "sniffed");
     encoding = detector.guessEncoding(content, "windows-1252");
-    assertEquals("windows-1254", encoding.toLowerCase());
+    Assert.assertEquals("windows-1254", encoding.toLowerCase());
 
     // enable autodetection
     conf.setInt(EncodingDetector.MIN_CONFIDENCE_KEY, 50);
@@ -87,7 +84,7 @@ public class TestEncodingDetector extend
     detector.autoDetectClues(content, true);
     detector.addClue("utf-32", "sniffed");
     encoding = detector.guessEncoding(content, "windows-1252");
-    assertEquals("utf-8", encoding.toLowerCase());
+    Assert.assertEquals("utf-8", encoding.toLowerCase());
   }
 
 }

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestGZIPUtils.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestGZIPUtils.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestGZIPUtils.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestGZIPUtils.java Sat Mar 29 00:54:40 2014
@@ -17,106 +17,103 @@
 
 package org.apache.nutch.util;
 
-import junit.framework.TestCase;
-
 import java.io.IOException;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 /** Unit tests for GZIPUtils methods. */
-public class TestGZIPUtils extends TestCase {
-  public TestGZIPUtils(String name) { 
-    super(name); 
-  }
+public class TestGZIPUtils {
 
   /* a short, highly compressable, string */
   String SHORT_TEST_STRING= 
-    "aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbcccccccccccccccc";
+      "aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbcccccccccccccccc";
 
   /* a short, highly compressable, string */
   String LONGER_TEST_STRING= 
-    SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING 
-    + SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING 
-    + SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING 
-    + SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING;
+      SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING 
+      + SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING 
+      + SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING 
+      + SHORT_TEST_STRING + SHORT_TEST_STRING + SHORT_TEST_STRING;
 
   /* a snapshot of the nutch webpage */
   String WEBPAGE= 
-  "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
-  + "<html>\n"
-  + "<head>\n"
-  + "  <meta http-equiv=\"content-type\"\n"
-  + " content=\"text/html; charset=ISO-8859-1\">\n"
-  + "  <title>Nutch</title>\n"
-  + "</head>\n"
-  + "<body>\n"
-  + "<h1\n"
-  + " style=\"font-family: helvetica,arial,sans-serif; text-align: center; color: rgb(255, 153, 0);\"><a\n"
-  + " href=\"http://www.nutch.org/\"><font style=\"color: rgb(255, 153, 0);\">Nutch</font></a><br>\n"
-  + "<small>an open source web-search engine</small></h1>\n"
-  + "<hr style=\"width: 100%; height: 1px;\" noshade=\"noshade\">\n"
-  + "<table\n"
-  + " style=\"width: 100%; text-align: left; margin-left: auto; margin-right: auto;\"\n"
-  + " border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
-  + "  <tbody>\n"
-  + "    <tr>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"http://sourceforge.net/project/showfiles.php?group_id=59548\">Download</a><br>\n"
-  + "      </td>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"tutorial.html\">Tutorial</a><br>\n"
-  + "      </td>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nutch/nutch/\">CVS</a><br>\n"
-  + "      </td>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"api/index.html\">Javadoc</a><br>\n"
-  + "      </td>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"http://sourceforge.net/tracker/?atid=491356&amp;group_id=59548&amp;func=browse\">Bugs</a><br>\n"
-  + "      </td>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"http://sourceforge.net/mail/?group_id=59548\">Lists</a></td>\n"
-  + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
-  + " href=\"policies.html\">Policies</a><br>\n"
-  + "      </td>\n"
-  + "    </tr>\n"
-  + "  </tbody>\n"
-  + "</table>\n"
-  + "<hr style=\"width: 100%; height: 1px;\" noshade=\"noshade\">\n"
-  + "<h2>Introduction</h2>\n"
-  + "Nutch is a nascent effort to implement an open-source web search\n"
-  + "engine. Web search is a basic requirement for internet navigation, yet\n"
-  + "the number of web search engines is decreasing. Today's oligopoly could\n"
-  + "soon be a monopoly, with a single company controlling nearly all web\n"
-  + "search for its commercial gain. &nbsp;That would not be good for the\n"
-  + "users of internet. &nbsp;Nutch aims to enable anyone to easily and\n"
-  + "cost-effectively deploy a world-class web search engine.<br>\n"
-  + "<br>\n"
-  + "To succeed, the Nutch software must be able to:<br>\n"
-  + "<ul>\n"
-  + "  <li> crawl several billion pages per month</li>\n"
-  + "  <li>maintain an index of these pages</li>\n"
-  + "  <li>search that index up to 1000 times per second</li>\n"
-  + "  <li>provide very high quality search results</li>\n"
-  + "  <li>operate at minimal cost</li>\n"
-  + "</ul>\n"
-  + "<h2>Status</h2>\n"
-  + "Currently we're just a handful of developers working part-time to put\n"
-  + "together a demo. &nbsp;The demo is coded entirely in Java. &nbsp;However\n"
-  + "persistent data is written in well-documented formats so that modules\n"
-  + "may eventually be re-written in other languages (e.g., Perl, C++) as the\n"
-  + "project progresses.<br>\n"
-  + "<br>\n"
-  + "<hr style=\"width: 100%; height: 1px;\" noshade=\"noshade\"> <a\n"
-  + " href=\"http://sourceforge.net\"> </a>\n"
-  + "<div style=\"text-align: center;\"><a href=\"http://sourceforge.net\"><img\n"
-  + " src=\"http://sourceforge.net/sflogo.php?group_id=59548&amp;type=1\"\n"
-  + " style=\"border: 0px solid ; width: 88px; height: 31px;\"\n"
-  + " alt=\"SourceForge.net Logo\" title=\"\"></a></div>\n"
-  + "</body>\n"
-  + "</html>\n";
-
-  // tests
+      "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
+          + "<html>\n"
+          + "<head>\n"
+          + "  <meta http-equiv=\"content-type\"\n"
+          + " content=\"text/html; charset=ISO-8859-1\">\n"
+          + "  <title>Nutch</title>\n"
+          + "</head>\n"
+          + "<body>\n"
+          + "<h1\n"
+          + " style=\"font-family: helvetica,arial,sans-serif; text-align: center; color: rgb(255, 153, 0);\"><a\n"
+          + " href=\"http://www.nutch.org/\"><font style=\"color: rgb(255, 153, 0);\">Nutch</font></a><br>\n"
+          + "<small>an open source web-search engine</small></h1>\n"
+          + "<hr style=\"width: 100%; height: 1px;\" noshade=\"noshade\">\n"
+          + "<table\n"
+          + " style=\"width: 100%; text-align: left; margin-left: auto; margin-right: auto;\"\n"
+          + " border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
+          + "  <tbody>\n"
+          + "    <tr>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"http://sourceforge.net/project/showfiles.php?group_id=59548\">Download</a><br>\n"
+          + "      </td>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"tutorial.html\">Tutorial</a><br>\n"
+          + "      </td>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nutch/nutch/\">CVS</a><br>\n"
+          + "      </td>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"api/index.html\">Javadoc</a><br>\n"
+          + "      </td>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"http://sourceforge.net/tracker/?atid=491356&amp;group_id=59548&amp;func=browse\">Bugs</a><br>\n"
+          + "      </td>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"http://sourceforge.net/mail/?group_id=59548\">Lists</a></td>\n"
+          + "      <td style=\"vertical-align: top; text-align: center;\"><a\n"
+          + " href=\"policies.html\">Policies</a><br>\n"
+          + "      </td>\n"
+          + "    </tr>\n"
+          + "  </tbody>\n"
+          + "</table>\n"
+          + "<hr style=\"width: 100%; height: 1px;\" noshade=\"noshade\">\n"
+          + "<h2>Introduction</h2>\n"
+          + "Nutch is a nascent effort to implement an open-source web search\n"
+          + "engine. Web search is a basic requirement for internet navigation, yet\n"
+          + "the number of web search engines is decreasing. Today's oligopoly could\n"
+          + "soon be a monopoly, with a single company controlling nearly all web\n"
+          + "search for its commercial gain. &nbsp;That would not be good for the\n"
+          + "users of internet. &nbsp;Nutch aims to enable anyone to easily and\n"
+          + "cost-effectively deploy a world-class web search engine.<br>\n"
+          + "<br>\n"
+          + "To succeed, the Nutch software must be able to:<br>\n"
+          + "<ul>\n"
+          + "  <li> crawl several billion pages per month</li>\n"
+          + "  <li>maintain an index of these pages</li>\n"
+          + "  <li>search that index up to 1000 times per second</li>\n"
+          + "  <li>provide very high quality search results</li>\n"
+          + "  <li>operate at minimal cost</li>\n"
+          + "</ul>\n"
+          + "<h2>Status</h2>\n"
+          + "Currently we're just a handful of developers working part-time to put\n"
+          + "together a demo. &nbsp;The demo is coded entirely in Java. &nbsp;However\n"
+          + "persistent data is written in well-documented formats so that modules\n"
+          + "may eventually be re-written in other languages (e.g., Perl, C++) as the\n"
+          + "project progresses.<br>\n"
+          + "<br>\n"
+          + "<hr style=\"width: 100%; height: 1px;\" noshade=\"noshade\"> <a\n"
+          + " href=\"http://sourceforge.net\"> </a>\n"
+          + "<div style=\"text-align: center;\"><a href=\"http://sourceforge.net\"><img\n"
+          + " src=\"http://sourceforge.net/sflogo.php?group_id=59548&amp;type=1\"\n"
+          + " style=\"border: 0px solid ; width: 88px; height: 31px;\"\n"
+          + " alt=\"SourceForge.net Logo\" title=\"\"></a></div>\n"
+          + "</body>\n"
+          + "</html>\n";
 
+  @Test
   public void testZipUnzip() {
     byte[] testBytes= SHORT_TEST_STRING.getBytes();
     testZipUnzip(testBytes);
@@ -126,6 +123,7 @@ public class TestGZIPUtils extends TestC
     testZipUnzip(testBytes);
   }
 
+  @Test
   public void testZipUnzipBestEffort() {
     byte[] testBytes= SHORT_TEST_STRING.getBytes();
     testZipUnzipBestEffort(testBytes);
@@ -134,7 +132,7 @@ public class TestGZIPUtils extends TestC
     testBytes= WEBPAGE.getBytes();
     testZipUnzipBestEffort(testBytes);
   }
-  
+
   public void testTruncation() {
     byte[] testBytes= SHORT_TEST_STRING.getBytes();
     testTruncation(testBytes);
@@ -144,6 +142,7 @@ public class TestGZIPUtils extends TestC
     testTruncation(testBytes);
   }
 
+  @Test
   public void testLimit() {
     byte[] testBytes= SHORT_TEST_STRING.getBytes();
     testLimit(testBytes);
@@ -158,38 +157,38 @@ public class TestGZIPUtils extends TestC
   public void testZipUnzip(byte[] origBytes) {
     byte[] compressedBytes= GZIPUtils.zip(origBytes);
 
-    assertTrue("compressed array is not smaller!",
-	       compressedBytes.length < origBytes.length);
+    Assert.assertTrue("compressed array is not smaller!",
+        compressedBytes.length < origBytes.length);
 
     byte[] uncompressedBytes= null;
     try {
       uncompressedBytes= GZIPUtils.unzip(compressedBytes);
     } catch (IOException e) {
       e.printStackTrace();
-      assertTrue("caught exception '" + e + "' during unzip()",
-		 false);
+      Assert.assertTrue("caught exception '" + e + "' during unzip()",
+          false);
     }
-    assertTrue("uncompressedBytes is wrong size", 
-	       uncompressedBytes.length == origBytes.length);
+    Assert.assertTrue("uncompressedBytes is wrong size", 
+        uncompressedBytes.length == origBytes.length);
 
     for (int i= 0; i < origBytes.length; i++) 
       if (origBytes[i] != uncompressedBytes[i])
-	assertTrue("uncompressedBytes does not match origBytes", false);
+        Assert.assertTrue("uncompressedBytes does not match origBytes", false);
   }
 
   public void testZipUnzipBestEffort(byte[] origBytes) {
     byte[] compressedBytes= GZIPUtils.zip(origBytes);
 
-    assertTrue("compressed array is not smaller!",
-	       compressedBytes.length < origBytes.length);
+    Assert.assertTrue("compressed array is not smaller!",
+        compressedBytes.length < origBytes.length);
 
     byte[] uncompressedBytes= GZIPUtils.unzipBestEffort(compressedBytes);
-    assertTrue("uncompressedBytes is wrong size", 
-	       uncompressedBytes.length == origBytes.length);
+    Assert.assertTrue("uncompressedBytes is wrong size", 
+        uncompressedBytes.length == origBytes.length);
 
     for (int i= 0; i < origBytes.length; i++) 
       if (origBytes[i] != uncompressedBytes[i])
-	assertTrue("uncompressedBytes does not match origBytes", false);
+        Assert.assertTrue("uncompressedBytes does not match origBytes", false);
   }
 
   public void testTruncation(byte[] origBytes) {
@@ -197,30 +196,30 @@ public class TestGZIPUtils extends TestC
 
     System.out.println("original data has len " + origBytes.length);
     System.out.println("compressed data has len " 
-		       + compressedBytes.length);
+        + compressedBytes.length);
 
     for (int i= compressedBytes.length; i >= 0; i--) {
 
       byte[] truncCompressed= new byte[i];
 
       for (int j= 0; j < i; j++)
-	truncCompressed[j]= compressedBytes[j];
+        truncCompressed[j]= compressedBytes[j];
 
       byte[] trunc= GZIPUtils.unzipBestEffort(truncCompressed);
 
       if (trunc == null) {
-	System.out.println("truncated to len "
-			   + i + ", trunc is null");
+        System.out.println("truncated to len "
+            + i + ", trunc is null");
       } else {
-	System.out.println("truncated to len "
-			   + i + ", trunc.length=  " 
-			   + trunc.length);
-
-	for (int j= 0; j < trunc.length; j++)
-	  if (trunc[j] != origBytes[j]) 
-	    assertTrue("truncated/uncompressed array differs at pos "
-		       + j + " (compressed data had been truncated to len "
-		       + i + ")", false);
+        System.out.println("truncated to len "
+            + i + ", trunc.length=  " 
+            + trunc.length);
+
+        for (int j= 0; j < trunc.length; j++)
+          if (trunc[j] != origBytes[j]) 
+            Assert.assertTrue("truncated/uncompressed array differs at pos "
+                + j + " (compressed data had been truncated to len "
+                + i + ")", false);
       }
     }
   }
@@ -228,20 +227,20 @@ public class TestGZIPUtils extends TestC
   public void testLimit(byte[] origBytes) {
     byte[] compressedBytes= GZIPUtils.zip(origBytes);
 
-    assertTrue("compressed array is not smaller!",
-               compressedBytes.length < origBytes.length);
+    Assert.assertTrue("compressed array is not smaller!",
+        compressedBytes.length < origBytes.length);
 
     for (int i= 0; i < origBytes.length; i++) {
 
       byte[] uncompressedBytes= 
-        GZIPUtils.unzipBestEffort(compressedBytes, i);
+          GZIPUtils.unzipBestEffort(compressedBytes, i);
 
-      assertTrue("uncompressedBytes is wrong size", 
-                 uncompressedBytes.length == i);
+      Assert.assertTrue("uncompressedBytes is wrong size", 
+          uncompressedBytes.length == i);
 
       for (int j= 0; j < i; j++) 
         if (origBytes[j] != uncompressedBytes[j])
-          assertTrue("uncompressedBytes does not match origBytes", false);
+          Assert.assertTrue("uncompressedBytes does not match origBytes", false);
     }
   }
 

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestNodeWalker.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestNodeWalker.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestNodeWalker.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestNodeWalker.java Sat Mar 29 00:54:40 2014
@@ -18,20 +18,16 @@
 package org.apache.nutch.util;
 
 import java.io.ByteArrayInputStream;
-import junit.framework.TestCase;
 
 import org.apache.xerces.parsers.DOMParser;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 
-
-
-
 /** Unit tests for NodeWalker methods. */
-public class TestNodeWalker extends TestCase {
-  public TestNodeWalker(String name) { 
-    super(name); 
-  }
+public class TestNodeWalker {
 
   /* a snapshot of the nutch webpage */
   private final static String WEBPAGE= 
@@ -49,13 +45,15 @@ public class TestNodeWalker extends Test
 
   private final static String[] ULCONTENT = new String[4];
   
-  protected void setUp() throws Exception{
+  @Before
+  public void setUp() throws Exception{
     ULCONTENT[0]="crawl several billion pages per month" ;
     ULCONTENT[1]="maintain an index of these pages" ;
     ULCONTENT[2]="search that index up to 1000 times per second"  ;
     ULCONTENT[3]="operate at minimal cost" ;
   }
 
+  @Test
   public void testSkipChildren() {
     DOMParser parser= new DOMParser();
     
@@ -78,7 +76,7 @@ public class TestNodeWalker extends Test
         sb.append(text);
       }
     }
-   assertTrue("UL Content can NOT be found in the node", findSomeUlContent(sb.toString()));
+    Assert.assertTrue("UL Content can NOT be found in the node", findSomeUlContent(sb.toString()));
      
    StringBuffer sbSkip = new StringBuffer();
    NodeWalker walkerSkip = new NodeWalker(parser.getDocument());
@@ -95,7 +93,7 @@ public class TestNodeWalker extends Test
        sbSkip.append(text);
      }
    }
-   assertFalse("UL Content can be found in the node", findSomeUlContent(sbSkip.toString()));
+   Assert.assertFalse("UL Content can be found in the node", findSomeUlContent(sbSkip.toString()));
   }
   
   public boolean findSomeUlContent(String str) {

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestPrefixStringMatcher.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestPrefixStringMatcher.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestPrefixStringMatcher.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestPrefixStringMatcher.java Sat Mar 29 00:54:40 2014
@@ -17,13 +17,12 @@
 
 package org.apache.nutch.util;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /** Unit tests for PrefixStringMatcher. */
-public class TestPrefixStringMatcher extends TestCase {
-  public TestPrefixStringMatcher(String name) { 
-    super(name); 
-  }
+public class TestPrefixStringMatcher {
+
 
   private final static int NUM_TEST_ROUNDS= 20;
   private final static int MAX_TEST_PREFIXES= 100;
@@ -51,6 +50,7 @@ public class TestPrefixStringMatcher ext
     return new String(chars);
   }
   
+  @Test
   public void testPrefixMatcher() {
     int numMatches= 0;
     int numInputsTested= 0;
@@ -96,18 +96,18 @@ public class TestPrefixStringMatcher ext
 
         numInputsTested++;
 
-        assertTrue( "'" + input + "' should " + (matches ? "" : "not ") 
+        Assert.assertTrue( "'" + input + "' should " + (matches ? "" : "not ") 
                     + "match!",
                     matches == prematcher.matches(input) );
         if (matches) {
-          assertTrue( shortestMatch 
+          Assert.assertTrue( shortestMatch 
                       == prematcher.shortestMatch(input).length());
-          assertTrue( input.substring(0, shortestMatch).equals(
+          Assert.assertTrue( input.substring(0, shortestMatch).equals(
                         prematcher.shortestMatch(input)) );
 
-          assertTrue( longestMatch 
+          Assert.assertTrue( longestMatch 
                       == prematcher.longestMatch(input).length());
-          assertTrue( input.substring(0, longestMatch).equals(
+          Assert.assertTrue( input.substring(0, longestMatch).equals(
                         prematcher.longestMatch(input)) );
 
         }

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestStringUtil.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestStringUtil.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestStringUtil.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestStringUtil.java Sat Mar 29 00:54:40 2014
@@ -17,45 +17,44 @@
 
 package org.apache.nutch.util;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /** Unit tests for StringUtil methods. */
-public class TestStringUtil extends TestCase {
-  public TestStringUtil(String name) { 
-    super(name); 
-  }
+public class TestStringUtil {
 
   public void testRightPad() {
     String s= "my string";
 
     String ps= StringUtil.rightPad(s, 0);
-    assertTrue(s.equals(ps));
+    Assert.assertTrue(s.equals(ps));
 
     ps= StringUtil.rightPad(s, 9);
-    assertTrue(s.equals(ps));
+    Assert.assertTrue(s.equals(ps));
 
     ps= StringUtil.rightPad(s, 10);
-    assertTrue( (s+" ").equals(ps) );
+    Assert.assertTrue( (s+" ").equals(ps) );
 
     ps= StringUtil.rightPad(s, 15);
-    assertTrue( (s+"      ").equals(ps) );
+    Assert.assertTrue( (s+"      ").equals(ps) );
 
   }
 
+  @Test
   public void testLeftPad() {
     String s= "my string";
 
     String ps= StringUtil.leftPad(s, 0);
-    assertTrue(s.equals(ps));
+    Assert.assertTrue(s.equals(ps));
 
     ps= StringUtil.leftPad(s, 9);
-    assertTrue(s.equals(ps));
+    Assert.assertTrue(s.equals(ps));
 
     ps= StringUtil.leftPad(s, 10);
-    assertTrue( (" "+s).equals(ps) );
+    Assert.assertTrue( (" "+s).equals(ps) );
 
     ps= StringUtil.leftPad(s, 15);
-    assertTrue( ("      "+s).equals(ps) );
+    Assert.assertTrue( ("      "+s).equals(ps) );
 
   }
 

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestSuffixStringMatcher.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestSuffixStringMatcher.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestSuffixStringMatcher.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestSuffixStringMatcher.java Sat Mar 29 00:54:40 2014
@@ -17,13 +17,11 @@
 
 package org.apache.nutch.util;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /** Unit tests for SuffixStringMatcher. */
-public class TestSuffixStringMatcher extends TestCase {
-  public TestSuffixStringMatcher(String name) { 
-    super(name); 
-  }
+public class TestSuffixStringMatcher {
 
   private final static int NUM_TEST_ROUNDS= 20;
   private final static int MAX_TEST_SUFFIXES= 100;
@@ -51,6 +49,7 @@ public class TestSuffixStringMatcher ext
     return new String(chars);
   }
   
+  @Test
   public void testSuffixMatcher() {
     int numMatches= 0;
     int numInputsTested= 0;
@@ -96,20 +95,19 @@ public class TestSuffixStringMatcher ext
 
         numInputsTested++;
 
-        assertTrue( "'" + input + "' should " + (matches ? "" : "not ") 
+        Assert.assertTrue( "'" + input + "' should " + (matches ? "" : "not ") 
                     + "match!",
                     matches == sufmatcher.matches(input) );
         if (matches) {
-          assertTrue( shortestMatch 
+          Assert.assertTrue( shortestMatch 
                       == sufmatcher.shortestMatch(input).length());
-          assertTrue( input.substring(input.length() - shortestMatch).equals(
+          Assert.assertTrue( input.substring(input.length() - shortestMatch).equals(
                         sufmatcher.shortestMatch(input)) );
 
-          assertTrue( longestMatch 
+          Assert.assertTrue( longestMatch 
                       == sufmatcher.longestMatch(input).length());
-          assertTrue( input.substring(input.length() - longestMatch).equals(
+          Assert.assertTrue( input.substring(input.length() - longestMatch).equals(
                         sufmatcher.longestMatch(input)) );
-
         }
       }
     }

Modified: nutch/trunk/src/test/org/apache/nutch/util/TestURLUtil.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/TestURLUtil.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/TestURLUtil.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/TestURLUtil.java Sat Mar 29 00:54:40 2014
@@ -19,120 +19,115 @@ package org.apache.nutch.util;
 
 import java.net.URL;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /** Test class for URLUtil */
-public class TestURLUtil
-  extends TestCase {
-
-  @Override
-  protected void setUp()
-    throws Exception {
-    super.setUp();
-  }
+public class TestURLUtil {
 
+  @Test
   public void testGetDomainName()
     throws Exception {
 
     URL url = null;
 
     url = new URL("http://lucene.apache.org/nutch");
-    assertEquals("apache.org", URLUtil.getDomainName(url));
+    Assert.assertEquals("apache.org", URLUtil.getDomainName(url));
 
     url = new URL("http://en.wikipedia.org/wiki/Java_coffee");
-    assertEquals("wikipedia.org", URLUtil.getDomainName(url));
+    Assert.assertEquals("wikipedia.org", URLUtil.getDomainName(url));
 
     url = new URL("http://140.211.11.130/foundation/contributing.html");
-    assertEquals("140.211.11.130", URLUtil.getDomainName(url));
+    Assert.assertEquals("140.211.11.130", URLUtil.getDomainName(url));
 
     url = new URL("http://www.example.co.uk:8080/index.html");
-    assertEquals("example.co.uk", URLUtil.getDomainName(url));
+    Assert.assertEquals("example.co.uk", URLUtil.getDomainName(url));
 
     url = new URL("http://com");
-    assertEquals("com", URLUtil.getDomainName(url));
+    Assert.assertEquals("com", URLUtil.getDomainName(url));
 
     url = new URL("http://www.example.co.uk.com");
-    assertEquals("uk.com", URLUtil.getDomainName(url));
+    Assert.assertEquals("uk.com", URLUtil.getDomainName(url));
 
     // "nn" is not a tld
     url = new URL("http://example.com.nn");
-    assertEquals("nn", URLUtil.getDomainName(url));
+    Assert.assertEquals("nn", URLUtil.getDomainName(url));
 
     url = new URL("http://");
-    assertEquals("", URLUtil.getDomainName(url));
+    Assert.assertEquals("", URLUtil.getDomainName(url));
 
     url = new URL("http://www.edu.tr.xyz");
-    assertEquals("xyz", URLUtil.getDomainName(url));
+    Assert.assertEquals("xyz", URLUtil.getDomainName(url));
 
     url = new URL("http://www.example.c.se");
-    assertEquals("example.c.se", URLUtil.getDomainName(url));
+    Assert.assertEquals("example.c.se", URLUtil.getDomainName(url));
 
     // plc.co.im is listed as a domain suffix
     url = new URL("http://www.example.plc.co.im");
-    assertEquals("example.plc.co.im", URLUtil.getDomainName(url));
+    Assert.assertEquals("example.plc.co.im", URLUtil.getDomainName(url));
 
     // 2000.hu is listed as a domain suffix
     url = new URL("http://www.example.2000.hu");
-    assertEquals("example.2000.hu", URLUtil.getDomainName(url));
+    Assert.assertEquals("example.2000.hu", URLUtil.getDomainName(url));
 
     // test non-ascii
     url = new URL("http://www.example.商業.tw");
-    assertEquals("example.商業.tw", URLUtil.getDomainName(url));
-
+    Assert.assertEquals("example.商業.tw", URLUtil.getDomainName(url));
   }
 
+  @Test
   public void testGetDomainSuffix()
     throws Exception {
     URL url = null;
 
     url = new URL("http://lucene.apache.org/nutch");
-    assertEquals("org", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("org", URLUtil.getDomainSuffix(url).getDomain());
 
     url = new URL("http://140.211.11.130/foundation/contributing.html");
-    assertNull(URLUtil.getDomainSuffix(url));
+    Assert.assertNull(URLUtil.getDomainSuffix(url));
 
     url = new URL("http://www.example.co.uk:8080/index.html");
-    assertEquals("co.uk", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("co.uk", URLUtil.getDomainSuffix(url).getDomain());
 
     url = new URL("http://com");
-    assertEquals("com", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("com", URLUtil.getDomainSuffix(url).getDomain());
 
     url = new URL("http://www.example.co.uk.com");
-    assertEquals("com", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("com", URLUtil.getDomainSuffix(url).getDomain());
 
     // "nn" is not a tld
     url = new URL("http://example.com.nn");
-    assertNull(URLUtil.getDomainSuffix(url));
+    Assert.assertNull(URLUtil.getDomainSuffix(url));
 
     url = new URL("http://");
-    assertNull(URLUtil.getDomainSuffix(url));
+    Assert.assertNull(URLUtil.getDomainSuffix(url));
 
     url = new URL("http://www.edu.tr.xyz");
-    assertNull(URLUtil.getDomainSuffix(url));
+    Assert.assertNull(URLUtil.getDomainSuffix(url));
 
     url = new URL("http://subdomain.example.edu.tr");
-    assertEquals("edu.tr", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("edu.tr", URLUtil.getDomainSuffix(url).getDomain());
 
     url = new URL("http://subdomain.example.presse.fr");
-    assertEquals("presse.fr", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("presse.fr", URLUtil.getDomainSuffix(url).getDomain());
 
     url = new URL("http://subdomain.example.presse.tr");
-    assertEquals("tr", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("tr", URLUtil.getDomainSuffix(url).getDomain());
 
     // plc.co.im is listed as a domain suffix
     url = new URL("http://www.example.plc.co.im");
-    assertEquals("plc.co.im", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("plc.co.im", URLUtil.getDomainSuffix(url).getDomain());
 
     // 2000.hu is listed as a domain suffix
     url = new URL("http://www.example.2000.hu");
-    assertEquals("2000.hu", URLUtil.getDomainSuffix(url).getDomain());
+    Assert.assertEquals("2000.hu", URLUtil.getDomainSuffix(url).getDomain());
 
     // test non-ascii
     url = new URL("http://www.example.商業.tw");
-    assertEquals("商業.tw", URLUtil.getDomainSuffix(url).getDomain());
-
+    Assert.assertEquals("商業.tw", URLUtil.getDomainSuffix(url).getDomain());
   }
 
+  @Test
   public void testGetHostSegments()
     throws Exception {
     URL url;
@@ -140,31 +135,32 @@ public class TestURLUtil
 
     url = new URL("http://subdomain.example.edu.tr");
     segments = URLUtil.getHostSegments(url);
-    assertEquals("subdomain", segments[0]);
-    assertEquals("example", segments[1]);
-    assertEquals("edu", segments[2]);
-    assertEquals("tr", segments[3]);
+    Assert.assertEquals("subdomain", segments[0]);
+    Assert.assertEquals("example", segments[1]);
+    Assert.assertEquals("edu", segments[2]);
+    Assert.assertEquals("tr", segments[3]);
 
     url = new URL("http://");
     segments = URLUtil.getHostSegments(url);
-    assertEquals(1, segments.length);
-    assertEquals("", segments[0]);
+    Assert.assertEquals(1, segments.length);
+    Assert.assertEquals("", segments[0]);
 
     url = new URL("http://140.211.11.130/foundation/contributing.html");
     segments = URLUtil.getHostSegments(url);
-    assertEquals(1, segments.length);
-    assertEquals("140.211.11.130", segments[0]);
+    Assert.assertEquals(1, segments.length);
+    Assert.assertEquals("140.211.11.130", segments[0]);
 
     // test non-ascii
     url = new URL("http://www.example.商業.tw");
     segments = URLUtil.getHostSegments(url);
-    assertEquals("www", segments[0]);
-    assertEquals("example", segments[1]);
-    assertEquals("商業", segments[2]);
-    assertEquals("tw", segments[3]);
+    Assert.assertEquals("www", segments[0]);
+    Assert.assertEquals("example", segments[1]);
+    Assert.assertEquals("商業", segments[2]);
+    Assert.assertEquals("tw", segments[3]);
 
   }
 
+  @Test
   public void testChooseRepr()
     throws Exception {
     
@@ -178,39 +174,39 @@ public class TestURLUtil
     
     // 1) different domain them keep dest, temp or perm
     // a.com -> b.com*
-    assertEquals(bDotCom, URLUtil.chooseRepr(aDotCom, bDotCom, true));
-    assertEquals(bDotCom, URLUtil.chooseRepr(aDotCom, bDotCom, false));
+    Assert.assertEquals(bDotCom, URLUtil.chooseRepr(aDotCom, bDotCom, true));
+    Assert.assertEquals(bDotCom, URLUtil.chooseRepr(aDotCom, bDotCom, false));
     
     // 2) permanent and root, keep src
     // *a.com -> a.com?y=1 || *a.com -> a.com/xyz/index.html
-    assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aQStr, false));
-    assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aPath, false));
+    Assert.assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aQStr, false));
+    Assert.assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aPath, false));
     
     //3) permanent and not root and dest root, keep dest
     //a.com/xyz/index.html -> a.com*
-    assertEquals(aDotCom, URLUtil.chooseRepr(aPath, aDotCom, false));
+    Assert.assertEquals(aDotCom, URLUtil.chooseRepr(aPath, aDotCom, false));
     
     //4) permanent and neither root keep dest
     // a.com/xyz/index.html -> a.com/abc/page.html*
-    assertEquals(aPath2, URLUtil.chooseRepr(aPath, aPath2, false));
+    Assert.assertEquals(aPath2, URLUtil.chooseRepr(aPath, aPath2, false));
     
     //5) temp and root and dest not root keep src
     //*a.com -> a.com/xyz/index.html
-    assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aPath, true));
+    Assert.assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aPath, true));
     
     //6) temp and not root and dest root keep dest
     // a.com/xyz/index.html -> a.com*
-    assertEquals(aDotCom, URLUtil.chooseRepr(aPath, aDotCom, true));
+    Assert.assertEquals(aDotCom, URLUtil.chooseRepr(aPath, aDotCom, true));
 
     //7) temp and neither root, keep shortest, if hosts equal by path else by hosts
     //  a.com/xyz/index.html -> a.com/abc/page.html*
     // *www.a.com/xyz/index.html -> www.news.a.com/xyz/index.html
-    assertEquals(aPath2, URLUtil.chooseRepr(aPath, aPath2, true));
-    assertEquals(aPath, URLUtil.chooseRepr(aPath, aPath3, true));
+    Assert.assertEquals(aPath2, URLUtil.chooseRepr(aPath, aPath2, true));
+    Assert.assertEquals(aPath, URLUtil.chooseRepr(aPath, aPath3, true));
 
     //8) temp and both root keep shortest sub domain
     // *www.a.com -> www.news.a.com
-    assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aSubDotCom, true));
+    Assert.assertEquals(aDotCom, URLUtil.chooseRepr(aDotCom, aSubDotCom, true));
   }
 
   // from RFC3986 section 5.4.1
@@ -241,37 +237,40 @@ public class TestURLUtil
     { "../../g"       ,  "http://a/g"}
   };
 
+  @Test
   public void testResolveURL() throws Exception {
     // test NUTCH-436
     URL u436 = new URL("http://a/b/c/d;p?q#f");
-    assertEquals("http://a/b/c/d;p?q#f", u436.toString());
+    Assert.assertEquals("http://a/b/c/d;p?q#f", u436.toString());
     URL abs = URLUtil.resolveURL(u436, "?y");
-    assertEquals("http://a/b/c/d;p?y", abs.toString());
+    Assert.assertEquals("http://a/b/c/d;p?y", abs.toString());
     // test NUTCH-566
     URL u566 = new URL("http://www.fleurie.org/entreprise.asp");
     abs = URLUtil.resolveURL(u566, "?id_entrep=111");
-    assertEquals("http://www.fleurie.org/entreprise.asp?id_entrep=111", abs.toString());
+    Assert.assertEquals("http://www.fleurie.org/entreprise.asp?id_entrep=111", abs.toString());
     URL base = new URL(baseString);
-    assertEquals("base url parsing", baseString, base.toString());
+    Assert.assertEquals("base url parsing", baseString, base.toString());
     for (int i = 0; i < targets.length; i++) {
       URL u = URLUtil.resolveURL(base, targets[i][0]);
-      assertEquals(targets[i][1], targets[i][1], u.toString());
+      Assert.assertEquals(targets[i][1], targets[i][1], u.toString());
     }
   }
   
+  @Test
   public void testToUNICODE() throws Exception {
-    assertEquals("http://www.çevir.com", URLUtil.toUNICODE("http://www.xn--evir-zoa.com"));
-    assertEquals("http://uni-tübingen.de/", URLUtil.toUNICODE("http://xn--uni-tbingen-xhb.de/"));
-    assertEquals(
+    Assert.assertEquals("http://www.çevir.com", URLUtil.toUNICODE("http://www.xn--evir-zoa.com"));
+    Assert.assertEquals("http://uni-tübingen.de/", URLUtil.toUNICODE("http://xn--uni-tbingen-xhb.de/"));
+    Assert.assertEquals(
         "http://www.medizin.uni-tübingen.de:8080/search.php?q=abc#p1",
         URLUtil.toUNICODE("http://www.medizin.xn--uni-tbingen-xhb.de:8080/search.php?q=abc#p1"));
     
   }
   
+  @Test
   public void testToASCII() throws Exception {
-    assertEquals("http://www.xn--evir-zoa.com", URLUtil.toASCII("http://www.çevir.com"));
-    assertEquals("http://xn--uni-tbingen-xhb.de/", URLUtil.toASCII("http://uni-tübingen.de/"));
-    assertEquals(
+    Assert.assertEquals("http://www.xn--evir-zoa.com", URLUtil.toASCII("http://www.çevir.com"));
+    Assert.assertEquals("http://xn--uni-tbingen-xhb.de/", URLUtil.toASCII("http://uni-tübingen.de/"));
+    Assert.assertEquals(
         "http://www.medizin.xn--uni-tbingen-xhb.de:8080/search.php?q=abc#p1",
         URLUtil.toASCII("http://www.medizin.uni-tübingen.de:8080/search.php?q=abc#p1")); 
   }

Modified: nutch/trunk/src/test/org/apache/nutch/util/WritableTestUtils.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/test/org/apache/nutch/util/WritableTestUtils.java?rev=1582928&r1=1582927&r2=1582928&view=diff
==============================================================================
--- nutch/trunk/src/test/org/apache/nutch/util/WritableTestUtils.java (original)
+++ nutch/trunk/src/test/org/apache/nutch/util/WritableTestUtils.java Sat Mar 29 00:54:40 2014
@@ -19,8 +19,7 @@ package org.apache.nutch.util;
 
 import org.apache.hadoop.io.*;
 import org.apache.hadoop.conf.*;
-
-import junit.framework.TestCase;
+import org.junit.Assert;
 
 public class WritableTestUtils {
 
@@ -32,7 +31,7 @@ public class WritableTestUtils {
   /** Utility method for testing writables. */
   public static void testWritable(Writable before, Configuration conf)
       throws Exception {
-    TestCase.assertEquals(before, writeRead(before, conf));
+    Assert.assertEquals(before, writeRead(before, conf));
   }