abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r415427 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/factory/ core/src/main/java/org/apache/abdera/util/ core/src/test/java/org/apache/abdera/test/core/ parser/src/main/java/org/apache/abdera/parser/stax/ parser/s...
Date Mon, 19 Jun 2006 21:24:45 GMT
Author: jmsnell
Date: Mon Jun 19 14:24:44 2006
New Revision: 415427

URL: http://svn.apache.org/viewvc?rev=415427&view=rev
Log:
Some test improvements.

* Moved testMinimalConfiguration to Parser tests (as suggested by Stephen)
* Provide a thorough testing of the Factory
* Fixed a few bugs made visible by the new test case (e.g., an infinite loop in Factory.getDefaultGenerator())

More to come

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java
    incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java?rev=415427&r1=415426&r2=415427&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
Mon Jun 19 14:24:44 2006
@@ -251,8 +251,12 @@
   
   StringElement newStringElement(QName qname, Element parent);
   
+  StringElement newStringElement(QName qname, Document parent);
+  
   StringElement newStringElement(QName qname, String value, Element parent);
 
+  StringElement newStringElement(QName qname, String value, Document parent);
+  
   ExtensionElement newExtensionElement(QName qname, Base parent);
   
   Control newControl(Element parent);

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java?rev=415427&r1=415426&r2=415427&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java Mon
Jun 19 14:24:44 2006
@@ -24,5 +24,6 @@
 
   public static final String APP_NAME = "Abdera";
   public static final String VERSION = "v0.1";
+  public static final String URI = "http://incubator.apache.org/abdera";
   
 }

Modified: incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java?rev=415427&r1=415426&r2=415427&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
(original)
+++ incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
Mon Jun 19 14:24:44 2006
@@ -42,12 +42,6 @@
       "org.apache.abdera.parser.stax.FOMXPath");
   }
   
-  public static void testMinimalConfiguration() {
-    assertNotNull(Factory.INSTANCE);
-    assertNotNull(Parser.INSTANCE);
-    assertNotNull(XPath.INSTANCE);
-  }
-  
   public static void testUriNormalization() {
     try {
       assertEquals(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=415427&r1=415426&r2=415427&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Mon Jun 19 14:24:44 2006
@@ -277,7 +277,7 @@
     ExtensionElement value, Element parent) {
       Content content = 
         newContent(
-          Content.Type.MEDIA, 
+          Content.Type.XML, 
           mediaType, 
           parent);
       if (src != null) content.setSrc(src);
@@ -362,9 +362,12 @@
   
   public Generator newDefaultGenerator(
     Element parent) {
-      Generator generator = newDefaultGenerator(parent);
+      Generator generator = newGenerator(parent);
       generator.setVersion(Version.VERSION);
       generator.setValue(Version.APP_NAME);
+      try {
+        generator.setUri(Version.URI);
+      } catch (Exception e) {}
       return generator;
   }
   
@@ -643,6 +646,12 @@
 
   public StringElement newStringElement(
     QName qname, 
+    Document parent) {
+      return new FOMStringElement(qname, (OMContainer)parent, this);
+  }
+  
+  public StringElement newStringElement(
+    QName qname, 
     String value,
     Element parent) {
     StringElement el = newStringElement(qname, parent);
@@ -651,6 +660,16 @@
     return el;
   }
 
+  public StringElement newStringElement(
+    QName qname, 
+    String value,
+    Document parent) {
+    StringElement el = newStringElement(qname, parent);
+    if (value != null)
+      el.setValue(value);
+    return el;
+  }
+  
   public ExtensionElement newExtensionElement(
     QName qname, 
     Base parent) {
@@ -688,6 +707,10 @@
       } else {
         if (parent instanceof Element)
           element = newStringElement(qname, (Element)parent);
+        else if (parent instanceof Document)
+          element = newStringElement(qname, (Document)parent);
+        else 
+          element = newStringElement(qname, (Element)null);
       }
       return element;
   }

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java?rev=415427&r1=415426&r2=415427&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
(original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
Mon Jun 19 14:24:44 2006
@@ -19,33 +19,63 @@
 
 import java.io.InputStream;
 import java.io.ByteArrayOutputStream;
+import java.net.URI;
 import java.net.URL;
+import java.util.Calendar;
+import java.util.Date;
 
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.filter.ParseFilter;
 import org.apache.abdera.filter.TextFilter;
+import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Base;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Control;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.ExtensionElement;
 import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRI;
+import org.apache.abdera.model.InReplyTo;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Service;
+import org.apache.abdera.model.Source;
+import org.apache.abdera.model.StringElement;
 import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Total;
+import org.apache.abdera.model.Workspace;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserOptions;
 import org.apache.abdera.util.BlackListParseFilter;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
+import org.apache.abdera.util.Version;
 import org.apache.abdera.util.WhiteListParseFilter;
 import org.apache.abdera.xpath.XPath;
+import org.apache.axiom.attachments.ByteArrayDataSource;
 
 
 import junit.framework.TestCase;
 
 public class FOMTest extends TestCase   {
 
+  public static void testMinimalConfiguration() {
+    assertNotNull(Factory.INSTANCE);
+    assertNotNull(Parser.INSTANCE);
+    assertNotNull(XPath.INSTANCE);
+  }
+  
   public void testParser() throws Exception {
     
     InputStream in = FOMTest.class.getResourceAsStream("/simple.xml");
@@ -244,5 +274,319 @@
     assertEquals(URIHelper.normalize(s2), "http://www.example.org:81/foo/-/foo");
   }
   
-  
+  public void testFactory() throws Exception {
+    Factory factory = Factory.INSTANCE;
+    Person author = factory.newAuthor(null);
+    assertNotNull(author);
+    author = factory.newAuthor("a", "b", "c", null);
+    assertNotNull(author);
+    assertEquals(author.getName(),"a");
+    assertEquals(author.getEmail(), "b");
+    assertEquals(author.getUri().toString(), "c");
+    author = factory.newAuthor("a", "b", new URI("c"), null);
+    assertNotNull(author);
+    assertEquals(author.getName(),"a");
+    assertEquals(author.getEmail(), "b");
+    assertEquals(author.getUri().toString(), "c");
+    Category category = factory.newCategory(null);
+    assertNotNull(category);
+    category = factory.newCategory(new URI("a"), "b", "c", null);
+    assertNotNull(category);
+    assertEquals(category.getScheme().toString(), "a");
+    assertEquals(category.getTerm(), "b");
+    assertEquals(category.getLabel(), "c");
+    Collection collection = factory.newCollection(null);
+    assertNotNull(collection);
+    Content content = factory.newContent(Content.Type.TEXT, null);
+    assertNotNull(content);
+    assertEquals(content.getContentType(), Content.Type.TEXT);
+    content = factory.newContent(Content.Type.HTML, null);
+    assertEquals(content.getContentType(), Content.Type.HTML);
+    content = factory.newContent(Content.Type.XHTML, null);
+    assertEquals(content.getContentType(), Content.Type.XHTML);
+    content = factory.newContent(Content.Type.MEDIA, null);
+    assertEquals(content.getContentType(), Content.Type.MEDIA);
+    content = factory.newContent(Content.Type.XML, null);
+    assertEquals(content.getContentType(), Content.Type.XML);
+    content = factory.newContent(Content.Type.MEDIA, new MimeType("text/foo"), null);
+    assertEquals(content.getContentType(), Content.Type.MEDIA);
+    assertEquals(content.getMimeType().toString(), "text/foo");
+    Person contributor = factory.newContributor(null);
+    assertNotNull(contributor);
+    contributor = factory.newContributor("a", "b", "c", null);
+    assertNotNull(contributor);
+    assertEquals(contributor.getName(),"a");
+    assertEquals(contributor.getEmail(), "b");
+    assertEquals(contributor.getUri().toString(), "c");
+    contributor = factory.newContributor("a", "b", new URI("c"), null);
+    assertNotNull(contributor);
+    assertEquals(contributor.getName(),"a");
+    assertEquals(contributor.getEmail(), "b");
+    assertEquals(contributor.getUri().toString(), "c");
+    Control control = factory.newControl(null);
+    assertNotNull(control);
+    control = factory.newControl(true, null);
+    assertTrue(control.isDraft());
+    Date now = new Date();
+    DateTime dateTime = factory.newDateTime(Constants.UPDATED, AtomDate.valueOf(now), null);
+    assertEquals(dateTime.getDate(), now);
+    Calendar cal = Calendar.getInstance();
+    dateTime = factory.newDateTime(Constants.UPDATED, cal, null);
+    assertEquals(dateTime.getCalendar(), cal);
+    dateTime = factory.newDateTime(Constants.UPDATED, now, null);
+    assertEquals(dateTime.getDate(), now);
+    dateTime = factory.newDateTime(Constants.UPDATED, null);
+    assertNotNull(dateTime);
+    dateTime = factory.newDateTime(Constants.UPDATED, now.getTime(), null);
+    assertEquals(dateTime.getTime(), now.getTime());
+    dateTime = factory.newDateTime(Constants.UPDATED, AtomDate.format(now), null);
+    assertEquals(dateTime.getString(), AtomDate.format(now));
+    assertEquals(dateTime.getDate(), now);
+    Generator generator = factory.newDefaultGenerator(null);
+    assertNotNull(generator);
+    assertEquals(generator.getValue(), Version.APP_NAME);
+    assertEquals(generator.getVersion(), Version.VERSION);
+    assertEquals(generator.getUri().toString(), Version.URI);
+    Div div = factory.newDiv(null);
+    assertNotNull(div);
+    Document doc = factory.newDocument();
+    assertNotNull(doc);
+    StringElement el = factory.newEmail(null);
+    assertNotNull(el);
+    el = factory.newEmail("a", null);
+    assertEquals(el.getValue(), "a");
+    Entry entry = factory.newEntry();
+    assertNotNull(entry);
+    entry = factory.newEntry(null);
+    assertNotNull(entry);
+    ExtensionElement ee = factory.newExtensionElement(new QName("urn:foo", "bar", "b"), null);
+    assertNotNull(ee);
+    assertEquals(ee.getQName(), new QName("urn:foo", "bar", "b"));
+    Feed feed = factory.newFeed();
+    assertNotNull(feed);
+    feed = factory.newFeed(null);
+    assertNotNull(feed);
+    generator = factory.newGenerator(null);
+    assertNotNull(generator);
+    generator = factory.newGenerator(new URI(Version.URI), Version.VERSION, Version.APP_NAME,
null);
+    assertNotNull(generator);
+    assertEquals(generator.getValue(), Version.APP_NAME);
+    assertEquals(generator.getVersion(), Version.VERSION);
+    assertEquals(generator.getUri().toString(), Version.URI);
+    content = factory.newHtmlContent("a", null);
+    assertNotNull(content);
+    assertEquals(content.getValue(), "a");
+    assertEquals(content.getContentType(), Content.Type.HTML);
+    Text text = factory.newHtmlRights("a", null);
+    assertNotNull(text);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.HTML);
+    text = factory.newHtmlSubtitle("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.HTML);
+    text = factory.newHtmlSummary("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.HTML);
+    text = factory.newHtmlText(Constants.TITLE, "a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.HTML);
+    assertEquals(text.getQName(), Constants.TITLE);
+    text = factory.newHtmlTitle("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.HTML);
+    IRI iri = factory.newIcon(null);
+    assertNotNull(iri);
+    iri = factory.newIcon("http://example.org/foo", null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newIcon(new URI("http://example.org/foo"), null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newID(null);
+    assertNotNull(iri);
+    iri = factory.newID("http://example.org/foo", null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newID(new URI("http://example.org/foo"), null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newIRIElement(Constants.ID, null);
+    assertNotNull(iri);
+    iri = factory.newIRIElement(Constants.ID, "http://example.org/foo", null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newIRIElement(Constants.ID, new URI("http://example.org/foo"), null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    InReplyTo inreplyto = factory.newInReplyTo(null);
+    assertNotNull(inreplyto);
+    inreplyto = factory.newInReplyTo("http://example.org/foo", null);
+    assertNotNull(inreplyto);
+    assertEquals(inreplyto.getRef().toString(), "http://example.org/foo");
+    inreplyto = factory.newInReplyTo(new URI("http://example.org/foo"), null);
+    assertEquals(inreplyto.getRef().toString(), "http://example.org/foo");
+    inreplyto = factory.newInReplyTo("http://example.org/foo", "http://example.org/foo",
"http://example.org/foo", "text/foo", null);
+    assertEquals(inreplyto.getRef().toString(), "http://example.org/foo");
+    assertEquals(inreplyto.getSource().toString(), "http://example.org/foo");
+    assertEquals(inreplyto.getHref().toString(), "http://example.org/foo");
+    assertEquals(inreplyto.getMimeType().toString(), "text/foo");
+    inreplyto = factory.newInReplyTo(new URI("http://example.org/foo"), new URI("http://example.org/foo"),
new URI("http://example.org/foo"), new MimeType("text/foo"), null);
+    assertEquals(inreplyto.getRef().toString(), "http://example.org/foo");
+    assertEquals(inreplyto.getSource().toString(), "http://example.org/foo");
+    assertEquals(inreplyto.getHref().toString(), "http://example.org/foo");
+    assertEquals(inreplyto.getMimeType().toString(), "text/foo");
+    Link link = factory.newLink(null);
+    assertNotNull(link);
+    link = factory.newLink("http://example.org/foo", "a", new MimeType("text/foo"), "b",
"en", 10, null);
+    assertEquals(link.getHref().toString(), "http://example.org/foo");
+    assertEquals(link.getRel(), "a");
+    assertEquals(link.getMimeType().toString(), "text/foo");
+    assertEquals(link.getTitle(), "b");
+    assertEquals(link.getHrefLang(), "en");
+    assertEquals(link.getLength(), 10);
+    link = factory.newLink(new URI("http://example.org/foo"), "a", new MimeType("text/foo"),
"b", "en", 10, null);
+    assertEquals(link.getHref().toString(), "http://example.org/foo");
+    assertEquals(link.getRel(), "a");
+    assertEquals(link.getMimeType().toString(), "text/foo");
+    assertEquals(link.getTitle(), "b");
+    assertEquals(link.getHrefLang(), "en");
+    assertEquals(link.getLength(), 10);
+    iri = factory.newLogo(null);
+    assertNotNull(iri);
+    iri = factory.newLogo("http://example.org/foo", null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newLogo(new URI("http://example.org/foo"), null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    content = factory.newMediaContent(new MimeType("text/foo"), new URI("foo"), null, null);
+    assertNotNull(content);
+    assertEquals(content.getMimeType().toString(), "text/foo");
+    assertEquals(content.getSrc().toString(), "foo");
+    content = factory.newMediaContent(new MimeType("text/foo"), null, new DataHandler(new
ByteArrayDataSource("foo".getBytes())), null);
+    assertEquals(content.getValue(), "Zm9v");
+    assertEquals(content.getContentType(), Content.Type.MEDIA);
+    el = factory.newName(null);
+    assertNotNull(el);
+    el = factory.newName("a", null);
+    assertEquals(el.getValue(), "a");
+    Parser parser = factory.newParser();
+    assertNotNull(parser);
+    Person person = factory.newPerson(Constants.AUTHOR, null);
+    assertNotNull(person);
+    assertEquals(person.getQName(), Constants.AUTHOR);
+    person = factory.newPerson(Constants.AUTHOR, "a", "b", "c", null);
+    assertEquals(person.getName(),"a");
+    assertEquals(person.getEmail(), "b");
+    assertEquals(person.getUri().toString(), "c");
+    person = factory.newPerson(Constants.AUTHOR, "a", "b", new URI("c"), null);
+    assertEquals(person.getName(),"a");
+    assertEquals(person.getEmail(), "b");
+    assertEquals(person.getUri().toString(), "c");
+    now = new Date();
+    dateTime = factory.newPublished(AtomDate.valueOf(now), null);
+    assertEquals(dateTime.getDate(), now);
+    cal = Calendar.getInstance();
+    dateTime = factory.newPublished(cal, null);
+    assertEquals(dateTime.getCalendar(), cal);
+    dateTime = factory.newPublished(now, null);
+    assertEquals(dateTime.getDate(), now);
+    dateTime = factory.newPublished(null);
+    assertNotNull(dateTime);
+    dateTime = factory.newPublished(now.getTime(), null);
+    assertEquals(dateTime.getTime(), now.getTime());
+    dateTime = factory.newPublished(AtomDate.format(now), null);
+    assertEquals(dateTime.getString(), AtomDate.format(now));
+    assertEquals(dateTime.getDate(), now);
+    Service service = factory.newService();
+    assertNotNull(service);
+    service = factory.newService(null);
+    assertNotNull(service);
+    Source source = factory.newSource(null);
+    assertNotNull(source);
+    el = factory.newStringElement(Constants.NAME, (Element)null);
+    assertNotNull(el);
+    assertEquals(el.getQName(), Constants.NAME);
+    el = factory.newStringElement(Constants.NAME, "a", (Element)null);
+    assertNotNull(el);
+    assertEquals(el.getQName(), Constants.NAME);
+    assertEquals(el.getValue(), "a");
+    text = factory.newText(Constants.TITLE, Text.Type.TEXT, null);
+    assertNotNull(text);
+    assertEquals(text.getTextType(), Text.Type.TEXT);
+    text = factory.newTextRights("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.TEXT);
+    text = factory.newTextSubtitle("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.TEXT);
+    text = factory.newTextSummary("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.TEXT);
+    text = factory.newTextText(Constants.TITLE, "a", null);
+    assertEquals(text.getQName(), Constants.TITLE);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.TEXT);
+    text = factory.newTextTitle("a", null);
+    assertEquals(text.getValue(), "a");
+    assertEquals(text.getTextType(), Text.Type.TEXT);
+    content = factory.newTextContent("a", null);
+    assertEquals(content.getValue(), "a");
+    assertEquals(content.getContentType(), Content.Type.TEXT);
+    Total total = factory.newTotal(null);
+    assertNotNull(total);
+    total = factory.newTotal(10, null);
+    assertEquals(total.getValue(), 10);
+    now = new Date();
+    dateTime = factory.newUpdated(AtomDate.valueOf(now), null);
+    assertEquals(dateTime.getDate(), now);
+    cal = Calendar.getInstance();
+    dateTime = factory.newUpdated(cal, null);
+    assertEquals(dateTime.getCalendar(), cal);
+    dateTime = factory.newUpdated(now, null);
+    assertEquals(dateTime.getDate(), now);
+    dateTime = factory.newUpdated(null);
+    assertNotNull(dateTime);
+    dateTime = factory.newUpdated(now.getTime(), null);
+    assertEquals(dateTime.getTime(), now.getTime());
+    dateTime = factory.newUpdated(AtomDate.format(now), null);
+    assertEquals(dateTime.getString(), AtomDate.format(now));
+    assertEquals(dateTime.getDate(), now);
+    iri = factory.newUri(null);
+    assertNotNull(iri);
+    iri = factory.newUri("http://example.org/foo", null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    iri = factory.newUri(new URI("http://example.org/foo"), null);
+    assertEquals(iri.getValue().toString(), "http://example.org/foo");
+    Workspace workspace = factory.newWorkspace(null);
+    assertNotNull(workspace);
+    div = factory.newDiv(null);
+    content = factory.newXhtmlContent(div, null);
+    assertNotNull(content);
+    assertEquals(content.getContentType(), Content.Type.XHTML);
+    assertNotNull(content.getValueElement());
+    assertEquals(content.getValueElement(), div);
+    content = factory.newXmlContent(new MimeType("application/xml"), null, div, null);
+    assertNotNull(content);
+    assertEquals(content.getContentType(), Content.Type.XML);
+    assertNotNull(content.getValueElement());
+    assertEquals(content.getValueElement(), div);
+    text = factory.newXhtmlRights(div, null);
+    assertNotNull(text);
+    assertEquals(text.getTextType(), Text.Type.XHTML);
+    assertEquals(text.getValueElement(), div);
+    text = factory.newXhtmlSubtitle(div, null);
+    assertNotNull(text);
+    assertEquals(text.getTextType(), Text.Type.XHTML);
+    assertEquals(text.getValueElement(), div);
+    text = factory.newXhtmlSummary(div, null);
+    assertNotNull(text);
+    assertEquals(text.getTextType(), Text.Type.XHTML);
+    assertEquals(text.getValueElement(), div);
+    text = factory.newXhtmlText(Constants.TITLE, div, null);
+    assertNotNull(text);
+    assertEquals(text.getQName(), Constants.TITLE);
+    assertEquals(text.getTextType(), Text.Type.XHTML);
+    assertEquals(text.getValueElement(), div);
+    text = factory.newXhtmlTitle(div, null);
+    assertNotNull(text);
+    assertEquals(text.getTextType(), Text.Type.XHTML);
+    assertEquals(text.getValueElement(), div);
+    QName qname = new QName("urn:foo", "bar");
+    factory.registerAsSimpleExtension(qname);
+    el = (StringElement) factory.newExtensionElement(qname, null);
+    assertEquals(el.getQName(), qname);
+  }
 }



Mime
View raw message