Added: incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/util/LinkResolverTests.java URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/util/LinkResolverTests.java?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/util/LinkResolverTests.java (added) +++ incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/util/LinkResolverTests.java Thu Jun 25 11:17:49 2009 @@ -0,0 +1,76 @@ +package org.apache.crawler.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import org.junit.Test; + +import java.net.URI; +import java.net.URISyntaxException; + +/** + * ot valid - link: /jump?to=1556987&url=http://40ass.net/, base: http://top.mail.ru/jump?from=1626951, e: Str + */ +public class LinkResolverTests { + + @Test + public void testFailure() throws URISyntaxException { + URI base = null; + // base = new URI("http://top.mail.ru/jump?from=1626951"); + //System.out.println(new LinkResolver(base).resolve("/jump?to=1556987&url=http://40ass.net/")); + + base = new URI("http://www.gz2010.cn"); + System.out.println(new LinkResolver(base).resolve("http://www.gz2010.cn\n/09/0605/19/5B2OG9VP0078000T.html")); + } + + @Test + public void testResolve() throws URISyntaxException, Exception { + URI base = new URI("http://www.apache.org"); + //assertEquals("http://www.apache.org", new LinkResolver(base).resolve(null).toString()); + assertNull(new LinkResolver(base).resolve(null)); + assertEquals("http://www.apache.org/", new LinkResolver(base).resolve("").toString()); + assertEquals("http://www.apache.org/", new LinkResolver(base).resolve("/").toString()); + assertEquals("http://www.apache.org/index.html", new LinkResolver(base).resolve("/index.html").toString()); + assertEquals("http://www.apache.org/index.html", new LinkResolver(base).resolve("index.html").toString()); + assertEquals("http://www.apache.org/?test=true", new LinkResolver(base).resolve("?test=true").toString()); + assertEquals("http://www.apache.org/?test=true", new LinkResolver(base).resolve("/?test=true").toString()); + assertEquals("http://www.apache.org/index.jsp?test=true", new LinkResolver(base).resolve("/index.jsp?test=true").toString()); + assertEquals("http://www.apache.org/index.html", new LinkResolver(base).resolve("/index.html#header1").toString()); + assertEquals("http://www.apache.org/index.html?test=true", new LinkResolver(base).resolve("/index.html?test=true#header1").toString()); + assertEquals("http://httpd.apache.org/", new LinkResolver(base).resolve("http://httpd.apache.org").toString()); + assertNull(new LinkResolver(base).resolve("mailto:[email protected]")); + assertNull(new LinkResolver(base).resolve("javascript:[email protected]")); + assertEquals("http://www.apache.org/javaTYPOscript:[email protected]", new LinkResolver(base).resolve("javaTYPOscript:[email protected]").toString()); + assertEquals("http://www.apache.org/news:comp.lang.java", new LinkResolver(base).resolve("news:comp.lang.java").toString()); + assertEquals("news://news.apache.org/comp.lang.java", new LinkResolver(base).resolve("news://news.apache.org/comp.lang.java").toString()); + + assertEquals("http://www.apache.org/index.html", new LinkResolver(base).resolve("/index.html\n").toString()); + assertEquals("http://www.apache.org/index.jsp?message=??", new LinkResolver(base).resolve("/index.jsp?message=??").toString());//UTF-8 chinese + assertEquals("http://www.apache.org/index.jsp?message=??", new LinkResolver(base).resolve("http://www.apache.org/index.jsp?message=??").toString()); //should the result uri be encoded? + assertEquals("http://www.apache.org/index.jsp?message=debug%20info", new LinkResolver(base).resolve("/index.jsp?message=debug info").toString()); + } + + @Test + public void testWithBaseIndexFile() throws URISyntaxException { + URI base = new URI("http://www.apache.org/index.jsp"); + + assertEquals("http://www.apache.org/index.jsp", new LinkResolver(base).resolve("").toString()); + assertEquals("http://www.apache.org/", new LinkResolver(base).resolve("/").toString()); + assertEquals("http://www.apache.org/index.html", new LinkResolver(base).resolve("/index.html").toString()); + assertEquals("http://www.apache.org/index.html", new LinkResolver(base).resolve("index.html").toString()); + + //fixed relative "?x=y" + assertEquals("http://www.apache.org/index.jsp?test=true", new LinkResolver(base).resolve("?test=true").toString());//notice that ppl may expect it to be http://www.apache.org?test=true + assertEquals("http://www.apache.org/?test=true", new LinkResolver(base).resolve("/?test=true").toString()); + assertEquals("http://www.apache.org/index.jsp?test=true", new LinkResolver(base).resolve("/index.jsp?test=true").toString()); + } + + @Test + public void testWithBaseDirectory() throws URISyntaxException { + URI base = new URI("http://www.apache.org/images/"); + assertEquals("http://www.apache.org/images/logo.gif", new LinkResolver(base).resolve("logo.gif").toString()); + assertEquals("http://www.apache.org/logo.gif", new LinkResolver(base).resolve("/logo.gif").toString()); + assertEquals("http://www.apache.org/images/logo.gif", new LinkResolver(base).resolve("./logo.gif").toString()); + + } + +}
Added: incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/worker/DummyWorker.java URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/worker/DummyWorker.java?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/worker/DummyWorker.java (added) +++ incubator/droids/sandbox/mingfai/src/test/java/com/apache/crawler/worker/DummyWorker.java Thu Jun 25 11:17:49 2009 @@ -0,0 +1,38 @@ +package org.apache.crawler.worker; + +import org.apache.crawler.link.Link; +import org.apache.crawler.Crawler; + +import java.util.Set; +import java.util.concurrent.ExecutionException; + +import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.Log; + +public class DummyWorker<T extends Link> extends AbstractWorker<T> { + protected static Log log = LogFactory.getLog(DummyWorker.class); + protected T link; + + public DummyWorker(Crawler<T> tCrawler) { + super(tCrawler); + } + + public void run() { + if (log.isDebugEnabled()) log.debug("run()"); + link = crawler.getQueue().poll(); + try { + next(link); + } catch (WorkerException e) { + log.error(e); + } + } + + public Set<T> next(T link) throws WorkerException { + if (log.isDebugEnabled()) log.debug("next() - link: " + link); + return null; + } + + @Override public Object get() throws InterruptedException, ExecutionException { + return link; + } +} Added: incubator/droids/sandbox/mingfai/src/test/resources/log4j.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/log4j.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/log4j.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/log4j.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/"> + <!-- http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html --> + + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d %-5p [%-40.40c] [%-11t] - %m%n"/> + <!--<param name="ConversionPattern" value="%d %-5p [%-30.40c{1}] [%t] - %m%n"/>--> + </layout> + </appender> + + <logger name="org.apache.http.wire" additivity="false"> + <level value="info"/> + <appender-ref ref="CONSOLE"/> + </logger> + + <logger name="org.apache.crawler" additivity="false"> + <level value="debug"/> + <appender-ref ref="CONSOLE"/> + </logger> + + <logger name="org.apache.crawler.filter.DepthFilter" additivity="false"> + <level value="trace"/> + <appender-ref ref="CONSOLE"/> + </logger> + + <logger name="org.apache.crawler.parser" additivity="false"> + <level value="debug"/> + <appender-ref ref="CONSOLE"/> + </logger> + + <logger name="org.apache.crawler.util" additivity="false"> + <level value="debug"/> + <appender-ref ref="CONSOLE"/> + </logger> + + <root> + <priority value="info"/> + <appender-ref ref="CONSOLE"/> + </root> + +</log4j:configuration> Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerCluster.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerCluster.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerCluster.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerCluster.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <bean id="crawlerService" class="org.apache.crawler.api.cloud.CrawlerClusteredWebService"> + <property name="crawlerWebServices"> + <list> + <ref bean="crawlerService1"/> + <ref bean="crawlerService2"/> + <ref bean="crawlerService3"/> + </list> + </property> + </bean> + + <bean id="crawlerService1" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> + <property name="serviceUrl" value="http://NODE1.appspot.com/api"/> + <property name="serviceInterface" value="org.apache.crawler.api.CrawlerService"/> + </bean> + + <bean id="crawlerService2" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> + <property name="serviceUrl" value="http://NODE2.appspot.com/api"/> + <property name="serviceInterface" value="org.apache.crawler.api.CrawlerService"/> + </bean> + + <bean id="crawlerService3" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> + <property name="serviceUrl" value="http://NODE3.appspot.com/api"/> + <property name="serviceInterface" value="org.apache.crawler.api.CrawlerService"/> + </bean> + + +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerSingleClient.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerSingleClient.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerSingleClient.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-CrawlerSingleClient.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + + <bean id="crawlerService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> + <property name="serviceUrl" value="http://YOUR_GAE_APP.appspot.com/api"/> + <property name="serviceInterface" value="org.apache.crawler.api.CrawlerService"/> + </bean> + +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-ExtractFilter.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-ExtractFilter.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-ExtractFilter.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-ExtractFilter.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + <bean id="testExtractFilter" class="org.apache.crawler.extractor.TestExtractFilter"/> +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-FetcherFilter.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-FetcherFilter.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-FetcherFilter.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-FetcherFilter.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + <bean id="testFetcherFilter" class="org.apache.crawler.fetcher.TestFetcherFilter"/> +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-MultithreadCrawler.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-MultithreadCrawler.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-MultithreadCrawler.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-MultithreadCrawler.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + + + <context:annotation-config/> + <context:component-scan base-package="org.apache.crawler"> + <context:exclude-filter type="regex" expression="org\.apache\.crawler\.AppEngineCrawler"/> + </context:component-scan> +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-NekoHtmlParser.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-NekoHtmlParser.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-NekoHtmlParser.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-NekoHtmlParser.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + + <bean id="nekoHtmlParser" class="org.apache.crawler.parser.NekoHtmlParser"> + <property name="elements"> + <util:map> + <entry key="test"> + <util:list> + <value>test</value> + </util:list> + </entry> + </util:map> + </property> + </bean> + + +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-SingleUnitWorkerTest.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-SingleUnitWorkerTest.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-SingleUnitWorkerTest.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-SingleUnitWorkerTest.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + + <!--<import resource="spring-webapp-sitemesh.xml"/>--> + <bean id="crawler.queue" class="java.util.concurrent.PriorityBlockingQueue"> + <constructor-arg index="0" value="10000"/> + <constructor-arg index="1"> + <bean class="org.apache.crawler.util.WeightComparator"/> + </constructor-arg> + </bean> + + <util:list id="crawler.filters" value-type="org.apache.crawler.link.filter.LinkFilter"> + <ref bean="refererFilter"/> + <ref bean="depthFilter"/> + <ref bean="noRepeatFilter"/> + <bean id="statsFilter" class="org.apache.crawler.filter.StatsFilter" init-method="init"> + <property name="reportInterval" value="10"/> + </bean> + </util:list> + + <context:annotation-config/> + <context:component-scan base-package="org.apache.crawler"> + <context:exclude-filter type="regex" expression="org\.apache\.crawler\.AppEngineCrawler"/> + </context:component-scan> +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-TestFilter.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-TestFilter.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-TestFilter.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-TestFilter.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + + <bean id="testFilter" class="org.apache.crawler.filter.TestFilterImpl"/> + <util:list id="crawler.filters" value-type="org.apache.crawler.link.filter.LinkFilter"> + <ref bean="testFilter"/> + </util:list> + +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + + <context:annotation-config/> + <context:component-scan base-package="org.apache.crawler"> + <context:exclude-filter type="regex" expression="org\.apache\.crawler\..*AppEngine.*"/> + </context:component-scan> + + <bean id="worker" class="org.apache.crawler.worker.WebServiceWorker"> + <constructor-arg index="0" ref="multithreadCrawler"/> + </bean> + + <bean id="crawlerService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> + <property name="serviceUrl" value="http://YOUR_GAE_APP.appspot.com/api"/> + <property name="serviceInterface" value="org.apache.crawler.api.CrawlerService"/> + </bean> + +</beans> \ No newline at end of file Added: incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler2.xml URL: http://svn.apache.org/viewvc/incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler2.xml?rev=788326&view=auto ============================================================================== --- incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler2.xml (added) +++ incubator/droids/sandbox/mingfai/src/test/resources/spring-test-WebServiceCrawler2.xml Thu Jun 25 11:17:49 2009 @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + + <context:annotation-config/> + <context:component-scan base-package="org.apache.crawler"> + <context:exclude-filter type="regex" expression="org\.apache\.crawler\..*AppEngine.*"/> + </context:component-scan> + + <bean id="worker" class="org.apache.crawler.worker.WebServiceWorker"> + <constructor-arg index="0" ref="multithreadCrawler"/> + </bean> + + <bean id="crawlerService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> + <property name="serviceUrl" value="http://YOUR_GAE_APP.appspot.com/api"/> + <property name="serviceInterface" value="org.apache.crawler.api.CrawlerService"/> + </bean> + + <bean id="multithreadCrawler" class="org.apache.crawler.MultithreadCrawler"> + <property name="threads" value="10"/> + </bean> +</beans> \ No newline at end of file
