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 2018/01/27 18:46:39 UTC
[5/6] logging-log4j2 git commit: [LOG4J2-2188] Split off JPA support
into a new module log4j-jpa.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/package-info.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/package-info.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/package-info.java
deleted file mode 100644
index 2245fa7..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/package-info.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-// Lines too long...
-//CHECKSTYLE:OFF
-/**
- * The converters in this package implement the JPA 2.1 mechanism for converting non-standard types to and from
- * database fields. Most of these types are capable of two-way conversion and can be used to both persist and retrieve
- * entities. The
- * {@link org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapAttributeConverter ContextMapAttributeConverter}
- * and {@link org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackAttributeConverter ContextStackAttributeConverter}
- * only support persistence and not retrieval, persisting the type as a simple string. You can use the
- * {@link org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter ContextMapJsonAttributeConverter}
- * and {@link org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackJsonAttributeConverter ContextStackJsonAttributeConverter}
- * instead, which require the Jackson Data Processor dependency to also be on your class path.
- */
-//CHECKSTYLE:ON
-package org.apache.logging.log4j.core.appender.db.jpa.converter;
-
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/package-info.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/package-info.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/package-info.java
deleted file mode 100644
index 3434faa..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * The JPA Appender supports writing log events to a relational database using the Java Persistence API. You will need
- * a JDBC driver on your classpath for the database you wish to log to. You will also need the Java Persistence API 2.1
- * and your JPA provider of choice on the class path; these Maven dependencies are optional and will not automatically
- * be added to your classpath.
- */
-package org.apache.logging.log4j.core.appender.db.jpa;
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
deleted file mode 100644
index 6ff3c14..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * 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.appender.db.jpa;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.core.config.DefaultConfiguration;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.apache.logging.log4j.util.PropertiesUtil;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public abstract class AbstractJpaAppenderTest {
- private final String databaseType;
- private Connection connection;
-
- public AbstractJpaAppenderTest(final String databaseType) {
- this.databaseType = databaseType;
- }
-
- protected abstract Connection setUpConnection() throws SQLException;
-
- public void setUp(final String configFileName) throws SQLException {
- this.connection = this.setUpConnection();
-
- System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
- "org/apache/logging/log4j/core/appender/db/jpa/" + configFileName);
- PropertiesUtil.getProperties().reload();
- final LoggerContext context = LoggerContext.getContext(false);
- if (context.getConfiguration() instanceof DefaultConfiguration) {
- context.reconfigure();
- }
- StatusLogger.getLogger().reset();
- }
-
- public void tearDown() throws SQLException {
- final LoggerContext context = LoggerContext.getContext(false);
- try {
- String appenderName = "databaseAppender";
- final Appender appender = context.getConfiguration().getAppender(appenderName);
- assertNotNull("The appender '" + appenderName + "' should not be null.", appender);
- assertTrue("The appender should be a JpaAppender.", appender instanceof JpaAppender);
- ((JpaAppender) appender).getManager().close();
- } finally {
- System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
- PropertiesUtil.getProperties().reload();
- context.reconfigure();
- StatusLogger.getLogger().reset();
-
- try (Statement statement = this.connection.createStatement();) {
- statement.execute("SHUTDOWN");
- }
-
- this.connection.close();
- }
- }
-
- @Test
- public void testBaseJpaEntityAppender() throws SQLException {
- try {
- this.setUp("log4j2-" + this.databaseType + "-jpa-base.xml");
-
- final RuntimeException exception = new RuntimeException("Hello, world!");
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final PrintWriter writer = new PrintWriter(outputStream);
- exception.printStackTrace(writer);
- writer.close();
- final String stackTrace = outputStream.toString().replace("\r\n", "\n");
-
- final long millis = System.currentTimeMillis();
-
- final Logger logger1 = LogManager.getLogger(this.getClass().getName() + ".testBaseJpaEntityAppender");
- final Logger logger2 = LogManager.getLogger(this.getClass().getName() + ".testBaseJpaEntityAppenderAgain");
- logger1.info("Test my message 01.");
- logger1.error("This is another message 02.", exception);
- logger2.warn("A final warning has been issued.");
-
- final Statement statement = this.connection.createStatement();
- final ResultSet resultSet = statement.executeQuery("SELECT * FROM jpaBaseLogEntry ORDER BY id");
-
- assertTrue("There should be at least one row.", resultSet.next());
-
- long date = resultSet.getTimestamp("eventDate").getTime();
- assertTrue("The date should be later than pre-logging (1).", date >= millis);
- assertTrue("The date should be earlier than now (1).", date <= System.currentTimeMillis());
- assertEquals("The level column is not correct (1).", "INFO", resultSet.getString("level"));
- assertEquals("The logger column is not correct (1).", logger1.getName(), resultSet.getString("logger"));
- assertEquals("The message column is not correct (1).", "Test my message 01.",
- resultSet.getString("message"));
- assertNull("The exception column is not correct (1).", resultSet.getString("exception"));
-
- assertTrue("There should be at least two rows.", resultSet.next());
-
- date = resultSet.getTimestamp("eventDate").getTime();
- assertTrue("The date should be later than pre-logging (2).", date >= millis);
- assertTrue("The date should be earlier than now (2).", date <= System.currentTimeMillis());
- assertEquals("The level column is not correct (2).", "ERROR", resultSet.getString("level"));
- assertEquals("The logger column is not correct (2).", logger1.getName(), resultSet.getString("logger"));
- assertEquals("The message column is not correct (2).", "This is another message 02.",
- resultSet.getString("message"));
- assertEquals("The exception column is not correct (2).", stackTrace, resultSet.getString("exception"));
-
- assertTrue("There should be three rows.", resultSet.next());
-
- date = resultSet.getTimestamp("eventDate").getTime();
- assertTrue("The date should be later than pre-logging (3).", date >= millis);
- assertTrue("The date should be earlier than now (3).", date <= System.currentTimeMillis());
- assertEquals("The level column is not correct (3).", "WARN", resultSet.getString("level"));
- assertEquals("The logger column is not correct (3).", logger2.getName(), resultSet.getString("logger"));
- assertEquals("The message column is not correct (3).", "A final warning has been issued.",
- resultSet.getString("message"));
- assertNull("The exception column is not correct (3).", resultSet.getString("exception"));
-
- assertFalse("There should not be four rows.", resultSet.next());
- } finally {
- this.tearDown();
- }
- }
-
- @Test
- public void testBasicJpaEntityAppender() throws SQLException {
- try {
- this.setUp("log4j2-" + this.databaseType + "-jpa-basic.xml");
-
- final Error exception = new Error("Goodbye, cruel world!");
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final PrintWriter writer = new PrintWriter(outputStream);
- exception.printStackTrace(writer);
- writer.close();
- final String stackTrace = outputStream.toString().replace("\r\n", "\n");
-
- final long millis = System.currentTimeMillis();
-
- final Logger logger1 = LogManager.getLogger(this.getClass().getName() + ".testBasicJpaEntityAppender");
- final Logger logger2 = LogManager.getLogger(this.getClass().getName() + ".testBasicJpaEntityAppenderAgain");
- logger1.debug("Test my debug 01.");
- logger1.warn("This is another warning 02.", exception);
- logger2.fatal("A fatal warning has been issued.");
-
- final Statement statement = this.connection.createStatement();
- final ResultSet resultSet = statement.executeQuery("SELECT * FROM jpaBasicLogEntry ORDER BY id");
-
- assertTrue("There should be at least one row.", resultSet.next());
-
- long date = resultSet.getLong("timemillis");
- assertTrue("The date should be later than pre-logging (1).", date >= millis);
- assertTrue("The date should be earlier than now (1).", date <= System.currentTimeMillis());
- assertEquals("The level column is not correct (1).", "DEBUG", resultSet.getString("level"));
- assertEquals("The logger column is not correct (1).", logger1.getName(), resultSet.getString("loggerName"));
- assertEquals("The message column is not correct (1).", "Test my debug 01.",
- resultSet.getString("message"));
- assertNull("The exception column is not correct (1).", resultSet.getString("thrown"));
-
- assertTrue("There should be at least two rows.", resultSet.next());
-
- date = resultSet.getLong("timemillis");
- assertTrue("The date should be later than pre-logging (2).", date >= millis);
- assertTrue("The date should be earlier than now (2).", date <= System.currentTimeMillis());
- assertEquals("The level column is not correct (2).", "WARN", resultSet.getString("level"));
- assertEquals("The logger column is not correct (2).", logger1.getName(), resultSet.getString("loggerName"));
- assertEquals("The message column is not correct (2).", "This is another warning 02.",
- resultSet.getString("message"));
- assertEquals("The exception column is not correct (2).", stackTrace, resultSet.getString("thrown"));
-
- assertTrue("There should be three rows.", resultSet.next());
-
- date = resultSet.getLong("timemillis");
- assertTrue("The date should be later than pre-logging (3).", date >= millis);
- assertTrue("The date should be earlier than now (3).", date <= System.currentTimeMillis());
- assertEquals("The level column is not correct (3).", "FATAL", resultSet.getString("level"));
- assertEquals("The logger column is not correct (3).", logger2.getName(), resultSet.getString("loggerName"));
- assertEquals("The message column is not correct (3).", "A fatal warning has been issued.",
- resultSet.getString("message"));
- assertNull("The exception column is not correct (3).", resultSet.getString("thrown"));
-
- assertFalse("There should not be four rows.", resultSet.next());
- } finally {
- this.tearDown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaH2AppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaH2AppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaH2AppenderTest.java
deleted file mode 100644
index 055dd03..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaH2AppenderTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.appender.db.jpa;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.util.Strings;
-import org.junit.experimental.categories.Category;
-
-@Category(Appenders.Jpa.class)
-public class JpaH2AppenderTest extends AbstractJpaAppenderTest {
- private static final String USER_ID = "sa";
- private static final String PASSWORD = Strings.EMPTY;
-
- public JpaH2AppenderTest() {
- super("h2");
- }
-
- @Override
- protected Connection setUpConnection() throws SQLException {
- final Connection connection = DriverManager.getConnection("jdbc:h2:mem:Log4j", USER_ID, PASSWORD);
-
- try (Statement statement = connection.createStatement()) {
- statement.executeUpdate("CREATE TABLE jpaBaseLogEntry ( "
- + "id INTEGER IDENTITY, eventDate DATETIME, level NVARCHAR(10), logger NVARCHAR(255), "
- + "message NVARCHAR(1024), exception NVARCHAR(1048576)" + " )");
- }
-
- try (Statement statement = connection.createStatement()) {
- statement.executeUpdate("CREATE TABLE jpaBasicLogEntry ( "
- + "id INTEGER IDENTITY, timemillis BIGINT, nanoTime BIGINT, level NVARCHAR(10), loggerName NVARCHAR(255), "
- + "message NVARCHAR(1024), thrown NVARCHAR(1048576), contextMapJson NVARCHAR(1048576),"
- + "loggerFQCN NVARCHAR(1024), contextStack NVARCHAR(1048576), marker NVARCHAR(255), source NVARCHAR(2048),"
- + "threadId BIGINT, threadName NVARCHAR(255), threadPriority INTEGER" + " )");
- }
-
- return connection;
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaHsqldbAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaHsqldbAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaHsqldbAppenderTest.java
deleted file mode 100644
index 3e22d96..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/JpaHsqldbAppenderTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.appender.db.jpa;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.util.Strings;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class JpaHsqldbAppenderTest extends AbstractJpaAppenderTest {
- private static final String USER_ID = "sa";
- private static final String PASSWORD = Strings.EMPTY;
-
- public JpaHsqldbAppenderTest() {
- super("hsqldb");
- }
-
- @Override
- protected Connection setUpConnection() throws SQLException {
- final Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", USER_ID, PASSWORD);
-
- try (Statement statement = connection.createStatement()) {
- statement.executeUpdate("CREATE TABLE jpaBaseLogEntry ( "
- + "id INTEGER IDENTITY, eventDate DATETIME, level VARCHAR(10), logger VARCHAR(255), "
- + "message VARCHAR(1024), exception VARCHAR(1048576)" + " )");
- }
-
- try (Statement statement = connection.createStatement()) {
- statement.executeUpdate("CREATE TABLE jpaBasicLogEntry ( "
- + "id INTEGER IDENTITY, timemillis BIGINT, nanoTime BIGINT, level VARCHAR(10), loggerName VARCHAR(255), "
- + "message VARCHAR(1024), thrown VARCHAR(1048576), contextMapJson VARCHAR(1048576),"
- + "loggerFQCN VARCHAR(1024), contextStack VARCHAR(1048576), marker VARCHAR(255), source VARCHAR(2048),"
- + "threadId BIGINT, threadName NVARCHAR(255), threadPriority INTEGER" + " )");
- }
-
- return connection;
- }
-
- @Test
- public void testNoEntityClassName() {
- final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, null, "jpaAppenderTestUnit");
-
- assertNull("The appender should be null.", appender);
- }
-
- @Test
- public void testNoPersistenceUnitName() {
- final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, TestBaseEntity.class.getName(),
- null);
-
- assertNull("The appender should be null.", appender);
- }
-
- @Test
- public void testBadEntityClassName() {
- final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, "com.foo.Bar",
- "jpaAppenderTestUnit");
-
- assertNull("The appender should be null.", appender);
- }
-
- @Test
- public void testNonLogEventEntity() {
- final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, Object.class.getName(),
- "jpaAppenderTestUnit");
-
- assertNull("The appender should be null.", appender);
- }
-
- @Test
- public void testBadConstructorEntity01() {
- final JpaAppender appender = JpaAppender.createAppender("name", null, null, null,
- BadConstructorEntity1.class.getName(), "jpaAppenderTestUnit");
-
- assertNull("The appender should be null.", appender);
- }
-
- @Test
- public void testBadConstructorEntity02() {
- final JpaAppender appender = JpaAppender.createAppender("name", null, null, null,
- BadConstructorEntity2.class.getName(), "jpaAppenderTestUnit");
-
- assertNull("The appender should be null.", appender);
- }
-
- @SuppressWarnings("unused")
- public static class BadConstructorEntity1 extends TestBaseEntity {
- private static final long serialVersionUID = 1L;
-
- public BadConstructorEntity1(final LogEvent wrappedEvent) {
- super(wrappedEvent);
- }
- }
-
- @SuppressWarnings("unused")
- public static class BadConstructorEntity2 extends TestBaseEntity {
- private static final long serialVersionUID = 1L;
-
- public BadConstructorEntity2() {
- super(null);
- }
-
- public BadConstructorEntity2(final LogEvent wrappedEvent, final String badParameter) {
- super(wrappedEvent);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntityTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntityTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntityTest.java
deleted file mode 100644
index ed59b53..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntityTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.appender.db.jpa;
-
-import java.util.Map;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.ThreadContext.ContextStack;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.message.Message;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class LogEventEntityTest {
-
- @Test
- public void testToImmutable_AbstractLogEventWrapperEntity() {
- final LogEvent logEvent = new AbstractLogEventWrapperEntity() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Map<String, String> getContextMap() {
- return null;
- }
-
- @Override
- public ContextStack getContextStack() {
- return null;
- }
-
- @Override
- public Level getLevel() {
- return null;
- }
-
- @Override
- public String getLoggerFqcn() {
- return null;
- }
-
- @Override
- public String getLoggerName() {
- return null;
- }
-
- @Override
- public Marker getMarker() {
- return null;
- }
-
- @Override
- public Message getMessage() {
- return null;
- }
-
- @Override
- public long getNanoTime() {
- return 0;
- }
-
- @Override
- public StackTraceElement getSource() {
- return null;
- }
-
- @Override
- public long getThreadId() {
- return 0;
- }
-
- @Override
- public String getThreadName() {
- return null;
- }
-
- @Override
- public int getThreadPriority() {
- return 0;
- }
-
- @Override
- public Throwable getThrown() {
- return null;
- }
-
- @Override
- public ThrowableProxy getThrownProxy() {
- return null;
- }
-
- @Override
- public long getTimeMillis() {
- return 0;
- }
- };
- Assert.assertNotSame(logEvent, logEvent.toImmutable());
- }
-
- @Test
- public void testToImmutable_TestBaseEntity() {
- final LogEvent logEvent = new TestBaseEntity();
- Assert.assertNotSame(logEvent, logEvent.toImmutable());
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
deleted file mode 100644
index 5d4473e..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.appender.db.jpa;
-
-import java.util.Date;
-import java.util.Map;
-
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Convert;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.appender.db.jpa.converter.LevelAttributeConverter;
-import org.apache.logging.log4j.core.appender.db.jpa.converter.MessageAttributeConverter;
-import org.apache.logging.log4j.core.appender.db.jpa.converter.ThrowableAttributeConverter;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.message.Message;
-
-@Entity
-@Table(name = "jpaBaseLogEntry")
-public class TestBaseEntity extends AbstractLogEventWrapperEntity {
- private static final long serialVersionUID = 1L;
-
- private long id = 0L;
-
- public TestBaseEntity() {
- super();
- }
-
- public TestBaseEntity(final LogEvent wrappedEvent) {
- super(wrappedEvent);
- }
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- public long getId() {
- return this.id;
- }
-
- public void setId(final long id) {
- this.id = id;
- }
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "eventDate")
- public Date getEventDate() {
- return new Date(this.getTimeMillis());
- }
-
- public void setEventDate(final Date date) {
- // this entity is write-only
- }
-
- @Override
- @Convert(converter = LevelAttributeConverter.class)
- @Column(name = "level")
- public Level getLevel() {
- return this.getWrappedEvent().getLevel();
- }
-
- @Override
- @Basic
- @Column(name = "logger")
- public String getLoggerName() {
- return this.getWrappedEvent().getLoggerName();
- }
-
- @Override
- @Transient
- public StackTraceElement getSource() {
- return this.getWrappedEvent().getSource();
- }
-
- @Override
- @Convert(converter = MessageAttributeConverter.class)
- @Column(name = "message")
- public Message getMessage() {
- return this.getWrappedEvent().getMessage();
- }
-
- @Override
- @Transient
- public Marker getMarker() {
- return this.getWrappedEvent().getMarker();
- }
-
- @Override
- @Transient
- public long getThreadId() {
- return this.getWrappedEvent().getThreadId();
- }
-
- @Override
- @Transient
- public String getThreadName() {
- return this.getWrappedEvent().getThreadName();
- }
-
- @Override
- @Transient
- public int getThreadPriority() {
- return this.getWrappedEvent().getThreadPriority();
- }
-
- @Override
- @Transient
- public long getTimeMillis() {
- return this.getWrappedEvent().getTimeMillis();
- }
-
- @Override
- @Transient
- public long getNanoTime() {
- return this.getWrappedEvent().getNanoTime();
- }
-
- @Override
- @Convert(converter = ThrowableAttributeConverter.class)
- @Column(name = "exception")
- public Throwable getThrown() {
- return this.getWrappedEvent().getThrown();
- }
-
- @Override
- @Transient
- public ThrowableProxy getThrownProxy() {
- return this.getWrappedEvent().getThrownProxy();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- @Transient
- public Map<String, String> getContextMap() {
- return this.getWrappedEvent().getContextMap();
- }
-
- @Override
- @Transient
- public ReadOnlyStringMap getContextData() {
- return this.getWrappedEvent().getContextData();
- }
-
- @Override
- @Transient
- public ThreadContext.ContextStack getContextStack() {
- return this.getWrappedEvent().getContextStack();
- }
-
- @Override
- @Transient
- public String getLoggerFqcn() {
- return this.getWrappedEvent().getLoggerFqcn();
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java
deleted file mode 100644
index b804078..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.appender.db.jpa;
-
-import java.util.Map;
-
-import javax.persistence.Column;
-import javax.persistence.Convert;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter;
-
-@Entity
-@Table(name = "jpaBasicLogEntry")
-@SuppressWarnings("unused")
-public class TestBasicEntity extends BasicLogEventEntity {
- private static final long serialVersionUID = 1L;
-
- private long id = 0L;
-
- public TestBasicEntity() {
- super();
- }
-
- public TestBasicEntity(final LogEvent wrapped) {
- super(wrapped);
- }
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- public long getId() {
- return this.id;
- }
-
- public void setId(final long id) {
- this.id = id;
- }
-
- @Override
- @Convert(converter = ContextMapJsonAttributeConverter.class)
- @Column(name = "contextMapJson")
- public Map<String, String> getContextMap() {
- return super.getContextMap();
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataAttributeConverterTest.java
deleted file mode 100644
index 41306a1..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataAttributeConverterTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.util.SortedArrayStringMap;
-import org.apache.logging.log4j.util.StringMap;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class ContextDataAttributeConverterTest {
- private ContextDataAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new ContextDataAttributeConverter();
- }
-
- @Test
- public void testConvertToDatabaseColumn01() {
- final StringMap map = new SortedArrayStringMap();
- map.putValue("test1", "another1");
- map.putValue("key2", "value2");
-
- assertEquals("The converted value is not correct.", map.toString(),
- this.converter.convertToDatabaseColumn(map));
- }
-
- @Test
- public void testConvertToDatabaseColumn02() {
- final StringMap map = new SortedArrayStringMap();
- map.putValue("someKey", "coolValue");
- map.putValue("anotherKey", "testValue");
- map.putValue("myKey", "yourValue");
-
- assertEquals("The converted value is not correct.", map.toString(),
- this.converter.convertToDatabaseColumn(map));
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConvertToEntityAttribute() {
- this.converter.convertToEntityAttribute(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataJsonAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataJsonAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataJsonAttributeConverterTest.java
deleted file mode 100644
index 161a23e..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextDataJsonAttributeConverterTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-import org.apache.logging.log4j.util.SortedArrayStringMap;
-import org.apache.logging.log4j.util.StringMap;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class ContextDataJsonAttributeConverterTest {
- private ContextDataJsonAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new ContextDataJsonAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final StringMap map = new SortedArrayStringMap();
- map.putValue("test1", "another1");
- map.putValue("key2", "value2");
-
- final String converted = this.converter.convertToDatabaseColumn(map);
-
- assertNotNull("The converted value should not be null.", converted);
-
- final ReadOnlyStringMap reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", map, reversed);
- }
-
- @Test
- public void testConvert02() {
- final StringMap map = new SortedArrayStringMap();
- map.putValue("someKey", "coolValue");
- map.putValue("anotherKey", "testValue");
- map.putValue("myKey", "yourValue");
-
- final String converted = this.converter.convertToDatabaseColumn(map);
-
- assertNotNull("The converted value should not be null.", converted);
-
- final ReadOnlyStringMap reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", map, reversed);
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java
deleted file mode 100644
index e755d7f..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class ContextMapAttributeConverterTest {
- private ContextMapAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new ContextMapAttributeConverter();
- }
-
- @Test
- public void testConvertToDatabaseColumn01() {
- final Map<String, String> map = new HashMap<>();
- map.put("test1", "another1");
- map.put("key2", "value2");
-
- assertEquals("The converted value is not correct.", map.toString(),
- this.converter.convertToDatabaseColumn(map));
- }
-
- @Test
- public void testConvertToDatabaseColumn02() {
- final Map<String, String> map = new HashMap<>();
- map.put("someKey", "coolValue");
- map.put("anotherKey", "testValue");
- map.put("myKey", "yourValue");
-
- assertEquals("The converted value is not correct.", map.toString(),
- this.converter.convertToDatabaseColumn(map));
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConvertToEntityAttribute() {
- this.converter.convertToEntityAttribute(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java
deleted file mode 100644
index 07af863..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class ContextMapJsonAttributeConverterTest {
- private ContextMapJsonAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new ContextMapJsonAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final Map<String, String> map = new HashMap<>();
- map.put("test1", "another1");
- map.put("key2", "value2");
-
- final String converted = this.converter.convertToDatabaseColumn(map);
-
- assertNotNull("The converted value should not be null.", converted);
-
- final Map<String, String> reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", map, reversed);
- }
-
- @Test
- public void testConvert02() {
- final Map<String, String> map = new HashMap<>();
- map.put("someKey", "coolValue");
- map.put("anotherKey", "testValue");
- map.put("myKey", "yourValue");
-
- final String converted = this.converter.convertToDatabaseColumn(map);
-
- assertNotNull("The converted value should not be null.", converted);
-
- final Map<String, String> reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", map, reversed);
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
deleted file mode 100644
index 57ae0a7..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import java.util.Arrays;
-
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.spi.MutableThreadContextStack;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class ContextStackAttributeConverterTest {
- private ContextStackAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new ContextStackAttributeConverter();
- }
-
- @Test
- public void testConvertToDatabaseColumn01() {
- final ThreadContext.ContextStack stack = new MutableThreadContextStack(
- Arrays.asList("value1", "another2"));
-
- assertEquals("The converted value is not correct.", "value1\nanother2",
- this.converter.convertToDatabaseColumn(stack));
- }
-
- @Test
- public void testConvertToDatabaseColumn02() {
- final ThreadContext.ContextStack stack = new MutableThreadContextStack(
- Arrays.asList("key1", "value2", "my3"));
-
- assertEquals("The converted value is not correct.",
- "key1\nvalue2\nmy3",
- this.converter.convertToDatabaseColumn(stack));
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testConvertToEntityAttribute() {
- this.converter.convertToEntityAttribute(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
deleted file mode 100644
index 0fae006..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Arrays;
-
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.junit.ThreadContextStackRule;
-import org.apache.logging.log4j.spi.MutableThreadContextStack;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(Appenders.Jpa.class)
-public class ContextStackJsonAttributeConverterTest {
- private ContextStackJsonAttributeConverter converter;
-
- @Rule
- public final ThreadContextStackRule threadContextRule = new ThreadContextStackRule();
-
- @Before
- public void setUp() {
- this.converter = new ContextStackJsonAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final ThreadContext.ContextStack stack = new MutableThreadContextStack(
- Arrays.asList("value1", "another2"));
-
- final String converted = this.converter.convertToDatabaseColumn(stack);
-
- assertNotNull("The converted value should not be null.", converted);
-
- final ThreadContext.ContextStack reversed = this.converter
- .convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", stack.asList(),
- reversed.asList());
- }
-
- @Test
- public void testConvert02() {
- final ThreadContext.ContextStack stack = new MutableThreadContextStack(
- Arrays.asList("key1", "value2", "my3"));
-
- final String converted = this.converter.convertToDatabaseColumn(stack);
-
- assertNotNull("The converted value should not be null.", converted);
-
- final ThreadContext.ContextStack reversed = this.converter
- .convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", stack.asList(),
- reversed.asList());
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
deleted file mode 100644
index 334bf1e..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.MarkerManager;
-import org.apache.logging.log4j.categories.Appenders;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class MarkerAttributeConverterTest {
- private MarkerAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new MarkerAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final Marker marker = MarkerManager.getMarker("testConvert01");
-
- final String converted = this.converter.convertToDatabaseColumn(marker);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.", "testConvert01", converted);
-
- final Marker reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
- }
-
- @Test
- public void testConvert02() {
- Marker marker = MarkerManager.getMarker("anotherConvert02").setParents(MarkerManager.getMarker("finalConvert03"));
- marker = MarkerManager.getMarker("testConvert02").setParents(marker);
-
- final String converted = this.converter.convertToDatabaseColumn(marker);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ]",
- converted);
-
- final Marker reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
- final Marker[] parents = marker.getParents();
- assertNotNull("The first parent should not be null.", parents);
- assertNotNull("The first parent should not be null.", parents[0]);
- assertEquals("The first parent is not correct.", "anotherConvert02", parents[0].getName());
- assertNotNull("The second parent should not be null.", parents[0].getParents());
- assertNotNull("The second parent should not be null.", parents[0].getParents()[0]);
- assertEquals("The second parent is not correct.", "finalConvert03", parents[0].getParents()[0].getName());
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
deleted file mode 100644
index e665dd6..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.apache.logging.log4j.message.Message;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class MessageAttributeConverterTest {
- private static final StatusLogger LOGGER = StatusLogger.getLogger();
-
- private MessageAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new MessageAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final Message message = LOGGER.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
-
- final String converted = this.converter.convertToDatabaseColumn(message);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
-
- final Message reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
deleted file mode 100644
index 6da0d93..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class StackTraceElementAttributeConverterTest {
- private StackTraceElementAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new StackTraceElementAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
-
- final String converted = this.converter.convertToDatabaseColumn(element);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
- converted);
-
- final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
- assertEquals("The method name is not correct.", "testConvert01", reversed.getMethodName());
- assertEquals("The file name is not correct.", "TestNoPackage.java", reversed.getFileName());
- assertEquals("The line number is not correct.", 1234, reversed.getLineNumber());
- assertFalse("The native flag should be false.", reversed.isNativeMethod());
- }
-
- @Test
- public void testConvert02() {
- final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
- "testConvert02", "TestWithPackage.java", -1);
-
- final String converted = this.converter.convertToDatabaseColumn(element);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.",
- "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
- converted);
-
- final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
- assertEquals("The method name is not correct.", "testConvert02", reversed.getMethodName());
- assertEquals("The file name is not correct.", "TestWithPackage.java", reversed.getFileName());
- assertEquals("The line number is not correct.", -1, reversed.getLineNumber());
- assertFalse("The native flag should be false.", reversed.isNativeMethod());
- }
-
- @Test
- public void testConvert03() {
- final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
- "testConvert03", null, -1);
-
- final String converted = this.converter.convertToDatabaseColumn(element);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.",
- "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
- converted);
-
- final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
- assertEquals("The method name is not correct.", "testConvert03", reversed.getMethodName());
- assertEquals("The file name is not correct.", null, reversed.getFileName());
- assertEquals("The line number is not correct.", -1, reversed.getLineNumber());
- assertFalse("The native flag should be false.", reversed.isNativeMethod());
- }
-
- @Test
- public void testConvert04() {
- final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
- "testConvert04", null, -2);
-
- final String converted = this.converter.convertToDatabaseColumn(element);
-
- assertNotNull("The converted value should not be null.", converted);
- assertEquals("The converted value is not correct.",
- "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
- converted);
-
- final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
- reversed.getClassName());
- assertEquals("The method name is not correct.", "testConvert04", reversed.getMethodName());
- assertEquals("The file name is not correct.", null, reversed.getFileName());
- assertEquals("The line number is not correct.", -2, reversed.getLineNumber());
- assertTrue("The native flag should be true.", reversed.isNativeMethod());
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
deleted file mode 100644
index 95deb6f..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.appender.db.jpa.converter;
-
-import java.sql.SQLException;
-
-import org.apache.logging.log4j.categories.Appenders;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-@Category(Appenders.Jpa.class)
-public class ThrowableAttributeConverterTest {
- private ThrowableAttributeConverter converter;
-
- @Before
- public void setUp() {
- this.converter = new ThrowableAttributeConverter();
- }
-
- @Test
- public void testConvert01() {
- final RuntimeException exception = new RuntimeException("My message 01.");
-
- final String stackTrace = getStackTrace(exception);
-
- final String converted = this.converter.convertToDatabaseColumn(exception);
-
- assertNotNull("The converted value is not correct.", converted);
- assertEquals("The converted value is not correct.", stackTrace, converted);
-
- final Throwable reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
- }
-
- @Test
- public void testConvert02() {
- final SQLException cause2 = new SQLException("This is a test cause.");
- final Error cause1 = new Error(cause2);
- final RuntimeException exception = new RuntimeException("My message 01.", cause1);
-
- final String stackTrace = getStackTrace(exception);
-
- final String converted = this.converter.convertToDatabaseColumn(exception);
-
- assertNotNull("The converted value is not correct.", converted);
- assertEquals("The converted value is not correct.", stackTrace, converted);
-
- final Throwable reversed = this.converter.convertToEntityAttribute(converted);
-
- assertNotNull("The reversed value should not be null.", reversed);
- assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
- }
-
- @Test
- public void testConvertNullToDatabaseColumn() {
- assertNull("The converted value should be null.", this.converter.convertToDatabaseColumn(null));
- }
-
- @Test
- public void testConvertNullOrBlankToEntityAttribute() {
- assertNull("The converted attribute should be null (1).", this.converter.convertToEntityAttribute(null));
- assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
- }
-
- private static String getStackTrace(final Throwable throwable) {
- String returnValue = throwable.toString() + '\n';
-
- for (final StackTraceElement element : throwable.getStackTrace()) {
- returnValue += "\tat " + element.toString() + '\n';
- }
-
- if (throwable.getCause() != null) {
- returnValue += "Caused by " + getStackTrace(throwable.getCause());
- }
-
- return returnValue;
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/META-INF/persistence.xml b/log4j-core/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index c174abc..0000000
--- a/log4j-core/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
-
--->
-<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
- http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
- version="2.1">
-
- <persistence-unit name="hyperSqlJpaAppenderTestUnit">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackJsonAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.LevelAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.MarkerAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.MessageAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.StackTraceElementAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ThrowableAttributeConverter</class>
- <exclude-unlisted-classes>false</exclude-unlisted-classes>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
- <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:Log4j;ifexists=true"/>
- <property name="javax.persistence.jdbc.user" value="sa"/>
- <property name="javax.persistence.jdbc.password" value=""/>
- <!--<property name="eclipselink.logging.level" value="FINE"/>
- <property name="eclipselink.logging.level.sql" value="FINE"/>
- <property name="eclipselink.logging.parameters" value="true"/> uncomment to troubleshoot SQL-->
- </properties>
- </persistence-unit>
-
- <persistence-unit name="h2JpaAppenderTestUnit">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextMapJsonAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ContextStackJsonAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.LevelAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.MarkerAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.MessageAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.StackTraceElementAttributeConverter</class>
- <class>org.apache.logging.log4j.core.appender.db.jpa.converter.ThrowableAttributeConverter</class>
- <exclude-unlisted-classes>false</exclude-unlisted-classes>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:Log4j"/>
- <property name="javax.persistence.jdbc.user" value="sa"/>
- <property name="javax.persistence.jdbc.password" value=""/>
- <!--<property name="eclipselink.logging.level" value="FINE"/>
- <property name="eclipselink.logging.level.sql" value="FINE"/>
- <property name="eclipselink.logging.parameters" value="true"/> uncomment to troubleshoot SQL-->
- </properties>
- </persistence-unit>
-
-</persistence>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml b/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
deleted file mode 100644
index ad22f65..0000000
--- a/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<Configuration status="OFF">
-
- <Appenders>
- <Console name="STDOUT">
- <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
- </Console>
- <Jpa name="databaseAppender" persistenceUnitName="h2JpaAppenderTestUnit"
- entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBaseEntity" ignoreExceptions="false" />
- </Appenders>
-
- <Loggers>
- <Logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
- <AppenderRef ref="databaseAppender" />
- </Logger>
-
- <Root level="fatal">
- <AppenderRef ref="STDOUT"/>
- </Root>
- </Loggers>
-
-</Configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/df10e02a/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml b/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
deleted file mode 100644
index af3a0b7..0000000
--- a/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<Configuration status="OFF">
-
- <Appenders>
- <Console name="STDOUT">
- <PatternLayout pattern="%C{1.} %m %level MDC%X%n"/>
- </Console>
- <Jpa name="databaseAppender" persistenceUnitName="h2JpaAppenderTestUnit"
- entityClassName="org.apache.logging.log4j.core.appender.db.jpa.TestBasicEntity" ignoreExceptions="false" />
- </Appenders>
-
- <Loggers>
- <Logger name="org.apache.logging.log4j.core.appender.db" level="debug" additivity="false">
- <AppenderRef ref="databaseAppender" />
- </Logger>
-
- <Root level="fatal">
- <AppenderRef ref="STDOUT"/>
- </Root>
- </Loggers>
-
-</Configuration>