ALF-4106: AuditService and audit DAO refactor

- Added 'dataSource' attribute to 'RecordValue': <RecordValue ... dataSource='...'/>
 - This doesn't affect any existing configurations as the 'dataSource' remains the current path
 - Process data extraction by DataExtractor rather than by path (simpler)
 - Added unit tests specific to 'dataSource' attribute


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22129 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-09-01 15:21:12 +00:00
parent 3708560de9
commit 73ae4f71ca
10 changed files with 234 additions and 132 deletions

View File

@@ -253,7 +253,7 @@ public class AuditComponentTest extends TestCase
Serializable valueA = new Date();
Serializable valueB = "BBB-value-here";
Serializable valueC = new Float(16.0F);
// Get a noderef
final Map<String, Serializable> parameters = new HashMap<String, Serializable>(13);
parameters.put("A", valueA);
parameters.put("B", valueB);
@@ -292,6 +292,45 @@ public class AuditComponentTest extends TestCase
auditAction01("action-01-mapped");
}
/**
* Test auditing of something resembling real-world data
*/
private void auditAction02(String actionName) throws Exception
{
Serializable valueA = new Date();
Serializable valueB = "BBB-value-here";
Serializable valueC = new Float(16.0F);
final Map<String, Serializable> parameters = new HashMap<String, Serializable>(13);
parameters.put("A", valueA);
parameters.put("B", valueB);
parameters.put("C", valueC);
// lowercase versions are not in the config
parameters.put("a", valueA);
parameters.put("b", valueB);
parameters.put("c", valueC);
Map<String, Serializable> result = auditTestAction(actionName, nodeRef, parameters);
Map<String, Serializable> expected = new HashMap<String, Serializable>();
expected.put("/actions-test/actions/user", AuthenticationUtil.getFullyAuthenticatedUser());
expected.put("/actions-test/actions/context-node/noderef", nodeRef);
expected.put("/actions-test/actions/action-02/valueA", valueA);
expected.put("/actions-test/actions/action-02/valueB", valueB);
expected.put("/actions-test/actions/action-02/valueC", valueC);
// Check
checkAuditMaps(result, expected);
}
/**
* Test auditing using alternative data sources
*/
public void testAudit_Action02Sourced() throws Exception
{
auditAction02("action-02-sourced");
}
public void testQuery_Action01() throws Exception
{
final Long beforeTime = new Long(System.currentTimeMillis());