mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
MNT-16375 "CMISChangelog auditing enablement impacts CMIS connection if quantity records are excessive" remove unintentional checkin of test
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129456 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -3589,126 +3589,4 @@ public class CMISTest
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMNT16375() throws Exception
|
||||
{
|
||||
setupAudit();
|
||||
|
||||
AuthenticationUtil.pushAuthentication();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
withCmisService(new CmisServiceCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute(CmisService cmisService)
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
logger.info("time = " + (end - start) + "ms");
|
||||
|
||||
assertNotNull(repositories);
|
||||
assertTrue(repositories.size() > 0);
|
||||
|
||||
return null;
|
||||
}
|
||||
}, CmisVersion.CMIS_1_1);
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void populate() throws Exception
|
||||
{
|
||||
setupAudit();
|
||||
|
||||
final NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome();
|
||||
final int batchSize = 100;
|
||||
final int totalWork = 500000;
|
||||
|
||||
BatchProcessor.BatchProcessWorker<String> worker = new BatchProcessor.BatchProcessWorker<String>()
|
||||
{
|
||||
public String getIdentifier(String folder)
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
|
||||
public void beforeProcess() throws Throwable
|
||||
{
|
||||
AuthenticationUtil.pushAuthentication();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
|
||||
public void afterProcess() throws Throwable
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
|
||||
public void process(final String guid) throws Throwable
|
||||
{
|
||||
Map<String, Serializable> auditData = new HashMap<>();
|
||||
HashMap<String, Serializable> data = new HashMap<>();
|
||||
data.put("nodeRef", "workspace://SpacesStore/" + guid);
|
||||
data.put("objectId", guid);
|
||||
auditData.put("/CMISChangeLog/CREATED/result/value", data);
|
||||
auditDAO.createAuditEntry(2l, System.currentTimeMillis(), "admin", auditData);
|
||||
|
||||
// perform CREATED, UPDATED, SECURITY, DELETED CMIS change type actions
|
||||
// FileInfo folderInfo = fileFolderService.create(companyHomeNodeRef, folder, ContentModel.TYPE_FOLDER);
|
||||
// nodeService.setProperty(folderInfo.getNodeRef(), ContentModel.PROP_NAME, folder);
|
||||
// assertNotNull(folderInfo);
|
||||
//
|
||||
// String content = GUID.generate();
|
||||
// FileInfo document = fileFolderService.create(folderInfo.getNodeRef(), content, ContentModel.TYPE_CONTENT);
|
||||
// assertNotNull(document);
|
||||
// nodeService.setProperty(document.getNodeRef(), ContentModel.PROP_NAME, content);
|
||||
//
|
||||
// permissionService.setPermission(document.getNodeRef(), "SomeAuthority", PermissionService.EXECUTE_CONTENT, true);
|
||||
//
|
||||
// fileFolderService.delete(document.getNodeRef());
|
||||
// fileFolderService.delete(folderInfo.getNodeRef());
|
||||
}
|
||||
};
|
||||
|
||||
BatchProcessWorkProvider<String> provider = new BatchProcessWorkProvider<String>()
|
||||
{
|
||||
private int counter = 0;
|
||||
|
||||
@Override
|
||||
public int getTotalEstimatedWorkSize()
|
||||
{
|
||||
return totalWork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getNextWork()
|
||||
{
|
||||
if(counter < totalWork)
|
||||
{
|
||||
counter += batchSize;
|
||||
List<String> guids = new ArrayList<>(batchSize);
|
||||
for(int i = 0; i < batchSize; i++)
|
||||
{
|
||||
guids.add(GUID.generate());
|
||||
}
|
||||
|
||||
return guids;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
new BatchProcessor<String>(
|
||||
"CMISTest.createAuditEntries",
|
||||
transactionService.getRetryingTransactionHelper(),
|
||||
provider,
|
||||
4, batchSize,
|
||||
ctx,
|
||||
logger, 100).process(worker, true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user