abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r415718 - in /incubator/abdera/java/trunk: ./ build/ parser/src/test/java/org/apache/abdera/test/parser/stax/ parser/src/test/resources/feedparser/
Date Tue, 20 Jun 2006 15:59:40 GMT
Author: jmsnell
Date: Tue Jun 20 08:59:40 2006
New Revision: 415718

URL: http://svn.apache.org/viewvc?rev=415718&view=rev
Log:
>From Garrett Rooney...

Stop fetching feedparser xml files from feedparser.org at test time.

* NOTICE: Note presence of software from feedparser.

* LICENSE: Add the feedparser license for their data files.

* build/build.xml
 (compile.parser): Copy feedparser files into test tree.

* parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java
 Remove import of java.net.URI.
 (get): Removed.
 (parse): New method.
 (setUp): Removed.
 (testAtom10Namespace, testEntryAuthorEmail,
  testEntryAuthorName, testEntryContentBase64,
  testEntryContentBase642): Use parse, not get.

* parser/src/test/resources/feedparser/entry_content_base64_2.xml: New file.
* parser/src/test/resources/feedparser/entry_author_name.xml: Ditto.
* parser/src/test/resources/feedparser/entry_author_email.xml: Ditto.
* parser/src/test/resources/feedparser/atom10_namespace.xml: Ditto.
* parser/src/test/resources/feedparser/entry_content_base64.xml: Ditto. 

Added:
    incubator/abdera/java/trunk/parser/src/test/resources/feedparser/
    incubator/abdera/java/trunk/parser/src/test/resources/feedparser/atom10_namespace.xml
    incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_email.xml
    incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_name.xml
    incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64.xml
    incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64_2.xml
Modified:
    incubator/abdera/java/trunk/LICENSE
    incubator/abdera/java/trunk/NOTICE
    incubator/abdera/java/trunk/build/build.xml
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java

Modified: incubator/abdera/java/trunk/LICENSE
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/LICENSE?rev=415718&r1=415717&r2=415718&view=diff
==============================================================================
--- incubator/abdera/java/trunk/LICENSE (original)
+++ incubator/abdera/java/trunk/LICENSE Tue Jun 20 08:59:40 2006
@@ -200,3 +200,29 @@
    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.
+
+For parser/src/tests/resources/feedparser/*.xml:
+
+Copyright (c) 2002-2005, Mark Pilgrim
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

Modified: incubator/abdera/java/trunk/NOTICE
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/NOTICE?rev=415718&r1=415717&r2=415718&view=diff
==============================================================================
--- incubator/abdera/java/trunk/NOTICE (original)
+++ incubator/abdera/java/trunk/NOTICE Tue Jun 20 08:59:40 2006
@@ -11,3 +11,6 @@
 licensed to the Apache Software Foundation under the
 "Software Grant and Corporate Contribution License Agreement",
 informally known as the "Abdera CLA".
+
+This software's test suite contains data files derived from the
+Universal Feed Parser, Copyright (c) 2002-2005, Mark Pilgrim.

Modified: incubator/abdera/java/trunk/build/build.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/build/build.xml?rev=415718&r1=415717&r2=415718&view=diff
==============================================================================
--- incubator/abdera/java/trunk/build/build.xml (original)
+++ incubator/abdera/java/trunk/build/build.xml Tue Jun 20 08:59:40 2006
@@ -101,6 +101,12 @@
   	    <include name="*.xml"/>
   	  </fileset>
   	</copy>
+        <mkdir dir="${test}/feedparser" />
+        <copy todir="${test}/feedparser">
+  	  <fileset dir="${parser.test.resources}/feedparser">
+  	    <include name="*.xml"/>
+  	  </fileset>
+  	</copy>
   </target>
 
   <target name="build" depends="init,compile.core,compile.parser"></target>

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java?rev=415718&r1=415717&r2=415718&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java
(original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java
Tue Jun 20 08:59:40 2006
@@ -20,7 +20,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.net.URI;
 
 import javax.activation.DataHandler;
 
@@ -36,32 +35,22 @@
 
 public class FeedParserTest extends TestCase {
 
-  private static URI baseURI = null;
-  
-  private static Document<Feed> get(URI uri) {
+  private static Document<Feed> parse(String name) {
     try {
-      return Parser.INSTANCE.parse(uri.toURL().openStream(), uri);
+      String path = "/feedparser/" + name;
+      InputStream stream = FeedParserTest.class.getResourceAsStream(path);
+      return Parser.INSTANCE.parse(stream);
     } catch (Exception e) {}
     return null;
   }
   
-  @Override
-  protected void setUp() throws Exception {
-    try {
-      baseURI = new URI("http://www.feedparser.org/tests/wellformed/atom10/");
-    } catch (Exception e) {}
-    super.setUp();
-  }
-  
   public void testAtom10Namespace() throws Exception {
-    URI uri = baseURI.resolve("atom10_namespace.xml");
-    Document doc = get(uri);
+    Document doc = parse("atom10_namespace.xml");
     assertNotNull(doc);
   }
   
   public void testEntryAuthorEmail() throws Exception {
-    URI uri = baseURI.resolve("entry_author_email.xml");
-    Document doc = get(uri);
+    Document doc = parse("entry_author_email.xml");
     Feed feed = (Feed) doc.getRoot();
     Entry entry = feed.getEntries().get(0);
     Person person = entry.getAuthor();
@@ -69,8 +58,7 @@
   }
   
   public void testEntryAuthorName() throws Exception {
-    URI uri = baseURI.resolve("entry_author_name.xml");
-    Document doc = get(uri);
+    Document doc = parse("entry_author_name.xml");
     Feed feed = (Feed) doc.getRoot();
     Entry entry = feed.getEntries().get(0);
     Person person = entry.getAuthor();
@@ -78,8 +66,7 @@
   }
   
   public void testEntryContentBase64() throws Exception {
-    URI uri = baseURI.resolve("entry_content_base64.xml");
-    Document doc = get(uri);
+    Document doc = parse("entry_content_base64.xml");
     Feed feed = (Feed)doc.getRoot();
     Entry entry = feed.getEntries().get(0);
     Content mediaContent = entry.getContentElement();
@@ -93,8 +80,7 @@
   }
   
   public void testEntryContentBase642() throws Exception {
-    URI uri = baseURI.resolve("entry_content_base64_2.xml");
-    Document doc = get(uri);
+    Document doc = parse("entry_content_base64_2.xml");
     Feed feed = (Feed)doc.getRoot();
     Entry entry = feed.getEntries().get(0);
     Content mediaContent = entry.getContentElement();

Added: incubator/abdera/java/trunk/parser/src/test/resources/feedparser/atom10_namespace.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/feedparser/atom10_namespace.xml?rev=415718&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/feedparser/atom10_namespace.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/feedparser/atom10_namespace.xml
Tue Jun 20 08:59:40 2006
@@ -0,0 +1,7 @@
+<!--
+Description: Atom namespace (official)
+Expect:      not bozo and feed['title'] == u'Example Atom'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <title>Example Atom</title>
+</feed>
\ No newline at end of file

Added: incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_email.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_email.xml?rev=415718&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_email.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_email.xml
Tue Jun 20 08:59:40 2006
@@ -0,0 +1,13 @@
+<!--
+Description: entry author email
+Expect:      not bozo and entries[0]['author_detail']['email'] == u'me@example.com'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+  <author>
+    <name>Example author</name>
+    <email>me@example.com</email>
+    <uri>http://example.com/</uri>
+  </author>
+</entry>
+</feed>
\ No newline at end of file

Added: incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_name.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_name.xml?rev=415718&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_name.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_author_name.xml
Tue Jun 20 08:59:40 2006
@@ -0,0 +1,13 @@
+<!--
+Description: entry author name
+Expect:      not bozo and entries[0]['author_detail']['name'] == u'Example author'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+  <author>
+    <name>Example author</name>
+    <email>me@example.com</email>
+    <uri>http://example.com/</uri>
+  </author>
+</entry>
+</feed>
\ No newline at end of file

Added: incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64.xml?rev=415718&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64.xml
Tue Jun 20 08:59:40 2006
@@ -0,0 +1,11 @@
+<!--
+Description: entry content base64-encoded
+Expect:      not bozo and entries[0]['content'][0]['value'] == u'Example <b>Atom</b>'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+  <content type="application/octet-stream">
+    RXhhbXBsZSA8Yj5BdG9tPC9iPg==
+  </content>
+</entry>
+</feed>
\ No newline at end of file

Added: incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64_2.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64_2.xml?rev=415718&view=auto
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64_2.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/feedparser/entry_content_base64_2.xml
Tue Jun 20 08:59:40 2006
@@ -0,0 +1,11 @@
+<!--
+Description: entry content base64-encoded
+Expect:      not bozo and entries[0]['content'][0]['value'] == u'<p>History of the
&lt;blink&gt; tag</p>'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+<content type="application/octet-stream">
+PHA+SGlzdG9yeSBvZiB0aGUgJmx0O2JsaW5rJmd0OyB0YWc8L3A+
+</content>
+</entry>
+</feed>
\ No newline at end of file



Mime
View raw message