chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r936938 [7/29] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ chemistry-opencmis-server-bindings/src/main/java/org/apache/chemi...
Date Thu, 22 Apr 2010 16:28:00 GMT
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
Thu Apr 22 16:27:57 2010
@@ -52,126 +52,126 @@ import org.apache.chemistry.opencmis.ser
  */
 @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.VersioningServicePort")
 public class VersioningService extends AbstractService implements VersioningServicePort {
-	@Resource
-	WebServiceContext wsContext;
+    @Resource
+    WebServiceContext wsContext;
 
-	public void cancelCheckOut(String repositoryId, String objectId, Holder<CmisExtensionType>
extension)
-			throws CmisException {
-		try {
-			AbstractServicesFactory factory = getServicesFactory(wsContext);
-			CmisVersioningService service = factory.getVersioningService();
-			CallContext context = createContext(wsContext, repositoryId);
-
-			ExtensionsData extData = convertExtensionHolder(extension);
-
-			service.cancelCheckOut(context, repositoryId, objectId, extData);
-
-			setExtensionValues(extData, extension);
-		} catch (Exception e) {
-			throw convertException(e);
-		}
-	}
-
-	public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, CmisPropertiesType
properties,
-			CmisContentStreamType contentStream, String checkinComment, List<String> policies,
-			CmisAccessControlListType addAces, CmisAccessControlListType removeAces, Holder<CmisExtensionType>
extension)
-			throws CmisException {
-		try {
-			AbstractServicesFactory factory = getServicesFactory(wsContext);
-			CmisVersioningService service = factory.getVersioningService();
-			CallContext context = createContext(wsContext, repositoryId);
-
-			org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder = convertHolder(objectId);
-			ExtensionsData extData = convertExtensionHolder(extension);
-
-			service.checkIn(context, repositoryId, objectIdHolder, major, convert(properties), convert(contentStream),
-					checkinComment, policies, convert(addAces, null), convert(removeAces, null), extData,
null);
-
-			setHolderValue(objectIdHolder, objectId);
-			setExtensionValues(extData, extension);
-		} catch (Exception e) {
-			throw convertException(e);
-		}
-	}
-
-	public void checkOut(String repositoryId, Holder<String> objectId, Holder<CmisExtensionType>
extension,
-			Holder<Boolean> contentCopied) throws CmisException {
-		try {
-			AbstractServicesFactory factory = getServicesFactory(wsContext);
-			CmisVersioningService service = factory.getVersioningService();
-			CallContext context = createContext(wsContext, repositoryId);
-
-			org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder = convertHolder(objectId);
-			org.apache.chemistry.opencmis.commons.api.Holder<Boolean> contentCopiedHolder =
new org.apache.chemistry.opencmis.commons.api.Holder<Boolean>();
-			ExtensionsData extData = convertExtensionHolder(extension);
-
-			service.checkOut(context, repositoryId, objectIdHolder, extData, contentCopiedHolder,
null);
-
-			if (contentCopied != null) {
-				contentCopied.value = contentCopiedHolder.getValue();
-			}
-
-			setHolderValue(objectIdHolder, objectId);
-			setExtensionValues(extData, extension);
-		} catch (Exception e) {
-			throw convertException(e);
-		}
-	}
-
-	public List<CmisObjectType> getAllVersions(String repositoryId, String versionSeriesId,
String filter,
-			Boolean includeAllowableActions, CmisExtensionType extension) throws CmisException {
-		try {
-			AbstractServicesFactory factory = getServicesFactory(wsContext);
-			CmisVersioningService service = factory.getVersioningService();
-			CallContext context = createContext(wsContext, repositoryId);
-
-			List<ObjectData> versions = service.getAllVersions(context, repositoryId, versionSeriesId,
filter,
-					includeAllowableActions, convert(extension), null);
-
-			if (versions == null) {
-				return null;
-			}
-
-			List<CmisObjectType> result = new ArrayList<CmisObjectType>();
-			for (ObjectData object : versions) {
-				result.add(convert(object));
-			}
-
-			return result;
-		} catch (Exception e) {
-			throw convertException(e);
-		}
-	}
-
-	public CmisObjectType getObjectOfLatestVersion(String repositoryId, String versionSeriesId,
Boolean major,
-			String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, CmisExtensionType
extension)
-			throws CmisException {
-		try {
-			AbstractServicesFactory factory = getServicesFactory(wsContext);
-			CmisVersioningService service = factory.getVersioningService();
-			CallContext context = createContext(wsContext, repositoryId);
-
-			return convert(service.getObjectOfLatestVersion(context, repositoryId, versionSeriesId,
major, filter,
-					includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
-					renditionFilter, includePolicyIds, includeAcl, convert(extension), null));
-		} catch (Exception e) {
-			throw convertException(e);
-		}
-	}
-
-	public CmisPropertiesType getPropertiesOfLatestVersion(String repositoryId, String versionSeriesId,
Boolean major,
-			String filter, CmisExtensionType extension) throws CmisException {
-		try {
-			AbstractServicesFactory factory = getServicesFactory(wsContext);
-			CmisVersioningService service = factory.getVersioningService();
-			CallContext context = createContext(wsContext, repositoryId);
-
-			return convert(service.getPropertiesOfLatestVersion(context, repositoryId, versionSeriesId,
major, filter,
-					convert(extension)));
-		} catch (Exception e) {
-			throw convertException(e);
-		}
-	}
+    public void cancelCheckOut(String repositoryId, String objectId, Holder<CmisExtensionType>
extension)
+            throws CmisException {
+        try {
+            AbstractServicesFactory factory = getServicesFactory(wsContext);
+            CmisVersioningService service = factory.getVersioningService();
+            CallContext context = createContext(wsContext, repositoryId);
+
+            ExtensionsData extData = convertExtensionHolder(extension);
+
+            service.cancelCheckOut(context, repositoryId, objectId, extData);
+
+            setExtensionValues(extData, extension);
+        } catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    public void checkIn(String repositoryId, Holder<String> objectId, Boolean major,
CmisPropertiesType properties,
+            CmisContentStreamType contentStream, String checkinComment, List<String>
policies,
+            CmisAccessControlListType addAces, CmisAccessControlListType removeAces, Holder<CmisExtensionType>
extension)
+            throws CmisException {
+        try {
+            AbstractServicesFactory factory = getServicesFactory(wsContext);
+            CmisVersioningService service = factory.getVersioningService();
+            CallContext context = createContext(wsContext, repositoryId);
+
+            org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder
= convertHolder(objectId);
+            ExtensionsData extData = convertExtensionHolder(extension);
+
+            service.checkIn(context, repositoryId, objectIdHolder, major, convert(properties),
convert(contentStream),
+                    checkinComment, policies, convert(addAces, null), convert(removeAces,
null), extData, null);
+
+            setHolderValue(objectIdHolder, objectId);
+            setExtensionValues(extData, extension);
+        } catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    public void checkOut(String repositoryId, Holder<String> objectId, Holder<CmisExtensionType>
extension,
+            Holder<Boolean> contentCopied) throws CmisException {
+        try {
+            AbstractServicesFactory factory = getServicesFactory(wsContext);
+            CmisVersioningService service = factory.getVersioningService();
+            CallContext context = createContext(wsContext, repositoryId);
+
+            org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder
= convertHolder(objectId);
+            org.apache.chemistry.opencmis.commons.api.Holder<Boolean> contentCopiedHolder
= new org.apache.chemistry.opencmis.commons.api.Holder<Boolean>();
+            ExtensionsData extData = convertExtensionHolder(extension);
+
+            service.checkOut(context, repositoryId, objectIdHolder, extData, contentCopiedHolder,
null);
+
+            if (contentCopied != null) {
+                contentCopied.value = contentCopiedHolder.getValue();
+            }
+
+            setHolderValue(objectIdHolder, objectId);
+            setExtensionValues(extData, extension);
+        } catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    public List<CmisObjectType> getAllVersions(String repositoryId, String versionSeriesId,
String filter,
+            Boolean includeAllowableActions, CmisExtensionType extension) throws CmisException
{
+        try {
+            AbstractServicesFactory factory = getServicesFactory(wsContext);
+            CmisVersioningService service = factory.getVersioningService();
+            CallContext context = createContext(wsContext, repositoryId);
+
+            List<ObjectData> versions = service.getAllVersions(context, repositoryId,
versionSeriesId, filter,
+                    includeAllowableActions, convert(extension), null);
+
+            if (versions == null) {
+                return null;
+            }
+
+            List<CmisObjectType> result = new ArrayList<CmisObjectType>();
+            for (ObjectData object : versions) {
+                result.add(convert(object));
+            }
+
+            return result;
+        } catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    public CmisObjectType getObjectOfLatestVersion(String repositoryId, String versionSeriesId,
Boolean major,
+            String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, CmisExtensionType
extension)
+            throws CmisException {
+        try {
+            AbstractServicesFactory factory = getServicesFactory(wsContext);
+            CmisVersioningService service = factory.getVersioningService();
+            CallContext context = createContext(wsContext, repositoryId);
+
+            return convert(service.getObjectOfLatestVersion(context, repositoryId, versionSeriesId,
major, filter,
+                    includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+                    renditionFilter, includePolicyIds, includeAcl, convert(extension), null));
+        } catch (Exception e) {
+            throw convertException(e);
+        }
+    }
+
+    public CmisPropertiesType getPropertiesOfLatestVersion(String repositoryId, String versionSeriesId,
Boolean major,
+            String filter, CmisExtensionType extension) throws CmisException {
+        try {
+            AbstractServicesFactory factory = getServicesFactory(wsContext);
+            CmisVersioningService service = factory.getVersioningService();
+            CallContext context = createContext(wsContext, repositoryId);
+
+            return convert(service.getPropertiesOfLatestVersion(context, repositoryId, versionSeriesId,
major, filter,
+                    convert(extension)));
+        } catch (Exception e) {
+            throw convertException(e);
+        }
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java
Thu Apr 22 16:27:57 2010
@@ -40,166 +40,166 @@ 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 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_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_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_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_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());
-		assertEquals(CMIS_ENTRY_CONTENT, new String(content));
-	}
-
-	@Test
-	public void testAtomContentText() throws Exception {
-		byte[] content = parse(ATOM_ENTRY_TEXT.getBytes());
-		assertEquals(ATOM_ENTRY_TEXT_CONTENT, new String(content));
-	}
-
-	@Test
-	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));
-	}
-
-	@Test
-	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));
-	}
-
-	@Test
-	public void testAtomContentBase64() throws Exception {
-		byte[] content = parse(ATOM_ENTRY_BASE64.getBytes());
-		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.NAME) instanceof
PropertyString);
-
-		PropertyString nameProperty = (PropertyString) aep.getObject().getProperties().getProperties().get(
-				PropertyIds.NAME);
-
-		assertEquals("atom.title", nameProperty.getFirstValue());
-	}
-
-	private byte[] parse(byte[] entry) throws Exception {
-		AtomEntryParser aep = new AtomEntryParser(new ByteArrayInputStream(entry));
-		ContentStream contentStream = aep.getContentStream();
-
-		assertNotNull(contentStream);
-		assertNotNull(contentStream.getStream());
-
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-		byte[] buffer = new byte[4096];
-		int b;
-
-		while ((b = contentStream.getStream().read(buffer)) > -1) {
-			baos.write(buffer, 0, b);
-		}
+    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 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_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_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_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_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());
+        assertEquals(CMIS_ENTRY_CONTENT, new String(content));
+    }
+
+    @Test
+    public void testAtomContentText() throws Exception {
+        byte[] content = parse(ATOM_ENTRY_TEXT.getBytes());
+        assertEquals(ATOM_ENTRY_TEXT_CONTENT, new String(content));
+    }
+
+    @Test
+    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));
+    }
+
+    @Test
+    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));
+    }
+
+    @Test
+    public void testAtomContentBase64() throws Exception {
+        byte[] content = parse(ATOM_ENTRY_BASE64.getBytes());
+        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.NAME)
instanceof PropertyString);
+
+        PropertyString nameProperty = (PropertyString) aep.getObject().getProperties().getProperties().get(
+                PropertyIds.NAME);
+
+        assertEquals("atom.title", nameProperty.getFirstValue());
+    }
+
+    private byte[] parse(byte[] entry) throws Exception {
+        AtomEntryParser aep = new AtomEntryParser(new ByteArrayInputStream(entry));
+        ContentStream contentStream = aep.getContentStream();
+
+        assertNotNull(contentStream);
+        assertNotNull(contentStream.getStream());
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        byte[] buffer = new byte[4096];
+        int b;
+
+        while ((b = contentStream.getStream().read(buffer)) > -1) {
+            baos.write(buffer, 0, b);
+        }
 
-		return baos.toByteArray();
-	}
+        return baos.toByteArray();
+    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/AclService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/AclService.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/AclService.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/AclService.java
Thu Apr 22 16:27:57 2010
@@ -33,57 +33,57 @@ import org.apache.chemistry.opencmis.ser
  */
 public class AclService implements CmisAclService {
 
-	private RepositoryMap fRepositoryMap;
+    private RepositoryMap fRepositoryMap;
 
-	/**
-	 * Constructor.
-	 */
-	public AclService(RepositoryMap repositoryMap) {
-		fRepositoryMap = repositoryMap;
-	}
+    /**
+     * Constructor.
+     */
+    public AclService(RepositoryMap repositoryMap) {
+        fRepositoryMap = repositoryMap;
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.apache.opencmis.server.spi.CmisAclService#applyAcl(org.apache.opencmis
-	 * .server.spi.CallContext , java.lang.String, java.lang.String,
-	 * org.apache.opencmis.commons.provider.AccessControlList,
-	 * org.apache.opencmis.commons.enums.AclPropagation)
-	 */
-	public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces,
-			AclPropagation aclPropagation) {
-		fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
-		throw new CmisNotSupportedException("applyAcl not supported!");
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.opencmis.server.spi.CmisAclService#applyAcl(org.apache.opencmis
+     * .server.spi.CallContext , java.lang.String, java.lang.String,
+     * org.apache.opencmis.commons.provider.AccessControlList,
+     * org.apache.opencmis.commons.enums.AclPropagation)
+     */
+    public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces,
+            AclPropagation aclPropagation) {
+        fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+        throw new CmisNotSupportedException("applyAcl not supported!");
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.apache.opencmis.server.spi.CmisAclService#applyAcl(org.apache.opencmis
-	 * .server.spi.CallContext , java.lang.String, java.lang.String,
-	 * org.apache.opencmis.commons.provider.AccessControlList,
-	 * org.apache.opencmis.commons.provider.AccessControlList,
-	 * org.apache.opencmis.commons.enums.AclPropagation,
-	 * org.apache.opencmis.commons.api.ExtensionsData)
-	 */
-	public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces,
Acl removeAces,
-			AclPropagation aclPropagation, ExtensionsData extension) {
-		fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
-		throw new CmisNotSupportedException("applyAcl not supported!");
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.opencmis.server.spi.CmisAclService#applyAcl(org.apache.opencmis
+     * .server.spi.CallContext , java.lang.String, java.lang.String,
+     * org.apache.opencmis.commons.provider.AccessControlList,
+     * org.apache.opencmis.commons.provider.AccessControlList,
+     * org.apache.opencmis.commons.enums.AclPropagation,
+     * org.apache.opencmis.commons.api.ExtensionsData)
+     */
+    public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces,
Acl removeAces,
+            AclPropagation aclPropagation, ExtensionsData extension) {
+        fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+        throw new CmisNotSupportedException("applyAcl not supported!");
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.apache.opencmis.server.spi.CmisAclService#getAcl(org.apache.opencmis
-	 * .server.spi.CallContext , java.lang.String, java.lang.String,
-	 * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData)
-	 */
-	public Acl getAcl(CallContext context, String repositoryId, String objectId, Boolean onlyBasicPermissions,
-			ExtensionsData extension) {
-		return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getAcl(context,
objectId);
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.opencmis.server.spi.CmisAclService#getAcl(org.apache.opencmis
+     * .server.spi.CallContext , java.lang.String, java.lang.String,
+     * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData)
+     */
+    public Acl getAcl(CallContext context, String repositoryId, String objectId, Boolean
onlyBasicPermissions,
+            ExtensionsData extension) {
+        return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getAcl(context,
objectId);
+    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/DocumentInfo.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/DocumentInfo.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/DocumentInfo.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/DocumentInfo.java
Thu Apr 22 16:27:57 2010
@@ -23,22 +23,22 @@ import org.apache.chemistry.opencmis.com
 
 public class DocumentInfo extends ObjectInfoImpl {
 
-	public DocumentInfo() {
-		setBaseType(BaseTypeId.CMIS_DOCUMENT);
-		setHasAcl(true);
-		setHasContent(true);
-		setHasParent(true);
-		setVersionSeriesId(null);
-		setIsCurrentVersion(true);
-		setRelationshipSourceIds(null);
-		setRelationshipTargetIds(null);
-		setRenditionInfos(null);
-		setSupportsDescendants(false);
-		setSupportsFolderTree(false);
-		setSupportsPolicies(false);
-		setSupportsRelationships(false);
-		setWorkingCopyId(null);
-		setWorkingCopyOriginalId(null);
-	}
+    public DocumentInfo() {
+        setBaseType(BaseTypeId.CMIS_DOCUMENT);
+        setHasAcl(true);
+        setHasContent(true);
+        setHasParent(true);
+        setVersionSeriesId(null);
+        setIsCurrentVersion(true);
+        setRelationshipSourceIds(null);
+        setRelationshipTargetIds(null);
+        setRenditionInfos(null);
+        setSupportsDescendants(false);
+        setSupportsFolderTree(false);
+        setSupportsPolicies(false);
+        setSupportsRelationships(false);
+        setWorkingCopyId(null);
+        setWorkingCopyOriginalId(null);
+    }
 
 }



Mime
View raw message