mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
AuditModelRegistryImpl refactored as dynamic subsystem
- Modules such as RM can now drop in their own config - should fix some unit tests - Picks up config from classpath*:alfresco/audit/*.xml classpath*:alfresco/enterprise/audit/*.xml classpath*:alfresco/module/*/audit/*.xml classpath*:alfresco/extension/audit/*.xml - One audit.{applicationkey}.enabled property for each application in the config, defaulting to true - One audit.enabled global enablement property defaulting to false - Still controllable by alfresco-global.properties and JMX git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18841 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,7 +34,6 @@ import org.alfresco.repo.audit.generator.DataGenerator;
|
||||
import org.alfresco.repo.audit.model.AuditApplication;
|
||||
import org.alfresco.repo.audit.model.AuditModelException;
|
||||
import org.alfresco.repo.audit.model.AuditModelRegistryImpl;
|
||||
import org.alfresco.repo.management.subsystems.ApplicationContextFactory;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.PathMapper;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -63,17 +62,21 @@ public class AuditBootstrapTest extends TestCase
|
||||
@Override
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
// We have to look inside the subsystem for this test
|
||||
ApplicationContextFactory subsystem = (ApplicationContextFactory) ctx.getBean("Audit");
|
||||
ApplicationContext subCtx = subsystem.getApplicationContext();
|
||||
auditModelRegistry = (AuditModelRegistryImpl) subCtx.getBean("auditModel.modelRegistry");
|
||||
auditModelRegistry = (AuditModelRegistryImpl) ctx.getBean("auditModel.modelRegistry");
|
||||
|
||||
// Register a new model
|
||||
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/audit/alfresco-audit-test.xml");
|
||||
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test.xml");
|
||||
auditModelRegistry.registerModel(testModelUrl);
|
||||
auditModelRegistry.loadAuditModels();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
// Throw away the reconfigured registry state
|
||||
auditModelRegistry.destroy();
|
||||
}
|
||||
|
||||
public void testSetUp()
|
||||
{
|
||||
// Just here to fail if the basic startup fails
|
||||
@@ -97,32 +100,32 @@ public class AuditBootstrapTest extends TestCase
|
||||
|
||||
public void testModelLoading_NoDataExtractor() throws Exception
|
||||
{
|
||||
loadBadModel("classpath:alfresco/audit/alfresco-audit-test-bad-01.xml");
|
||||
loadBadModel("classpath:alfresco/testaudit/alfresco-audit-test-bad-01.xml");
|
||||
}
|
||||
|
||||
public void testModelLoading_NoDataGenerator() throws Exception
|
||||
{
|
||||
loadBadModel("classpath:alfresco/audit/alfresco-audit-test-bad-02.xml");
|
||||
loadBadModel("classpath:alfresco/testaudit/alfresco-audit-test-bad-02.xml");
|
||||
}
|
||||
|
||||
public void testModelLoading_DuplicatePath() throws Exception
|
||||
{
|
||||
loadBadModel("classpath:alfresco/audit/alfresco-audit-test-bad-03.xml");
|
||||
loadBadModel("classpath:alfresco/testaudit/alfresco-audit-test-bad-03.xml");
|
||||
}
|
||||
|
||||
public void testModelLoading_UppercasePath() throws Exception
|
||||
{
|
||||
loadBadModel("classpath:alfresco/audit/alfresco-audit-test-bad-04.xml");
|
||||
loadBadModel("classpath:alfresco/testaudit/alfresco-audit-test-bad-04.xml");
|
||||
}
|
||||
|
||||
public void testModelLoading_InvalidDataGeneratorName() throws Exception
|
||||
{
|
||||
loadBadModel("classpath:alfresco/audit/alfresco-audit-test-bad-05.xml");
|
||||
loadBadModel("classpath:alfresco/testaudit/alfresco-audit-test-bad-05.xml");
|
||||
}
|
||||
|
||||
public void testModelLoading_BadGeneratorRegisteredName() throws Exception
|
||||
{
|
||||
loadBadModel("classpath:alfresco/audit/alfresco-audit-test-bad-06.xml");
|
||||
loadBadModel("classpath:alfresco/testaudit/alfresco-audit-test-bad-06.xml");
|
||||
}
|
||||
|
||||
public void testGetApplicationId()
|
||||
|
Reference in New Issue
Block a user