mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merge 1.4 to HEAD
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4351 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4352 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4353 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4354 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4354 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4362 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4657 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -329,11 +329,19 @@ public class RoutingContentService implements ContentService
|
||||
|
||||
public ContentWriter getWriter(NodeRef nodeRef, QName propertyQName, boolean update)
|
||||
{
|
||||
// TODO: Choose the store to write to at runtime
|
||||
|
||||
if (nodeRef == null)
|
||||
{
|
||||
// for this case, we just give back a valid URL into the content store
|
||||
ContentWriter writer = store.getWriter(null, null);
|
||||
// done
|
||||
return writer;
|
||||
}
|
||||
|
||||
// check for an existing URL - the get of the reader will perform type checking
|
||||
ContentReader existingContentReader = getReader(nodeRef, propertyQName, false);
|
||||
|
||||
// TODO: Choose the store to write to at runtime
|
||||
|
||||
// get the content using the (potentially) existing content - the new content
|
||||
// can be wherever the store decides.
|
||||
ContentWriter writer = store.getWriter(existingContentReader, null);
|
||||
|
@@ -153,6 +153,29 @@ public class RoutingContentServiceTest extends TestCase
|
||||
assertFalse(getUserTransaction() == getUserTransaction()); // ensure txn instances aren't shared
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that a valid writer into the content store can be retrieved and used.
|
||||
*/
|
||||
public void testSimpleNonTempWriter() throws Exception
|
||||
{
|
||||
ContentWriter writer = contentService.getWriter(null, null, false);
|
||||
assertNotNull("Writer should not be null", writer);
|
||||
assertNotNull("Content URL should not be null", writer.getContentUrl());
|
||||
|
||||
// write some content
|
||||
writer.putContent(SOME_CONTENT);
|
||||
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
writer.setEncoding("UTF8");
|
||||
|
||||
// set the content property manually
|
||||
nodeService.setProperty(contentNodeRef, ContentModel.PROP_CONTENT, writer.getContentData());
|
||||
|
||||
// get the reader
|
||||
ContentReader reader = contentService.getReader(contentNodeRef, ContentModel.PROP_CONTENT);
|
||||
assertNotNull("Reader should not be null", reader);
|
||||
assertNotNull("Content URL should not be null", reader.getContentUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the URL, mimetype and encoding are automatically set on the readers
|
||||
* and writers
|
||||
|
Reference in New Issue
Block a user