You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2016/04/06 23:21:47 UTC
logging-log4j2 git commit: Refactor to add XML test.
Repository: logging-log4j2
Updated Branches:
refs/heads/master 96a9e998a -> a2d3215ab
Refactor to add XML test.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a2d3215a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a2d3215a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a2d3215a
Branch: refs/heads/master
Commit: a2d3215ab02d058e226e13b6d75336595d164447
Parents: 96a9e99
Author: ggregory <gg...@apache.org>
Authored: Wed Apr 6 14:21:45 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Wed Apr 6 14:21:45 2016 -0700
----------------------------------------------------------------------
.../logging/log4j/MarkerMixInJsonTest.java | 31 ++++++++++++++++++++
.../apache/logging/log4j/MarkerMixInTest.java | 7 +++--
.../logging/log4j/MarkerMixInXmlTest.java | 31 ++++++++++++++++++++
3 files changed, 67 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a2d3215a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInJsonTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInJsonTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInJsonTest.java
new file mode 100644
index 0000000..6ae91c8
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInJsonTest.java
@@ -0,0 +1,31 @@
+/*
+* 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;
+
+import org.apache.logging.log4j.core.jackson.Log4jJsonObjectMapper;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class MarkerMixInJsonTest extends MarkerMixInTest {
+
+ @Override
+ protected ObjectMapper newObjectMapper() {
+ return new Log4jJsonObjectMapper();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a2d3215a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInTest.java
index ddde008..99ba28a 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInTest.java
@@ -25,6 +25,7 @@ import org.junit.Before;
import org.junit.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -33,19 +34,21 @@ import com.fasterxml.jackson.databind.ObjectWriter;
*
* This class is in this package to let {@link Log4jMarker} have the least visibility.
*/
-public class MarkerMixInTest {
+public abstract class MarkerMixInTest {
private ObjectReader reader;
private ObjectWriter writer;
@Before
public void setUp() {
- final Log4jJsonObjectMapper log4jObjectMapper = new Log4jJsonObjectMapper();
+ final ObjectMapper log4jObjectMapper = newObjectMapper();
writer = log4jObjectMapper.writer();
reader = log4jObjectMapper.readerFor(Log4jMarker.class);
MarkerManager.clear();
}
+ protected abstract ObjectMapper newObjectMapper();
+
@Test
public void testNameOnly() throws IOException {
final Marker expected = MarkerManager.getMarker("A");
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a2d3215a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInXmlTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInXmlTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInXmlTest.java
new file mode 100644
index 0000000..8c63560
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/MarkerMixInXmlTest.java
@@ -0,0 +1,31 @@
+/*
+* 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;
+
+import org.apache.logging.log4j.core.jackson.Log4jXmlObjectMapper;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class MarkerMixInXmlTest extends MarkerMixInTest {
+
+ @Override
+ protected ObjectMapper newObjectMapper() {
+ return new Log4jXmlObjectMapper();
+ }
+
+}