You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2023/01/24 08:42:08 UTC
[logging-log4j2] 02/02: Fix JPA tests (switch to Postgres compatibility)
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 9c4b8e054534172908795e70bd264388158c3354
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Tue Jan 24 09:25:09 2023 +0100
Fix JPA tests (switch to Postgres compatibility)
---
.../org/apache/logging/log4j/jpa/appender/JpaH2AppenderTest.java | 4 ++--
log4j-jpa/src/test/resources/META-INF/persistence.xml | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/log4j-jpa/src/test/java/org/apache/logging/log4j/jpa/appender/JpaH2AppenderTest.java b/log4j-jpa/src/test/java/org/apache/logging/log4j/jpa/appender/JpaH2AppenderTest.java
index c3439cc615..cfb9adb5d1 100644
--- a/log4j-jpa/src/test/java/org/apache/logging/log4j/jpa/appender/JpaH2AppenderTest.java
+++ b/log4j-jpa/src/test/java/org/apache/logging/log4j/jpa/appender/JpaH2AppenderTest.java
@@ -40,13 +40,13 @@ public class JpaH2AppenderTest extends AbstractJpaAppenderTest {
try (Statement statement = connection.createStatement()) {
statement.executeUpdate("CREATE TABLE jpaBaseLogEntry ( "
- + "id INTEGER IDENTITY, eventDate DATETIME, instant NVARCHAR(64), level NVARCHAR(10), "
+ + "id INTEGER GENERATED ALWAYS AS IDENTITY, eventDate DATETIME, instant NVARCHAR(64), 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, instant NVARCHAR(64), nanoTime BIGINT, "
+ + "id INTEGER GENERATED ALWAYS AS IDENTITY, timemillis BIGINT, instant NVARCHAR(64), 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),"
diff --git a/log4j-jpa/src/test/resources/META-INF/persistence.xml b/log4j-jpa/src/test/resources/META-INF/persistence.xml
index 209ae2176e..8b4e1d2c71 100644
--- a/log4j-jpa/src/test/resources/META-INF/persistence.xml
+++ b/log4j-jpa/src/test/resources/META-INF/persistence.xml
@@ -63,9 +63,14 @@
<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.url" value="jdbc:h2:mem:Log4j;MODE=PostgreSQL"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
+ <!--
+ Until the issue in https://github.com/eclipse-ee4j/eclipselink/issues/1393
+ we run in PostgreSQL compatibility mode.
+ -->
+ <property name="eclipselink.target-database" value="PostgreSQL"/>
<!--<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-->