Created AuthenticationService-specific config for audit tests

- Makes for a clearer demonstration of API-based auditing


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17693 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-12-01 15:41:49 +00:00
parent 4835819b62
commit 48df5a03ac
4 changed files with 41 additions and 27 deletions

View File

@@ -178,8 +178,6 @@ public interface AuditComponent
* @return Returns the values that were actually persisted, keyed by their full path. * @return Returns the values that were actually persisted, keyed by their full path.
* @throws IllegalStateException if there is not a writable transaction present * @throws IllegalStateException if there is not a writable transaction present
* *
* @see #startAuditSession()
*
* @since 3.2 * @since 3.2
*/ */
Map<String, Serializable> recordAuditValues(String rootPath, Map<String, Serializable> values); Map<String, Serializable> recordAuditValues(String rootPath, Map<String, Serializable> values);

View File

@@ -72,7 +72,7 @@ public class AuditComponentTest extends TestCase
{ {
private static final String APPLICATION_TEST = "Alfresco Test"; private static final String APPLICATION_TEST = "Alfresco Test";
private static final String APPLICATION_ACTIONS_TEST = "Actions Test"; private static final String APPLICATION_ACTIONS_TEST = "Actions Test";
private static final String APPLICATION_API_TEST = "API Test"; private static final String APPLICATION_API_TEST = "Test AuthenticationService";
private static final Log logger = LogFactory.getLog(AuditComponentTest.class); private static final Log logger = LogFactory.getLog(AuditComponentTest.class);
@@ -454,12 +454,10 @@ public class AuditComponentTest extends TestCase
public void testAuditAuthenticationService() throws Exception public void testAuditAuthenticationService() throws Exception
{ {
final Map<String, Serializable> expected = new HashMap<String, Serializable>(); // Load in the config for this specific test: alfresco-audit-test-authenticationservice.xml
expected.put("/actions-test/actions/user", AuthenticationUtil.getFullyAuthenticatedUser()); URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/audit/alfresco-audit-test-authenticationservice.xml");
expected.put("/actions-test/actions/context-node/noderef", nodeRef); auditModelRegistry.registerModel(testModelUrl);
expected.put("/actions-test/actions/action-01/params/A/value", null); auditModelRegistry.loadAuditModels();
expected.put("/actions-test/actions/action-01/params/B/value", null);
expected.put("/actions-test/actions/action-01/params/C/value", null);
final List<Map<String, Serializable>> results = new ArrayList<Map<String,Serializable>>(); final List<Map<String, Serializable>> results = new ArrayList<Map<String,Serializable>>();
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();

View File

@@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Default Audit Configuration -->
<Audit
xmlns="http://www.alfresco.org/repo/audit/model/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.alfresco.org/repo/audit/model/3.2 alfresco-audit-3.2.xsd"
>
<DataExtractors>
<DataExtractor name="simpleValue" registeredName="auditModel.extractor.simpleValue"/>
</DataExtractors>
<PathMappings>
<PathMap source="/alfresco-api" target="/test-authenticationservice"/>
</PathMappings>
<Application name="Test AuthenticationService" key="test-authenticationservice">
<AuditPath key="post">
<AuditPath key="AuthenticationService">
<AuditPath key="authenticate">
<AuditPath key="args">
<AuditPath key="userName">
<RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath>
</AuditPath>
<AuditPath key="error">
<RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath>
</AuditPath>
</AuditPath>
</AuditPath>
</Application>
</Audit>

View File

@@ -24,7 +24,6 @@
<PathMap source="/test/one.one/two.two" target="/test/1.1/2.2"/> <PathMap source="/test/one.one/two.two" target="/test/1.1/2.2"/>
<PathMap source="/actions-test" target="/actions-test"/> <PathMap source="/actions-test" target="/actions-test"/>
<PathMap source="/actions-test/actions/action-01-mapped" target="/actions-test/actions/action-01"/> <PathMap source="/actions-test/actions/action-01-mapped" target="/actions-test/actions/action-01"/>
<PathMap source="/alfresco-api" target="/api-test"/>
</PathMappings> </PathMappings>
<Application name="Alfresco Test" key="test"> <Application name="Alfresco Test" key="test">
@@ -96,21 +95,4 @@
</AuditPath> </AuditPath>
</Application> </Application>
<Application name="API Test" key="api-test">
<AuditPath key="post">
<AuditPath key="AuthenticationService">
<AuditPath key="authenticate">
<AuditPath key="args">
<AuditPath key="userName">
<RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath>
</AuditPath>
<AuditPath key="error">
<RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath>
</AuditPath>
</AuditPath>
</AuditPath>
</Application>
</Audit> </Audit>