Merge branch 'release/os/4.7' into aga/make-recordDependencies-suspendable-4.8

This commit is contained in:
Agnieszka Szczepanska 2021-04-27 15:08:13 +01:00
commit 0b9513ffa3
4 changed files with 33 additions and 3 deletions

View File

@ -30,5 +30,6 @@ interface TransactionsResolver {
@Suspendable
fun downloadDependencies(batchMode: Boolean)
@Suspendable
fun recordDependencies(usedStatesToRecord: StatesToRecord)
}

View File

@ -43,7 +43,7 @@ task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
includes = ['packages.md']
jdkVersion = 8
externalDocumentationLink {
url = new URL("http://fasterxml.github.io/jackson-core/javadoc/2.9/")
url = new URL("https://fasterxml.github.io/jackson-core/javadoc/2.9/")
}
externalDocumentationLink {
url = new URL("https://docs.oracle.com/javafx/2/api/")

View File

@ -62,7 +62,7 @@ class FlowWithClientIdTest {
}
@Test(timeout = 300_000)
fun `start flow with client id permissions`() {
fun `start flow with client id permissions - StartFlow`() {
val user = User("TonyStark", "I AM IRONMAN", setOf("StartFlow.net.corda.node.flows.FlowWithClientIdTest\$ResultFlow"))
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
@ -75,9 +75,37 @@ class FlowWithClientIdTest {
}
}
@Test(timeout = 300_000)
fun `start flow with client id permissions - InvokeRpc-startFlowWithClientId`() {
val user = User("TonyStark", "I AM IRONMAN", setOf("InvokeRpc.startFlowWithClientId"))
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
nodeA.rpc.startFlowWithClientId(UUID.randomUUID().toString(), ::ResultFlow, 5).returnValue.getOrThrow(20.seconds)
nodeA.rpc.startFlowDynamicWithClientId(
UUID.randomUUID().toString(),
ResultFlow::class.java,
5
).returnValue.getOrThrow(20.seconds)
}
}
@Test(timeout = 300_000)
fun `start flow with client id permissions - InvokeRpc-startFlowDynamicWithClientId`() {
val user = User("TonyStark", "I AM IRONMAN", setOf("InvokeRpc.startFlowDynamicWithClientId"))
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
nodeA.rpc.startFlowWithClientId(UUID.randomUUID().toString(), ::ResultFlow, 5).returnValue.getOrThrow(20.seconds)
nodeA.rpc.startFlowDynamicWithClientId(
UUID.randomUUID().toString(),
ResultFlow::class.java,
5
).returnValue.getOrThrow(20.seconds)
}
}
@Test(timeout = 300_000)
fun `start flow with client id without permissions`() {
val user = User("TonyStark", "I AM IRONMAN", setOf())
val user = User("TonyStark", "I AM IRONMAN", setOf("InvokeRpc.startFlow"))
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
assertFailsWith<PermissionException> {

View File

@ -94,6 +94,7 @@ class DbTransactionsResolver(private val flow: ResolveTransactionsFlow) : Transa
logger.debug { "Downloaded ${sortedDependencies?.size} dependencies from remote peer for transactions ${flow.txHashes}" }
}
@Suspendable
override fun recordDependencies(usedStatesToRecord: StatesToRecord) {
val sortedDependencies = checkNotNull(this.sortedDependencies)
logger.trace { "Recording ${sortedDependencies.size} dependencies for ${flow.txHashes.size} transactions" }