Fix broken doorman tests after OS -> ENT merge

This commit is contained in:
Katarzyna Streich 2017-12-14 11:25:02 +00:00
parent a260d7eb0b
commit 158993edb1
2 changed files with 21 additions and 16 deletions

View File

@ -12,6 +12,7 @@ import net.corda.core.crypto.sign
import net.corda.core.identity.CordaX500Name import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.PartyAndCertificate import net.corda.core.identity.PartyAndCertificate
import net.corda.core.internal.cert import net.corda.core.internal.cert
import net.corda.core.internal.createDirectories
import net.corda.core.node.NodeInfo import net.corda.core.node.NodeInfo
import net.corda.core.serialization.serialize import net.corda.core.serialization.serialize
import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.NetworkHostAndPort
@ -26,7 +27,6 @@ import net.corda.testing.SerializationEnvironmentRule
import net.corda.testing.common.internal.testNetworkParameters import net.corda.testing.common.internal.testNetworkParameters
import net.corda.testing.node.testNodeConfiguration import net.corda.testing.node.testNodeConfiguration
import org.bouncycastle.cert.X509CertificateHolder import org.bouncycastle.cert.X509CertificateHolder
import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.rules.TemporaryFolder import org.junit.rules.TemporaryFolder
@ -44,8 +44,6 @@ class DoormanIntegrationTest {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule(true) val testSerialization = SerializationEnvironmentRule(true)
// TODO: fix me (see commented out code in this test)
@Ignore
@Test @Test
fun `initial registration`() { fun `initial registration`() {
val rootCertAndKey = createDoormanRootCertificateAndKeyPair() val rootCertAndKey = createDoormanRootCertificateAndKeyPair()
@ -62,8 +60,12 @@ class DoormanIntegrationTest {
whenever(it.compatibilityZoneURL).thenReturn(URL("http://${doormanHostAndPort.host}:${doormanHostAndPort.port}")) whenever(it.compatibilityZoneURL).thenReturn(URL("http://${doormanHostAndPort.host}:${doormanHostAndPort.port}"))
whenever(it.emailAddress).thenReturn("iTest@R3.com") whenever(it.emailAddress).thenReturn("iTest@R3.com")
} }
// config.rootCaCertFile.parent.createDirectories()
// X509Utilities.saveCertificateAsPEMFile(rootCertAndKey.certificate.toX509Certificate(), config.rootCaCertFile) config.trustStoreFile.parent.createDirectories()
loadOrCreateKeyStore(config.trustStoreFile, config.trustStorePassword).also {
it.addOrReplaceCertificate(X509Utilities.CORDA_ROOT_CA, rootCertAndKey.certificate.cert)
it.save(config.trustStoreFile, config.trustStorePassword)
}
NetworkRegistrationHelper(config, HTTPNetworkRegistrationService(config.compatibilityZoneURL!!)).buildKeystore() NetworkRegistrationHelper(config, HTTPNetworkRegistrationService(config.compatibilityZoneURL!!)).buildKeystore()
@ -95,8 +97,6 @@ class DoormanIntegrationTest {
doorman.close() doorman.close()
} }
// TODO: fix me (see commented out code in this test)
@Ignore
@Test @Test
fun `nodeInfo is published to the network map`() { fun `nodeInfo is published to the network map`() {
// Given // Given
@ -114,8 +114,12 @@ class DoormanIntegrationTest {
whenever(it.compatibilityZoneURL).thenReturn(URL("http://${doormanHostAndPort.host}:${doormanHostAndPort.port}")) whenever(it.compatibilityZoneURL).thenReturn(URL("http://${doormanHostAndPort.host}:${doormanHostAndPort.port}"))
whenever(it.emailAddress).thenReturn("iTest@R3.com") whenever(it.emailAddress).thenReturn("iTest@R3.com")
} }
// config.rootCaCertFile.parent.createDirectories()
// X509Utilities.saveCertificateAsPEMFile(rootCertAndKey.certificate.toX509Certificate(), config.rootCaCertFile) config.trustStoreFile.parent.createDirectories()
loadOrCreateKeyStore(config.trustStoreFile, config.trustStorePassword).also {
it.addOrReplaceCertificate(X509Utilities.CORDA_ROOT_CA, rootCertAndKey.certificate.cert)
it.save(config.trustStoreFile, config.trustStorePassword)
}
NetworkRegistrationHelper(config, HTTPNetworkRegistrationService(config.compatibilityZoneURL!!)).buildKeystore() NetworkRegistrationHelper(config, HTTPNetworkRegistrationService(config.compatibilityZoneURL!!)).buildKeystore()

View File

@ -15,13 +15,14 @@ import com.r3.corda.networkmanage.hsm.persistence.SignedCertificateRequestStorag
import com.r3.corda.networkmanage.hsm.signer.HsmCsrSigner import com.r3.corda.networkmanage.hsm.signer.HsmCsrSigner
import net.corda.core.crypto.Crypto import net.corda.core.crypto.Crypto
import net.corda.core.identity.CordaX500Name import net.corda.core.identity.CordaX500Name
import net.corda.core.internal.cert
import net.corda.core.internal.createDirectories
import net.corda.core.internal.uncheckedCast import net.corda.core.internal.uncheckedCast
import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.NetworkHostAndPort
import net.corda.core.utilities.seconds import net.corda.core.utilities.seconds
import net.corda.node.utilities.registration.HTTPNetworkRegistrationService import net.corda.node.utilities.registration.HTTPNetworkRegistrationService
import net.corda.node.utilities.registration.NetworkRegistrationHelper import net.corda.node.utilities.registration.NetworkRegistrationHelper
import net.corda.nodeapi.internal.crypto.CertificateType import net.corda.nodeapi.internal.crypto.*
import net.corda.nodeapi.internal.crypto.X509Utilities
import net.corda.nodeapi.internal.persistence.DatabaseConfig import net.corda.nodeapi.internal.persistence.DatabaseConfig
import net.corda.testing.ALICE_NAME import net.corda.testing.ALICE_NAME
import net.corda.testing.BOB_NAME import net.corda.testing.BOB_NAME
@ -93,8 +94,6 @@ class SigningServiceIntegrationTest {
} }
} }
// TODO: fix me (see commented out code in this test)
@Ignore
@Test @Test
fun `Signing service signs approved CSRs`() { fun `Signing service signs approved CSRs`() {
//Start doorman server //Start doorman server
@ -132,8 +131,11 @@ class SigningServiceIntegrationTest {
// [org.hibernate.tool.schema.spi.SchemaManagementException] being thrown as the schema is missing. // [org.hibernate.tool.schema.spi.SchemaManagementException] being thrown as the schema is missing.
} }
} }
// config.rootCaCertFile.parent.createDirectories() config.trustStoreFile.parent.createDirectories()
// X509Utilities.saveCertificateAsPEMFile(rootCACert, config.rootCaCertFile) loadOrCreateKeyStore(config.trustStoreFile, config.trustStorePassword).also {
it.addOrReplaceCertificate(X509Utilities.CORDA_ROOT_CA, rootCACert.cert)
it.save(config.trustStoreFile, config.trustStorePassword)
}
NetworkRegistrationHelper(config, HTTPNetworkRegistrationService(config.compatibilityZoneURL!!)).buildKeystore() NetworkRegistrationHelper(config, HTTPNetworkRegistrationService(config.compatibilityZoneURL!!)).buildKeystore()
verify(hsmSigner).sign(any()) verify(hsmSigner).sign(any())
} }
@ -148,7 +150,6 @@ class SigningServiceIntegrationTest {
* *
*/ */
@Test @Test
@Ignore
fun `DEMO - Create CSR and poll`() { fun `DEMO - Create CSR and poll`() {
//Start doorman server //Start doorman server
val database = configureDatabase(makeTestDataSourceProperties(), DatabaseConfig()) val database = configureDatabase(makeTestDataSourceProperties(), DatabaseConfig())