You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/04/08 14:04:24 UTC
[32/50] logging-log4j2 git commit: Refactor to add XML test.
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/67ca08b2
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/67ca08b2
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/67ca08b2
Branch: refs/heads/LOG4J2-1356
Commit: 67ca08b2a69408f1d57d7cb8f074f4a1937fc508
Parents: c7be2fe
Author: ggregory <gg...@apache.org>
Authored: Wed Apr 6 15:00:18 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Wed Apr 6 15:00:18 2016 -0700
----------------------------------------------------------------------
.../log4j/core/jackson/LevelMixInJsonTest.java | 28 +++++++++++++++++
.../log4j/core/jackson/LevelMixInTest.java | 9 ++++--
.../log4j/core/jackson/LevelMixInXmlTest.java | 32 ++++++++++++++++++++
3 files changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/67ca08b2/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInJsonTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInJsonTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInJsonTest.java
new file mode 100644
index 0000000..55853fa
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInJsonTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.jackson;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class LevelMixInJsonTest extends LevelMixInTest {
+
+ protected ObjectMapper newObjectMapper() {
+ return new Log4jJsonObjectMapper();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/67ca08b2/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInTest.java
index 9a05881..d9d11f1 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInTest.java
@@ -24,13 +24,14 @@ import org.junit.Before;
import org.junit.Test;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
/**
* Tests {@link LevelMixIn}.
*/
-public class LevelMixInTest {
+public abstract class LevelMixInTest {
static class Fixture {
@JsonProperty
@@ -66,7 +67,7 @@ public class LevelMixInTest {
return result;
}
}
- private Log4jJsonObjectMapper log4jObjectMapper;
+ private ObjectMapper log4jObjectMapper;
private ObjectReader reader;
@@ -74,11 +75,13 @@ public class LevelMixInTest {
@Before
public void setUp() {
- log4jObjectMapper = new Log4jJsonObjectMapper();
+ log4jObjectMapper = newObjectMapper();
writer = log4jObjectMapper.writer();
reader = log4jObjectMapper.readerFor(Level.class);
}
+ protected abstract ObjectMapper newObjectMapper();
+
@Test
public void testContainer() throws IOException {
final Fixture expected = new Fixture();
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/67ca08b2/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInXmlTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInXmlTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInXmlTest.java
new file mode 100644
index 0000000..e14b248
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/jackson/LevelMixInXmlTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.jackson;
+
+import org.junit.Ignore;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Ignore("Fails for #testNameOnly()")
+public class LevelMixInXmlTest extends LevelMixInTest {
+
+ @Override
+ protected ObjectMapper newObjectMapper() {
+ return new Log4jXmlObjectMapper();
+ }
+
+}