You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by mo...@apache.org on 2012/03/06 15:34:25 UTC

svn commit: r1297498 - in /incubator/any23/trunk/plugins/integration-test: pom.xml src/test/java/org/apache/any23/plugin/PluginIT.java

Author: mostarda
Date: Tue Mar  6 14:34:24 2012
New Revision: 1297498

URL: http://svn.apache.org/viewvc?rev=1297498&view=rev
Log:
Improved integration test: renamed test to verify Extractor plugins detection. Added test to verify CLI plugins detection. Added minimal Javadoc. This commit is related to issue #ANY23-54 .

Modified:
    incubator/any23/trunk/plugins/integration-test/pom.xml
    incubator/any23/trunk/plugins/integration-test/src/test/java/org/apache/any23/plugin/PluginIT.java

Modified: incubator/any23/trunk/plugins/integration-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/plugins/integration-test/pom.xml?rev=1297498&r1=1297497&r2=1297498&view=diff
==============================================================================
--- incubator/any23/trunk/plugins/integration-test/pom.xml (original)
+++ incubator/any23/trunk/plugins/integration-test/pom.xml Tue Mar  6 14:34:24 2012
@@ -48,6 +48,11 @@
       <artifactId>any23-office-scraper</artifactId>
       <version>1.0.0-incubating-SNAPSHOT</version>
     </dependency>
+      <dependency>
+      <groupId>org.apache.any23.plugin</groupId>
+      <artifactId>any23-basic-crawler</artifactId>
+      <version>1.0.0-incubating-SNAPSHOT</version>
+    </dependency>
   </dependencies>
 
   <build>

Modified: incubator/any23/trunk/plugins/integration-test/src/test/java/org/apache/any23/plugin/PluginIT.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/plugins/integration-test/src/test/java/org/apache/any23/plugin/PluginIT.java?rev=1297498&r1=1297497&r2=1297498&view=diff
==============================================================================
--- incubator/any23/trunk/plugins/integration-test/src/test/java/org/apache/any23/plugin/PluginIT.java (original)
+++ incubator/any23/trunk/plugins/integration-test/src/test/java/org/apache/any23/plugin/PluginIT.java Tue Mar  6 14:34:24 2012
@@ -17,6 +17,8 @@
 
 package org.apache.any23.plugin;
 
+import org.apache.any23.cli.Crawler;
+import org.apache.any23.cli.Tool;
 import org.apache.any23.extractor.ExtractorGroup;
 import org.junit.After;
 import org.junit.Assert;
@@ -25,6 +27,9 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
 
 /**
  * Integration test for plugins.
@@ -54,8 +59,15 @@ public class PluginIT {
         manager = null;
     }
 
+    /**
+     * <i>Extractor</i> plugins detection testing.
+     *
+     * @throws IOException
+     * @throws InstantiationException
+     * @throws IllegalAccessException
+     */
     @Test
-    public void testGetApplicableExtractors() throws IOException, InstantiationException, IllegalAccessException {
+    public void testDetectExtractorPlugins() throws IOException, InstantiationException, IllegalAccessException {
         final ExtractorGroup extractorGroup = manager.getApplicableExtractors(
                 HTML_SCRAPER_TARGET_DIR,
                 HTML_SCRAPER_DEPENDENCY_DIR,  // Required to satisfy class dependencies.
@@ -68,4 +80,22 @@ public class PluginIT {
         );
     }
 
+    /**
+     * <i>CLI</i> plugins detection testing.
+     *
+     * @throws IOException
+     */
+    @Test
+    public void testDetectCLIPlugins() throws IOException {
+        final Iterator<Tool> tools = manager.getTools();
+        final Set<String> toolClasses = new HashSet<String>(); 
+        Tool tool;
+        while(tools.hasNext()) {
+            tool = tools.next();
+            Assert.assertTrue("Found duplicate tool.", toolClasses.add(tool.getClass().getName()));
+        }
+        Assert.assertTrue( toolClasses.contains( Crawler.class.getName() ) );
+        Assert.assertEquals(7 + 1, toolClasses.size());
+    }
+
 }