mirror of
https://github.com/corda/corda.git
synced 2025-01-15 01:10:33 +00:00
[ENT-1153]: fix merge
This commit is contained in:
parent
a982bb2ae6
commit
7d75d95dc2
@ -47,7 +47,8 @@ data class DatabaseConfig(
|
|||||||
val initDatabase: Boolean = true,
|
val initDatabase: Boolean = true,
|
||||||
val serverNameTablePrefix: String = "",
|
val serverNameTablePrefix: String = "",
|
||||||
val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ,
|
val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ,
|
||||||
val schema: String? = null
|
val schema: String? = null,
|
||||||
|
val nodeOrganizationName: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class TransactionIsolationLevel {
|
enum class TransactionIsolationLevel {
|
||||||
|
@ -24,6 +24,7 @@ import net.corda.node.services.config.VerifierType
|
|||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
||||||
|
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +65,7 @@ fun testNodeConfiguration(
|
|||||||
doReturn(emptyList<User>()).whenever(it).rpcUsers
|
doReturn(emptyList<User>()).whenever(it).rpcUsers
|
||||||
doReturn(null).whenever(it).notary
|
doReturn(null).whenever(it).notary
|
||||||
doReturn(makeTestDataSourceProperties(myLegalName.organisation)).whenever(it).dataSourceProperties
|
doReturn(makeTestDataSourceProperties(myLegalName.organisation)).whenever(it).dataSourceProperties
|
||||||
doReturn(DatabaseConfig(serverNameTablePrefix = myLegalName.organisation)).whenever(it).database
|
doReturn(makeTestDatabaseProperties(myLegalName.organisation)).whenever(it).database
|
||||||
doReturn("").whenever(it).emailAddress
|
doReturn("").whenever(it).emailAddress
|
||||||
doReturn("").whenever(it).exportJMXto
|
doReturn("").whenever(it).exportJMXto
|
||||||
doReturn(true).whenever(it).devMode
|
doReturn(true).whenever(it).devMode
|
||||||
|
@ -41,6 +41,7 @@ import net.corda.node.utilities.CordaPersistence
|
|||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.node.MockServices.Companion.MOCK_VERSION_INFO
|
import net.corda.testing.node.MockServices.Companion.MOCK_VERSION_INFO
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
||||||
|
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties
|
||||||
import net.corda.testing.setGlobalSerialization
|
import net.corda.testing.setGlobalSerialization
|
||||||
import net.corda.testing.testNodeConfiguration
|
import net.corda.testing.testNodeConfiguration
|
||||||
import org.apache.activemq.artemis.utils.ReusableLatch
|
import org.apache.activemq.artemis.utils.ReusableLatch
|
||||||
@ -364,7 +365,7 @@ class MockNetwork(defaultParameters: MockNetworkParameters = MockNetworkParamete
|
|||||||
baseDirectory = baseDirectory(id).createDirectories(),
|
baseDirectory = baseDirectory(id).createDirectories(),
|
||||||
myLegalName = parameters.legalName ?: CordaX500Name(organisation = "Mock Company $id", locality = "London", country = "GB")).also {
|
myLegalName = parameters.legalName ?: CordaX500Name(organisation = "Mock Company $id", locality = "London", country = "GB")).also {
|
||||||
doReturn(makeTestDataSourceProperties("node_$id", "net_$networkId")).whenever(it).dataSourceProperties
|
doReturn(makeTestDataSourceProperties("node_$id", "net_$networkId")).whenever(it).dataSourceProperties
|
||||||
doReturn(DatabaseConfig()).whenever(it).database
|
doReturn(makeTestDatabaseProperties("node_$id")).whenever(it).database
|
||||||
parameters.configOverrides(it)
|
parameters.configOverrides(it)
|
||||||
}
|
}
|
||||||
val node = nodeFactory(MockNodeArgs(config, this, id, parameters.entropyRoot))
|
val node = nodeFactory(MockNodeArgs(config, this, id, parameters.entropyRoot))
|
||||||
|
@ -103,6 +103,15 @@ open class MockServices(
|
|||||||
return props
|
return props
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make properties appropriate for creating a Database for unit tests.
|
||||||
|
*
|
||||||
|
* @param nodeName Reflects the "instance" of the in-memory database or database username/schema.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun makeTestDatabaseProperties(nodeName: String? = null): DatabaseConfig =
|
||||||
|
DatabaseConfig(nodeOrganizationName = nodeName)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of [InMemoryIdentityService] with [MOCK_IDENTITIES].
|
* Creates an instance of [InMemoryIdentityService] with [MOCK_IDENTITIES].
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user