Ensure that all DJVM test contract CorDapps are signed.

This commit is contained in:
Chris Rankin 2019-10-15 12:16:02 +01:00
parent 210f10f6be
commit f208b054c3
3 changed files with 20 additions and 10 deletions

View File

@ -12,12 +12,12 @@ class SandboxAttachmentContract : Contract {
val attachments = tx.attachments val attachments = tx.attachments
require(attachments.isNotEmpty()) { "Attachments are missing for TX=${tx.id}" } require(attachments.isNotEmpty()) { "Attachments are missing for TX=${tx.id}" }
require(attachments.size == 1) { "Did not expect to find ${attachments.size} attachments for TX${tx.id}" } require(attachments.size == 1) { "Did not expect to find ${attachments.size} attachments for TX=${tx.id}" }
val attachment = attachments[0] val attachment = attachments[0]
require(attachment.size > 0) { "Attachment ${attachment.id} has no contents for TX=${tx.id}" } require(attachment.size > 0) { "Attachment ${attachment.id} has no contents for TX=${tx.id}" }
val keyCount = attachment.signerKeys.size val keyCount = attachment.signerKeys.size
require(keyCount == 1) { "Attachment ${attachment.id} has $keyCount signing keys for TX=${tx.id}" } require(keyCount == 1) { "Did not expect to find $keyCount signing keys for attachment ${attachment.id}, TX=${tx.id}" }
tx.commandsOfType(ExtractFile::class.java).forEach { extract -> tx.commandsOfType(ExtractFile::class.java).forEach { extract ->
val fileName = extract.value.fileName val fileName = extract.value.fileName

View File

@ -15,7 +15,8 @@ import net.corda.testing.driver.DriverParameters
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 net.corda.testing.node.NotarySpec import net.corda.testing.node.NotarySpec
import net.corda.testing.node.internal.cordappsForPackages import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages
import org.junit.ClassRule import org.junit.ClassRule
import org.junit.Test import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertDoesNotThrow
@ -35,9 +36,13 @@ class DeterministicContractCryptoTest {
portAllocation = incrementalPortAllocation(), portAllocation = incrementalPortAllocation(),
startNodesInProcess = false, startNodesInProcess = false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)), notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = cordappsForPackages( cordappsForAllNodes = listOf(
"net.corda.contracts.djvm.crypto", cordappWithPackages("net.corda.flows.djvm.crypto"),
"net.corda.flows.djvm.crypto" CustomCordapp(
packages = setOf("net.corda.contracts.djvm.crypto"),
name = "deterministic-crypto-contract",
signingInfo = CustomCordapp.SigningInfo()
)
), ),
djvmBootstrapSource = djvmSources.bootstrap, djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda djvmCordaSource = djvmSources.corda

View File

@ -13,7 +13,8 @@ import net.corda.testing.driver.DriverParameters
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 net.corda.testing.node.NotarySpec import net.corda.testing.node.NotarySpec
import net.corda.testing.node.internal.cordappsForPackages import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages
import org.assertj.core.api.AssertionsForInterfaceTypes.assertThat import org.assertj.core.api.AssertionsForInterfaceTypes.assertThat
import org.junit.ClassRule import org.junit.ClassRule
import org.junit.Test import org.junit.Test
@ -33,9 +34,13 @@ class NonDeterministicContractVerifyTest {
portAllocation = incrementalPortAllocation(), portAllocation = incrementalPortAllocation(),
startNodesInProcess =false, startNodesInProcess =false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)), notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = cordappsForPackages( cordappsForAllNodes = listOf(
"net.corda.contracts.djvm.broken", cordappWithPackages("net.corda.flows.djvm.broken"),
"net.corda.flows.djvm.broken" CustomCordapp(
packages = setOf("net.corda.contracts.djvm.broken"),
name = "nondeterministic-contract",
signingInfo = CustomCordapp.SigningInfo()
)
), ),
djvmBootstrapSource = djvmSources.bootstrap, djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda djvmCordaSource = djvmSources.corda