From ac83f3e62faa60c2e925bb83f997f619391cc819 Mon Sep 17 00:00:00 2001 From: Gavin Date: Sat, 13 May 2023 21:24:12 +0200 Subject: [PATCH] improve the aesthetics of some quite ugly log messages --- .../internal/JtaPlatformInitiator.java | 7 +- .../hibernate/internal/CoreMessageLogger.java | 72 ++++++++++--------- .../exec/GenerationTargetToDatabase.java | 4 +- .../exec/ScriptSourceInputAggregate.java | 18 ++--- .../ScriptSourceInputNonExistentImpl.java | 5 ++ .../tool/schema/spi/ScriptSourceInput.java | 4 ++ .../tool/schema/JtaPlatformLoggingTest.java | 7 +- 7 files changed, 68 insertions(+), 49 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JtaPlatformInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JtaPlatformInitiator.java index c808ded97e..4a0ff04545 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JtaPlatformInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JtaPlatformInitiator.java @@ -48,7 +48,12 @@ public class JtaPlatformInitiator implements StandardServiceInitiator list = new ArrayList<>( size ); diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/exec/ScriptSourceInputNonExistentImpl.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/exec/ScriptSourceInputNonExistentImpl.java index 1eee1a192a..c3e5d105e9 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/exec/ScriptSourceInputNonExistentImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/exec/ScriptSourceInputNonExistentImpl.java @@ -49,4 +49,9 @@ public class ScriptSourceInputNonExistentImpl extends AbstractScriptSourceInput public List extract(Function> extractor) { return Collections.emptyList(); } + + @Override + public boolean exists() { + return false; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/ScriptSourceInput.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/ScriptSourceInput.java index f12c2c7305..5c6a25c842 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/ScriptSourceInput.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/ScriptSourceInput.java @@ -32,4 +32,8 @@ public interface ScriptSourceInput { return false; } + default boolean exists() { + return true; + } + } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/JtaPlatformLoggingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/JtaPlatformLoggingTest.java index 715d47b7a4..7f66e42775 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/JtaPlatformLoggingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/JtaPlatformLoggingTest.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.jboss.logging.Logger; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * @author Vlad Mihalcea @@ -47,10 +47,7 @@ public class JtaPlatformLoggingTest extends BaseNonConfigCoreFunctionalTestCase @Test public void test() { - assertEquals( - "HHH000490: Using JtaPlatform implementation: [org.hibernate.testing.jta.TestingJtaPlatformImpl]", - triggerable.triggerMessage() - ); + assertTrue( triggerable.triggerMessage().startsWith("HHH000490: Using JTA platform")); } @Override