[ENT-1153]: fix merge

This commit is contained in:
Tudor Malene 2017-11-28 10:42:40 +00:00 committed by tudor.malene@gmail.com
parent a982bb2ae6
commit 7d75d95dc2
4 changed files with 15 additions and 3 deletions

View File

@ -47,7 +47,8 @@ data class DatabaseConfig(
val initDatabase: Boolean = true,
val serverNameTablePrefix: String = "",
val transactionIsolationLevel: TransactionIsolationLevel = TransactionIsolationLevel.REPEATABLE_READ,
val schema: String? = null
val schema: String? = null,
val nodeOrganizationName: String? = null
)
enum class TransactionIsolationLevel {

View File

@ -24,6 +24,7 @@ import net.corda.node.services.config.VerifierType
import net.corda.nodeapi.User
import net.corda.testing.node.MockServices
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties
import java.nio.file.Path
/**
@ -64,7 +65,7 @@ fun testNodeConfiguration(
doReturn(emptyList<User>()).whenever(it).rpcUsers
doReturn(null).whenever(it).notary
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).exportJMXto
doReturn(true).whenever(it).devMode

View File

@ -41,6 +41,7 @@ import net.corda.node.utilities.CordaPersistence
import net.corda.testing.DUMMY_NOTARY
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.makeTestDatabaseProperties
import net.corda.testing.setGlobalSerialization
import net.corda.testing.testNodeConfiguration
import org.apache.activemq.artemis.utils.ReusableLatch
@ -364,7 +365,7 @@ class MockNetwork(defaultParameters: MockNetworkParameters = MockNetworkParamete
baseDirectory = baseDirectory(id).createDirectories(),
myLegalName = parameters.legalName ?: CordaX500Name(organisation = "Mock Company $id", locality = "London", country = "GB")).also {
doReturn(makeTestDataSourceProperties("node_$id", "net_$networkId")).whenever(it).dataSourceProperties
doReturn(DatabaseConfig()).whenever(it).database
doReturn(makeTestDatabaseProperties("node_$id")).whenever(it).database
parameters.configOverrides(it)
}
val node = nodeFactory(MockNodeArgs(config, this, id, parameters.entropyRoot))

View File

@ -103,6 +103,15 @@ open class MockServices(
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].
*/