use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class CompositeFilterTest method testDecideWithMultipleRules.
public void testDecideWithMultipleRules() {
CompositeFilter compositeFilter = new CompositeFilter();
LogBackLogInclusionRule neutral = createRule(FilterReply.NEUTRAL);
compositeFilter.addLogInclusionRule(neutral);
LogBackLogInclusionRule deny = createRule(FilterReply.DENY);
compositeFilter.addLogInclusionRule(deny);
LogBackLogInclusionRule accept = createRule(FilterReply.ACCEPT);
compositeFilter.addLogInclusionRule(accept);
FilterReply reply = compositeFilter.decide(mock(ILoggingEvent.class));
assertEquals("Unexpected reply", FilterReply.DENY, reply);
verify(neutral.asFilter()).decide(any(ILoggingEvent.class));
verify(deny.asFilter()).decide(any(ILoggingEvent.class));
verify(accept.asFilter(), never()).decide(any(ILoggingEvent.class));
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class CompositeFilterTest method testDecideWithNeutralRule.
public void testDecideWithNeutralRule() {
CompositeFilter compositeFilter = new CompositeFilter();
compositeFilter.addLogInclusionRule(createRule(FilterReply.NEUTRAL));
final ILoggingEvent loggingEvent = mock(ILoggingEvent.class);
when(loggingEvent.getLevel()).thenReturn(Level.ERROR);
FilterReply reply = compositeFilter.decide(loggingEvent);
assertEquals("Unexpected reply with NEUTRAL rule added", FilterReply.DENY, reply);
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class Logback1027WorkaroundTurboFilterTest method testOneException.
public void testOneException() {
Exception e = new Exception();
final FilterReply reply = doDecide(e);
assertEquals(FilterReply.NEUTRAL, reply);
assertEquals(0, _snoopingAppender.getEvents().size());
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class PrincipalLogEventFilterTest method testNoPrincipal.
public void testNoPrincipal() {
FilterReply reply = doFilter();
assertEquals(FilterReply.DENY, reply);
}
use of ch.qos.logback.core.spi.FilterReply in project qpid-broker-j by apache.
the class PrincipalLogEventFilterTest method testPrincipalMatches.
public void testPrincipalMatches() {
_subject.getPrincipals().add(_principal);
FilterReply reply = doFilter();
assertEquals(FilterReply.NEUTRAL, reply);
}
Aggregations