Search in sources :

Example 1 with AuditEventFactory

use of org.forgerock.openam.audit.AuditEventFactory in project OpenAM by OpenRock.

the class AbstractRestletAccessAuditFilterTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    restlet = mock(Restlet.class);
    AMAuditServiceConfiguration serviceConfig = new AMAuditServiceConfiguration(true);
    AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withConfiguration(serviceConfig);
    AMAuditService auditService = new DefaultAuditServiceProxy(builder.build(), serviceConfig);
    auditService.startup();
    auditServiceProvider = mock(AuditServiceProvider.class);
    when(auditServiceProvider.getDefaultAuditService()).thenReturn(auditService);
    eventFactory = new AuditEventFactory();
    eventPublisher = mock(AuditEventPublisher.class);
    auditFilter = new RestletAccessAuditFilterTest(restlet, eventPublisher, eventFactory, null, null);
}
Also used : AuditServiceBuilder(org.forgerock.audit.AuditServiceBuilder) DefaultAuditServiceProxy(org.forgerock.openam.audit.DefaultAuditServiceProxy) AuditServiceProvider(org.forgerock.openam.audit.AuditServiceProvider) Restlet(org.restlet.Restlet) AMAuditService(org.forgerock.openam.audit.AMAuditService) AuditEventFactory(org.forgerock.openam.audit.AuditEventFactory) AMAuditServiceConfiguration(org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration) AuditEventPublisher(org.forgerock.openam.audit.AuditEventPublisher) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with AuditEventFactory

use of org.forgerock.openam.audit.AuditEventFactory in project OpenAM by OpenRock.

the class AuditTestUtils method mockAuditEventFactory.

public static AuditEventFactory mockAuditEventFactory() {
    AuditEventFactory auditEventFactory = mock(AuditEventFactory.class);
    when(auditEventFactory.accessEvent(NO_REALM)).thenAnswer(new Answer<AMAccessAuditEventBuilder>() {

        @Override
        public AMAccessAuditEventBuilder answer(InvocationOnMock invocation) throws Throwable {
            return new AMAccessAuditEventBuilder();
        }
    });
    return auditEventFactory;
}
Also used : InvocationOnMock(org.mockito.invocation.InvocationOnMock) AuditEventFactory(org.forgerock.openam.audit.AuditEventFactory) AMAccessAuditEventBuilder(org.forgerock.openam.audit.AMAccessAuditEventBuilder)

Aggregations

AuditEventFactory (org.forgerock.openam.audit.AuditEventFactory)2 AuditServiceBuilder (org.forgerock.audit.AuditServiceBuilder)1 AMAccessAuditEventBuilder (org.forgerock.openam.audit.AMAccessAuditEventBuilder)1 AMAuditService (org.forgerock.openam.audit.AMAuditService)1 AuditEventPublisher (org.forgerock.openam.audit.AuditEventPublisher)1 AuditServiceProvider (org.forgerock.openam.audit.AuditServiceProvider)1 DefaultAuditServiceProxy (org.forgerock.openam.audit.DefaultAuditServiceProxy)1 AMAuditServiceConfiguration (org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Restlet (org.restlet.Restlet)1 BeforeMethod (org.testng.annotations.BeforeMethod)1