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.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages import net.corda.testing.node.internal.cordappWithPackages
import org.junit.ClassRule import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.rules.TemporaryFolder
import java.security.KeyPairGenerator import java.security.KeyPairGenerator
class DeterministicContractCryptoTest { class DeterministicContractCryptoTest {
@ -31,22 +33,28 @@ class DeterministicContractCryptoTest {
@JvmField @JvmField
val djvmSources = DeterministicSourcesRule() val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters { fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
return DriverParameters( tempFolder.root.toPath().let { path ->
portAllocation = incrementalPortAllocation(), return DriverParameters(
startNodesInProcess = false, portAllocation = incrementalPortAllocation(),
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)), startNodesInProcess = false,
cordappsForAllNodes = listOf( notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappWithPackages("net.corda.flows.djvm.crypto"), cordappsForAllNodes = listOf(
CustomCordapp( cordappWithPackages("net.corda.flows.djvm.crypto"),
packages = setOf("net.corda.contracts.djvm.crypto"), CustomCordapp(
name = "deterministic-crypto-contract", packages = setOf("net.corda.contracts.djvm.crypto"),
signingInfo = CustomCordapp.SigningInfo() name = "deterministic-crypto-contract",
) signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
), )
djvmBootstrapSource = djvmSources.bootstrap, ),
djvmCordaSource = djvmSources.corda djvmBootstrapSource = djvmSources.bootstrap,
) djvmCordaSource = djvmSources.corda
)
}
} }
} }

View File

@ -22,9 +22,11 @@ import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages 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.Rule
import org.junit.Test import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import org.junit.rules.TemporaryFolder
class NonDeterministicContractVerifyTest { class NonDeterministicContractVerifyTest {
companion object { companion object {
@ -34,22 +36,28 @@ class NonDeterministicContractVerifyTest {
@JvmField @JvmField
val djvmSources = DeterministicSourcesRule() val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters { fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
return DriverParameters( tempFolder.root.toPath().let { path ->
portAllocation = incrementalPortAllocation(), return DriverParameters(
startNodesInProcess =false, portAllocation = incrementalPortAllocation(),
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)), startNodesInProcess = false,
cordappsForAllNodes = listOf( notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappWithPackages("net.corda.flows.djvm.broken"), cordappsForAllNodes = listOf(
CustomCordapp( cordappWithPackages("net.corda.flows.djvm.broken"),
packages = setOf("net.corda.contracts.djvm.broken"), CustomCordapp(
name = "nondeterministic-contract", packages = setOf("net.corda.contracts.djvm.broken"),
signingInfo = CustomCordapp.SigningInfo() name = "nondeterministic-contract",
) signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
), )
djvmBootstrapSource = djvmSources.bootstrap, ),
djvmCordaSource = djvmSources.corda djvmBootstrapSource = djvmSources.bootstrap,
) djvmCordaSource = djvmSources.corda
)
}
} }
} }
@ -62,7 +70,7 @@ class NonDeterministicContractVerifyTest {
.returnValue.getOrThrow() .returnValue.getOrThrow()
} }
assertThat(ex) assertThat(ex)
.hasMessageStartingWith("NoSuchMethodError: sandbox.java.time.Instant.now()Lsandbox/java/time/Instant;, ") .hasMessageStartingWith("NoSuchMethodError: sandbox.java.time.Instant.now()Lsandbox/java/time/Instant;, ")
} }
} }
@ -75,7 +83,7 @@ class NonDeterministicContractVerifyTest {
.returnValue.getOrThrow() .returnValue.getOrThrow()
} }
assertThat(ex) assertThat(ex)
.hasMessageStartingWith("NoSuchMethodError: sandbox.java.lang.System.currentTimeMillis()J, ") .hasMessageStartingWith("NoSuchMethodError: sandbox.java.lang.System.currentTimeMillis()J, ")
} }
} }
@ -88,7 +96,7 @@ class NonDeterministicContractVerifyTest {
.returnValue.getOrThrow() .returnValue.getOrThrow()
} }
assertThat(ex) assertThat(ex)
.hasMessageStartingWith("NoSuchMethodError: sandbox.java.lang.System.nanoTime()J, ") .hasMessageStartingWith("NoSuchMethodError: sandbox.java.lang.System.nanoTime()J, ")
} }
} }
@ -101,7 +109,7 @@ class NonDeterministicContractVerifyTest {
.returnValue.getOrThrow() .returnValue.getOrThrow()
} }
assertThat(ex) assertThat(ex)
.hasMessageStartingWith("NoSuchMethodError: sandbox.java.util.UUID.randomUUID()Lsandbox/java/util/UUID;, ") .hasMessageStartingWith("NoSuchMethodError: sandbox.java.util.UUID.randomUUID()Lsandbox/java/util/UUID;, ")
} }
} }
@ -114,7 +122,7 @@ class NonDeterministicContractVerifyTest {
.returnValue.getOrThrow() .returnValue.getOrThrow()
} }
assertThat(ex).hasMessageStartingWith( assertThat(ex).hasMessageStartingWith(
"RuleViolationError: Disallowed reference to API; java.lang.Class.getDeclaredConstructor(Class[]), " "RuleViolationError: Disallowed reference to API; java.lang.Class.getDeclaredConstructor(Class[]), "
) )
} }
} }

View File

@ -19,9 +19,11 @@ import net.corda.testing.node.internal.CustomCordapp
import net.corda.testing.node.internal.cordappWithPackages import net.corda.testing.node.internal.cordappWithPackages
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.ClassRule import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import org.junit.rules.TemporaryFolder
class SandboxAttachmentsTest { class SandboxAttachmentsTest {
companion object { companion object {
@ -31,22 +33,28 @@ class SandboxAttachmentsTest {
@JvmField @JvmField
val djvmSources = DeterministicSourcesRule() val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters { fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
return DriverParameters( tempFolder.root.toPath().let { path ->
portAllocation = incrementalPortAllocation(), return DriverParameters(
startNodesInProcess = false, portAllocation = incrementalPortAllocation(),
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)), startNodesInProcess = false,
cordappsForAllNodes = listOf( notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappWithPackages("net.corda.flows.djvm.attachment"), cordappsForAllNodes = listOf(
CustomCordapp( cordappWithPackages("net.corda.flows.djvm.attachment"),
packages = setOf("net.corda.contracts.djvm.attachment"), CustomCordapp(
name = "sandbox-attachment-contract", packages = setOf("net.corda.contracts.djvm.attachment"),
signingInfo = CustomCordapp.SigningInfo() name = "sandbox-attachment-contract",
) signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
), )
djvmBootstrapSource = djvmSources.bootstrap, ),
djvmCordaSource = djvmSources.corda djvmBootstrapSource = djvmSources.bootstrap,
) djvmCordaSource = djvmSources.corda
)
}
} }
} }
@ -73,9 +81,9 @@ class SandboxAttachmentsTest {
.returnValue.getOrThrow() .returnValue.getOrThrow()
} }
assertThat(ex) assertThat(ex)
.hasMessageStartingWith("sandbox.net.corda.core.contracts.TransactionVerificationException\$ContractRejection -> ") .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, ") .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.NotaryChangeFlow
import net.corda.core.flows.NotaryFlow import net.corda.core.flows.NotaryFlow
import net.corda.core.flows.StartableByService import net.corda.core.flows.StartableByService
import net.corda.core.flows.StateMachineRunId
import net.corda.core.identity.AbstractParty import net.corda.core.identity.AbstractParty
import net.corda.core.identity.CordaX500Name import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.Party 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.persistence.PublicKeyToTextConverter
import net.corda.node.services.rpc.CheckpointDumper import net.corda.node.services.rpc.CheckpointDumper
import net.corda.node.services.schema.NodeSchemaService 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.ExternalEvent
import net.corda.node.services.statemachine.FlowLogicRefFactoryImpl import net.corda.node.services.statemachine.FlowLogicRefFactoryImpl
import net.corda.node.services.statemachine.FlowMonitor 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.SingleThreadedStateMachineManager
import net.corda.node.services.statemachine.StaffedFlowHospital import net.corda.node.services.statemachine.StaffedFlowHospital
import net.corda.node.services.statemachine.StateMachineManager import net.corda.node.services.statemachine.StateMachineManager