From 2b62484011374cd3fa7d9f16c6caab4af74140a1 Mon Sep 17 00:00:00 2001
From: Paolo Mazzoncini
Date: Mon, 12 Sep 2011 18:16:13 +0200
Subject: [PATCH 1/2] add test for composite marker filters in
MarkerFilterTest
---
.../logback/classic/turbo/MarkerFilterTest.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
index 33805dc..f6a6efa 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
@@ -54,4 +54,23 @@ public class MarkerFilterTest {
assertEquals(FilterReply.ACCEPT, mkt.decide(totoMarker, null, null, null, null, null));
}
+ @Test
+ public void testComposite(){
+ String compositeMarkerName = "compositeMarker";
+ Marker compositeMarker=MarkerFactory.getMarker(compositeMarkerName);
+ compositeMarker.add(totoMarker);
+
+ MarkerFilter mkt = new MarkerFilter();
+ mkt.setMarker(MARKER_NAME);
+ mkt.setOnMatch("ACCEPT");
+ mkt.setOnMismatch("DENY");
+
+ mkt.start();
+
+ assertTrue(mkt.isStarted());
+ assertEquals(FilterReply.DENY, mkt.decide(null, null, null, null, null, null));
+ assertEquals(FilterReply.ACCEPT, mkt.decide(totoMarker, null, null, null, null, null));
+ assertEquals(FilterReply.ACCEPT, mkt.decide(compositeMarker, null, null, null, null, null));
+ }
+
}
--
1.7.5.4
From 3b2327ebc71a634ef639002ca30bcfeca76d5469 Mon Sep 17 00:00:00 2001
From: Paolo Mazzoncini
Date: Mon, 12 Sep 2011 18:17:19 +0200
Subject: [PATCH 2/2] Fix for MarkerFilter, now the test succeeds
---
.../ch/qos/logback/classic/turbo/MarkerFilter.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
index 8e133cb..434b035 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
@@ -47,7 +47,7 @@ public class MarkerFilter extends MatchingFilter {
return onMismatch;
}
- if(markerToMatch.contains(marker)) {
+ if(marker.contains(markerToMatch)) {
return onMatch;
} else {
return onMismatch;
--
1.7.5.4