logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1186305 - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core: layout/PatternLayoutTest.java pattern/MarkerPatternConverterTest.java
Date Wed, 19 Oct 2011 16:24:08 GMT
Author: rgoers
Date: Wed Oct 19 16:24:08 2011
New Revision: 1186305

URL: http://svn.apache.org/viewvc?rev=1186305&view=rev
Log:
Add unit test for MarkerPatternConverter

Added:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/MarkerPatternConverterTest.java
Modified:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java?rev=1186305&r1=1186304&r2=1186305&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
Wed Oct 19 16:24:08 2011
@@ -128,6 +128,8 @@ public class PatternLayoutTest {
 
         assertTrue(Compare.compare(this.getClass(), OUTPUT_FILE + "_mdc", WITNESS_FILE +
"_mdc"));
 
+        root.removeAppender(appender);
+
         appender.stop();
     }
 }

Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/MarkerPatternConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/MarkerPatternConverterTest.java?rev=1186305&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/MarkerPatternConverterTest.java
(added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/pattern/MarkerPatternConverterTest.java
Wed Oct 19 16:24:08 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.pattern;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.MarkerManager;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.StructuredDataMessage;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ *
+ */
+public class MarkerPatternConverterTest {
+
+
+    @Test
+    public void testLookup() {
+        Message msg = new StructuredDataMessage("Test", "This is a test", "Audit");
+        Marker eventMarker = MarkerManager.getMarker("EVENT");
+        Marker auditMarker = MarkerManager.getMarker("AUDIT", eventMarker);
+        LogEvent event = new Log4jLogEvent("MyLogger", auditMarker, null, Level.DEBUG, msg,
null);
+        StringBuilder sb = new StringBuilder();
+        MarkerPatternConverter converter = MarkerPatternConverter.newInstance(null);
+        converter.format(event, sb);
+        assertEquals(auditMarker.toString(), sb.toString());
+    }
+}



Mime
View raw message