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)
64787: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (4.3/Cloud) 64256: MNT-10767: Guard in AuditMethodInterceptor is too restrictive preventing subordinate service calls from producing data. - Fix unit test failing. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@66190 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,6 +35,9 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.repo.audit.model.AuditApplication;
|
import org.alfresco.repo.audit.model.AuditApplication;
|
||||||
import org.alfresco.repo.audit.model.AuditModelException;
|
import org.alfresco.repo.audit.model.AuditModelException;
|
||||||
import org.alfresco.repo.audit.model.AuditModelRegistryImpl;
|
import org.alfresco.repo.audit.model.AuditModelRegistryImpl;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy;
|
||||||
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
@@ -44,6 +47,8 @@ import org.alfresco.service.ServiceRegistry;
|
|||||||
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
import org.alfresco.service.cmr.audit.AuditQueryParameters;
|
||||||
import org.alfresco.service.cmr.audit.AuditService;
|
import org.alfresco.service.cmr.audit.AuditService;
|
||||||
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
||||||
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.MLText;
|
import org.alfresco.service.cmr.repository.MLText;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -82,7 +87,7 @@ public class AuditComponentTest extends TestCase
|
|||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(AuditComponentTest.class);
|
private static final Log logger = LogFactory.getLog(AuditComponentTest.class);
|
||||||
|
|
||||||
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(new String[] {ApplicationContextHelper.CONFIG_LOCATIONS[0], "classpath:alfresco/testaudit/alfresco-audit-test-mnt-10767-context.xml"});
|
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
|
||||||
|
|
||||||
private AuditModelRegistryImpl auditModelRegistry;
|
private AuditModelRegistryImpl auditModelRegistry;
|
||||||
private AuditComponent auditComponent;
|
private AuditComponent auditComponent;
|
||||||
@@ -90,6 +95,7 @@ public class AuditComponentTest extends TestCase
|
|||||||
private ServiceRegistry serviceRegistry;
|
private ServiceRegistry serviceRegistry;
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
private FileFolderService fileFolderService;
|
||||||
|
|
||||||
private NodeRef nodeRef;
|
private NodeRef nodeRef;
|
||||||
private String user;
|
private String user;
|
||||||
@@ -103,6 +109,7 @@ public class AuditComponentTest extends TestCase
|
|||||||
auditService = serviceRegistry.getAuditService();
|
auditService = serviceRegistry.getAuditService();
|
||||||
transactionService = serviceRegistry.getTransactionService();
|
transactionService = serviceRegistry.getTransactionService();
|
||||||
nodeService = serviceRegistry.getNodeService();
|
nodeService = serviceRegistry.getNodeService();
|
||||||
|
fileFolderService = serviceRegistry.getFileFolderService();
|
||||||
|
|
||||||
// Register the test model
|
// Register the test model
|
||||||
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test.xml");
|
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test.xml");
|
||||||
@@ -838,13 +845,17 @@ public class AuditComponentTest extends TestCase
|
|||||||
queryAuditLog(auditQueryCallback, params, -1);
|
queryAuditLog(auditQueryCallback, params, -1);
|
||||||
assertTrue("There should be no audit entries for the API test after a clear", results.isEmpty());
|
assertTrue("There should be no audit entries for the API test after a clear", results.isEmpty());
|
||||||
|
|
||||||
TestCreateFileFolderService testCreateFileFolderService = (TestCreateFileFolderService) ctx.getBean("TestCreateFileFolderService");
|
PolicyComponent policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
|
||||||
|
policyComponent.bindClassBehaviour(
|
||||||
|
OnCreateNodePolicy.QNAME,
|
||||||
|
ContentModel.TYPE_FOLDER,
|
||||||
|
new JavaBehaviour(this, "onCreateFolderMNT10767"));
|
||||||
|
|
||||||
NodeRef workingRootNodeRef = null;
|
NodeRef workingRootNodeRef = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
workingRootNodeRef = nodeService.createNode(nodeRef, ContentModel.ASSOC_CHILDREN,
|
workingRootNodeRef = nodeService.createNode(nodeRef, ContentModel.ASSOC_CHILDREN,
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "working_root" + System.currentTimeMillis()), ContentModel.TYPE_FOLDER).getChildRef();
|
QName.createQName(NamespaceService.ALFRESCO_URI, "working_root" + System.currentTimeMillis()), ContentModel.TYPE_FOLDER).getChildRef();
|
||||||
testCreateFileFolderService.create(workingRootNodeRef, "TestFolder-" + System.currentTimeMillis(), ContentModel.TYPE_FOLDER);
|
|
||||||
|
|
||||||
// Try this for a while until we get a result
|
// Try this for a while until we get a result
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
@@ -879,6 +890,13 @@ public class AuditComponentTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onCreateFolderMNT10767(ChildAssociationRef childAssocRef)
|
||||||
|
{
|
||||||
|
NodeRef newFolderRef = childAssocRef.getChildRef();
|
||||||
|
fileFolderService.create(newFolderRef, "testcontent-" + System.currentTimeMillis(), ContentModel.TYPE_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testAuditOverlimitProperties() throws Exception
|
public void testAuditOverlimitProperties() throws Exception
|
||||||
{
|
{
|
||||||
final int OVERLIMIT_SIZE = 1500;
|
final int OVERLIMIT_SIZE = 1500;
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
package org.alfresco.repo.audit;
|
|
@@ -1 +0,0 @@
|
|||||||
package org.alfresco.repo.audit;
|
|
@@ -1,24 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
|
||||||
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<bean id="testCreateFileFolderService" class="org.alfresco.repo.audit.TestCreateFileFolderServiceImpl">
|
|
||||||
<property name="fileFolderService"><ref bean="FileFolderService" /></property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="TestCreateFileFolderService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
|
||||||
<property name="proxyInterfaces">
|
|
||||||
<value>org.alfresco.repo.audit.TestCreateFileFolderService</value>
|
|
||||||
</property>
|
|
||||||
<property name="target">
|
|
||||||
<ref bean="testCreateFileFolderService"/>
|
|
||||||
</property>
|
|
||||||
<property name="interceptorNames">
|
|
||||||
<list>
|
|
||||||
<value>AuditMethodInterceptor</value>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
Reference in New Issue
Block a user