use of org.alfresco.repo.audit.model.AuditModelRegistryImpl in project alfresco-remote-api by Alfresco.
the class AuditWebScriptTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ctx = getServer().getApplicationContext();
// MNT-10807 : Auditing does not take into account audit.filter.alfresco-access.transaction.user
UserAuditFilter userAuditFilter = new UserAuditFilter();
userAuditFilter.setUserFilterPattern("System;.*");
userAuditFilter.afterPropertiesSet();
AuditComponent auditComponent = (AuditComponent) ctx.getBean("auditComponent");
auditComponent.setUserAuditFilter(userAuditFilter);
AuditServiceImpl auditServiceImpl = (AuditServiceImpl) ctx.getBean("auditService");
auditServiceImpl.setAuditComponent(auditComponent);
authenticationService = (AuthenticationService) ctx.getBean("AuthenticationService");
auditService = (AuditService) ctx.getBean("AuditService");
searchService = (SearchService) ctx.getBean("SearchService");
repositoryHelper = (Repository) getServer().getApplicationContext().getBean("repositoryHelper");
fileFolderService = (FileFolderService) getServer().getApplicationContext().getBean("FileFolderService");
admin = AuthenticationUtil.getAdminUserName();
// Register the test models
AuditModelRegistryImpl auditModelRegistry = (AuditModelRegistryImpl) ctx.getBean("auditModel.modelRegistry");
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-repository.xml");
URL testModelUrl1 = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-16748.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.registerModel(testModelUrl1);
auditModelRegistry.loadAuditModels();
AuthenticationUtil.setFullyAuthenticatedUser(admin);
wasGloballyEnabled = auditService.isAuditEnabled();
wasRepoEnabled = auditService.isAuditEnabled(APP_REPOTEST_NAME, APP_REPOTEST_PATH);
wasSearchEnabled = auditService.isAuditEnabled(APP_SEARCHTEST_NAME, APP_SEARCHTEST_PATH);
// Only enable if required
if (!wasGloballyEnabled) {
auditService.setAuditEnabled(true);
wasGloballyEnabled = auditService.isAuditEnabled();
if (!wasGloballyEnabled) {
fail("Failed to enable global audit for test");
}
}
if (!wasRepoEnabled) {
auditService.enableAudit(APP_REPOTEST_NAME, APP_REPOTEST_PATH);
wasRepoEnabled = auditService.isAuditEnabled(APP_REPOTEST_NAME, APP_REPOTEST_PATH);
if (!wasRepoEnabled) {
fail("Failed to enable repo audit for test");
}
}
if (!wasSearchEnabled) {
auditService.enableAudit(APP_SEARCHTEST_NAME, APP_SEARCHTEST_PATH);
wasSearchEnabled = auditService.isAuditEnabled(APP_SEARCHTEST_NAME, APP_SEARCHTEST_PATH);
if (!wasSearchEnabled) {
fail("Failed to enable search audit for test");
}
}
}
use of org.alfresco.repo.audit.model.AuditModelRegistryImpl in project alfresco-remote-api by Alfresco.
the class AuditAppTest method setup.
@Before
public void setup() throws Exception {
super.setup();
permissionService = applicationContext.getBean("permissionService", PermissionService.class);
authorityService = (AuthorityService) applicationContext.getBean("AuthorityService");
auditService = applicationContext.getBean("AuditService", AuditService.class);
AuditModelRegistryImpl auditModelRegistry = (AuditModelRegistryImpl) applicationContext.getBean("auditModel.modelRegistry");
// Register the test model
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/audit/alfresco-audit-access.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
}
Aggregations