Merge branch 'release/os/4.9' into adel/merge-from-OS4.10-7Mar23

This commit is contained in:
Adel El-Beik 2023-03-07 12:12:55 +00:00
commit 2808347b58
2 changed files with 60 additions and 6 deletions

View File

@ -29,6 +29,7 @@ import rx.Observable
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths
import java.time.Duration
import java.util.concurrent.atomic.AtomicInteger
/**
@ -216,7 +217,8 @@ fun <A> driver(defaultParameters: DriverParameters = DriverParameters(), dsl: Dr
djvmCordaSource = defaultParameters.djvmCordaSource,
environmentVariables = defaultParameters.environmentVariables,
allowHibernateToManageAppSchema = defaultParameters.allowHibernateToManageAppSchema,
premigrateH2Database = defaultParameters.premigrateH2Database
premigrateH2Database = defaultParameters.premigrateH2Database,
notaryHandleTimeout = defaultParameters.notaryHandleTimeout
),
coerce = { it },
dsl = dsl
@ -256,6 +258,8 @@ fun <A> driver(defaultParameters: DriverParameters = DriverParameters(), dsl: Dr
* @property djvmBootstrapSource Location of a JAR containing the Java APIs for the DJVM to use.
* @property djvmCordaSource Locations of JARs of user-supplied classes to execute within the DJVM sandbox.
* @property premigrateH2Database Whether to use a prebuilt H2 database schema or start from an empty schema.
* @property notaryHandleTimeout Specifies how long to wait to receive a notary handle. This waiting includes waiting for
* the notary to start.
* This can save time for tests which do not need to migrate from a blank schema.
*/
@Suppress("unused")
@ -281,7 +285,8 @@ data class DriverParameters(
val djvmCordaSource: List<Path> = emptyList(),
val environmentVariables: Map<String, String> = emptyMap(),
val allowHibernateToManageAppSchema: Boolean = true,
val premigrateH2Database: Boolean = true
val premigrateH2Database: Boolean = true,
val notaryHandleTimeout: Duration = Duration.ofMinutes(1)
) {
constructor(cordappsForAllNodes: Collection<TestCordapp>) : this(isDebug = false, cordappsForAllNodes = cordappsForAllNodes)
@ -464,6 +469,51 @@ data class DriverParameters(
cordappsForAllNodes = null
)
constructor(
isDebug: Boolean,
driverDirectory: Path,
portAllocation: PortAllocation,
debugPortAllocation: PortAllocation,
systemProperties: Map<String, String>,
useTestClock: Boolean,
startNodesInProcess: Boolean,
waitForAllNodesToFinish: Boolean,
notarySpecs: List<NotarySpec>,
extraCordappPackagesToScan: List<String>,
jmxPolicy: JmxPolicy,
networkParameters: NetworkParameters,
notaryCustomOverrides: Map<String, Any?>,
inMemoryDB: Boolean,
cordappsForAllNodes: Collection<TestCordapp>?,
djvmBootstrapSource: Path?,
djvmCordaSource: List<Path>,
environmentVariables: Map<String, String>,
allowHibernateToManageAppSchema: Boolean,
premigrateH2Database: Boolean
) : this(
isDebug,
driverDirectory,
portAllocation,
debugPortAllocation,
systemProperties,
useTestClock,
startNodesInProcess,
waitForAllNodesToFinish,
notarySpecs,
extraCordappPackagesToScan,
jmxPolicy,
networkParameters,
notaryCustomOverrides,
inMemoryDB,
cordappsForAllNodes,
djvmBootstrapSource,
djvmCordaSource,
environmentVariables,
allowHibernateToManageAppSchema,
premigrateH2Database,
notaryHandleTimeout = Duration.ofMinutes(1)
)
fun withIsDebug(isDebug: Boolean): DriverParameters = copy(isDebug = isDebug)
fun withDriverDirectory(driverDirectory: Path): DriverParameters = copy(driverDirectory = driverDirectory)
fun withPortAllocation(portAllocation: PortAllocation): DriverParameters = copy(portAllocation = portAllocation)
@ -487,6 +537,7 @@ data class DriverParameters(
fun withDjvmCordaSource(djvmCordaSource: List<Path>): DriverParameters = copy(djvmCordaSource = djvmCordaSource)
fun withEnvironmentVariables(variables: Map<String, String>): DriverParameters = copy(environmentVariables = variables)
fun withAllowHibernateToManageAppSchema(value: Boolean): DriverParameters = copy(allowHibernateToManageAppSchema = value)
fun withNotaryHandleTimeout(value: Duration): DriverParameters = copy(notaryHandleTimeout = value)
fun copy(
isDebug: Boolean,

View File

@ -154,7 +154,8 @@ class DriverDSLImpl(
val djvmCordaSource: List<Path>,
val environmentVariables: Map<String, String>,
val allowHibernateToManageAppSchema: Boolean = true,
val premigrateH2Database: Boolean = true
val premigrateH2Database: Boolean = true,
val notaryHandleTimeout: Duration = Duration.ofMinutes(1)
) : InternalDriverDSL {
private var _executorService: ScheduledExecutorService? = null
@ -854,7 +855,6 @@ class DriverDSLImpl(
// While starting with inProcess mode, we need to have different names to avoid clashes
private val inMemoryCounter = AtomicInteger()
private val notaryHandleTimeout = Duration.ofMinutes(1)
private val defaultRpcUserList = listOf(InternalUser("default", "default", setOf("ALL")).toConfig().root().unwrapped())
private val names = arrayOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME)
@ -1332,7 +1332,8 @@ fun <DI : DriverDSL, D : InternalDriverDSL, A> genericDriver(
djvmCordaSource = defaultParameters.djvmCordaSource,
environmentVariables = defaultParameters.environmentVariables,
allowHibernateToManageAppSchema = defaultParameters.allowHibernateToManageAppSchema,
premigrateH2Database = defaultParameters.premigrateH2Database
premigrateH2Database = defaultParameters.premigrateH2Database,
notaryHandleTimeout = defaultParameters.notaryHandleTimeout
)
)
val shutdownHook = addShutdownHook(driverDsl::shutdown)
@ -1432,6 +1433,7 @@ fun <A> internalDriver(
environmentVariables: Map<String, String> = emptyMap(),
allowHibernateToManageAppSchema: Boolean = true,
premigrateH2Database: Boolean = true,
notaryHandleTimeout: Duration = Duration.ofMinutes(1),
dsl: DriverDSLImpl.() -> A
): A {
return genericDriver(
@ -1456,7 +1458,8 @@ fun <A> internalDriver(
djvmCordaSource = djvmCordaSource,
environmentVariables = environmentVariables,
allowHibernateToManageAppSchema = allowHibernateToManageAppSchema,
premigrateH2Database = premigrateH2Database
premigrateH2Database = premigrateH2Database,
notaryHandleTimeout = notaryHandleTimeout
),
coerce = { it },
dsl = dsl