From eece1e923cb978dbe516dcbe1879dc285fffa9db Mon Sep 17 00:00:00 2001 From: chriscochrane Date: Fri, 25 Oct 2024 15:25:59 +0100 Subject: [PATCH] Mocknetwork remove hibernate sessions on stop --- testing/node-driver/build.gradle | 1 + .../net/corda/testing/node/internal/InternalMockNetwork.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/testing/node-driver/build.gradle b/testing/node-driver/build.gradle index 8d1a6f8b31..f334ce4871 100644 --- a/testing/node-driver/build.gradle +++ b/testing/node-driver/build.gradle @@ -101,6 +101,7 @@ dependencies { } implementation "co.paralleluniverse:quasar-core:$quasar_version" + implementation "org.hibernate:hibernate-core:$hibernate_version" } compileJava { diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt index 1c508d2edd..640705903a 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt @@ -83,6 +83,7 @@ import java.time.Clock import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicReference +import org.hibernate.internal.SessionFactoryRegistry import kotlin.io.path.createDirectories import kotlin.io.path.deleteIfExists import kotlin.io.path.div @@ -620,6 +621,7 @@ open class InternalMockNetwork(cordappPackages: List = emptyList(), } messagingNetwork.stop() } + SessionFactoryRegistry.INSTANCE.clearRegistrations() } /** Block until all scheduled activity, active flows and network activity has ceased. */