mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126482 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 122590 jkaabimofrad: RA-841: Fixed the status code for the large file upload. Also, added a new exception with 507 status code to be thrown, when "ContentQuotaException" occurs. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126826 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.ForumModel;
|
||||
import org.alfresco.repo.content.ContentLimitProvider.SimpleFixedLimitProvider;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
@@ -867,6 +868,26 @@ public class NodeApiTest extends AbstractBaseApiTest
|
||||
.build();
|
||||
post(getChildrenUrl(user1Home.getId()), user1, reqBody.getBody(), null, reqBody.getContentType(), 400);
|
||||
|
||||
// Test content size limit
|
||||
final SimpleFixedLimitProvider limitProvider = applicationContext.getBean("defaultContentLimitProvider", SimpleFixedLimitProvider.class);
|
||||
final long defaultSizeLimit = limitProvider.getSizeLimit();
|
||||
limitProvider.setSizeLimitString("20000"); //20 KB
|
||||
|
||||
try
|
||||
{
|
||||
// quick.pdf size is about 23 KB
|
||||
reqBody = MultiPartBuilder.create()
|
||||
.setFileData(new FileData(fileName, file, MimetypeMap.MIMETYPE_PDF))
|
||||
.setAutoRename(true)
|
||||
.build();
|
||||
|
||||
// Try to upload a file larger than the configured size limit
|
||||
post(getChildrenUrl(Nodes.PATH_MY), user1, reqBody.getBody(), null, reqBody.getContentType(), 413);
|
||||
}
|
||||
finally
|
||||
{
|
||||
limitProvider.setSizeLimitString(Long.toString(defaultSizeLimit));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user