abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r503980 - in /incubator/abdera/java/trunk/parser/src/test: java/org/apache/abdera/test/parser/stax/ resources/www.snellspace.com/public/
Date Tue, 06 Feb 2007 04:55:12 GMT
Author: jmsnell
Date: Mon Feb  5 20:55:11 2007
New Revision: 503980

URL: http://svn.apache.org/viewvc?view=rev&rev=503980
Log:
Remove our build dependency on test feeds that are only available online.

Added:
    incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace.xml
    incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace2.xml
    incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace3.xml
    incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/xmlbase.xml
Modified:
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java?view=diff&rev=503980&r1=503979&r2=503980
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
(original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
Mon Feb  5 20:55:11 2007
@@ -99,15 +99,14 @@
    */
   public static void testXmlNamespace() throws Exception {
     String[] tests = {
-      "http://plasmasturm.org/attic/atom-tests/nondefaultnamespace.atom",
-      "http://plasmasturm.org/attic/atom-tests/nondefaultnamespace-xhtml.atom",
-      "http://hsivonen.iki.fi/test/unknown-namespace.atom",
-      "http://plasmasturm.org/attic/atom-tests/nondefaultnamespace-baseline.atom"
+      "http://www.snellspace.com/public/nondefaultnamespace.xml",
+      "http://www.snellspace.com/public/nondefaultnamespace2.xml",
+      "http://www.snellspace.com/public/nondefaultnamespace3.xml"
     };
     int n = 1;
     for (String test : tests) {
       IRI uri = new IRI(test);
-      Document<Feed> doc = get(uri);
+      Document<Feed> doc = parse(uri);
       assertNotNull(doc);
       Feed feed = doc.getRoot();
       Entry entry = feed.getEntries().get(0);
@@ -115,11 +114,11 @@
         case 1:
           assertNotNull(entry.getTitleElement());
           assertEquals(entry.getIdElement().getValue(), 
-              new IRI("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
-          Content content = entry.getContentElement();
-          assertNotNull(content);
-          assertEquals(content.getContentType(), Content.Type.XHTML);
-          OMElement element = (OMElement)content;
+              new IRI("tag:example.org,2007:bar"));
+          Text summary = entry.getSummaryElement();
+          assertNotNull(summary);
+          assertEquals(summary.getTextType(), Text.Type.XHTML);
+          OMElement element = (OMElement)summary;
           OMElement div = 
             element.getFirstChildWithName(
               new QName("http://www.w3.org/1999/xhtml", "div"));
@@ -128,11 +127,11 @@
         case 2:
           assertNotNull(entry.getTitleElement());
           assertEquals(entry.getIdElement().getValue(), 
-              new IRI("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
-          content = entry.getContentElement();
-          assertNotNull(content);
-          assertEquals(content.getContentType(), Content.Type.XHTML);
-          element = (OMElement)content;
+              new IRI("tag:example.org,2007:bar"));
+          summary = entry.getSummaryElement();
+          assertNotNull(summary);
+          assertEquals(summary.getTextType(), Text.Type.XHTML);
+          element = (OMElement)summary;
           div = 
             element.getFirstChildWithName(
               new QName("http://www.w3.org/1999/xhtml", "div"));
@@ -141,24 +140,11 @@
         case 3:
           assertNotNull(entry.getTitleElement());
           assertEquals(entry.getIdElement().getValue(), 
-              new IRI("http://hsivonen.iki.fi/test/unknown-namespace.atom/entry"));
-          content = entry.getContentElement();
-          assertNotNull(content);
-          assertEquals(content.getContentType(), Content.Type.XHTML);
-          element = (OMElement)content;
-          div = 
-            element.getFirstChildWithName(
-              new QName("http://www.w3.org/1999/xhtml", "div"));
-          assertNotNull(div);
-          break;
-        case 4:
-          assertNotNull(entry.getTitleElement());
-          assertEquals(entry.getIdElement().getValue(), 
-              new IRI("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
-          content = entry.getContentElement();
-          assertNotNull(content);
-          assertEquals(content.getContentType(), Content.Type.XHTML);
-          element = (OMElement)content;
+              new IRI("tag:example.org,2007:bar"));
+          summary = entry.getSummaryElement();
+          assertNotNull(summary);
+          assertEquals(summary.getTextType(), Text.Type.XHTML);
+          element = (OMElement)summary;
           div = 
             element.getFirstChildWithName(
               new QName("http://www.w3.org/1999/xhtml", "div"));
@@ -173,139 +159,18 @@
    * Test to ensure that the parser properly resolves relative URI
    */
   public static void testXmlBase() throws Exception {
-    //http://tbray.org/ongoing/ongoing.atom
-    IRI uri = new IRI("http://www.tbray.org/ongoing/ongoing.atom");
-    Document<Feed> doc = get(uri);
-    assertNotNull(doc);
-    Feed feed = doc.getRoot();
-    assertEquals(feed.getBaseUri(), new IRI("http://www.tbray.org/ongoing/ongoing.atom"));
-    assertEquals(feed.getLogoElement().getResolvedValue(), new IRI("http://www.tbray.org/ongoing/rsslogo.jpg"));
-    assertEquals(feed.getIconElement().getResolvedValue(),new IRI("http://www.tbray.org/favicon.ico"));
   
-  }
-  
-  /**
-   * Test to ensure that the parser properly resolves relative URI
-   */
-  public static void testXmlBase2() throws Exception {
-    //http://plasmasturm.org/attic/atom-tests/xmlbase.atom
-    IRI uri = new IRI("http://plasmasturm.org/attic/atom-tests/xmlbase.atom");
-    IRI result = new IRI("http://example.org/tests/base/result.html");
-    Document<Feed> doc = get(uri);
+    IRI uri = new IRI("http://www.snellspace.com/public/xmlbase.xml");
+    Document<Feed> doc = parse(uri);
     assertNotNull(doc);
     Feed feed = doc.getRoot();
-    int n = 1;
-    for (Entry entry : feed.getEntries()) {
-      switch(n) {
-        case 1:
-          assertEquals(entry.getAlternateLink().getResolvedHref(), result);
-          break;
-        case 2:
-          assertEquals(entry.getAlternateLink().getResolvedHref(), result);
-          break;
-        case 3:
-          assertEquals(entry.getAlternateLink().getResolvedHref(), result);
-          break;
-        case 4:
-          assertEquals(entry.getAlternateLink().getResolvedHref(), result);
-          break;
-        case 5:
-        case 6:
-        case 7:
-        case 8:
-        case 9:
-        case 10:
-        case 11:
-        case 12:
-        case 13:
-        case 14:
-        case 15:
-        case 16:
-          // content tests... skipping
-          // we defer the proper handling of xml:base in the content to the
-          // application using the parser. 
-          break;
-      }
-      n++;
-    }
-  }
-  
-  public static void testUpdated() throws Exception {
-    //http://intertwingly.net/testcase/updated.atom
-    //Note: This test determines whether or not applications properly
-    //      detect content changes in an atom entry based on the value
-    //      of the atom:updated.  This isn't really relevant at this 
-    //      level.  The responsibility for properly detecting modifications
-    //      belongs to the application.
+    assertEquals(feed.getBaseUri(), new IRI("http://www.snellspace.com/public/xmlbase.xml"));
+    assertEquals(feed.getLogoElement().getResolvedValue(), new IRI("http://www.snellspace.com/public/atom-logo.png"));
+    assertEquals(feed.getIconElement().getResolvedValue(),new IRI("http://www.snellspace.com/public/atom-icon.png"));
+    
+    Entry entry = feed.getEntries().get(0);
+    assertEquals(entry.getAlternateLinkResolvedHref().toString(), "http://www.snellspace.com/wp");
   }
   
-  /**
-   * Test support for markup in Text constructs
-   */
-  public static void testTitle() throws Exception {
-    String[] tests = {
-      "html-cdata.atom",
-      "html-entity.atom",
-      "html-ncr.atom",
-      "text-cdata.atom",
-      "text-entity.atom",
-      "text-ncr.atom",
-      "xhtml-entity.atom",
-      "xhtml-ncr.atom"};
-    IRI baseUri = new IRI("http://atomtests.philringnalda.com/tests/item/title/");
-    int n = 1;
-    for (String test : tests) {
-      Document<Feed> doc = get(baseUri.resolve(test));
-      assertNotNull(doc);
-      Feed feed = doc.getRoot();
-      Entry entry = feed.getEntries().get(0);
-      assertNotNull(entry);
-      Text title = entry.getTitleElement();
-      assertNotNull(title);
-      switch(n) {
-        case 1:
-          // The parser passes escaped HTML back up to the application.
-          // is the applications responsibility to properly display it
-          String value = title.getValue();
-          assertEquals(value, "&lt;title>");
-          break;
-        case 2:
-          // The parser passes escaped HTML back up to the application.
-          // is the applications responsibility to properly display it
-          value = title.getValue();
-          assertEquals(value, "&lt;title>");
-          break;
-        case 3:
-          // The parser passes escaped HTML back up to the application.
-          // is the applications responsibility to properly display it
-          value = title.getValue();
-          assertEquals(value, "&lt;title>");          
-          break;
-        case 4:
-          value = title.getValue();
-          assertEquals(value, "<title>");          
-          break;
-        case 5:
-          value = title.getValue();
-          assertEquals(value, "<title>");
-          break;
-        case 6:
-          value = title.getValue();
-          assertEquals(value, "<title>");
-          break;
-        case 7:
-          Div div = title.getValueElement();
-          assertTrue(div.getValue().equals("&lt;title>") || 
-                     div.getValue().equals("&lt;title&gt;"));
-          break;
-        case 8:
-          div = title.getValueElement();
-          assertTrue(div.getValue().equals("&lt;title>") ||
-                     div.getValue().equals("&lt;title&gt;"));
-          break;
-      }
-      n++;
-    }
-  }
   
   /**
    * This tests the parsers ability to properly ignore the ordering of elements

Added: incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace.xml?view=auto&rev=503980
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace.xml
Mon Feb  5 20:55:11 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<a:feed 
+  xmlns:a="http://www.w3.org/2005/Atom" 
+  xmlns="http://www.w3.org/1999/xhtml">
+  <a:id>tag:example.org,2007:foo</a:id>
+  <a:title>Test</a:title>
+  <a:updated>2007-02-05T12:12:12T</a:updated>
+  <a:link href="" />
+  <a:author><a:name>James</a:name></a:author>
+  <a:entry>
+    <a:id>tag:example.org,2007:bar</a:id>
+    <a:title>Test</a:title>
+    <a:updated>2007-02-05T12:12:12Z</a:updated>
+    <a:link href="" />
+    <a:summary type="xhtml"><div><p>foo</p></div></a:summary>
+  </a:entry>
+</a:feed>

Added: incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace2.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace2.xml?view=auto&rev=503980
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace2.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace2.xml
Mon Feb  5 20:55:11 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<a:feed 
+  xmlns:a="http://www.w3.org/2005/Atom" 
+  xmlns:h="http://www.w3.org/1999/xhtml">
+  <a:id>tag:example.org,2007:foo</a:id>
+  <a:title>Test</a:title>
+  <a:updated>2007-02-05T12:12:12T</a:updated>
+  <a:link href="" />
+  <a:author><a:name>James</a:name></a:author>
+  <a:entry>
+    <a:id>tag:example.org,2007:bar</a:id>
+    <a:title>Test</a:title>
+    <a:updated>2007-02-05T12:12:12Z</a:updated>
+    <a:link href="" />
+    <a:summary type="xhtml"><h:div><h:p>foo</h:p></h:div></a:summary>
+  </a:entry>
+</a:feed>

Added: incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace3.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace3.xml?view=auto&rev=503980
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace3.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/nondefaultnamespace3.xml
Mon Feb  5 20:55:11 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <id>tag:example.org,2007:foo</id>
+  <title>Test</title>
+  <updated>2007-02-05T12:12:12T</updated>
+  <link href="" />
+  <author><name>James</name></author>
+  <entry>
+    <id>tag:example.org,2007:bar</id>
+    <title>Test</title>
+    <updated>2007-02-05T12:12:12Z</updated>
+    <link href="" />
+    <summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>foo</p></div></summary>
+  </entry>
+</feed>

Added: incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/xmlbase.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/xmlbase.xml?view=auto&rev=503980
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/xmlbase.xml
(added)
+++ incubator/abdera/java/trunk/parser/src/test/resources/www.snellspace.com/public/xmlbase.xml
Mon Feb  5 20:55:11 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://www.snellspace.com/public/xmlbase.xml">
+  <id>tag:example.org,2007:foo</id>
+  <title>test</title>
+  <updated>2007-02-05T12:12:12Z</updated>
+  <logo>atom-logo.png</logo>
+  <icon>atom-icon.png</icon>
+  <author><name>James</name></author>
+  <link href="" />
+  <entry>
+    <id>tag:example.org,2007:bar</id>
+    <title>test</title>
+    <updated>2007-02-05T12:12:12Z</updated>
+    <link href="../wp" />
+  </entry>
+</feed>
\ No newline at end of file



Mime
View raw message