mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
63067: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 62765: MNT-10611: Merged DEV to V4.2-BUG-FIX (4.2.2) 62735: MNT-10611: Exception generated in .AccessAuditor. when audited String values bigger than 1024 characters (non-MySQL) - Trim String and MLtext audit values to not exceed system.maximumStringLength. Add unit test for case. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64255 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
@@ -42,6 +43,7 @@ import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
||||
import org.alfresco.service.cmr.repository.MLText;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -785,6 +787,43 @@ public class AuditComponentTest extends TestCase
|
||||
assertTrue("There should be exactly one audit entry for the API test", success);
|
||||
}
|
||||
|
||||
public void testAuditOverlimitProperties() throws Exception
|
||||
{
|
||||
final int OVERLIMIT_SIZE = 1500;
|
||||
final RetryingTransactionCallback<Void> testCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < OVERLIMIT_SIZE; i++)
|
||||
{
|
||||
sb.append("a");
|
||||
}
|
||||
|
||||
MLText mlTextValue = new MLText();
|
||||
mlTextValue.put(Locale.ENGLISH, sb.toString());
|
||||
|
||||
Map<String, Serializable> values = new HashMap<String, Serializable>(13);
|
||||
values.put("/3.1/4.1", sb.toString());
|
||||
values.put("/3.1/4.2", mlTextValue);
|
||||
|
||||
auditComponent.recordAuditValues("/test/one.one/two.one", values);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
RunAsWork<Void> testRunAs = new RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
return transactionService.getRetryingTransactionHelper().doInTransaction(testCallback);
|
||||
}
|
||||
};
|
||||
AuthenticationUtil.runAs(testRunAs, "SomeOtherUser");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clearn the audit log as 'admin'
|
||||
*/
|
||||
|
Reference in New Issue
Block a user