fix merge conflicts due to changes in Signed test cordapp creation

This commit is contained in:
stefano 2019-11-05 17:42:38 +00:00
parent 6a3a9eded3
commit d8ed3492b9
5 changed files with 80 additions and 53 deletions

Binary file not shown.

View File

@ -18,8 +18,10 @@ import net.corda.testing.node.NotarySpec
import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.rules.TemporaryFolder
import java.security.KeyPairGenerator
class DeterministicContractCryptoTest {
@ -31,7 +33,12 @@ class DeterministicContractCryptoTest {
@JvmField
val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
tempFolder.root.toPath().let { path ->
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess = false,
@ -41,7 +48,7 @@ class DeterministicContractCryptoTest {
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.crypto"),
name = "deterministic-crypto-contract",
signingInfo = CustomCordapp.SigningInfo()
signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
)
),
djvmBootstrapSource = djvmSources.bootstrap,
@ -49,6 +56,7 @@ class DeterministicContractCryptoTest {
)
}
}
}
@Test
fun `test DJVM can verify using crypto`() {

View File

@ -22,9 +22,11 @@ import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages
import org.assertj.core.api.AssertionsForInterfaceTypes.assertThat
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows
import org.junit.rules.TemporaryFolder
class NonDeterministicContractVerifyTest {
companion object {
@ -34,17 +36,22 @@ class NonDeterministicContractVerifyTest {
@JvmField
val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
tempFolder.root.toPath().let { path ->
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess =false,
startNodesInProcess = false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = listOf(
cordappWithPackages("net.corda.flows.djvm.broken"),
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.broken"),
name = "nondeterministic-contract",
signingInfo = CustomCordapp.SigningInfo()
signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
)
),
djvmBootstrapSource = djvmSources.bootstrap,
@ -52,6 +59,7 @@ class NonDeterministicContractVerifyTest {
)
}
}
}
@Test
fun `test DJVM rejects contract that uses Instant now`() {

View File

@ -19,9 +19,11 @@ import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages
import org.assertj.core.api.Assertions.assertThat
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows
import org.junit.rules.TemporaryFolder
class SandboxAttachmentsTest {
companion object {
@ -31,7 +33,12 @@ class SandboxAttachmentsTest {
@JvmField
val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
tempFolder.root.toPath().let { path ->
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess = false,
@ -41,7 +48,7 @@ class SandboxAttachmentsTest {
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.attachment"),
name = "sandbox-attachment-contract",
signingInfo = CustomCordapp.SigningInfo()
signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
)
),
djvmBootstrapSource = djvmSources.bootstrap,
@ -49,6 +56,7 @@ class SandboxAttachmentsTest {
)
}
}
}
@Test
fun `test attachment accessible within sandbox`() {
@ -74,7 +82,7 @@ class SandboxAttachmentsTest {
}
assertThat(ex)
.hasMessageStartingWith("sandbox.net.corda.core.contracts.TransactionVerificationException\$ContractRejection -> ")
.hasMessageContaining(" Contract verification failed: does/not/Exist.class, " )
.hasMessageContaining(" Contract verification failed: does/not/Exist.class, ")
.hasMessageContaining(" contract: sandbox.net.corda.contracts.djvm.attachment.SandboxAttachmentContract, ")
}
}

View File

@ -20,6 +20,7 @@ import net.corda.core.flows.InitiatedBy
import net.corda.core.flows.NotaryChangeFlow
import net.corda.core.flows.NotaryFlow
import net.corda.core.flows.StartableByService
import net.corda.core.flows.StateMachineRunId
import net.corda.core.identity.AbstractParty
import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.Party
@ -119,9 +120,11 @@ import net.corda.node.services.persistence.PublicKeyToOwningIdentityCacheImpl
import net.corda.node.services.persistence.PublicKeyToTextConverter
import net.corda.node.services.rpc.CheckpointDumper
import net.corda.node.services.schema.NodeSchemaService
import net.corda.node.services.statemachine.Event
import net.corda.node.services.statemachine.ExternalEvent
import net.corda.node.services.statemachine.FlowLogicRefFactoryImpl
import net.corda.node.services.statemachine.FlowMonitor
import net.corda.node.services.statemachine.FlowStateMachineImpl
import net.corda.node.services.statemachine.SingleThreadedStateMachineManager
import net.corda.node.services.statemachine.StaffedFlowHospital
import net.corda.node.services.statemachine.StateMachineManager