mirror of
https://github.com/corda/corda.git
synced 2025-06-06 09:21:47 +00:00
Merge pull request #6901 from corda/aga/make-recordDependencies-suspendable-4.7
NOTICK - forward merge from OS 4.6 (2021-04-26)
This commit is contained in:
commit
02d82a8368
@ -30,5 +30,6 @@ interface TransactionsResolver {
|
|||||||
@Suspendable
|
@Suspendable
|
||||||
fun downloadDependencies(batchMode: Boolean)
|
fun downloadDependencies(batchMode: Boolean)
|
||||||
|
|
||||||
|
@Suspendable
|
||||||
fun recordDependencies(usedStatesToRecord: StatesToRecord)
|
fun recordDependencies(usedStatesToRecord: StatesToRecord)
|
||||||
}
|
}
|
@ -43,13 +43,13 @@ task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
|
|||||||
includes = ['packages.md']
|
includes = ['packages.md']
|
||||||
jdkVersion = 8
|
jdkVersion = 8
|
||||||
externalDocumentationLink {
|
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 {
|
externalDocumentationLink {
|
||||||
url = new URL("https://docs.oracle.com/javafx/2/api/")
|
url = new URL("https://docs.oracle.com/javafx/2/api/")
|
||||||
}
|
}
|
||||||
externalDocumentationLink {
|
externalDocumentationLink {
|
||||||
url = new URL("http://www.bouncycastle.org/docs/docs1.5on/")
|
url = new URL("https://www.bouncycastle.org/docs/docs1.5on/")
|
||||||
}
|
}
|
||||||
internalPackagePrefixes.collect { packagePrefix ->
|
internalPackagePrefixes.collect { packagePrefix ->
|
||||||
packageOptions {
|
packageOptions {
|
||||||
|
@ -62,7 +62,7 @@ class FlowWithClientIdTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 300_000)
|
@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"))
|
val user = User("TonyStark", "I AM IRONMAN", setOf("StartFlow.net.corda.node.flows.FlowWithClientIdTest\$ResultFlow"))
|
||||||
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
|
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
|
||||||
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
|
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)
|
@Test(timeout = 300_000)
|
||||||
fun `start flow with client id without permissions`() {
|
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())) {
|
driver(DriverParameters(startNodesInProcess = true, cordappsForAllNodes = emptySet())) {
|
||||||
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
|
val nodeA = startNode(rpcUsers = listOf(user)).getOrThrow()
|
||||||
assertFailsWith<PermissionException> {
|
assertFailsWith<PermissionException> {
|
||||||
|
@ -94,6 +94,7 @@ class DbTransactionsResolver(private val flow: ResolveTransactionsFlow) : Transa
|
|||||||
logger.debug { "Downloaded ${sortedDependencies?.size} dependencies from remote peer for transactions ${flow.txHashes}" }
|
logger.debug { "Downloaded ${sortedDependencies?.size} dependencies from remote peer for transactions ${flow.txHashes}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suspendable
|
||||||
override fun recordDependencies(usedStatesToRecord: StatesToRecord) {
|
override fun recordDependencies(usedStatesToRecord: StatesToRecord) {
|
||||||
val sortedDependencies = checkNotNull(this.sortedDependencies)
|
val sortedDependencies = checkNotNull(this.sortedDependencies)
|
||||||
logger.trace { "Recording ${sortedDependencies.size} dependencies for ${flow.txHashes.size} transactions" }
|
logger.trace { "Recording ${sortedDependencies.size} dependencies for ${flow.txHashes.size} transactions" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user