incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1158480 - in /incubator/lcf/trunk/connectors: rss/ rss/connector/src/test/java/org/ rss/connector/src/test/java/org/apache/ rss/connector/src/test/java/org/apache/manifoldcf/ rss/connector/src/test/java/org/apache/manifoldcf/crawler/ rss/c...
Date Wed, 17 Aug 2011 00:26:59 GMT
Author: kwright
Date: Wed Aug 17 00:26:58 2011
New Revision: 1158480

URL: http://svn.apache.org/viewvc?rev=1158480&view=rev
Log:
Add URL tests to RSS connector

Added:
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/
    incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java
  (with props)
Modified:
    incubator/lcf/trunk/connectors/rss/build.xml
    incubator/lcf/trunk/connectors/webcrawler/build.xml

Modified: incubator/lcf/trunk/connectors/rss/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/rss/build.xml?rev=1158480&r1=1158479&r2=1158480&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/rss/build.xml (original)
+++ incubator/lcf/trunk/connectors/rss/build.xml Wed Aug 17 00:26:58 2011
@@ -51,11 +51,46 @@
         <copy todir="dist/lib" file="build/jar/mcf-rss-connector.jar"/>
     </target>
 
-    <target name="build" depends="lib"/>
-    <target name="build-tests">
-      <mkdir dir="build/test-jar"/>
+    <target name="compile-connector-tests" depends="compile-connector">
+        <mkdir dir="build/connector-tests/classes"/>
+        <javac srcdir="connector/src/test/java" destdir="build/connector-tests/classes"
target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
+            <classpath>
+                 <fileset dir="lib"> 
+                    <include name="*.jar"/> 
+                </fileset>
+                <pathelement location="build/connector/classes"/>
+            </classpath>
+        </javac>
+    </target>
+    
+    <target name="compile-tests" depends="compile-connector-tests"/>
+    
+    <target name="jar-connector-tests" depends="compile-connector-tests">
+        <mkdir dir="build/test-jar"/>
+        <jar destfile="build/test-jar/mcf-rss-connector-tests.jar" basedir="build/connector-tests/classes"/>
     </target>
-    <target name="run-tests"/>
+
+    <target name="jar-tests" depends="jar-connector-tests"/>
+    
+    <target name="run-tests" depends="compile-tests">
+        <mkdir dir="test-output"/>
+        <junit fork="true" maxmemory="128m" dir="test-output" showoutput="true" haltonfailure="true">
+            <classpath>
+                <fileset dir="lib">
+                    <include name="*.jar"/>
+                </fileset>
+                <pathelement location="build/connector/classes"/>
+                <pathelement location="build/connector-tests/classes"/>
+            </classpath>
+            <test name="org.apache.manifoldcf.crawler.connectors.rss.tests.URLTest" todir="test-output"/>
+            <!-- MHL -->
+        </junit>
+    </target>
+
+    <target name="build" depends="lib"/>
+    
+    <target name="build-tests" depends="jar-tests"/>
+    
     <target name="run-tests-postgresql"/>
     <target name="run-tests-HSQLDB"/>
     <target name="all" depends="build,doc,build-tests,run-tests,run-tests-postgresql,run-tests-HSQLDB"/>

Added: incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java?rev=1158480&view=auto
==============================================================================
--- incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java
(added)
+++ incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java
Wed Aug 17 00:26:58 2011
@@ -0,0 +1,74 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.crawler.connectors.rss.tests;
+
+import org.apache.manifoldcf.crawler.connectors.rss.WebURL;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+public class URLTest
+{
+
+  @Test
+  public void absolutePath()
+    throws Exception
+  {
+    WebURL parent = new WebURL("http://foo.com");
+    WebURL resolved = parent.resolve("http://bar.com");
+    assertEquals(resolved.toASCIIString(),"http://bar.com");
+  }
+
+  @Test
+  public void relativePath()
+    throws Exception
+  {
+    WebURL parent = new WebURL("http://foo.com/abc/def.html");
+    WebURL resolved = parent.resolve("/def/ghi.html");
+    assertEquals(resolved.toASCIIString(),"http://foo.com/def/ghi.html");
+  }
+
+  @Test
+  public void noSlashDocument()
+    throws Exception
+  {
+    WebURL parent = new WebURL("http://foo.com");
+    WebURL resolved = parent.resolve("hello.pdf");
+    assertEquals(resolved.toASCIIString(),"http://foo.com/hello.pdf");
+  }
+
+  @Test
+  public void relativeQuery()
+    throws Exception
+  {
+    WebURL parent = new WebURL("http://foo.com/abc/def/ghi.asmx?q=foo");
+    WebURL resolved = parent.resolve("?q=bar");
+    assertEquals(resolved.toASCIIString(),"http://foo.com/abc/def/ghi.asmx?q=bar");
+  }
+
+  @Test
+  public void queryEscaping()
+    throws Exception
+  {
+    WebURL parent = new WebURL("http://foo.com/abc/def/ghi.asmx?q=foo%3Dbar");
+    WebURL resolved = parent.resolve("?q=bar%3Dfoo");
+    assertEquals(resolved.toASCIIString(),"http://foo.com/abc/def/ghi.asmx?q=bar%3Dfoo");
+  }
+
+
+}

Propchange: incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/URLTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/trunk/connectors/webcrawler/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/webcrawler/build.xml?rev=1158480&r1=1158479&r2=1158480&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/webcrawler/build.xml (original)
+++ incubator/lcf/trunk/connectors/webcrawler/build.xml Wed Aug 17 00:26:58 2011
@@ -67,7 +67,7 @@
     
     <target name="jar-connector-tests" depends="compile-connector-tests">
         <mkdir dir="build/test-jar"/>
-        <jar destfile="build/test-jar/mcf-filesystem-connector-tests.jar" basedir="build/connector-tests/classes"/>
+        <jar destfile="build/test-jar/mcf-web-connector-tests.jar" basedir="build/connector-tests/classes"/>
     </target>
 
     <target name="jar-tests" depends="jar-connector-tests"/>



Mime
View raw message