Add db integration test setup for new tests (#197)

* Added db test setup for NetworkMapTest and NodeRegistrationTest.
* Removed database.serverNameTablePrefix property setup for notaries in DriveDSL (after rebase from OS)
* Add missing schemas for Azure master database setup.
This commit is contained in:
szymonsztuka 2017-12-14 17:33:59 +00:00 committed by GitHub
parent 2f246afc28
commit 9600622db7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 10 deletions

View File

@ -2,9 +2,8 @@ package net.corda.node.services.network
import net.corda.core.node.NodeInfo
import net.corda.core.utilities.seconds
import net.corda.testing.*
import net.corda.testing.node.internal.CompatibilityZoneParams
import net.corda.testing.ALICE_NAME
import net.corda.testing.BOB_NAME
import net.corda.testing.driver.NodeHandle
import net.corda.testing.driver.PortAllocation
import net.corda.testing.node.internal.internalDriver
@ -12,10 +11,16 @@ import net.corda.testing.node.network.NetworkMapServer
import org.assertj.core.api.Assertions.assertThat
import org.junit.After
import org.junit.Before
import org.junit.ClassRule
import org.junit.Test
import java.net.URL
class NetworkMapTest {
class NetworkMapTest : IntegrationTest() {
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas(ALICE_NAME.toDatabaseSchemaName(), BOB_NAME.toDatabaseSchemaName(),
DUMMY_NOTARY_NAME.toDatabaseSchemaName())
}
private val cacheTimeout = 1.seconds
private val portAllocation = PortAllocation.Incremental(10000)

View File

@ -14,16 +14,21 @@ import net.corda.nodeapi.internal.crypto.X509Utilities
import net.corda.nodeapi.internal.crypto.X509Utilities.CORDA_CLIENT_CA
import net.corda.nodeapi.internal.crypto.X509Utilities.CORDA_INTERMEDIATE_CA
import net.corda.nodeapi.internal.crypto.X509Utilities.CORDA_ROOT_CA
import net.corda.testing.ALICE_NAME
import net.corda.testing.IntegrationTest
import net.corda.testing.IntegrationTestSchemas
import net.corda.testing.node.internal.CompatibilityZoneParams
import net.corda.testing.driver.PortAllocation
import net.corda.testing.node.internal.internalDriver
import net.corda.testing.node.network.NetworkMapServer
import net.corda.testing.toDatabaseSchemaName
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatThrownBy
import org.bouncycastle.pkcs.PKCS10CertificationRequest
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest
import org.junit.After
import org.junit.Before
import org.junit.ClassRule
import org.junit.Test
import java.io.ByteArrayOutputStream
import java.io.InputStream
@ -37,7 +42,12 @@ import javax.ws.rs.*
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
class NodeRegistrationTest {
class NodeRegistrationTest : IntegrationTest() {
companion object {
@ClassRule @JvmField
val databaseSchemas = IntegrationTestSchemas("Alice")
}
private val portAllocation = PortAllocation.Incremental(13000)
private val rootCertAndKeyPair = createSelfKeyAndSelfSignedCertificate()
private val registrationHandler = RegistrationHandler(rootCertAndKeyPair)

View File

@ -426,9 +426,7 @@ class DriverDSLImpl(
providedName = nodeNames[0],
rpcUsers = spec.rpcUsers,
verifierType = spec.verifierType,
customOverrides = notaryConfig(clusterAddress) + mapOf(
"database.serverNameTablePrefix" to nodeNames[0].toString().replace(Regex("[^0-9A-Za-z]+"), "")
)
customOverrides = notaryConfig(clusterAddress) //TODO discrepancy with OS - check if 'serverNameTablePrefix' can be removed in OS
)
// All other nodes will join the cluster
@ -438,9 +436,7 @@ class DriverDSLImpl(
providedName = it,
rpcUsers = spec.rpcUsers,
verifierType = spec.verifierType,
customOverrides = notaryConfig(nodeAddress, clusterAddress) + mapOf(
"database.serverNameTablePrefix" to it.toString().replace(Regex("[^0-9A-Za-z]+"), "")
)
customOverrides = notaryConfig(nodeAddress, clusterAddress) //TODO discrepancy with OS - check if 'serverNameTablePrefix' can be removed in OS
)
}

View File

@ -1,4 +1,5 @@
--once off script to run against master database (not a user database)
CREATE LOGIN Alice WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN AliceCorp WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN AliceCorp_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN AliceCorp_10003 WITH PASSWORD = 'yourStrong(!)Password';
@ -10,6 +11,8 @@ CREATE LOGIN BankA_10003 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankA_10006 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankA_10012 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankB WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BankOfCorda WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BigCorporation WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc_10000 WITH PASSWORD = 'yourStrong(!)Password';
CREATE LOGIN BobPlc_10003 WITH PASSWORD = 'yourStrong(!)Password';