You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2012/11/23 19:09:08 UTC
svn commit: r1413006 - in
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src:
main/java/org/apache/chemistry/opencmis/inmemory/server/
main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/
main/java/org...
Author: jens
Date: Fri Nov 23 18:09:05 2012
New Revision: 1413006
URL: http://svn.apache.org/viewvc?rev=1413006&view=rev
Log:
InMemory: More CMIS 1.1 implement appendContentStream
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/CmisServiceValidator.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java Fri Nov 23 18:09:05 2012
@@ -322,6 +322,11 @@ public class BaseServiceValidatorImpl im
return checkStandardParameters(repositoryId, objectId.getValue());
}
+ public StoredObject appendContentStream(CallContext context, String repositoryId, Holder<String> objectId,
+ ExtensionsData extension) {
+ return checkStandardParameters(repositoryId, objectId.getValue());
+ }
+
public StoredObject deleteContentStream(CallContext context, String repositoryId, Holder<String> objectId,
ExtensionsData extension) {
return checkStandardParameters(repositoryId, objectId.getValue());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java Fri Nov 23 18:09:05 2012
@@ -545,8 +545,10 @@ public class InMemoryObjectServiceImpl e
StoredObject so = validator.setContentStream(context, repositoryId, objectId, overwriteFlag, extension);
- if ( so.getChangeToken() != null && ( changeToken == null || !so.getChangeToken().equals( changeToken.getValue() ) ) )
- throw new CmisUpdateConflictException( "setContentStream failed, ChangeToken does not match." );
+ if (changeToken != null && changeToken.getValue() != null
+ && Long.valueOf(so.getChangeToken()) > Long.valueOf(changeToken.getValue())) {
+ throw new CmisUpdateConflictException("updateProperties failed: changeToken does not match");
+ }
if (!(so instanceof Document || so instanceof VersionedDocument || so instanceof DocumentVersion)) {
throw new CmisObjectNotFoundException("Id" + objectId
@@ -701,6 +703,47 @@ public class InMemoryObjectServiceImpl e
LOG.debug("stop updateProperties()");
}
+ // CMIS 1.1
+ public void appendContentStream(CallContext context, String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+ ContentStream contentStream, ExtensionsData extension) {
+
+ Content content;
+
+ LOG.debug("start appendContentStream()");
+ StoredObject so = validator.appendContentStream(context, repositoryId, objectId, extension);
+
+ if (changeToken != null && changeToken.getValue() != null
+ && Long.valueOf(so.getChangeToken()) > Long.valueOf(changeToken.getValue())) {
+ throw new CmisUpdateConflictException("updateProperties failed: changeToken does not match");
+ }
+
+ if (!(so instanceof Document || so instanceof VersionedDocument || so instanceof DocumentVersion)) {
+ throw new CmisObjectNotFoundException("Id" + objectId
+ + " does not refer to a document, but only documents can have content");
+ }
+
+ // validate content allowed
+ TypeDefinition typeDef = getTypeDefinition(repositoryId, so);
+ if (!(typeDef instanceof DocumentTypeDefinition))
+ throw new CmisInvalidArgumentException("Object does not refer to a document, can't set content");
+ TypeValidator.validateContentAllowed((DocumentTypeDefinition) typeDef , null != contentStream);
+
+ if (so instanceof Document) {
+ content = ((Document) so);
+ } else if (so instanceof DocumentVersion) {
+ // something that is versionable check the proper status of the
+ // object
+ String user = context.getUsername();
+ testHasProperCheckedOutStatus(so, user);
+ content = (DocumentVersion) so;
+ } else {
+ throw new IllegalArgumentException("Content cannot be set on this object (must be document or version)");
+ }
+
+ content.appendContent(contentStream);
+ }
+
+
// ///////////////////////////////////////////////////////
// private helper methods
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java Fri Nov 23 18:09:05 2012
@@ -313,6 +313,13 @@ public class InMemoryService extends Abs
this);
}
+ // CMIS 1.1
+ @Override
+ public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+ ContentStream contentStream, ExtensionsData extension) {
+ fObjSvc.appendContentStream(getCallContext(), repositoryId, objectId, changeToken, contentStream, extension);
+ }
+
// --- versioning service ---
@Override
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/CmisServiceValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/CmisServiceValidator.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/CmisServiceValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/CmisServiceValidator.java Fri Nov 23 18:09:05 2012
@@ -106,6 +106,9 @@ public interface CmisServiceValidator {
StoredObject setContentStream(CallContext context, String repositoryId, Holder<String> objectId,
Boolean overwriteFlag, ExtensionsData extension);
+
+ StoredObject appendContentStream(CallContext context, String repositoryId, Holder<String> objectId,
+ ExtensionsData extension);
StoredObject deleteContentStream(CallContext context, String repositoryId, Holder<String> objectId,
ExtensionsData extension);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java Fri Nov 23 18:09:05 2012
@@ -38,7 +38,7 @@ public interface Content {
ContentStream getContent(long offset, long length);
/**
- * Assign content do a document. Existing content gets overwritten. The
+ * Assign content to a document. Existing content gets overwritten. The
* document is not yet persisted in the new state.
*
* @param content
@@ -49,4 +49,12 @@ public interface Content {
*/
void setContent(ContentStream content, boolean mustPersist);
+ /**
+ * Append content to an existing content stream. The
+ * document is persisted in the new state.
+ *
+ * @param content
+ * content to be assigned to the document.
+ */
+ void appendContent(ContentStream content);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java Fri Nov 23 18:09:05 2012
@@ -61,6 +61,7 @@ public class ContentStreamDataImpl imple
public ContentStreamDataImpl(long maxAllowedContentSizeKB) {
sizeLimitKB = maxAllowedContentSizeKB;
+ fLength = 0;
}
public void setContent(InputStream in) throws IOException {
@@ -87,7 +88,37 @@ public class ContentStreamDataImpl imple
TOTAL_LENGTH += fLength;
LOG.debug("setting content stream, total no calls " + ++TOTAL_CALLS + ".");
LOG.debug("setting content stream, new size total " + (TOTAL_LENGTH / (1024 * 1024)) + "MB.");
-
+ }
+
+ public void appendContent(InputStream is) throws IOException {
+
+ if (null == is) {
+ return; // nothing to do
+ } else {
+ byte[] buffer = new byte[0xFFFF];
+ ByteArrayOutputStream contentStream = new ByteArrayOutputStream();
+
+ // first read existing stream
+ contentStream.write(fContent);
+ TOTAL_LENGTH -= fLength;
+
+ // then append new content
+ for (int len = 0; (len = is.read(buffer)) != -1;) {
+ contentStream.write(buffer, 0, len);
+ fLength += len;
+ if (sizeLimitKB > 0 && fLength > sizeLimitKB * 1024) {
+ throw new CmisInvalidArgumentException("Content size exceeds max. allowed size of " + sizeLimitKB
+ + "KB.");
+ }
+ }
+ fContent = contentStream.toByteArray();
+ fLength = contentStream.size();
+ contentStream.close();
+ is.close();
+ }
+ TOTAL_LENGTH += fLength;
+ LOG.debug("setting content stream, total no calls " + ++TOTAL_CALLS + ".");
+ LOG.debug("setting content stream, new size total " + (TOTAL_LENGTH / (1024 * 1024)) + "MB.");
}
public long getLength() {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Fri Nov 23 18:09:05 2012
@@ -18,10 +18,7 @@
*/
package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@@ -29,10 +26,10 @@ import java.util.Map;
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.data.RenditionData;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
@@ -96,6 +93,22 @@ public class DocumentImpl extends Abstra
}
}
}
+
+ public void appendContent(ContentStream content) {
+ if (null == content) {
+ return;
+ } if (null == fContent) {
+ setContent(content, true);
+ } else {
+ try {
+ fContent.appendContent(content.getStream());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new CmisStorageException("Failed to append content: IO Exception", e);
+ }
+ }
+ }
+
@Override
public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
@@ -311,5 +324,5 @@ public class DocumentImpl extends Abstra
private boolean isPlainText(String mimeType) {
return mimeType.equals("text/plain");
}
-
+
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Fri Nov 23 18:09:05 2012
@@ -28,6 +28,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.ContentStream;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
import org.apache.chemistry.opencmis.inmemory.ConfigurationSettings;
@@ -91,6 +92,21 @@ public class DocumentVersionImpl extends
}
}
+ public void appendContent(ContentStream content) {
+ if (null == content) {
+ return;
+ } if (null != fContent) {
+ setContent(content, true);
+ } else {
+ try {
+ fContent.appendContent(content.getStream());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new CmisStorageException("Failed to append content: IO Exception", e);
+ }
+ }
+ }
+
public void setCheckinComment(String comment) {
fComment = comment;
}
@@ -300,4 +316,5 @@ public class DocumentVersionImpl extends
return label;
}
+
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java Fri Nov 23 18:09:05 2012
@@ -286,9 +286,13 @@ public class AbstractServiceTest {
}
protected void verifyContentResult(ContentStream sd) {
+ verifyContentResult(sd, 32);
+ }
+
+ protected void verifyContentResult(ContentStream sd, int sizeInK) {
assertEquals("text/plain", sd.getMimeType());
assertEquals("data.txt", sd.getFileName());
- assertEquals(32 * 1024, sd.getBigLength().longValue());
+ assertEquals(sizeInK * 1024, sd.getBigLength().longValue());
byte[] ba = new byte[32];
InputStream is = sd.getStream();
int counter = 0;
@@ -303,7 +307,7 @@ public class AbstractServiceTest {
} catch (IOException e) {
fail("reading from content stream failed");
}
- assertEquals(1024, counter);
+ assertEquals(sizeInK * 1024 / 32, counter);
}
protected String getByPath(String id, String path) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1413006&r1=1413005&r2=1413006&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Fri Nov 23 18:09:05 2012
@@ -183,7 +183,7 @@ public class ObjectServiceTest extends A
}
try {
- createDocumentNoCatch("/(%#$�", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
+ createDocumentNoCatch("/(%#$���", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
fail("Document creation with ilegal name should fail.");
} catch (Exception e) {
assertTrue(e instanceof CmisInvalidArgumentException);
@@ -215,7 +215,7 @@ public class ObjectServiceTest extends A
}
try {
- createFolderNoCatch("/(%#$�", fRootFolderId, FOLDER_TYPE_ID);
+ createFolderNoCatch("/(%#$���", fRootFolderId, FOLDER_TYPE_ID);
fail("Folder creation with ilegal name should fail.");
} catch (Exception e) {
assertTrue(e instanceof CmisInvalidArgumentException);
@@ -910,10 +910,10 @@ public class ObjectServiceTest extends A
log.info("starting testGetObjectByPath() with specal chars...");
log.info(" creating object");
- String docID = createDocument("Hänschen", fRootFolderId, false);
+ String docID = createDocument("H��nschen", fRootFolderId, false);
log.info(" getting object by path with special chars");
try {
- ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/Hänschen", "*", false, IncludeRelationships.NONE, null, false,
+ ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/H��nschen", "*", false, IncludeRelationships.NONE, null, false,
false, null);
assertNotNull(res);
assertNotNull(res.getId());
@@ -1084,6 +1084,29 @@ public class ObjectServiceTest extends A
log.info("... testFolderRendition finished.");
}
+
+ @Test
+ public void testAppendContent() {
+ log.info("starting testAppendContent() ...");
+ String id = createDocument(fRootFolderId, true);
+ if (id != null) {
+ log.info("createDocument succeeded with created id: " + id);
+ }
+
+ // append content again in a second call
+ Holder<String> idHolder = new Holder<String>(id);
+
+ ContentStream contentStream = createContent();
+ fObjSvc.appendContentStream(fRepositoryId, idHolder, null, contentStream, null);
+ ContentStream sd = fObjSvc.getContentStream(fRepositoryId, id, null, null, null, null);
+ verifyContentResult(sd, 64);
+
+ // cleanup
+ fObjSvc.deleteObject(fRepositoryId, id, true, null);
+
+ log.info("... testAppendContent() finished.");
+ }
+
protected String createDocumentFromStream(String name, String folderId, String typeId, InputStream is,
String contentType) throws IOException {