Added a raw download servlet at URL http://.../alfresco/dr?contentUrl=...?ticket=...

Added ContentService.getRawReader to get content directly using a content URL.  To access this, you need to be admin.
Fixed EHCacheAdapter to handle non-Serializable values.
Added tests for above and for AbstractRoutingContentStore.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5841 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-06-04 14:44:29 +00:00
parent c2b6a11cd7
commit 6ff0696bf9
14 changed files with 371 additions and 22 deletions

View File

@@ -102,7 +102,8 @@ public abstract class AbstractContentReadWriteTest extends TestCase
*/
protected final ContentWriter getWriter()
{
return getStore().getWriter(null, contentUrl);
ContentContext contentCtx = new ContentContext(null, contentUrl);
return getStore().getWriter(contentCtx);
}
/**
@@ -187,7 +188,8 @@ public abstract class AbstractContentReadWriteTest extends TestCase
assertFalse("Reader exists failure", reader.exists());
// write something
ContentWriter writer = store.getWriter(null, contentUrl);
ContentContext contentContext = new ContentContext(null, contentUrl);
ContentWriter writer = store.getWriter(contentContext);
writer.putContent("ABC");
assertTrue("Store exists should show URL to be present", store.exists(contentUrl));
@@ -298,10 +300,11 @@ public abstract class AbstractContentReadWriteTest extends TestCase
String contentUrl = AbstractContentStore.createNewUrl();
ContentStore store = getStore();
ContentWriter firstWriter = store.getWriter(null, contentUrl);
ContentContext contentCtx = new ContentContext(null, contentUrl);
ContentWriter firstWriter = store.getWriter(contentCtx);
try
{
ContentWriter secondWriter = store.getWriter(null, contentUrl);
ContentWriter secondWriter = store.getWriter(contentCtx);
fail("Store issued two writers for the same URL: " + store);
}
catch (ContentIOException e)
@@ -620,7 +623,8 @@ public abstract class AbstractContentReadWriteTest extends TestCase
}
// get a new writer from the store, using the existing content and perform a truncation check
ContentWriter writerTruncate = getStore().getWriter(writer.getReader(), AbstractContentStore.createNewUrl());
ContentContext writerTruncateCtx = new ContentContext(writer.getReader(), AbstractContentStore.createNewUrl());
ContentWriter writerTruncate = getStore().getWriter(writerTruncateCtx);
assertEquals("Content size incorrect", 0, writerTruncate.getSize());
// get the channel with truncation
FileChannel fcTruncate = writerTruncate.getFileChannel(true);
@@ -628,7 +632,8 @@ public abstract class AbstractContentReadWriteTest extends TestCase
assertEquals("Content not truncated", 0, writerTruncate.getSize());
// get a new writer from the store, using the existing content and perform a non-truncation check
ContentWriter writerNoTruncate = getStore().getWriter(writer.getReader(), AbstractContentStore.createNewUrl());
ContentContext writerNoTruncateCtx = new ContentContext(writer.getReader(), AbstractContentStore.createNewUrl());
ContentWriter writerNoTruncate = getStore().getWriter(writerNoTruncateCtx);
assertEquals("Content size incorrect", 0, writerNoTruncate.getSize());
// get the channel without truncation
FileChannel fcNoTruncate = writerNoTruncate.getFileChannel(false);