incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfrov...@apache.org
Subject svn commit: r1209824 - in /incubator/droids/trunk/droids-core/src: main/java/org/apache/droids/helper/factories/ test/java/org/apache/droids/ test/java/org/apache/droids/examples/ test/java/org/apache/droids/robot/crawler/
Date Sat, 03 Dec 2011 01:53:59 GMT
Author: rfrovarp
Date: Sat Dec  3 01:53:58 2011
New Revision: 1209824

URL: http://svn.apache.org/viewvc?rev=1209824&view=rev
Log:
Fix DROIDS-127.
Mark as deprecated.
Fix annoying unused import in test that was being fixed for deprecation reasons anyway.

Modified:
    incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/GenericFactory.java
    incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/DroidsFactory.java
    incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/examples/SimpleRuntime.java
    incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/robot/crawler/TestCrawlingWorker.java

Modified: incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/GenericFactory.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/GenericFactory.java?rev=1209824&r1=1209823&r2=1209824&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/GenericFactory.java
(original)
+++ incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/GenericFactory.java
Sat Dec  3 01:53:58 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.droids.helper.factories;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -29,6 +30,10 @@ public class GenericFactory<T> {
 
   private Map<String,T> map = null;
 
+  public GenericFactory() {
+    map = new HashMap<String,T>();
+  }
+  
   /**
    * Get the register which contains all components.
    * 
@@ -45,6 +50,7 @@ public class GenericFactory<T> {
    *                the register which contains all components.
    */
   @SuppressWarnings("unchecked")
+  @Deprecated
   public void setMap(Map map) {
     this.map = map;
   }

Modified: incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/DroidsFactory.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/DroidsFactory.java?rev=1209824&r1=1209823&r2=1209824&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/DroidsFactory.java
(original)
+++ incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/DroidsFactory.java
Sat Dec  3 01:53:58 2011
@@ -35,7 +35,6 @@ import org.apache.droids.helper.factorie
 import org.apache.droids.helper.factories.ProtocolFactory;
 import org.apache.droids.helper.factories.URLFiltersFactory;
 import org.apache.droids.impl.DefaultTaskExceptionHandler;
-import org.apache.droids.impl.MultiThreadedTaskMaster;
 import org.apache.droids.impl.ExceptionCrawlingDroid;
 import org.apache.droids.impl.ReportCrawlingDroid;
 import org.apache.droids.impl.SaveCrawlingDroid;
@@ -56,7 +55,6 @@ public class DroidsFactory
     htmlParser.getElements().put("link", "href");
     htmlParser.getElements().put("img", "src");
     htmlParser.getElements().put("script", "src");
-    parserFactory.setMap(new HashMap<String, Object>());
     parserFactory.getMap().put("text/html", htmlParser);
     return parserFactory;
   }
@@ -66,7 +64,6 @@ public class DroidsFactory
     HttpProtocol httpProtocol = new HttpProtocol();
     httpProtocol.setForceAllow(true);
     
-    protocolFactory.setMap(new HashMap<String, Object>());
     protocolFactory.getMap().put("http", httpProtocol);
     return protocolFactory; 
   }
@@ -80,14 +77,12 @@ public class DroidsFactory
       }
       
     };
-    filtersFactory.setMap(new HashMap<String, Object>());
     filtersFactory.getMap().put("default", defaultURLFilter);
     return filtersFactory;
   }
   
   public static HandlerFactory createDefaultHandlerFactory(Handler defaultHandler) {
     HandlerFactory handlerFactory = new HandlerFactory();
-    handlerFactory.setMap(new HashMap<String, Object>());
     handlerFactory.getMap().put("default", defaultHandler);
     return handlerFactory; 
   }

Modified: incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/examples/SimpleRuntime.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/examples/SimpleRuntime.java?rev=1209824&r1=1209823&r2=1209824&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/examples/SimpleRuntime.java
(original)
+++ incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/examples/SimpleRuntime.java
Sat Dec  3 01:53:58 2011
@@ -74,7 +74,6 @@ public class SimpleRuntime {
     htmlParser.getElements().put("link", "href");
     htmlParser.getElements().put("img", "src");
     htmlParser.getElements().put("script", "src");
-    parserFactory.setMap(new HashMap<String, Object>());
     parserFactory.getMap().put("text/html", htmlParser);
 
     // Create protocol factory. Support HTTP/S only.
@@ -100,7 +99,6 @@ public class SimpleRuntime {
     DroidsHttpClient httpclient = new DroidsHttpClient(params);
     
     HttpProtocol httpProtocol = new HttpProtocol(httpclient);
-    protocolFactory.setMap(new HashMap<String, Object>());
     protocolFactory.getMap().put("http", httpProtocol);
     protocolFactory.getMap().put("https", httpProtocol);
     
@@ -108,18 +106,15 @@ public class SimpleRuntime {
     URLFiltersFactory filtersFactory = new URLFiltersFactory();
     RegexURLFilter defaultURLFilter = new RegexURLFilter();
     defaultURLFilter.setFile("classpath:/regex-urlfilter.txt");
-    filtersFactory.setMap(new HashMap<String, Object>());
     filtersFactory.getMap().put("default", defaultURLFilter);
     
     // Create handler factory. Provide sysout handler only.
     HandlerFactory handlerFactory = new HandlerFactory();
     SysoutHandler defaultHandler = new SysoutHandler();
-    handlerFactory.setMap(new HashMap<String, Object>());
     handlerFactory.getMap().put("default", defaultHandler);
     
     // Create droid factory. Leave it empty for now.
     DroidFactory<Link> droidFactory = new DroidFactory<Link>();
-    droidFactory.setMap(new HashMap<String, Object>());
     
     // Create default droid 
     SimpleDelayTimer simpleDelayTimer = new SimpleDelayTimer();

Modified: incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/robot/crawler/TestCrawlingWorker.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/robot/crawler/TestCrawlingWorker.java?rev=1209824&r1=1209823&r2=1209824&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/robot/crawler/TestCrawlingWorker.java
(original)
+++ incubator/droids/trunk/droids-core/src/test/java/org/apache/droids/robot/crawler/TestCrawlingWorker.java
Sat Dec  3 01:53:58 2011
@@ -67,9 +67,8 @@ public class TestCrawlingWorker {
     final HashMap<String, Object> parserFactoryMap = new HashMap<String, Object>();
     
     htmlParser = Mockito.mock(HtmlParser.class, new ReturnsMocks());
-    parserFactoryMap.put("text/html", htmlParser);
     
-    parserFactory.setMap(parserFactoryMap);
+    parserFactory.getMap().put("text/html", htmlParser);
     return parserFactory;
   }
   



Mime
View raw message