Fixed unit test: Forgot that auditing is not enabled by default in repo anymore

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16505 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-24 23:56:34 +00:00
parent 7c68847cb6
commit 9c05bc8ca1
2 changed files with 9 additions and 4 deletions

View File

@@ -79,6 +79,7 @@ public class AuditComponentTest extends TestCase
private AuditModelRegistry auditModelRegistry; private AuditModelRegistry auditModelRegistry;
private AuditComponent auditComponent; private AuditComponent auditComponent;
private AuditMethodInterceptor auditMethodInterceptor;
private AuditService auditService; private AuditService auditService;
private ServiceRegistry serviceRegistry; private ServiceRegistry serviceRegistry;
private TransactionService transactionService; private TransactionService transactionService;
@@ -92,6 +93,7 @@ public class AuditComponentTest extends TestCase
{ {
auditModelRegistry = (AuditModelRegistry) ctx.getBean("auditModel.modelRegistry"); auditModelRegistry = (AuditModelRegistry) ctx.getBean("auditModel.modelRegistry");
auditComponent = (AuditComponent) ctx.getBean("auditComponent"); auditComponent = (AuditComponent) ctx.getBean("auditComponent");
auditMethodInterceptor = (AuditMethodInterceptor) ctx.getBean("AuditMethodInterceptor");
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
auditService = serviceRegistry.getAuditService(); auditService = serviceRegistry.getAuditService();
transactionService = serviceRegistry.getTransactionService(); transactionService = serviceRegistry.getTransactionService();
@@ -125,12 +127,17 @@ public class AuditComponentTest extends TestCase
} }
}; };
transactionService.getRetryingTransactionHelper().doInTransaction(resetDisabledPathsCallback); transactionService.getRetryingTransactionHelper().doInTransaction(resetDisabledPathsCallback);
auditMethodInterceptor.setEnabled(true);
auditMethodInterceptor.setUseNewConfig(true);
} }
@Override @Override
public void tearDown() throws Exception public void tearDown() throws Exception
{ {
AuthenticationUtil.clearCurrentSecurityContext(); AuthenticationUtil.clearCurrentSecurityContext();
auditMethodInterceptor.setEnabled(false);
auditMethodInterceptor.setUseNewConfig(false);
} }
public void testSetUp() public void testSetUp()
@@ -459,12 +466,12 @@ public class AuditComponentTest extends TestCase
long time, long time,
Map<String, Serializable> values) Map<String, Serializable> values)
{ {
results.add(values);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug( logger.debug(
"Audit Entry: " + applicationName + ", " + user + ", " + new Date(time) + "\n" + "Audit Entry: " + applicationName + ", " + user + ", " + new Date(time) + "\n" +
" Data: " + values); " Data: " + values);
results.add(values);
} }
sb.append("Row: ") sb.append("Row: ")
.append(entryId).append(" | ") .append(entryId).append(" | ")

View File

@@ -106,13 +106,11 @@
</AuditPath> </AuditPath>
</AuditPath> </AuditPath>
<AuditPath key="error"> <AuditPath key="error">
<AuditPath key="userName">
<RecordValue key="value" dataExtractor="simpleValue"/> <RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath> </AuditPath>
</AuditPath> </AuditPath>
</AuditPath> </AuditPath>
</AuditPath> </AuditPath>
</AuditPath>
</Application> </Application>
</Audit> </Audit>