Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed CMIS-164

git-svn-id: https://svn.apache.org/repos/asf/incubator/chemistry/trunk@925796 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 6a75b0843f8ee96be901a55360aa144c76ca317b 1 parent 8c64d0e
@fmui fmui authored
View
2  ...-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomDocumentBase.java
@@ -136,6 +136,7 @@ public void writeAuthor(String author) throws XMLStreamException {
* 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 void writeUpdated(GregorianCalendar updated) throws XMLStreamException {
* Writes an Atom updated tag.
*/
public void writeUpdated(long updated) throws XMLStreamException {
+ writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
}
View
1  ...pencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntry.java
@@ -65,6 +65,7 @@ public void startEntry(boolean isRoot) throws XMLStreamException {
writeNamespace(Constants.NAMESPACE_ATOM);
writeNamespace(Constants.NAMESPACE_CMIS);
writeNamespace(Constants.NAMESPACE_RESTATOM);
+ writeNamespace(Constants.NAMESPACE_APP);
}
}
View
15 ...s-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomEntryParser.java
@@ -41,6 +41,8 @@
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.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 @@
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 void parse(InputStream stream) throws Exception {
* 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 @@ else if (Constants.NAMESPACE_ATOM.equals(name.getNamespaceURI())) {
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 @@ else if (event == XMLStreamReader.END_ELEMENT) {
}
}
}
+
+ // 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);
+ }
}
/**
View
295 ...ncmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
@@ -25,7 +25,10 @@
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 @@
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 void testAtomContentXml() throws Exception {
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 void testAtomContentXHtml() throws Exception {
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 void testAtomContentBase64() throws Exception {
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();
Please sign in to comment.
Something went wrong with that request. Please try again.