本文整理汇总了Java中org.alfresco.repo.content.filestore.FileContentStore.createNewFileStoreUrl方法的典型用法代码示例。如果您正苦于以下问题:Java FileContentStore.createNewFileStoreUrl方法的具体用法?Java FileContentStore.createNewFileStoreUrl怎么用?Java FileContentStore.createNewFileStoreUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.content.filestore.FileContentStore
的用法示例。
在下文中一共展示了FileContentStore.createNewFileStoreUrl方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMissingUrl
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
/**
* Checks that requests for missing content URLs are served.
*/
@Test
public void testMissingUrl()
{
String missingContentUrl = FileContentStore.createNewFileStoreUrl();
ContentReader reader = routingStore.getReader(missingContentUrl);
assertNotNull("Missing URL should not return null", reader);
assertFalse("Empty reader should say content doesn't exist.", reader.exists());
try
{
reader.getContentString();
fail("Empty reader cannot return content.");
}
catch (Throwable e)
{
// Expected
}
}
示例2: writeToCacheWithExistingReader
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
@Test
public void writeToCacheWithExistingReader()
{
ContentWriter oldWriter = store.getWriter(ContentContext.NULL_CONTEXT);
oldWriter.putContent("Old content for " + getClass().getSimpleName());
ContentReader existingReader = oldWriter.getReader();
// Write through the caching content store - cache during the process.
final String proposedUrl = FileContentStore.createNewFileStoreUrl();
ContentWriter writer = store.getWriter(new ContentContext(existingReader, proposedUrl));
final String content = makeContent();
writer.putContent(content);
assertEquals("Writer should have correct URL", proposedUrl, writer.getContentUrl());
assertFalse("Old and new writers must have different URLs",
oldWriter.getContentUrl().equals(writer.getContentUrl()));
ContentReader reader = store.getReader(writer.getContentUrl());
assertEquals("Reader and writer should have same URLs", writer.getContentUrl(), reader.getContentUrl());
assertEquals("Reader should get correct content", content, reader.getContentString());
}
示例3: loadData
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
private void loadData(final int maxCount)
{
final MutableInt doneCount = new MutableInt(0);
// Batches of 1000 objects
RetryingTransactionCallback<Integer> makeNodesCallback = new RetryingTransactionCallback<Integer>()
{
public Integer execute() throws Throwable
{
for (int i = 0; i < 1000; i++)
{
// We don't need to write anything
String contentUrl = FileContentStore.createNewFileStoreUrl();
ContentData contentData = new ContentData(contentUrl, MimetypeMap.MIMETYPE_TEXT_PLAIN, 10, "UTF-8");
nodeHelper.makeNode(contentData);
int count = doneCount.intValue();
count++;
doneCount.setValue(count);
// Do some reporting
if (count % 1000 == 0)
{
System.out.println(String.format(" " + (new Date()) + "Total created: %6d", count));
}
// Double check for shutdown
if (vmShutdownListener.isVmShuttingDown())
{
break;
}
}
return maxCount;
}
};
int repetitions = (int) Math.floor((double)maxCount / 1000.0);
for (int i = 0; i < repetitions; i++)
{
transactionService.getRetryingTransactionHelper().doInTransaction(makeNodesCallback);
}
}
示例4: testCacheOnInbound
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
public void testCacheOnInbound()
{
store = new CachingContentStore(backingStore, cache, true);
final String content = "Content for " + getName() + " test.";
final String contentUrl = FileContentStore.createNewFileStoreUrl();
assertFalse("Content shouldn't be cached yet", cache.contains(contentUrl));
// Write some content using the caching store
ContentWriter writer = store.getWriter(new ContentContext(null, contentUrl));
writer.putContent(content);
assertTrue("Cache should contain content after write", cache.contains(contentUrl));
// Check DIRECTLY with the cache, since a getReader() from the CachingContentStore would result
// in caching, but we're checking that caching was caused by the write operation.
String retrievedContent = cache.getReader(contentUrl).getContentString();
assertEquals(content, retrievedContent);
// The content should have been written through to the backing store.
String fromBackingStore = backingStore.getReader(contentUrl).getContentString();
assertEquals("Content should be in backing store", content, fromBackingStore);
// Remove the original content from the backing store.
backingStore.delete(contentUrl);
assertFalse("Original content should have been deleted", backingStore.exists(contentUrl));
// The cached version is still available
String contentAfterDelete = store.getReader(contentUrl).getContentString();
assertEquals(content, contentAfterDelete);
}
示例5: testQuotaOnOverlimitCacheFile
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
public void testQuotaOnOverlimitCacheFile()
{
store = new CachingContentStore(backingStore, cache, true);
final int overLimitSize = 1;
QuotaManagerStrategy quota = mock(QuotaManagerStrategy.class);
store.setQuota(quota);
when(quota.beforeWritingCacheFile(0)).thenReturn(true);
when(quota.afterWritingCacheFile(overLimitSize)).thenReturn(false);
char[] chars = new char[overLimitSize];
// Optional step - unnecessary if you're happy with the array being full of \0
Arrays.fill(chars, 'f');
final String content = new String(chars);
final String contentUrl = FileContentStore.createNewFileStoreUrl();
assertFalse("Content shouldn't be cached yet", cache.contains(contentUrl));
// Write some content using the caching store
ContentWriter writer = store.getWriter(new ContentContext(null, contentUrl));
writer.putContent(content);
assertFalse("Overlimit content should be deleted from cache", cache.contains(contentUrl));
assertFalse("Overlimit content should be deleted from cache", writer.getReader().exists());
// The content should have been written through to the backing store.
String fromBackingStore = backingStore.getReader(contentUrl).getContentString();
assertEquals("Content should be in backing store", content, fromBackingStore);
assertEquals("Content should be in backing store", overLimitSize, fromBackingStore.length());
// cache writer should still return actual size
// so that listeners could be executed correctly
assertEquals("Cache writer should still return actual size", overLimitSize, writer.getSize());
assertEquals("Cache writer should still return actual size", overLimitSize, writer.getContentData().getSize());
}
示例6: writeToCacheWithContentContext
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
@Test
public void writeToCacheWithContentContext()
{
// Write through the caching content store - cache during the process.
final String proposedUrl = FileContentStore.createNewFileStoreUrl();
ContentWriter writer = store.getWriter(new ContentContext(null, proposedUrl));
final String content = makeContent();
writer.putContent(content);
assertEquals("Writer should have correct URL", proposedUrl, writer.getContentUrl());
ContentReader reader = store.getReader(writer.getContentUrl());
assertEquals("Reader and writer should have same URLs", writer.getContentUrl(), reader.getContentUrl());
assertEquals("Reader should get correct content", content, reader.getContentString());
}
示例7: getWriterInternal
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
@Override
protected ContentWriter getWriterInternal(ContentReader existingContentReader, String newContentUrl)
{
if (newContentUrl == null)
newContentUrl = FileContentStore.createNewFileStoreUrl() + ".slow";
return new SlowWriter(newContentUrl, existingContentReader);
}
示例8: getUrls
import org.alfresco.repo.content.filestore.FileContentStore; //导入方法依赖的package包/类
@Override
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
{
// Make up it up
for (int i = 0; i < count; i++)
{
String contentUrl = FileContentStore.createNewFileStoreUrl() + "-imaginary";
handler.handle(contentUrl);
}
}