use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class PrincipalLogEventFilterTest method testWrongPrincipal.
public void testWrongPrincipal() {
_subject.getPrincipals().add(mock(Principal.class));
FilterReply reply = doFilter();
assertEquals(FilterReply.DENY, reply);
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class VirtualHostLogEventExcludingFilterTest method testDecideOnVirtualHostPrincipalInSubjectAndVirtualHostLogEventExcluded.
public void testDecideOnVirtualHostPrincipalInSubjectAndVirtualHostLogEventExcluded() throws Exception {
when(_brokerLogger.isVirtualHostLogEventExcluded()).thenReturn(true);
Subject subject = new Subject();
subject.getPrincipals().add(mock(VirtualHostPrincipal.class));
FilterReply reply = doTestDecide(subject);
assertEquals("Unexpected reply for BrokerLogger#virtualHostLogEventExcluded=true and VH principal in subject", FilterReply.DENY, reply);
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class VirtualHostLogEventExcludingFilterTest method testDecideOnVirtualHostPrincipalInSubjectAndVirtualHostLogEventNotExcluded.
public void testDecideOnVirtualHostPrincipalInSubjectAndVirtualHostLogEventNotExcluded() throws Exception {
Subject subject = new Subject();
subject.getPrincipals().add(mock(VirtualHostPrincipal.class));
FilterReply reply = doTestDecide(subject);
assertEquals("Unexpected reply for BrokerLogger#virtualHostLogEventExcluded=false and VH principal in subject", FilterReply.NEUTRAL, reply);
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class VirtualHostLogEventExcludingFilterTest method testDecideOnVirtualHostLogEventExcludedAndNullSubject.
public void testDecideOnVirtualHostLogEventExcludedAndNullSubject() throws Exception {
when(_brokerLogger.isVirtualHostLogEventExcluded()).thenReturn(true);
FilterReply reply = _filter.decide(_loggingEvent);
assertEquals(" BrokerLogger#virtualHostLogEventExcluded=true and subject=null", FilterReply.NEUTRAL, reply);
assertNull("Subject should not be set in test environment", Subject.getSubject(AccessController.getContext()));
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class VirtualHostLogEventExcludingFilterTest method testDecideOnNoVirtualHostPrincipalInSubjectAndVirtualHostLogEventExcluded.
public void testDecideOnNoVirtualHostPrincipalInSubjectAndVirtualHostLogEventExcluded() throws Exception {
when(_brokerLogger.isVirtualHostLogEventExcluded()).thenReturn(true);
Subject subject = new Subject();
subject.getPrincipals().add(mock(Principal.class));
FilterReply reply = doTestDecide(subject);
assertEquals("Unexpected reply for BrokerLogger#virtualHostLogEventExcluded=true and no VH principal in subject", FilterReply.NEUTRAL, reply);
}
Aggregations