This patch moves some of the conformance tests data files into our
source tree, specifically the ones from snellspace.com, since I
imagine James will be ok with donating them to us ;-)

-garrett

[[[
Move some of the atom conformance test data files into our tree.

* build/build.xml
 (compile.parser): Copy conformance test files into test directory.

[ in parser/src/test ]

* java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
 Import java.io.InputStream.
 (parse): New method.
 (testContentTypes, testOrder, testLink): Use parse, not get.

* resources/conformance/linktests.xml: New test file.
* resources/conformance/contentsummary.xml: Ditto.
* resources/conformance/ordertest.xml: Ditto.
]]]
Index: build/build.xml
===================================================================
--- build/build.xml     (revision 415835)
+++ build/build.xml     (working copy)
@@ -113,6 +113,12 @@
            <include name="*.xml"/>
          </fileset>
        </copy>
+        <mkdir dir="${test}/conformance" />
+        <copy todir="${test}/conformance">
+         <fileset dir="${parser.test.resources}/conformance">
+           <include name="*.xml"/>
+         </fileset>
+       </copy>
   </target>
        
   <target name="compile.server" depends="init, compile.core">
Index: 
parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
===================================================================
--- 
parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
    (revision 415835)
+++ 
parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
    (working copy)
@@ -19,6 +19,7 @@
 
 import java.net.URI;
 import java.util.List;
+import java.io.InputStream;
 
 import javax.xml.namespace.QName;
 
@@ -37,6 +38,15 @@
 
 public class AtomConformanceTest extends TestCase {
 
+  private static Document<Feed> parse(String uri) {
+    try {
+      String path = "/conformance/" + uri.substring(uri.lastIndexOf('/'));
+      InputStream stream = AtomConformanceTest.class.getResourceAsStream(path);
+      return Parser.INSTANCE.parse(stream, uri);
+    } catch (Exception e) {}
+    return null;
+  }
+
   private static Document<Feed> get(URI uri) {
     try {
       return Parser.INSTANCE.parse(uri.toURL().openStream(), uri);
@@ -50,7 +60,7 @@
    */
   public static void testContentTypes() throws Exception {
     URI uri = new URI("http://www.snellspace.com/public/contentsummary.xml";);
-    Document<Feed> doc = get(uri);
+    Document<Feed> doc = parse(uri.toString());
     Feed feed = doc.getRoot();
     int n = 1;
     for (Entry entry : feed.getEntries()) {
@@ -318,7 +328,7 @@
   public static void testOrder() throws Exception {
     //http://www.snellspace.com/public/ordertest.xml
     URI uri = new URI("http://www.snellspace.com/public/ordertest.xml";);
-    Document<Feed> doc = get(uri);
+    Document<Feed> doc = parse(uri.toString());
     assertNotNull(doc);
     Feed feed = doc.getRoot();
     List<Entry> entries = feed.getEntries();
@@ -413,7 +423,7 @@
   public static void testLink() throws Exception {
     //http://www.snellspace.com/public/linktests.xml
     URI uri = new URI("http://www.snellspace.com/public/linktests.xml";);
-    Document<Feed> doc = get(uri);
+    Document<Feed> doc = parse(uri.toString());
     assertNotNull(doc);
     Feed feed = doc.getRoot();
     List<Entry> entries = feed.getEntries();
Index: parser/src/test/resources/conformance/linktests.xml
===================================================================
--- parser/src/test/resources/conformance/linktests.xml (revision 0)
+++ parser/src/test/resources/conformance/linktests.xml (revision 0)
@@ -0,0 +1,93 @@
+<feed xmlns="http://www.w3.org/2005/Atom";>
+  <id>tag:snellspace.com,2006:/atom/conformance/linktest/</id>
+  <title>Atom Link Tests</title>
+  <updated>2005-01-18T15:10:00Z</updated>
+  <author><name>James Snell</name></author>
+  <link href="http://www.intertwingly.net/wiki/pie/LinkConformanceTests"; />
+  <link rel="self" href="http://www.snellspace.com/public/linktests.xml"; />
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/1</id>
+    <title>Just a single Alternate Link</title>
+    <updated>2005-01-18T15:00:01Z</updated>
+    <summary>The aggregator should pick the second link as the 
alternate</summary>
+    <link rel="http://example.org/random";
+         href="http://www.snellspace.com/public/wrong"; /> 
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+    <link rel="http://example.org/random";
+         href="http://www.snellspace.com/public/wrong"; /> 
+  </entry>
+
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/2</id>
+    <title>Two alternate links</title>
+    <updated>2005-01-18T15:00:02Z</updated>
+    <summary>The aggregator should pick either the second or third link below 
as the alternate</summary>
+    <link rel="ALTERNATE" 
href="http://www.snellspace.com/public/linktests/wrong"; />    
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+    <link type="text/plain" 
href="http://www.snellspace.com/public/linktests/alternate2"; />
+    <link rel="ALTERNATE" 
href="http://www.snellspace.com/public/linktests/wrong"; />
+  </entry>
+
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/3</id>
+    <title>One of each core link rel type</title>
+    <updated>2005-01-18T15:00:03Z</updated>
+    <summary>The aggregator should pick the first link as the 
alternate</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+    <link rel="enclosure" 
href="http://www.snellspace.com/public/linktests/enclosure"; length="19" />
+    <link rel="related" 
href="http://www.snellspace.com/public/linktests/related"; />
+    <link rel="self" href="http://www.snellspace.com/public/linktests/self"; />
+    <link rel="via" href="http://www.snellspace.com/public/linktests/via"; />
+  </entry>  
+
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/4</id>
+    <title>One of each core link rel type + An additional alternate 
link</title>
+    <updated>2005-01-18T15:00:04Z</updated>
+    <summary>The aggregator should pick either the first or last links as the 
alternate. First link is likely better.</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+    <link rel="enclosure" 
href="http://www.snellspace.com/public/linktests/enclosure"; length="19" />
+    <link rel="related" 
href="http://www.snellspace.com/public/linktests/related"; />
+    <link rel="self" href="http://www.snellspace.com/public/linktests/self"; />
+    <link rel="via" href="http://www.snellspace.com/public/linktests/via"; />
+    <link rel="alternate" type="text/plain" 
href="http://www.snellspace.com/public/linktests/alternate2"; />
+  </entry>  
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/5</id>
+    <title>Entry with a link relation registered by an extension</title>
+    <updated>2005-01-18T15:00:05Z</updated>
+    <summary>The aggregator should ignore the license link without throwing 
any errors.  The first link should be picked as the alternate.</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+    <link rel="license" 
href="http://www.snellspace.com/public/linktests/license"; />
+  </entry>
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/6</id>
+    <title>Entry with a link relation identified by URI</title>
+    <updated>2005-01-18T15:00:06Z</updated>
+    <summary>The aggregator should ignore the second link without throwing any 
errors.  The first link should be picked as the alternate.</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+    <link rel="http://example.org"; 
href="http://www.snellspace.com/public/linktests/example"; />
+  </entry>
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/7</id>
+    <title>Entry with a link relation registered by an extension</title>
+    <updated>2005-01-18T15:00:05Z</updated>
+    <summary>The aggregator should ignore the license link without throwing 
any errors.  The second link should be picked as the alternate.</summary>
+    <link rel="license" 
href="http://www.snellspace.com/public/linktests/license"; />
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+  </entry>
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/8</id>
+    <title>Entry with a link relation identified by URI</title>
+    <updated>2005-01-18T15:00:06Z</updated>
+    <summary>The aggregator should ignore the first link without throwing any 
errors.  The second link should be picked as the alternate.</summary>
+    <link rel="http://example.org"; 
href="http://www.snellspace.com/public/linktests/example"; />
+    <link href="http://www.snellspace.com/public/linktests/alternate"; />
+  </entry>
+  
+</feed>
Index: parser/src/test/resources/conformance/contentsummary.xml
===================================================================
--- parser/src/test/resources/conformance/contentsummary.xml    (revision 0)
+++ parser/src/test/resources/conformance/contentsummary.xml    (revision 0)
@@ -0,0 +1,88 @@
+<feed xmlns="http://www.w3.org/2005/Atom";>
+  <id>tag:example.org,2006:/contentsummary</id>
+  <title>Content and Summary Test</title>
+  <updated>2006-01-01T12:12:12Z</updated>
+  <author><name>James</name></author>
+  <link href="http://www.snellspace.com"; />
+  <link rel="self" href="http://www.snellspace.com/public/contentsummary.xml"; 
/>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/1</id>
+    <title>Content with XML and summary</title>
+    <updated>2006-01-01T12:12:12Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <summary>If you're seeing this, your feed reader is doing a good thing. It 
doesn't understand the content so it is showing the text summary 
instead.</summary>
+    <content type="application/xml">
+      <a xmlns="tag:example.org,2006:foo"><b>If you're seeing this, something 
is wrong. 
+      <i>Your</i> feed <blink>reader</blink> is likely <p>trying</p> to render 
arbitrary <c>XML</c>
+      content as if it were HTML.</b></a>
+    </content>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/2</id>
+    <title>Content with src attribute and summary</title>
+    <updated>2006-01-01T12:12:13Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <summary>If you're seeing this, your feed reader is doing a good thing. It 
doesn't understand the content so it is showing the text summary 
instead.</summary>
+    <content type="application/xml" 
src="http://www.snellspace.com/public/content.xml"; />
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/3</id>
+    <title>Summary then Content</title>
+    <updated>2006-01-01T12:12:14Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <summary>Does it show summary?  It's ok if your reader shows this, but it 
is good to know whether or not your reader has a preference for showing the 
summary rather than the content</summary>
+    <content>Does it show content?  It's ok if your reader shows this, but it 
is good to know whether or not your reader has a preference for showing the 
content rather than the summary</content>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/4</id>
+    <title>Content then Summary</title>
+    <updated>2006-01-01T12:12:15Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <content>Does it show content?  It's ok if your reader shows this, but it 
is good to know whether or not your reader has a preference for showing the 
content rather than the summary</content>
+    <summary>Does it show summary?  It's ok if your reader shows this, but it 
is good to know whether or not your reader has a preference for showing the 
summary rather than the content</summary>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/5</id>
+    <title>Content with iCal and Summary</title>
+    <updated>2006-01-01T12:12:16Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <summary>If you see this, your feed reader is doing a good thing.  The 
content contains iCalendar data that shouldn't be displayed. If the reader 
doesn't understand the content type, it likely should not attempt to display it 
if a text summary is available.</summary>
+    <content type="text/calendar">BEGIN:VCALENDAR
+END:VCALENDAR
+    </content>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/6</id>
+    <title>Content with Base64 encoded image</title>
+    <updated>2006-01-01T12:12:17Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <summary>If you're seeing this, your feed reader is doing good.  
Alternatively, your feed reader might be smart enough to Base64 decode the 
content and show you the GIF image.  If all you're seeing is a bunch of Base64 
encoded stuff, then your feed reader is broken.</summary>
+    <content type="image/gif">
+R0lGODlhSwBLAKUfAOLcnp61x26Mm9HTx+7qx/z8/GRrQYeMa5Kpt3mUo7TG1NXMdOfp5MnV3re6
+ptrh4/b04KywmfP08eTq73d+W/v68u3w8vP2+IWeq/j5+Z+ki3qevMLEtJSZeoOkwP//////////
+////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////yH5BAEAAB8ALAAAAgBLAEkAAAb+wI9w
+SCwaj8ikcslsOomTyXNKrRYbGIE2ILV6v8aAdixINMBob4NMxqTfUwSbrIDblY/EfBy4+4kMDHl7
+Wx8PD39vAxoUBhwfWYR1BwYUEQOJVg6NBgcOmGJ7CYgDEZSVj5lNm5URDFB6c31EDxEGqKpJA40H
+mEcPkXxJHLy+uUIMHbhLDQEICl1KDrcax4aNHU3RQohLyZ3didMUxkoTAnVCGG5NHLepftMH4cwC
+Z0IICU+7jvEGHa+cKBAQTsGoJwwowUszLdsUMdHW3HOSsF+aAZ2q5KNljwqDRuWsPKBAIWAcdkLO
+pZvysSQYSvSeYEBQJMEsKhgPfLHlwAv+hpvqgE6xtfDJg39ffhZBQNPLAZdUlJmkMiHBSiEBUFY5
+6nDfPwAACECgarVI1i8TKIVcQmmB27dhxzLJM1GIAq1MJjRQEMCDBwwGqjnJSUAIBAIA3i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EBDXDAJHQB3QcY
+wIED/sN886sFJ25xgA4wgiQN3GAlHEA7/wFiAA7QwFNuwUIKHEADn+CcCWdIwxoyIQgAOw==
+    </content>
+  </entry>
+</feed>
Index: parser/src/test/resources/conformance/ordertest.xml
===================================================================
--- parser/src/test/resources/conformance/ordertest.xml (revision 0)
+++ parser/src/test/resources/conformance/ordertest.xml (revision 0)
@@ -0,0 +1,112 @@
+<feed xmlns="http://www.w3.org/2005/Atom";>
+  <id>tag:example.org,2006:atom/conformance/element_order</id>
+  <title>Order Matters</title>
+  <subtitle>Testing how feed readers handle the order of entry 
elements</subtitle>
+  <updated>2006-01-26T09:16:00Z</updated>
+  <author><name>James Snell</name></author>
+  <link href="http://www.snellspace.com/wp/?p=255"; />
+  <link rel="self" href="http://www.snellspace.com/public/ordertest.xml"; />
+  <entry>
+    <id>tag:example.org,2006:atom/conformance/element_order/1</id>
+    <title>Simple order, nothing fancy</title>
+    <summary>Simple ordering, nothing fancy</summary>
+    <updated>2006-01-26T09:20:01Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+  </entry>
+  <entry>
+    <updated>2006-01-26T09:20:02Z</updated>  
+    <summary>Same as the first, only mixed up a bit</summary>
+    <id>tag:example.org,2006:atom/conformance/element_order/2</id>
+    <link href="http://www.snellspace.com/public/alternate"; />    
+    <title>Same as the first, only mixed up a bit</title>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:atom/conformance/element_order/3</id>
+    <title>Multiple alt link elements, which one does your reader show?</title>
+    <summary>Multiple alt link elements, which does your reader show?</summary>
+    <updated>2006-01-26T09:20:03Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <link type="text/plain" href="http://www.snellspace.com/public/alternate2"; 
/>
+  </entry>  
+  <entry>
+    <id>tag:example.org,2006:atom/conformance/element_order/4</id>
+    <title>Multiple link elements, does your feed reader show the "alternate" 
correctly?</title>
+    <summary>Multiple link elements, does your feed reader show the 
"alternate" correctly? (also checks to see if the reader is paying attention to 
link rel values)</summary>
+    <updated>2006-01-26T09:20:04Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <link rel="related" href="http://www.snellspace.com/public/related"; />
+    <link rel="urn:foo" href="http://www.snellspace.com/public/foo"; />
+  </entry>
+  <entry>
+    <source>
+      <id>tag:example.org,2006:atom/conformance/element_order</id>
+      <title>Order Matters</title>
+      <subtitle>Testing how feed readers handle the order of entry 
elements</subtitle>
+      <updated>2006-01-26T09:16:00Z</updated>
+      <author><name>James Snell</name></author>
+      <link href="http://www.snellspace.com/wp/?p=255"; />
+      <link rel="self" href="http://www.snellspace.com/public/ordertest.xml"; />
+    </source>
+    <id>tag:example.org,2006:atom/conformance/element_order/5</id>
+    <title>Entry with a source first</title>
+    <summary>Entry with a source first.. does your feed reader show the right 
title, updated, and alt link?</summary>
+    <updated>2006-01-26T09:20:05Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:atom/conformance/element_order/6</id>
+    <title>Entry with a source last</title>
+    <summary>Entry with a source first.. does your feed reader show the right 
title, updated, and alt link?</summary>
+    <updated>2006-01-26T09:20:06Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <source>
+      <id>tag:example.org,2006:atom/conformance/element_order</id>
+      <title>Order Matters</title>
+      <subtitle>Testing how feed readers handle the order of entry 
elements</subtitle>
+      <updated>2006-01-26T09:16:00Z</updated>
+      <author><name>James Snell</name></author>
+      <link href="http://www.snellspace.com/wp/?p=255"; />
+      <link rel="self" href="http://www.snellspace.com/public/ordertest.xml"; />
+    </source>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:atom/conformance/element_order/7</id>
+    <title>Entry with a source in the middle</title>
+    <source>
+      <id>tag:example.org,2006:atom/conformance/element_order</id>
+      <title>Order Matters</title>
+      <subtitle>Testing how feed readers handle the order of entry 
elements</subtitle>
+      <updated>2006-01-26T09:16:00Z</updated>
+      <author><name>James Snell</name></author>
+      <link href="http://www.snellspace.com/wp/?p=255"; />
+      <link rel="self" href="http://www.snellspace.com/public/ordertest.xml"; />
+    </source>
+    <summary>Entry with a source in the middle.. does your feed reader show 
the right id, title, updated, and alt link?</summary>
+    <updated>2006-01-26T09:20:07Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+  </entry>
+  <entry>
+    <x:foo xmlns:x="urn:foo">
+      <id>tag:example.org,2006:atom/conformance/element_order/9</id>
+      <title>Something is wrong if you're seeing this</title>
+      <updated>2006-01-26T09:20:00Z</updated>
+    </x:foo>
+    <id>tag:example.org,2006:atom/conformance/element_order/8</id>
+    <title>Atom elements in an extension element</title>
+    <summary>Atom elements in an extension element</summary>
+    <updated>2006-01-26T09:20:08Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:atom/conformance/element_order/9</id>
+    <title>Atom elements in an extension element</title>
+    <summary>Atom elements in an extension element</summary>
+    <updated>2006-01-26T09:20:09Z</updated>
+    <link href="http://www.snellspace.com/public/alternate"; />
+    <x:foo xmlns:x="urn:foo">
+      <id>tag:example.org,2006:atom/conformance/element_order/8</id>
+      <title>Something is wrong if you're seeing this</title>
+      <updated>2006-01-26T09:20:00Z</updated>
+    </x:foo>
+  </entry>  
+</feed>

Reply via email to