Search in sources :

Example 1 with Auditor

use of org.nhindirect.common.audit.Auditor in project nhin-d by DirectProject.

the class MultiProviderAuditorTest method testAuditEvent.

@Test
public void testAuditEvent() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    auditor.audit(PRINCIPAL, UNIT_TEST_EVENT);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Auditor(org.nhindirect.common.audit.Auditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 2 with Auditor

use of org.nhindirect.common.audit.Auditor in project nhin-d by DirectProject.

the class MultiProviderAuditorTest method testAuditCategoryAndMessage_EmptyPrincipal_AssertExeption.

@Test
public void testAuditCategoryAndMessage_EmptyPrincipal_AssertExeption() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    boolean exceptionOccured = false;
    try {
        auditor.audit("", UNIT_TEST_EVENT);
    } catch (IllegalArgumentException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Auditor(org.nhindirect.common.audit.Auditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 3 with Auditor

use of org.nhindirect.common.audit.Auditor in project nhin-d by DirectProject.

the class MultiProviderAuditorTest method testAudit_NullPrincipal_AssertExeption.

@Test
public void testAudit_NullPrincipal_AssertExeption() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    boolean exceptionOccured = false;
    try {
        auditor.audit(null, UNIT_TEST_EVENT);
    } catch (IllegalArgumentException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Auditor(org.nhindirect.common.audit.Auditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 4 with Auditor

use of org.nhindirect.common.audit.Auditor in project nhin-d by DirectProject.

the class MultiProviderAuditorTest method testAuditCategoryAndMessage_OneAuditorFails.

@Test
public void testAuditCategoryAndMessage_OneAuditorFails() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new ExceptionAuditor()));
    auditor.audit(PRINCIPAL, UNIT_TEST_EVENT);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Auditor(org.nhindirect.common.audit.Auditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 5 with Auditor

use of org.nhindirect.common.audit.Auditor in project nhin-d by DirectProject.

the class MultiProviderAuditorTest method testAudit_NullEvent_AssertExeption.

@Test
public void testAudit_NullEvent_AssertExeption() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    boolean exceptionOccured = false;
    try {
        auditor.audit(PRINCIPAL, null);
    } catch (IllegalArgumentException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Auditor(org.nhindirect.common.audit.Auditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Aggregations

Auditor (org.nhindirect.common.audit.Auditor)8 Test (org.junit.Test)6 LoggingAuditor (org.nhindirect.common.audit.impl.LoggingAuditor)6 MultiProviderAuditor (org.nhindirect.common.audit.impl.MultiProviderAuditor)6 NoOpAuditor (org.nhindirect.common.audit.impl.NoOpAuditor)6 Module (com.google.inject.Module)1 Provider (com.google.inject.Provider)1 Constructor (java.lang.reflect.Constructor)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 MessagingException (javax.mail.MessagingException)1 DefaultAuditContext (org.nhindirect.common.audit.DefaultAuditContext)1 ServiceException (org.nhindirect.common.rest.exceptions.ServiceException)1 OpenServiceSecurityManagerProvider (org.nhindirect.common.rest.provider.OpenServiceSecurityManagerProvider)1 SmtpAgentException (org.nhindirect.gateway.smtp.SmtpAgentException)1 RejectedRecipientDSNCreatorProvider (org.nhindirect.gateway.smtp.dsn.provider.RejectedRecipientDSNCreatorProvider)1 AuditorModule (org.nhindirect.gateway.smtp.module.AuditorModule)1 KeyStoreProtectionConfigProvider (org.nhindirect.gateway.smtp.provider.KeyStoreProtectionConfigProvider)1 MailetAwareProvider (org.nhindirect.gateway.smtp.provider.MailetAwareProvider)1 SecureURLAccessedConfigProvider (org.nhindirect.gateway.smtp.provider.SecureURLAccessedConfigProvider)1