mirror of
https://github.com/corda/corda.git
synced 2024-12-21 13:57:54 +00:00
Merge pull request #6748 from corda/INFRA-683-os-45-bouncy-castle
NOTICK Merge OS 4.4 to 4.5
This commit is contained in:
commit
2dd2029e24
@ -68,8 +68,8 @@ buildscript {
|
|||||||
ext.jersey_version = '2.25'
|
ext.jersey_version = '2.25'
|
||||||
ext.servlet_version = '4.0.1'
|
ext.servlet_version = '4.0.1'
|
||||||
ext.assertj_version = '3.12.2'
|
ext.assertj_version = '3.12.2'
|
||||||
ext.slf4j_version = '1.7.26'
|
ext.slf4j_version = '1.7.30'
|
||||||
ext.log4j_version = '2.11.2'
|
ext.log4j_version = '2.12.1'
|
||||||
ext.bouncycastle_version = constants.getProperty("bouncycastleVersion")
|
ext.bouncycastle_version = constants.getProperty("bouncycastleVersion")
|
||||||
ext.guava_version = constants.getProperty("guavaVersion")
|
ext.guava_version = constants.getProperty("guavaVersion")
|
||||||
ext.caffeine_version = constants.getProperty("caffeineVersion")
|
ext.caffeine_version = constants.getProperty("caffeineVersion")
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
package net.corda.common.logging
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.core.Core
|
|
||||||
import org.apache.logging.log4j.core.LogEvent
|
|
||||||
import org.apache.logging.log4j.core.appender.rewrite.RewritePolicy
|
|
||||||
import org.apache.logging.log4j.core.config.plugins.Plugin
|
|
||||||
import org.apache.logging.log4j.core.config.plugins.PluginFactory
|
|
||||||
import org.apache.logging.log4j.core.impl.Log4jLogEvent
|
|
||||||
|
|
||||||
@Plugin(name = "ErrorCodeRewritePolicy", category = Core.CATEGORY_NAME, elementType = "rewritePolicy", printObject = false)
|
|
||||||
class ErrorCodeRewritePolicy : RewritePolicy {
|
|
||||||
override fun rewrite(source: LogEvent): LogEvent? {
|
|
||||||
val newMessage = source.message?.withErrorCodeFor(source.thrown, source.level)
|
|
||||||
return if (newMessage == source.message) {
|
|
||||||
source
|
|
||||||
} else {
|
|
||||||
Log4jLogEvent.Builder(source).setMessage(newMessage).build()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
@PluginFactory
|
|
||||||
fun createPolicy(): ErrorCodeRewritePolicy {
|
|
||||||
return ErrorCodeRewritePolicy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration status="info" packages="net.corda.common.logging" shutdownHook="disable">
|
<Configuration status="info" shutdownHook="disable">
|
||||||
|
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-path">${sys:log-path:-logs}</Property>
|
<Property name="log-path">${sys:log-path:-logs}</Property>
|
||||||
@ -172,21 +172,17 @@
|
|||||||
|
|
||||||
<Rewrite name="Console-ErrorCode-Selector">
|
<Rewrite name="Console-ErrorCode-Selector">
|
||||||
<AppenderRef ref="Console-Selector"/>
|
<AppenderRef ref="Console-Selector"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
|
|
||||||
<Rewrite name="Console-ErrorCode-Appender-Println">
|
<Rewrite name="Console-ErrorCode-Appender-Println">
|
||||||
<AppenderRef ref="Console-Appender-Println"/>
|
<AppenderRef ref="Console-Appender-Println"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
|
|
||||||
<Rewrite name="RollingFile-ErrorCode-Appender">
|
<Rewrite name="RollingFile-ErrorCode-Appender">
|
||||||
<AppenderRef ref="RollingFile-Appender"/>
|
<AppenderRef ref="RollingFile-Appender"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
<Rewrite name="Diagnostic-RollingFile-ErrorCode-Appender">
|
<Rewrite name="Diagnostic-RollingFile-ErrorCode-Appender">
|
||||||
<AppenderRef ref="Diagnostic-RollingFile-Appender"/>
|
<AppenderRef ref="Diagnostic-RollingFile-Appender"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ quasarClassifier=jdk8
|
|||||||
quasarVersion11=0.8.0_r3
|
quasarVersion11=0.8.0_r3
|
||||||
jdkClassifier11=jdk11
|
jdkClassifier11=jdk11
|
||||||
proguardVersion=6.1.1
|
proguardVersion=6.1.1
|
||||||
bouncycastleVersion=1.61
|
bouncycastleVersion=1.66
|
||||||
classgraphVersion=4.8.90
|
classgraphVersion=4.8.90
|
||||||
disruptorVersion=3.4.2
|
disruptorVersion=3.4.2
|
||||||
typesafeConfigVersion=1.3.4
|
typesafeConfigVersion=1.3.4
|
||||||
|
@ -22,9 +22,9 @@ import org.junit.Before
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.junit.runners.Parameterized
|
import org.junit.runners.Parameterized
|
||||||
|
import java.sql.Connection
|
||||||
import java.sql.Statement
|
import java.sql.Statement
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.sql.DataSource
|
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -33,7 +33,7 @@ import kotlin.test.assertFailsWith
|
|||||||
*/
|
*/
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
class AuthDBTests : NodeBasedTest() {
|
class AuthDBTests : NodeBasedTest() {
|
||||||
private lateinit var node: NodeWithInfo
|
private var node: NodeWithInfo? = null
|
||||||
private lateinit var client: CordaRPCClient
|
private lateinit var client: CordaRPCClient
|
||||||
private lateinit var db: UsersDB
|
private lateinit var db: UsersDB
|
||||||
|
|
||||||
@ -93,8 +93,9 @@ class AuthDBTests : NodeBasedTest() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
node = startNode(ALICE_NAME, rpcUsers = emptyList(), configOverrides = securityConfig)
|
node = startNode(ALICE_NAME, rpcUsers = emptyList(), configOverrides = securityConfig).also { node ->
|
||||||
client = CordaRPCClient(node.node.configuration.rpcOptions.address)
|
client = CordaRPCClient(node.node.configuration.rpcOptions.address)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout=300_000)
|
@Test(timeout=300_000)
|
||||||
@ -215,6 +216,7 @@ class AuthDBTests : NodeBasedTest() {
|
|||||||
|
|
||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
|
node?.node?.stop()
|
||||||
db.close()
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +230,7 @@ private data class RoleAndPermissions(val role: String, val permissions: List<St
|
|||||||
* Manage in-memory DB mocking a users database with the schema expected by Node's security manager
|
* Manage in-memory DB mocking a users database with the schema expected by Node's security manager
|
||||||
*/
|
*/
|
||||||
private class UsersDB(name: String, users: List<UserAndRoles> = emptyList(), roleAndPermissions: List<RoleAndPermissions> = emptyList()) : AutoCloseable {
|
private class UsersDB(name: String, users: List<UserAndRoles> = emptyList(), roleAndPermissions: List<RoleAndPermissions> = emptyList()) : AutoCloseable {
|
||||||
val jdbcUrl = "jdbc:h2:mem:$name;DB_CLOSE_DELAY=-1"
|
val jdbcUrl = "jdbc:h2:mem:$name"
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val DB_CREATE_SCHEMA = """
|
const val DB_CREATE_SCHEMA = """
|
||||||
@ -269,36 +271,34 @@ private class UsersDB(name: String, users: List<UserAndRoles> = emptyList(), rol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val dataSource: DataSource
|
private val connection: Connection
|
||||||
private inline fun session(statement: (Statement) -> Unit) {
|
private inline fun session(statement: (Statement) -> Unit) {
|
||||||
dataSource.connection.use {
|
connection.createStatement().use(statement)
|
||||||
it.autoCommit = false
|
connection.commit()
|
||||||
it.createStatement().use(statement)
|
|
||||||
it.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
dataSource = DataSourceFactory.createDataSource(Properties().apply {
|
require(users.map { it.username }.toSet().size == users.size) {
|
||||||
|
"Duplicate username in input"
|
||||||
|
}
|
||||||
|
connection = DataSourceFactory.createDataSource(Properties().apply {
|
||||||
put("dataSourceClassName", "org.h2.jdbcx.JdbcDataSource")
|
put("dataSourceClassName", "org.h2.jdbcx.JdbcDataSource")
|
||||||
put("dataSource.url", jdbcUrl)
|
put("dataSource.url", jdbcUrl)
|
||||||
}, false)
|
}, false)
|
||||||
|
.connection
|
||||||
|
.apply {
|
||||||
|
autoCommit = false
|
||||||
|
}
|
||||||
session {
|
session {
|
||||||
it.execute(DB_CREATE_SCHEMA)
|
it.execute(DB_CREATE_SCHEMA)
|
||||||
}
|
}
|
||||||
require(users.map { it.username }.toSet().size == users.size) {
|
|
||||||
"Duplicate username in input"
|
|
||||||
}
|
|
||||||
users.forEach { insert(it) }
|
users.forEach { insert(it) }
|
||||||
roleAndPermissions.forEach { insert(it) }
|
roleAndPermissions.forEach { insert(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
dataSource.connection.use {
|
// Close the connection, at which point the database will shut down
|
||||||
it.createStatement().use {
|
connection.close()
|
||||||
it.execute("DROP ALL OBJECTS")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
package net.corda.node
|
package net.corda.node
|
||||||
|
|
||||||
|
import net.corda.core.internal.div
|
||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.node.logging.logFile
|
|
||||||
import net.corda.testing.driver.DriverParameters
|
import net.corda.testing.driver.DriverParameters
|
||||||
|
import net.corda.testing.driver.NodeHandle
|
||||||
import net.corda.testing.driver.NodeParameters
|
import net.corda.testing.driver.NodeParameters
|
||||||
import net.corda.testing.driver.driver
|
import net.corda.testing.driver.driver
|
||||||
import net.corda.testing.driver.internal.incrementalPortAllocation
|
import net.corda.testing.driver.internal.incrementalPortAllocation
|
||||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class NodeConfigParsingTests {
|
class NodeConfigParsingTests {
|
||||||
|
companion object {
|
||||||
|
fun NodeHandle.logFile(): File = (baseDirectory / "logs").toFile().walk().filter { it.name.startsWith("node-") && it.extension == "log" }.single()
|
||||||
|
}
|
||||||
|
|
||||||
@Test(timeout=300_000)
|
@Test(timeout=300_000)
|
||||||
fun `config is overriden by underscore variable`() {
|
fun `config is overriden by underscore variable`() {
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
package net.corda.node.logging
|
|
||||||
|
|
||||||
import net.corda.core.flows.FlowLogic
|
|
||||||
import net.corda.core.flows.InitiatingFlow
|
|
||||||
import net.corda.core.flows.StartableByRPC
|
|
||||||
import net.corda.core.internal.div
|
|
||||||
import net.corda.core.messaging.FlowHandle
|
|
||||||
import net.corda.core.messaging.startFlow
|
|
||||||
import net.corda.core.utilities.getOrThrow
|
|
||||||
import net.corda.testing.driver.DriverParameters
|
|
||||||
import net.corda.testing.driver.NodeHandle
|
|
||||||
import net.corda.testing.driver.driver
|
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
|
||||||
import org.junit.Test
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class ErrorCodeLoggingTests {
|
|
||||||
@Test(timeout=300_000)
|
|
||||||
fun `log entries with a throwable and ERROR or WARN get an error code appended`() {
|
|
||||||
driver(DriverParameters(notarySpecs = emptyList())) {
|
|
||||||
val node = startNode(startInSameProcess = false).getOrThrow()
|
|
||||||
node.rpc.startFlow(::MyFlow).waitForCompletion()
|
|
||||||
val logFile = node.logFile()
|
|
||||||
|
|
||||||
val linesWithErrorCode = logFile.useLines { lines ->
|
|
||||||
lines.filter { line ->
|
|
||||||
line.contains("[errorCode=")
|
|
||||||
}.filter { line ->
|
|
||||||
line.contains("moreInformationAt=https://errors.corda.net/")
|
|
||||||
}.toList()
|
|
||||||
}
|
|
||||||
|
|
||||||
assertThat(linesWithErrorCode).isNotEmpty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is used to detect broken logging which can be caused by loggers being initialized
|
|
||||||
// before the initLogging() call is made
|
|
||||||
@Test(timeout=300_000)
|
|
||||||
fun `When logging is set to error level, there are no other levels logged after node startup`() {
|
|
||||||
driver(DriverParameters(notarySpecs = emptyList())) {
|
|
||||||
val node = startNode(startInSameProcess = false, logLevelOverride = "ERROR").getOrThrow()
|
|
||||||
val logFile = node.logFile()
|
|
||||||
val lengthAfterStart = logFile.length()
|
|
||||||
node.rpc.startFlow(::MyFlow).waitForCompletion()
|
|
||||||
// An exception thrown in a flow will log at the "INFO" level.
|
|
||||||
assertThat(logFile.length()).isEqualTo(lengthAfterStart)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@StartableByRPC
|
|
||||||
@InitiatingFlow
|
|
||||||
class MyFlow : FlowLogic<String>() {
|
|
||||||
override fun call(): String {
|
|
||||||
throw IllegalArgumentException("Mwahahahah")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun FlowHandle<*>.waitForCompletion() {
|
|
||||||
try {
|
|
||||||
returnValue.getOrThrow()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
// This is expected to throw an exception, using getOrThrow() just to wait until done.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun NodeHandle.logFile(): File = (baseDirectory / "logs").toFile().walk().filter { it.name.startsWith("node-") && it.extension == "log" }.single()
|
|
@ -22,6 +22,7 @@ import net.corda.testing.driver.driver
|
|||||||
import net.corda.testing.node.User
|
import net.corda.testing.node.User
|
||||||
import net.corda.testing.node.internal.DUMMY_CONTRACTS_CORDAPP
|
import net.corda.testing.node.internal.DUMMY_CONTRACTS_CORDAPP
|
||||||
import net.corda.testing.node.internal.enclosedCordapp
|
import net.corda.testing.node.internal.enclosedCordapp
|
||||||
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ import kotlin.test.assertEquals
|
|||||||
* Check that we can add lots of large attachments to a transaction and that it works OK, e.g. does not hit the
|
* Check that we can add lots of large attachments to a transaction and that it works OK, e.g. does not hit the
|
||||||
* transaction size limit (which should only consider the hashes).
|
* transaction size limit (which should only consider the hashes).
|
||||||
*/
|
*/
|
||||||
|
@Ignore("ENT-5679: This test triggers OOM errors")
|
||||||
class LargeTransactionsTest {
|
class LargeTransactionsTest {
|
||||||
private companion object {
|
private companion object {
|
||||||
val BOB = TestIdentity(BOB_NAME, 80).party
|
val BOB = TestIdentity(BOB_NAME, 80).party
|
||||||
|
@ -51,6 +51,7 @@ import kotlin.test.assertTrue
|
|||||||
class VaultObserverExceptionTest {
|
class VaultObserverExceptionTest {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
val waitForFlowDuration = 45.seconds
|
||||||
val log = contextLogger()
|
val log = contextLogger()
|
||||||
|
|
||||||
private fun testCordapps() = listOf(
|
private fun testCordapps() = listOf(
|
||||||
@ -98,7 +99,7 @@ class VaultObserverExceptionTest {
|
|||||||
"Syntax Error in Custom SQL",
|
"Syntax Error in Custom SQL",
|
||||||
CreateStateFlow.errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxError)
|
CreateStateFlow.errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxError)
|
||||||
).returnValue.then { testControlFuture.complete(false) }
|
).returnValue.then { testControlFuture.complete(false) }
|
||||||
val foundExpectedException = testControlFuture.getOrThrow(30.seconds)
|
val foundExpectedException = testControlFuture.getOrThrow(waitForFlowDuration)
|
||||||
|
|
||||||
Assert.assertTrue(foundExpectedException)
|
Assert.assertTrue(foundExpectedException)
|
||||||
}
|
}
|
||||||
@ -132,7 +133,7 @@ class VaultObserverExceptionTest {
|
|||||||
"Syntax Error in Custom SQL",
|
"Syntax Error in Custom SQL",
|
||||||
CreateStateFlow.errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxError)
|
CreateStateFlow.errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxError)
|
||||||
).returnValue.then { testControlFuture.complete(false) }
|
).returnValue.then { testControlFuture.complete(false) }
|
||||||
val foundExpectedException = testControlFuture.getOrThrow(30.seconds)
|
val foundExpectedException = testControlFuture.getOrThrow(waitForFlowDuration)
|
||||||
|
|
||||||
Assert.assertTrue(foundExpectedException)
|
Assert.assertTrue(foundExpectedException)
|
||||||
}
|
}
|
||||||
@ -223,7 +224,7 @@ class VaultObserverExceptionTest {
|
|||||||
assertFailsWith<TimeoutException>("PersistenceException") {
|
assertFailsWith<TimeoutException>("PersistenceException") {
|
||||||
aliceNode.rpc.startFlow(CreateStateFlow::Initiator, "EntityManager", errorTargetsToNum(
|
aliceNode.rpc.startFlow(CreateStateFlow::Initiator, "EntityManager", errorTargetsToNum(
|
||||||
CreateStateFlow.ErrorTarget.TxInvalidState))
|
CreateStateFlow.ErrorTarget.TxInvalidState))
|
||||||
.returnValue.getOrThrow(30.seconds)
|
.returnValue.getOrThrow(waitForFlowDuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.assertTrue("Flow has not been to hospital", counter > 0)
|
Assert.assertTrue("Flow has not been to hospital", counter > 0)
|
||||||
@ -259,7 +260,7 @@ class VaultObserverExceptionTest {
|
|||||||
CreateStateFlow.ErrorTarget.TxInvalidState,
|
CreateStateFlow.ErrorTarget.TxInvalidState,
|
||||||
CreateStateFlow.ErrorTarget.FlowSwallowErrors))
|
CreateStateFlow.ErrorTarget.FlowSwallowErrors))
|
||||||
val flowResult = flowHandle.returnValue
|
val flowResult = flowHandle.returnValue
|
||||||
assertFailsWith<TimeoutException>("PersistenceException") { flowResult.getOrThrow(30.seconds) }
|
assertFailsWith<TimeoutException>("PersistenceException") { flowResult.getOrThrow(waitForFlowDuration) }
|
||||||
Assert.assertTrue("Flow has not been to hospital", counter > 0)
|
Assert.assertTrue("Flow has not been to hospital", counter > 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,7 +291,7 @@ class VaultObserverExceptionTest {
|
|||||||
log.info("Flow has finished")
|
log.info("Flow has finished")
|
||||||
testControlFuture.set(false)
|
testControlFuture.set(false)
|
||||||
}
|
}
|
||||||
Assert.assertTrue("Flow has not been kept in hospital", testControlFuture.getOrThrow(30.seconds))
|
Assert.assertTrue("Flow has not been kept in hospital", testControlFuture.getOrThrow(waitForFlowDuration))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +310,7 @@ class VaultObserverExceptionTest {
|
|||||||
CreateStateFlow.ErrorTarget.ServiceSqlSyntaxError,
|
CreateStateFlow.ErrorTarget.ServiceSqlSyntaxError,
|
||||||
CreateStateFlow.ErrorTarget.ServiceSwallowErrors))
|
CreateStateFlow.ErrorTarget.ServiceSwallowErrors))
|
||||||
val flowResult = flowHandle.returnValue
|
val flowResult = flowHandle.returnValue
|
||||||
flowResult.getOrThrow(30.seconds)
|
flowResult.getOrThrow(waitForFlowDuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +411,7 @@ class VaultObserverExceptionTest {
|
|||||||
testControlFuture.complete(true)
|
testControlFuture.complete(true)
|
||||||
}
|
}
|
||||||
startNode(providedName = ALICE_NAME, rpcUsers = listOf(aliceUser), startInSameProcess = true).getOrThrow()
|
startNode(providedName = ALICE_NAME, rpcUsers = listOf(aliceUser), startInSameProcess = true).getOrThrow()
|
||||||
assert(testControlFuture.getOrThrow(30.seconds))
|
assert(testControlFuture.getOrThrow(waitForFlowDuration))
|
||||||
} else {
|
} else {
|
||||||
throw IllegalStateException("Out of process node is still up and running!")
|
throw IllegalStateException("Out of process node is still up and running!")
|
||||||
}
|
}
|
||||||
@ -460,7 +461,7 @@ class VaultObserverExceptionTest {
|
|||||||
CreateStateFlow::Initiator,
|
CreateStateFlow::Initiator,
|
||||||
"AllGood",
|
"AllGood",
|
||||||
errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxErrorOnConsumed)
|
errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxErrorOnConsumed)
|
||||||
).returnValue.getOrThrow(30.seconds)
|
).returnValue.getOrThrow(waitForFlowDuration)
|
||||||
|
|
||||||
println("Created new state")
|
println("Created new state")
|
||||||
|
|
||||||
@ -551,7 +552,7 @@ class VaultObserverExceptionTest {
|
|||||||
"AllGood",
|
"AllGood",
|
||||||
// should be a hospital exception
|
// should be a hospital exception
|
||||||
errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxErrorOnConsumed)
|
errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxErrorOnConsumed)
|
||||||
).returnValue.getOrThrow(30.seconds)
|
).returnValue.getOrThrow(waitForFlowDuration)
|
||||||
|
|
||||||
val flowHandle = aliceNode.rpc.startFlow(
|
val flowHandle = aliceNode.rpc.startFlow(
|
||||||
SendStateFlow::PassErroneousOwnableState,
|
SendStateFlow::PassErroneousOwnableState,
|
||||||
@ -632,7 +633,7 @@ class VaultObserverExceptionTest {
|
|||||||
CreateStateFlow::Initiator,
|
CreateStateFlow::Initiator,
|
||||||
"AllGood",
|
"AllGood",
|
||||||
errorTargetsToNum(CreateStateFlow.ErrorTarget.NoError)
|
errorTargetsToNum(CreateStateFlow.ErrorTarget.NoError)
|
||||||
).returnValue.getOrThrow(30.seconds)
|
).returnValue.getOrThrow(waitForFlowDuration)
|
||||||
|
|
||||||
aliceNode.rpc.startFlow(
|
aliceNode.rpc.startFlow(
|
||||||
SendStateFlow::PassErroneousOwnableState,
|
SendStateFlow::PassErroneousOwnableState,
|
||||||
@ -709,7 +710,7 @@ class VaultObserverExceptionTest {
|
|||||||
CreateStateFlow::Initiator,
|
CreateStateFlow::Initiator,
|
||||||
"AllGood",
|
"AllGood",
|
||||||
errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxErrorOnConsumed)
|
errorTargetsToNum(CreateStateFlow.ErrorTarget.ServiceSqlSyntaxErrorOnConsumed)
|
||||||
).returnValue.getOrThrow(30.seconds)
|
).returnValue.getOrThrow(waitForFlowDuration)
|
||||||
|
|
||||||
val flowHandle = aliceNode.rpc.startFlow(
|
val flowHandle = aliceNode.rpc.startFlow(
|
||||||
SendStateFlow::PassErroneousOwnableState,
|
SendStateFlow::PassErroneousOwnableState,
|
||||||
@ -764,7 +765,7 @@ class VaultObserverExceptionTest {
|
|||||||
"Flow ${SubscribingRawUpdatesFlow::class.java.name} tried to access VaultService.rawUpdates " +
|
"Flow ${SubscribingRawUpdatesFlow::class.java.name} tried to access VaultService.rawUpdates " +
|
||||||
"- Rx.Observables should only be accessed outside the context of a flow "
|
"- Rx.Observables should only be accessed outside the context of a flow "
|
||||||
) {
|
) {
|
||||||
flowHandle.returnValue.getOrThrow(30.seconds)
|
flowHandle.returnValue.getOrThrow(waitForFlowDuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,11 @@ class NetworkMapUpdater(private val networkMapCache: NetworkMapCacheInternal,
|
|||||||
val nextScheduleDelay = try {
|
val nextScheduleDelay = try {
|
||||||
updateNetworkMapCache()
|
updateNetworkMapCache()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
// Check to see if networkmap was reachable before and cached information exists
|
||||||
|
if (networkMapCache.allNodeHashes.size > 1) {
|
||||||
|
logger.debug("Networkmap Service unreachable but more than one nodeInfo entries found in the cache. Allowing node start-up to proceed.")
|
||||||
|
networkMapCache.nodeReady.set(null)
|
||||||
|
}
|
||||||
logger.warn("Error encountered while updating network map, will retry in $defaultRetryInterval", e)
|
logger.warn("Error encountered while updating network map, will retry in $defaultRetryInterval", e)
|
||||||
defaultRetryInterval
|
defaultRetryInterval
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import net.corda.testing.node.internal.genericDriver
|
|||||||
import net.corda.testing.node.internal.getTimestampAsDirectoryName
|
import net.corda.testing.node.internal.getTimestampAsDirectoryName
|
||||||
import net.corda.testing.node.internal.newContext
|
import net.corda.testing.node.internal.newContext
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
import java.io.File
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
@ -66,6 +67,8 @@ interface NodeHandle : AutoCloseable {
|
|||||||
fun stop()
|
fun stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun NodeHandle.logFile(): File = (baseDirectory / "logs").toFile().walk().filter { it.name.startsWith("node-") && it.extension == "log" }.single()
|
||||||
|
|
||||||
/** Interface which represents an out of process node and exposes its process handle. **/
|
/** Interface which represents an out of process node and exposes its process handle. **/
|
||||||
@DoNotImplement
|
@DoNotImplement
|
||||||
interface OutOfProcess : NodeHandle {
|
interface OutOfProcess : NodeHandle {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration status="info" packages="net.corda.common.logging">
|
<Configuration status="info">
|
||||||
|
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-path">${sys:log-path:-logs}</Property>
|
<Property name="log-path">${sys:log-path:-logs}</Property>
|
||||||
@ -63,17 +63,14 @@
|
|||||||
|
|
||||||
<Rewrite name="Console-ErrorCode-Appender">
|
<Rewrite name="Console-ErrorCode-Appender">
|
||||||
<AppenderRef ref="Console-Appender"/>
|
<AppenderRef ref="Console-Appender"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
|
|
||||||
<Rewrite name="Console-ErrorCode-Appender-Println">
|
<Rewrite name="Console-ErrorCode-Appender-Println">
|
||||||
<AppenderRef ref="Console-Appender-Println"/>
|
<AppenderRef ref="Console-Appender-Println"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
|
|
||||||
<Rewrite name="RollingFile-ErrorCode-Appender">
|
<Rewrite name="RollingFile-ErrorCode-Appender">
|
||||||
<AppenderRef ref="RollingFile-Appender"/>
|
<AppenderRef ref="RollingFile-Appender"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration status="info" packages="net.corda.common.logging">
|
<Configuration status="info">
|
||||||
|
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="log-path">${sys:log-path:-logs}</Property>
|
<Property name="log-path">${sys:log-path:-logs}</Property>
|
||||||
@ -65,17 +65,14 @@
|
|||||||
|
|
||||||
<Rewrite name="Console-ErrorCode-Appender">
|
<Rewrite name="Console-ErrorCode-Appender">
|
||||||
<AppenderRef ref="Console-Appender"/>
|
<AppenderRef ref="Console-Appender"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
|
|
||||||
<Rewrite name="Console-ErrorCode-Appender-Println">
|
<Rewrite name="Console-ErrorCode-Appender-Println">
|
||||||
<AppenderRef ref="Console-Appender-Println"/>
|
<AppenderRef ref="Console-Appender-Println"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
|
|
||||||
<Rewrite name="RollingFile-ErrorCode-Appender">
|
<Rewrite name="RollingFile-ErrorCode-Appender">
|
||||||
<AppenderRef ref="RollingFile-Appender"/>
|
<AppenderRef ref="RollingFile-Appender"/>
|
||||||
<ErrorCodeRewritePolicy/>
|
|
||||||
</Rewrite>
|
</Rewrite>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user