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,22 +33,28 @@ class DeterministicContractCryptoTest {
@JvmField
val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess = false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = listOf(
cordappWithPackages("net.corda.flows.djvm.crypto"),
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.crypto"),
name = "deterministic-crypto-contract",
signingInfo = CustomCordapp.SigningInfo()
)
),
djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda
)
tempFolder.root.toPath().let { path ->
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess = false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = listOf(
cordappWithPackages("net.corda.flows.djvm.crypto"),
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.crypto"),
name = "deterministic-crypto-contract",
signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
)
),
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 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,22 +36,28 @@ class NonDeterministicContractVerifyTest {
@JvmField
val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
return DriverParameters(
portAllocation = incrementalPortAllocation(),
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()
)
),
djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda
)
tempFolder.root.toPath().let { path ->
return DriverParameters(
portAllocation = incrementalPortAllocation(),
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(path, 10, "RSA")
)
),
djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda
)
}
}
}
@ -62,7 +70,7 @@ class NonDeterministicContractVerifyTest {
.returnValue.getOrThrow()
}
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()
}
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()
}
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()
}
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()
}
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 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,22 +33,28 @@ class SandboxAttachmentsTest {
@JvmField
val djvmSources = DeterministicSourcesRule()
@Rule
@JvmField
val tempFolder = TemporaryFolder()
fun parametersFor(djvmSources: DeterministicSourcesRule): DriverParameters {
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess = false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = listOf(
cordappWithPackages("net.corda.flows.djvm.attachment"),
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.attachment"),
name = "sandbox-attachment-contract",
signingInfo = CustomCordapp.SigningInfo()
)
),
djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda
)
tempFolder.root.toPath().let { path ->
return DriverParameters(
portAllocation = incrementalPortAllocation(),
startNodesInProcess = false,
notarySpecs = listOf(NotarySpec(DUMMY_NOTARY_NAME, validating = true)),
cordappsForAllNodes = listOf(
cordappWithPackages("net.corda.flows.djvm.attachment"),
CustomCordapp(
packages = setOf("net.corda.contracts.djvm.attachment"),
name = "sandbox-attachment-contract",
signingInfo = CustomCordapp.SigningInfo(path, 10, "RSA")
)
),
djvmBootstrapSource = djvmSources.bootstrap,
djvmCordaSource = djvmSources.corda
)
}
}
}
@ -73,9 +81,9 @@ class SandboxAttachmentsTest {
.returnValue.getOrThrow()
}
assertThat(ex)
.hasMessageStartingWith("sandbox.net.corda.core.contracts.TransactionVerificationException\$ContractRejection -> ")
.hasMessageContaining(" Contract verification failed: does/not/Exist.class, " )
.hasMessageContaining(" contract: sandbox.net.corda.contracts.djvm.attachment.SandboxAttachmentContract, ")
.hasMessageStartingWith("sandbox.net.corda.core.contracts.TransactionVerificationException\$ContractRejection -> ")
.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