chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r925796 - in /incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src: main/java/org/apache/opencmis/server/impl/atompub/ test/java/org/apache/opencmis/server/impl/
Date Sun, 21 Mar 2010 15:26:07 GMT
Author: fmui
Date: Sun Mar 21 15:26:07 2010
New Revision: 925796

URL: http://svn.apache.org/viewvc?rev=925796&view=rev
Log:
fixed CMIS-164

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomDocumentBase.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntry.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntryParser.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomDocumentBase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomDocumentBase.java?rev=925796&r1=925795&r2=925796&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomDocumentBase.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomDocumentBase.java
Sun Mar 21 15:26:07 2010
@@ -136,6 +136,7 @@ public abstract class AtomDocumentBase e
    * Writes an Atom updated tag.
    */
   public void writeUpdated(GregorianCalendar updated) throws XMLStreamException {
+    writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
     writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
   }
 
@@ -143,6 +144,7 @@ public abstract class AtomDocumentBase e
    * Writes an Atom updated tag.
    */
   public void writeUpdated(long updated) throws XMLStreamException {
+    writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
     writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
   }
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntry.java?rev=925796&r1=925795&r2=925796&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntry.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntry.java
Sun Mar 21 15:26:07 2010
@@ -65,6 +65,7 @@ public class AtomEntry extends AtomDocum
       writeNamespace(Constants.NAMESPACE_ATOM);
       writeNamespace(Constants.NAMESPACE_CMIS);
       writeNamespace(Constants.NAMESPACE_RESTATOM);
+      writeNamespace(Constants.NAMESPACE_APP);
     }
   }
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntryParser.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntryParser.java?rev=925796&r1=925795&r2=925796&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntryParser.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntryParser.java
Sun Mar 21 15:26:07 2010
@@ -41,6 +41,8 @@ import org.apache.opencmis.commons.impl.
 import org.apache.opencmis.commons.impl.Converter;
 import org.apache.opencmis.commons.impl.JaxBHelper;
 import org.apache.opencmis.commons.impl.dataobjects.ContentStreamDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertiesDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyStringDataImpl;
 import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
 import org.apache.opencmis.commons.provider.AccessControlList;
 import org.apache.opencmis.commons.provider.ContentStreamData;
@@ -48,6 +50,7 @@ import org.apache.opencmis.commons.provi
 import org.apache.opencmis.commons.provider.PropertiesData;
 import org.apache.opencmis.commons.provider.PropertyData;
 import org.apache.opencmis.commons.provider.PropertyIdData;
+import org.apache.opencmis.commons.provider.PropertyStringData;
 
 /**
  * Parser for Atom Entries.
@@ -58,6 +61,7 @@ import org.apache.opencmis.commons.provi
 public class AtomEntryParser {
 
   private final static String TAG_ENTRY = "entry";
+  private final static String TAG_TITLE = "title";
   private final static String TAG_OBJECT = "object";
   private final static String TAG_CONTENT = "content";
   private final static String TAG_BASE64 = "base64";
@@ -186,6 +190,8 @@ public class AtomEntryParser {
    * Parses an Atom entry.
    */
   private void parseEntry(XMLStreamReader parser) throws Exception {
+    String atomTitle = null;
+
     next(parser);
 
     // walk through all tags in entry
@@ -209,6 +215,9 @@ public class AtomEntryParser {
           if (TAG_CONTENT.equals(name.getLocalPart())) {
             parseAtomContent(parser);
           }
+          else if (TAG_TITLE.equals(name.getLocalPart())) {
+            atomTitle = readText(parser);
+          }
           else {
             skip(parser);
           }
@@ -226,6 +235,12 @@ public class AtomEntryParser {
         }
       }
     }
+
+    // overwrite cmis:name with Atom title
+    if ((fObject != null) && (fObject.getProperties() != null) && (atomTitle
!= null)) {
+      PropertyStringData nameProperty = new PropertyStringDataImpl(PropertyIds.CMIS_NAME,
atomTitle);
+      ((PropertiesDataImpl) fObject.getProperties()).addProperty(nameProperty);
+    }
   }
 
   /**

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java?rev=925796&r1=925795&r2=925796&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
Sun Mar 21 15:26:07 2010
@@ -25,7 +25,10 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
 import org.apache.commons.codec.binary.Base64;
+import org.apache.opencmis.commons.PropertyIds;
 import org.apache.opencmis.commons.provider.ContentStreamData;
+import org.apache.opencmis.commons.provider.PropertyData;
+import org.apache.opencmis.commons.provider.PropertyStringData;
 import org.apache.opencmis.server.impl.atompub.AtomEntryParser;
 import org.junit.Test;
 
@@ -38,138 +41,155 @@ import org.junit.Test;
 public class AtomEntryParserTest {
 
   private static final String CMIS_ENTRY_CONTENT = "This is my content!";
-  private static final String CMIS_ENTRY = "<?xml version='1.0' encoding='utf-8'?>"
+
-    "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">" +
-    "<atom:author><atom:name>test</atom:name></atom:author>" +
-    "<atom:id>http://test/id</atom:id>" +
-    "<atom:published>2009-12-31T12:53:37Z</atom:published>" +
-    "<atom:title>test.txt</atom:title>" +
-    "<atom:updated>2010-01-01T00:00:00Z</atom:updated>" +
-    "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+
-    "  <cmis:properties>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">" +
-    "      <cmis:value>id</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">" +
-    "      <cmis:value>test.txt</cmis:value>" +
-    "    </cmis:propertyString>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">" +
-    "      <cmis:value>cmis:document</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "  </cmis:properties>" +
-    "</cmisra:object>" +
-    "<cmisra:content>" +
-    "  <cmisra:mediatype>text/plain</cmisra:mediatype>" +
-    "  <cmisra:base64>" + Base64.encodeBase64String(CMIS_ENTRY_CONTENT.getBytes())+
"</cmisra:base64>" +
-    "</cmisra:content>" +
-    "</atom:entry>";
+  private static final String CMIS_ENTRY = "<?xml version='1.0' encoding='utf-8'?>"
+      + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">"
+      + "<atom:author><atom:name>test</atom:name></atom:author>"
+      + "<atom:id>http://test/id</atom:id>"
+      + "<atom:published>2009-12-31T12:53:37Z</atom:published>"
+      + "<atom:title>test.txt</atom:title>"
+      + "<atom:updated>2010-01-01T00:00:00Z</atom:updated>"
+      + "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+      + "  <cmis:properties>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">"
+      + "      <cmis:value>id</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">"
+      + "      <cmis:value>test.txt</cmis:value>"
+      + "    </cmis:propertyString>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">"
+      + "      <cmis:value>cmis:document</cmis:value>" + "    </cmis:propertyId>"
+      + "  </cmis:properties>" + "</cmisra:object>"
+      + "<cmisra:content>"
+      + "  <cmisra:mediatype>text/plain</cmisra:mediatype>"
+      + "  <cmisra:base64>"
+      + Base64.encodeBase64String(CMIS_ENTRY_CONTENT.getBytes())
+      + "</cmisra:base64>"
+      + "</cmisra:content>" + "</atom:entry>";
 
-  
   private static final String ATOM_ENTRY_TEXT_CONTENT = "This is plain text!";
-  private static final String ATOM_ENTRY_TEXT = "<?xml version='1.0' encoding='utf-8'?>"
+
-    "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">" +
-    "<atom:author><atom:name>test</atom:name></atom:author>" +
-    "<atom:id>http://test/id</atom:id>" +
-    "<atom:published>2009-12-31T12:53:37Z</atom:published>" +
-    "<atom:title>test.txt</atom:title>" +
-    "<atom:updated>2010-01-01T00:00:00Z</atom:updated>" +
-    "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+
-    "  <cmis:properties>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">" +
-    "      <cmis:value>id</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">" +
-    "      <cmis:value>test.txt</cmis:value>" +
-    "    </cmis:propertyString>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">" +
-    "      <cmis:value>cmis:document</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "  </cmis:properties>" +
-    "</cmisra:object>" +
-    "<atom:content type=\"text\">" +
-    ATOM_ENTRY_TEXT_CONTENT +
-    "</atom:content>" +
-    "</atom:entry>";
-  
+  private static final String ATOM_ENTRY_TEXT = "<?xml version='1.0' encoding='utf-8'?>"
+      + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">"
+      + "<atom:author><atom:name>test</atom:name></atom:author>"
+      + "<atom:id>http://test/id</atom:id>"
+      + "<atom:published>2009-12-31T12:53:37Z</atom:published>"
+      + "<atom:title>test.txt</atom:title>"
+      + "<atom:updated>2010-01-01T00:00:00Z</atom:updated>"
+      + "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+      + "  <cmis:properties>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">"
+      + "      <cmis:value>id</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">"
+      + "      <cmis:value>test.txt</cmis:value>"
+      + "    </cmis:propertyString>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">"
+      + "      <cmis:value>cmis:document</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "  </cmis:properties>"
+      + "</cmisra:object>"
+      + "<atom:content type=\"text\">"
+      + ATOM_ENTRY_TEXT_CONTENT
+      + "</atom:content>"
+      + "</atom:entry>";
+
   private static final String ATOM_ENTRY_XML_CONTENT = "<first xmlns=\"http://test/1\"><second
myattr=\"Cool, a value!\">hey, this is text</second><myns:third xmlns:myns=\"http://test/2\">guess
what's here ... more text</myns:third></first>";
-  private static final String ATOM_ENTRY_XML = "<?xml version='1.0' encoding='utf-8'?>"
+
-    "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">" +
-    "<atom:author><atom:name>test</atom:name></atom:author>" +
-    "<atom:id>http://test/id</atom:id>" +
-    "<atom:published>2009-12-31T12:53:37Z</atom:published>" +
-    "<atom:title>test.txt</atom:title>" +
-    "<atom:updated>2010-01-01T00:00:00Z</atom:updated>" +
-    "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+
-    "  <cmis:properties>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">" +
-    "      <cmis:value>id</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">" +
-    "      <cmis:value>test.txt</cmis:value>" +
-    "    </cmis:propertyString>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">" +
-    "      <cmis:value>cmis:document</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "  </cmis:properties>" +
-    "</cmisra:object>" +
-    "<atom:content type=\"text/xml\">" +
-    ATOM_ENTRY_XML_CONTENT +
-    "</atom:content>" +
-    "</atom:entry>";
-  
+  private static final String ATOM_ENTRY_XML = "<?xml version='1.0' encoding='utf-8'?>"
+      + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">"
+      + "<atom:author><atom:name>test</atom:name></atom:author>"
+      + "<atom:id>http://test/id</atom:id>"
+      + "<atom:published>2009-12-31T12:53:37Z</atom:published>"
+      + "<atom:title>test.txt</atom:title>"
+      + "<atom:updated>2010-01-01T00:00:00Z</atom:updated>"
+      + "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+      + "  <cmis:properties>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">"
+      + "      <cmis:value>id</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">"
+      + "      <cmis:value>test.txt</cmis:value>"
+      + "    </cmis:propertyString>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">"
+      + "      <cmis:value>cmis:document</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "  </cmis:properties>" + "</cmisra:object>"
+      + "<atom:content type=\"text/xml\">"
+      + ATOM_ENTRY_XML_CONTENT
+      + "</atom:content>"
+      + "</atom:entry>";
+
   private static final String ATOM_ENTRY_XHTML_CONTENT = "<div xmlns=\"http://www.w3.org/1999/xhtml\">This
is <b>XHTML</b> content.</div>";
-  private static final String ATOM_ENTRY_XHTML = "<?xml version='1.0' encoding='utf-8'?>"
+
-    "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">" +
-    "<atom:author><atom:name>test</atom:name></atom:author>" +
-    "<atom:id>http://test/id</atom:id>" +
-    "<atom:published>2009-12-31T12:53:37Z</atom:published>" +
-    "<atom:title>test.txt</atom:title>" +
-    "<atom:updated>2010-01-01T00:00:00Z</atom:updated>" +
-    "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+
-    "  <cmis:properties>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">" +
-    "      <cmis:value>id</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">" +
-    "      <cmis:value>test.txt</cmis:value>" +
-    "    </cmis:propertyString>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">" +
-    "      <cmis:value>cmis:document</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "  </cmis:properties>" +
-    "</cmisra:object>" +
-    "<atom:content type=\"xhtml\">" +
-    ATOM_ENTRY_XHTML_CONTENT +
-    "</atom:content>" +
-    "</atom:entry>";
-  
+  private static final String ATOM_ENTRY_XHTML = "<?xml version='1.0' encoding='utf-8'?>"
+      + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">"
+      + "<atom:author><atom:name>test</atom:name></atom:author>"
+      + "<atom:id>http://test/id</atom:id>"
+      + "<atom:published>2009-12-31T12:53:37Z</atom:published>"
+      + "<atom:title>test.txt</atom:title>"
+      + "<atom:updated>2010-01-01T00:00:00Z</atom:updated>"
+      + "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+      + "  <cmis:properties>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">"
+      + "      <cmis:value>id</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">"
+      + "      <cmis:value>test.txt</cmis:value>"
+      + "    </cmis:propertyString>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">"
+      + "      <cmis:value>cmis:document</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "  </cmis:properties>"
+      + "</cmisra:object>"
+      + "<atom:content type=\"xhtml\">"
+      + ATOM_ENTRY_XHTML_CONTENT
+      + "</atom:content>"
+      + "</atom:entry>";
+
   private static final String ATOM_ENTRY_BASE64_CONTENT = "This is another content!";
-  private static final String ATOM_ENTRY_BASE64 = "<?xml version='1.0' encoding='utf-8'?>"
+
-    "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">" +
-    "<atom:author><atom:name>test</atom:name></atom:author>" +
-    "<atom:id>http://test/id</atom:id>" +
-    "<atom:published>2009-12-31T12:53:37Z</atom:published>" +
-    "<atom:title>test.txt</atom:title>" +
-    "<atom:updated>2010-01-01T00:00:00Z</atom:updated>" +
-    "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+
-    "  <cmis:properties>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">" +
-    "      <cmis:value>id</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">" +
-    "      <cmis:value>test.txt</cmis:value>" +
-    "    </cmis:propertyString>" +
-    "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">" +
-    "      <cmis:value>cmis:document</cmis:value>" +
-    "    </cmis:propertyId>" +
-    "  </cmis:properties>" +
-    "</cmisra:object>" +
-    "<atom:content type=\"application/something\">" +
-    Base64.encodeBase64String(ATOM_ENTRY_BASE64_CONTENT.getBytes()) +
-    "</atom:content>" +
-    "</atom:entry>";
+  private static final String ATOM_ENTRY_BASE64 = "<?xml version='1.0' encoding='utf-8'?>"
+      + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">"
+      + "<atom:author><atom:name>test</atom:name></atom:author>"
+      + "<atom:id>http://test/id</atom:id>"
+      + "<atom:published>2009-12-31T12:53:37Z</atom:published>"
+      + "<atom:title>test.txt</atom:title>"
+      + "<atom:updated>2010-01-01T00:00:00Z</atom:updated>"
+      + "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+      + "  <cmis:properties>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">"
+      + "      <cmis:value>id</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">"
+      + "      <cmis:value>test.txt</cmis:value>"
+      + "    </cmis:propertyString>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">"
+      + "      <cmis:value>cmis:document</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "  </cmis:properties>"
+      + "</cmisra:object>"
+      + "<atom:content type=\"application/something\">"
+      + Base64.encodeBase64String(ATOM_ENTRY_BASE64_CONTENT.getBytes())
+      + "</atom:content>"
+      + "</atom:entry>";
+
+  private static final String ATOM_ENTRY_NAME = "<?xml version='1.0' encoding='utf-8'?>"
+      + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"
xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\">"
+      + "<atom:author><atom:name>test</atom:name></atom:author>"
+      + "<atom:id>http://test/id</atom:id>"
+      + "<atom:published>2009-12-31T12:53:37Z</atom:published>"
+      + "<atom:title>atom.title</atom:title>"
+      + "<atom:updated>2010-01-01T00:00:00Z</atom:updated>"
+      + "<cmisra:object xmlns:ns3=\"http://docs.oasis-open.org/ns/cmis/messaging/200908/\">"
+      + "  <cmis:properties>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectId\">"
+      + "      <cmis:value>id</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "    <cmis:propertyString propertyDefinitionId=\"cmis:name\">"
+      + "      <cmis:value>cmis.name</cmis:value>"
+      + "    </cmis:propertyString>"
+      + "    <cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">"
+      + "      <cmis:value>cmis:document</cmis:value>"
+      + "    </cmis:propertyId>"
+      + "  </cmis:properties>" + "</cmisra:object>"
+      + "</atom:entry>";
 
-  
   @Test
   public void testCmisContent() throws Exception {
     byte[] content = parse(CMIS_ENTRY.getBytes());
@@ -187,7 +207,7 @@ public class AtomEntryParserTest {
     byte[] content = parse(ATOM_ENTRY_XML.getBytes());
     String xmlContent = new String(content);
     assertTrue(xmlContent.indexOf('>') > -1);
-    assertEquals(ATOM_ENTRY_XML_CONTENT, xmlContent.substring(xmlContent.indexOf('>')+1));
+    assertEquals(ATOM_ENTRY_XML_CONTENT, xmlContent.substring(xmlContent.indexOf('>')
+ 1));
   }
 
   @Test
@@ -195,7 +215,7 @@ public class AtomEntryParserTest {
     byte[] content = parse(ATOM_ENTRY_XHTML.getBytes());
     String xmlContent = new String(content);
     assertTrue(xmlContent.indexOf('>') > -1);
-    assertEquals(ATOM_ENTRY_XHTML_CONTENT, xmlContent.substring(xmlContent.indexOf('>')+1));
+    assertEquals(ATOM_ENTRY_XHTML_CONTENT, xmlContent.substring(xmlContent.indexOf('>')
+ 1));
   }
 
   @Test
@@ -204,6 +224,21 @@ public class AtomEntryParserTest {
     assertEquals(ATOM_ENTRY_BASE64_CONTENT, new String(content));
   }
 
+  @Test
+  public void testAtomTitle() throws Exception {
+    AtomEntryParser aep = new AtomEntryParser(new ByteArrayInputStream(ATOM_ENTRY_NAME.getBytes()));
+
+    assertNotNull(aep.getObject());
+    assertNotNull(aep.getObject().getProperties());
+    assertNotNull(aep.getObject().getProperties().getProperties());
+    assertNotNull(aep.getObject().getProperties().getProperties().get(PropertyIds.CMIS_NAME)
instanceof PropertyStringData);
+
+    PropertyStringData nameProperty = (PropertyStringData) aep.getObject().getProperties()
+        .getProperties().get(PropertyIds.CMIS_NAME);
+
+    assertEquals("atom.title", nameProperty.getFirstValue());
+  }
+
   private byte[] parse(byte[] entry) throws Exception {
     AtomEntryParser aep = new AtomEntryParser(new ByteArrayInputStream(entry));
     ContentStreamData contentStream = aep.getContentStream();



Mime
View raw message