mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
CORDA-2333: Dependency update pass for tests and demos (#5211)
This commit is contained in:
parent
8480d49e7e
commit
2152961d46
25
build.gradle
25
build.gradle
@ -44,9 +44,10 @@ buildscript {
|
|||||||
ext.artemis_version = '2.6.2'
|
ext.artemis_version = '2.6.2'
|
||||||
// upgrade Jackson only when corda is using kotlin 1.3.10
|
// upgrade Jackson only when corda is using kotlin 1.3.10
|
||||||
ext.jackson_version = '2.9.5'
|
ext.jackson_version = '2.9.5'
|
||||||
ext.jetty_version = '9.4.7.v20170914'
|
ext.jetty_version = '9.4.18.v20190429'
|
||||||
ext.jersey_version = '2.25'
|
ext.jersey_version = '2.28'
|
||||||
ext.assertj_version = '3.8.0'
|
ext.servlet_version = '4.0.1'
|
||||||
|
ext.assertj_version = '3.12.2'
|
||||||
ext.slf4j_version = '1.7.25'
|
ext.slf4j_version = '1.7.25'
|
||||||
ext.log4j_version = '2.9.1'
|
ext.log4j_version = '2.9.1'
|
||||||
ext.bouncycastle_version = constants.getProperty("bouncycastleVersion")
|
ext.bouncycastle_version = constants.getProperty("bouncycastleVersion")
|
||||||
@ -58,18 +59,18 @@ buildscript {
|
|||||||
ext.okhttp_version = '3.14.1'
|
ext.okhttp_version = '3.14.1'
|
||||||
ext.netty_version = '4.1.22.Final'
|
ext.netty_version = '4.1.22.Final'
|
||||||
ext.typesafe_config_version = constants.getProperty("typesafeConfigVersion")
|
ext.typesafe_config_version = constants.getProperty("typesafeConfigVersion")
|
||||||
ext.fileupload_version = '1.3.3'
|
ext.fileupload_version = '1.4'
|
||||||
// Legacy JUnit 4 version
|
// Legacy JUnit 4 version
|
||||||
ext.junit_version = '4.12'
|
ext.junit_version = '4.12'
|
||||||
// Need this version to access classpath scanning error handling fix -
|
// Need this version to access classpath scanning error handling fix -
|
||||||
// see https://github.com/junit-team/junit5/commit/389de48c2a18c5a93a7203ef424aa47a8a835a74
|
// see https://github.com/junit-team/junit5/commit/389de48c2a18c5a93a7203ef424aa47a8a835a74
|
||||||
// Upgrade to 5.5.x when GA release is available.
|
// Upgrade to 5.5.x when GA release is available.
|
||||||
ext.junit_vintage_version = '5.5.0-M1'
|
ext.junit_vintage_version = '5.5.0-RC1'
|
||||||
ext.junit_jupiter_version = '5.5.0-M1'
|
ext.junit_jupiter_version = '5.5.0-RC1'
|
||||||
ext.junit_platform_version = '1.4.2'
|
ext.junit_platform_version = '1.5.0-RC1'
|
||||||
ext.mockito_version = '2.18.3'
|
ext.mockito_version = '2.28.2'
|
||||||
ext.mockito_kotlin_version = '1.5.0'
|
ext.mockito_kotlin_version = '1.6.0'
|
||||||
ext.hamkrest_version = '1.4.2.2'
|
ext.hamkrest_version = '1.7.0.0'
|
||||||
ext.jopt_simple_version = '5.0.2'
|
ext.jopt_simple_version = '5.0.2'
|
||||||
ext.jansi_version = '1.14'
|
ext.jansi_version = '1.14'
|
||||||
ext.hibernate_version = '5.3.10.Final'
|
ext.hibernate_version = '5.3.10.Final'
|
||||||
@ -89,8 +90,8 @@ buildscript {
|
|||||||
ext.liquibase_version = '3.5.5'
|
ext.liquibase_version = '3.5.5'
|
||||||
ext.artifactory_contextUrl = 'https://ci-artifactory.corda.r3cev.com/artifactory'
|
ext.artifactory_contextUrl = 'https://ci-artifactory.corda.r3cev.com/artifactory'
|
||||||
ext.snake_yaml_version = constants.getProperty('snakeYamlVersion')
|
ext.snake_yaml_version = constants.getProperty('snakeYamlVersion')
|
||||||
ext.docker_compose_rule_version = '0.33.0'
|
ext.docker_compose_rule_version = '0.35.0'
|
||||||
ext.selenium_version = '3.8.1'
|
ext.selenium_version = '3.141.59'
|
||||||
ext.ghostdriver_version = '2.1.0'
|
ext.ghostdriver_version = '2.1.0'
|
||||||
ext.eaagentloader_version = '1.0.3'
|
ext.eaagentloader_version = '1.0.3'
|
||||||
ext.proguard_version = constants.getProperty('proguardVersion')
|
ext.proguard_version = constants.getProperty('proguardVersion')
|
||||||
|
@ -697,7 +697,7 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun JsonNode.assertHasOnlyFields(vararg fieldNames: String): List<JsonNode> {
|
private fun JsonNode.assertHasOnlyFields(vararg fieldNames: String): List<JsonNode> {
|
||||||
assertThat(fieldNames()).containsOnly(*fieldNames)
|
assertThat(fieldNames()).toIterable().containsOnly(*fieldNames)
|
||||||
return fieldNames.map { this[it] }
|
return fieldNames.map { this[it] }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package net.corda.confidential
|
|||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import com.natpryce.hamkrest.MatchResult
|
import com.natpryce.hamkrest.MatchResult
|
||||||
import com.natpryce.hamkrest.Matcher
|
import com.natpryce.hamkrest.Matcher
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import com.natpryce.hamkrest.equalTo
|
import com.natpryce.hamkrest.equalTo
|
||||||
import net.corda.core.crypto.DigitalSignature
|
import net.corda.core.crypto.DigitalSignature
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
@ -18,7 +18,10 @@ import net.corda.testing.core.*
|
|||||||
import net.corda.testing.internal.matchers.allOf
|
import net.corda.testing.internal.matchers.allOf
|
||||||
import net.corda.testing.internal.matchers.flow.willReturn
|
import net.corda.testing.internal.matchers.flow.willReturn
|
||||||
import net.corda.testing.internal.matchers.hasOnlyEntries
|
import net.corda.testing.internal.matchers.hasOnlyEntries
|
||||||
import net.corda.testing.node.internal.*
|
import net.corda.testing.node.internal.InternalMockNetwork
|
||||||
|
import net.corda.testing.node.internal.TestStartedNode
|
||||||
|
import net.corda.testing.node.internal.enclosedCordapp
|
||||||
|
import net.corda.testing.node.internal.startFlow
|
||||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -45,7 +48,7 @@ class SwapIdentitiesFlowTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `issue key`() {
|
fun `issue key`() {
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.services.startFlow(SwapIdentitiesInitiator(bob)),
|
aliceNode.services.startFlow(SwapIdentitiesInitiator(bob)),
|
||||||
willReturn(
|
willReturn(
|
||||||
hasOnlyEntries(
|
hasOnlyEntries(
|
||||||
|
@ -2,7 +2,7 @@ package net.corda.core.flows
|
|||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import com.natpryce.hamkrest.*
|
import com.natpryce.hamkrest.*
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import net.corda.core.contracts.Attachment
|
import net.corda.core.contracts.Attachment
|
||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
import net.corda.core.flows.mixins.WithMockNet
|
import net.corda.core.flows.mixins.WithMockNet
|
||||||
@ -48,18 +48,18 @@ class AttachmentTests : WithMockNet {
|
|||||||
val id = aliceNode.importAttachment(fakeAttachment("file1.txt", "Some useful content"))
|
val id = aliceNode.importAttachment(fakeAttachment("file1.txt", "Some useful content"))
|
||||||
|
|
||||||
// Get node one to run a flow to fetch it and insert it.
|
// Get node one to run a flow to fetch it and insert it.
|
||||||
assert.that(
|
assertThat(
|
||||||
bobNode.startAttachmentFlow(id, alice),
|
bobNode.startAttachmentFlow(id, alice),
|
||||||
willReturn(noAttachments()))
|
willReturn(noAttachments()))
|
||||||
|
|
||||||
// Verify it was inserted into node one's store.
|
// Verify it was inserted into node one's store.
|
||||||
val attachment = bobNode.getAttachmentWithId(id)
|
val attachment = bobNode.getAttachmentWithId(id)
|
||||||
assert.that(attachment, hashesTo(id))
|
assertThat(attachment, hashesTo(id))
|
||||||
|
|
||||||
// Shut down node zero and ensure node one can still resolve the attachment.
|
// Shut down node zero and ensure node one can still resolve the attachment.
|
||||||
aliceNode.dispose()
|
aliceNode.dispose()
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
bobNode.startAttachmentFlow(id, alice),
|
bobNode.startAttachmentFlow(id, alice),
|
||||||
willReturn(soleAttachment(attachment)))
|
willReturn(soleAttachment(attachment)))
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ class AttachmentTests : WithMockNet {
|
|||||||
val hash: SecureHash = SecureHash.randomSHA256()
|
val hash: SecureHash = SecureHash.randomSHA256()
|
||||||
|
|
||||||
// Get node one to fetch a non-existent attachment.
|
// Get node one to fetch a non-existent attachment.
|
||||||
assert.that(
|
assertThat(
|
||||||
bobNode.startAttachmentFlow(hash, alice),
|
bobNode.startAttachmentFlow(hash, alice),
|
||||||
willThrow(withRequestedHash(hash)))
|
willThrow(withRequestedHash(hash)))
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ class AttachmentTests : WithMockNet {
|
|||||||
badAliceNode.updateAttachment(corruptAttachment)
|
badAliceNode.updateAttachment(corruptAttachment)
|
||||||
|
|
||||||
// Get n1 to fetch the attachment. Should receive corrupted bytes.
|
// Get n1 to fetch the attachment. Should receive corrupted bytes.
|
||||||
assert.that(
|
assertThat(
|
||||||
bobNode.startAttachmentFlow(id, badAlice),
|
bobNode.startAttachmentFlow(id, badAlice),
|
||||||
willThrow<FetchDataFlow.DownloadedVsRequestedDataMismatch>()
|
willThrow<FetchDataFlow.DownloadedVsRequestedDataMismatch>()
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.corda.core.flows
|
package net.corda.core.flows
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import net.corda.core.contracts.Command
|
import net.corda.core.contracts.Command
|
||||||
import net.corda.core.contracts.StateAndContract
|
import net.corda.core.contracts.StateAndContract
|
||||||
import net.corda.core.contracts.requireThat
|
import net.corda.core.contracts.requireThat
|
||||||
@ -54,7 +54,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
|||||||
val bConfidentialIdentity = bobNode.createConfidentialIdentity(bob)
|
val bConfidentialIdentity = bobNode.createConfidentialIdentity(bob)
|
||||||
aliceNode.verifyAndRegister(bConfidentialIdentity)
|
aliceNode.verifyAndRegister(bConfidentialIdentity)
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.startTestFlow(alice, bConfidentialIdentity.party, charlie),
|
aliceNode.startTestFlow(alice, bConfidentialIdentity.party, charlie),
|
||||||
willReturn(requiredSignatures(3))
|
willReturn(requiredSignatures(3))
|
||||||
)
|
)
|
||||||
@ -64,7 +64,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
|||||||
fun `no need to collect any signatures`() {
|
fun `no need to collect any signatures`() {
|
||||||
val ptx = aliceNode.signDummyContract(alice.ref(1))
|
val ptx = aliceNode.signDummyContract(alice.ref(1))
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.collectSignatures(ptx),
|
aliceNode.collectSignatures(ptx),
|
||||||
willReturn(requiredSignatures(1))
|
willReturn(requiredSignatures(1))
|
||||||
)
|
)
|
||||||
@ -74,7 +74,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
|||||||
fun `fails when not signed by initiator`() {
|
fun `fails when not signed by initiator`() {
|
||||||
val ptx = miniCorpServices.signDummyContract(alice.ref(1))
|
val ptx = miniCorpServices.signDummyContract(alice.ref(1))
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.collectSignatures(ptx),
|
aliceNode.collectSignatures(ptx),
|
||||||
willThrow(errorMessage("The Initiator of CollectSignaturesFlow must have signed the transaction.")))
|
willThrow(errorMessage("The Initiator of CollectSignaturesFlow must have signed the transaction.")))
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class CollectSignaturesFlowTests : WithContracts {
|
|||||||
bob.ref(3))
|
bob.ref(3))
|
||||||
val signedByBoth = bobNode.addSignatureTo(signedByA)
|
val signedByBoth = bobNode.addSignatureTo(signedByA)
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.collectSignatures(signedByBoth),
|
aliceNode.collectSignatures(signedByBoth),
|
||||||
willReturn(requiredSignatures(2))
|
willReturn(requiredSignatures(2))
|
||||||
)
|
)
|
||||||
|
@ -2,7 +2,7 @@ package net.corda.core.flows
|
|||||||
|
|
||||||
import com.natpryce.hamkrest.and
|
import com.natpryce.hamkrest.and
|
||||||
import com.natpryce.hamkrest.anything
|
import com.natpryce.hamkrest.anything
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import com.natpryce.hamkrest.has
|
import com.natpryce.hamkrest.has
|
||||||
import com.natpryce.hamkrest.isA
|
import com.natpryce.hamkrest.isA
|
||||||
import net.corda.core.CordaRuntimeException
|
import net.corda.core.CordaRuntimeException
|
||||||
@ -52,30 +52,30 @@ class ContractUpgradeFlowRPCTest : WithContracts, WithFinality {
|
|||||||
// Create, sign and finalise dummy contract.
|
// Create, sign and finalise dummy contract.
|
||||||
val signedByA = aliceNode.signDummyContract(alice.ref(1), 0, bob.ref(1))
|
val signedByA = aliceNode.signDummyContract(alice.ref(1), 0, bob.ref(1))
|
||||||
val stx = bobNode.addSignatureTo(signedByA)
|
val stx = bobNode.addSignatureTo(signedByA)
|
||||||
assert.that(rpcA.finalise(stx, bob), willReturn())
|
assertThat(rpcA.finalise(stx, bob), willReturn())
|
||||||
|
|
||||||
val atx = aliceNode.getValidatedTransaction(stx)
|
val atx = aliceNode.getValidatedTransaction(stx)
|
||||||
val btx = bobNode.getValidatedTransaction(stx)
|
val btx = bobNode.getValidatedTransaction(stx)
|
||||||
|
|
||||||
// Cannot upgrade contract without prior authorisation from counterparty
|
// Cannot upgrade contract without prior authorisation from counterparty
|
||||||
assert.that(
|
assertThat(
|
||||||
rpcA.initiateDummyContractUpgrade(atx),
|
rpcA.initiateDummyContractUpgrade(atx),
|
||||||
willThrow<CordaRuntimeException>())
|
willThrow<CordaRuntimeException>())
|
||||||
|
|
||||||
// Party B authorises the contract state upgrade, and immediately deauthorises the same.
|
// Party B authorises the contract state upgrade, and immediately deauthorises the same.
|
||||||
assert.that(rpcB.authoriseDummyContractUpgrade(btx), willReturn())
|
assertThat(rpcB.authoriseDummyContractUpgrade(btx), willReturn())
|
||||||
assert.that(rpcB.deauthoriseContractUpgrade(btx), willReturn())
|
assertThat(rpcB.deauthoriseContractUpgrade(btx), willReturn())
|
||||||
|
|
||||||
// Cannot upgrade contract if counterparty has deauthorised a previously-given authority
|
// Cannot upgrade contract if counterparty has deauthorised a previously-given authority
|
||||||
assert.that(
|
assertThat(
|
||||||
rpcA.initiateDummyContractUpgrade(atx),
|
rpcA.initiateDummyContractUpgrade(atx),
|
||||||
willThrow<CordaRuntimeException>())
|
willThrow<CordaRuntimeException>())
|
||||||
|
|
||||||
// Party B authorise the contract state upgrade.
|
// Party B authorise the contract state upgrade.
|
||||||
assert.that(rpcB.authoriseDummyContractUpgrade(btx), willReturn())
|
assertThat(rpcB.authoriseDummyContractUpgrade(btx), willReturn())
|
||||||
|
|
||||||
// Party A initiates contract upgrade flow, expected to succeed this time.
|
// Party A initiates contract upgrade flow, expected to succeed this time.
|
||||||
assert.that(
|
assertThat(
|
||||||
rpcA.initiateDummyContractUpgrade(atx),
|
rpcA.initiateDummyContractUpgrade(atx),
|
||||||
willReturn(
|
willReturn(
|
||||||
aliceNode.hasDummyContractUpgradeTransaction()
|
aliceNode.hasDummyContractUpgradeTransaction()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.corda.core.flows
|
package net.corda.core.flows
|
||||||
|
|
||||||
import com.natpryce.hamkrest.*
|
import com.natpryce.hamkrest.*
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.flows.mixins.WithContracts
|
import net.corda.core.flows.mixins.WithContracts
|
||||||
import net.corda.core.flows.mixins.WithFinality
|
import net.corda.core.flows.mixins.WithFinality
|
||||||
@ -59,24 +59,24 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
|
|||||||
val bobTx = bobNode.getValidatedTransaction(stx)
|
val bobTx = bobNode.getValidatedTransaction(stx)
|
||||||
|
|
||||||
// The request is expected to be rejected because party B hasn't authorised the upgrade yet.
|
// The request is expected to be rejected because party B hasn't authorised the upgrade yet.
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.initiateContractUpgrade(aliceTx, DummyContractV2::class),
|
aliceNode.initiateContractUpgrade(aliceTx, DummyContractV2::class),
|
||||||
willThrow<UnexpectedFlowEndException>())
|
willThrow<UnexpectedFlowEndException>())
|
||||||
|
|
||||||
// Party B authorises the contract state upgrade, and immediately de-authorises the same.
|
// Party B authorises the contract state upgrade, and immediately de-authorises the same.
|
||||||
assert.that(bobNode.authoriseContractUpgrade(bobTx, DummyContractV2::class), willReturn())
|
assertThat(bobNode.authoriseContractUpgrade(bobTx, DummyContractV2::class), willReturn())
|
||||||
assert.that(bobNode.deauthoriseContractUpgrade(bobTx), willReturn())
|
assertThat(bobNode.deauthoriseContractUpgrade(bobTx), willReturn())
|
||||||
|
|
||||||
// The request is expected to be rejected because party B has subsequently de-authorised a previously authorised upgrade.
|
// The request is expected to be rejected because party B has subsequently de-authorised a previously authorised upgrade.
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.initiateContractUpgrade(aliceTx, DummyContractV2::class),
|
aliceNode.initiateContractUpgrade(aliceTx, DummyContractV2::class),
|
||||||
willThrow<UnexpectedFlowEndException>())
|
willThrow<UnexpectedFlowEndException>())
|
||||||
|
|
||||||
// Party B authorises the contract state upgrade.
|
// Party B authorises the contract state upgrade.
|
||||||
assert.that(bobNode.authoriseContractUpgrade(bobTx, DummyContractV2::class), willReturn())
|
assertThat(bobNode.authoriseContractUpgrade(bobTx, DummyContractV2::class), willReturn())
|
||||||
|
|
||||||
// Party A initiates contract upgrade flow, expected to succeed this time.
|
// Party A initiates contract upgrade flow, expected to succeed this time.
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.initiateContractUpgrade(aliceTx, DummyContractV2::class),
|
aliceNode.initiateContractUpgrade(aliceTx, DummyContractV2::class),
|
||||||
willReturn(
|
willReturn(
|
||||||
aliceNode.hasContractUpgradeTransaction<DummyContract.State, DummyContractV2.State>()
|
aliceNode.hasContractUpgradeTransaction<DummyContract.State, DummyContractV2.State>()
|
||||||
@ -86,10 +86,10 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
|
|||||||
|
|
||||||
// We now test that the upgraded state can be upgraded further, to V3.
|
// We now test that the upgraded state can be upgraded further, to V3.
|
||||||
// Party B authorises the contract state upgrade.
|
// Party B authorises the contract state upgrade.
|
||||||
assert.that(bobNode.authoriseContractUpgrade(upgradedState, DummyContractV3::class), willReturn())
|
assertThat(bobNode.authoriseContractUpgrade(upgradedState, DummyContractV3::class), willReturn())
|
||||||
|
|
||||||
// Party A initiates contract upgrade flow which is expected to succeed.
|
// Party A initiates contract upgrade flow which is expected to succeed.
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.initiateContractUpgrade(upgradedState, DummyContractV3::class),
|
aliceNode.initiateContractUpgrade(upgradedState, DummyContractV3::class),
|
||||||
willReturn(
|
willReturn(
|
||||||
aliceNode.hasContractUpgradeTransaction<DummyContractV2.State, DummyContractV3.State>()
|
aliceNode.hasContractUpgradeTransaction<DummyContractV2.State, DummyContractV3.State>()
|
||||||
@ -125,14 +125,14 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
|
|||||||
val stateAndRef = cashFlowResult.stx.tx.outRef<Cash.State>(0)
|
val stateAndRef = cashFlowResult.stx.tx.outRef<Cash.State>(0)
|
||||||
|
|
||||||
// The un-upgraded state is Cash.State
|
// The un-upgraded state is Cash.State
|
||||||
assert.that(aliceNode.getBaseStateFromVault(), hasContractState(isA<Cash.State>(anything)))
|
assertThat(aliceNode.getBaseStateFromVault(), hasContractState(isA<Cash.State>(anything)))
|
||||||
|
|
||||||
// Starts contract upgrade flow.
|
// Starts contract upgrade flow.
|
||||||
assert.that(aliceNode.initiateContractUpgrade(stateAndRef, CashV2::class), willReturn())
|
assertThat(aliceNode.initiateContractUpgrade(stateAndRef, CashV2::class), willReturn())
|
||||||
|
|
||||||
// Get contract state from the vault.
|
// Get contract state from the vault.
|
||||||
val upgradedState = aliceNode.getCashStateFromVault()
|
val upgradedState = aliceNode.getCashStateFromVault()
|
||||||
assert.that(upgradedState,
|
assertThat(upgradedState,
|
||||||
hasIssuedAmount(Amount(1000000, USD) `issued by` (alice.ref(1)))
|
hasIssuedAmount(Amount(1000000, USD) `issued by` (alice.ref(1)))
|
||||||
and belongsTo(anonymisedRecipient))
|
and belongsTo(anonymisedRecipient))
|
||||||
|
|
||||||
@ -146,8 +146,8 @@ class ContractUpgradeFlowTest : WithContracts, WithFinality {
|
|||||||
addCommand(CashV2.Move(), alice.owningKey)
|
addCommand(CashV2.Move(), alice.owningKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.that(aliceNode.finalise(spendUpgradedTx), willReturn())
|
assertThat(aliceNode.finalise(spendUpgradedTx), willReturn())
|
||||||
assert.that(aliceNode.getCashStateFromVault(), hasContractState(equalTo(movedState)))
|
assertThat(aliceNode.getCashStateFromVault(), hasContractState(equalTo(movedState)))
|
||||||
}
|
}
|
||||||
|
|
||||||
class CashV2 : UpgradedContractWithLegacyConstraint<Cash.State, CashV2.State> {
|
class CashV2 : UpgradedContractWithLegacyConstraint<Cash.State, CashV2.State> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.corda.core.flows
|
package net.corda.core.flows
|
||||||
|
|
||||||
import com.natpryce.hamkrest.and
|
import com.natpryce.hamkrest.and
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import net.corda.core.flows.mixins.WithFinality
|
import net.corda.core.flows.mixins.WithFinality
|
||||||
import net.corda.core.flows.mixins.WithFinality.FinalityInvoker
|
import net.corda.core.flows.mixins.WithFinality.FinalityInvoker
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
@ -17,7 +17,6 @@ import net.corda.testing.internal.matchers.flow.willReturn
|
|||||||
import net.corda.testing.internal.matchers.flow.willThrow
|
import net.corda.testing.internal.matchers.flow.willThrow
|
||||||
import net.corda.testing.node.internal.*
|
import net.corda.testing.node.internal.*
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ class FinalityFlowTests : WithFinality {
|
|||||||
val bob = createBob()
|
val bob = createBob()
|
||||||
val stx = aliceNode.issuesCashTo(bob)
|
val stx = aliceNode.issuesCashTo(bob)
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.finalise(stx, bob.info.singleIdentity()),
|
aliceNode.finalise(stx, bob.info.singleIdentity()),
|
||||||
willReturn(
|
willReturn(
|
||||||
requiredSignatures(1)
|
requiredSignatures(1)
|
||||||
@ -52,7 +51,7 @@ class FinalityFlowTests : WithFinality {
|
|||||||
// Charlie isn't part of this network, so node A won't recognise them
|
// Charlie isn't part of this network, so node A won't recognise them
|
||||||
val stx = aliceNode.issuesCashTo(CHARLIE)
|
val stx = aliceNode.issuesCashTo(CHARLIE)
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
aliceNode.finalise(stx),
|
aliceNode.finalise(stx),
|
||||||
willThrow<IllegalArgumentException>())
|
willThrow<IllegalArgumentException>())
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.corda.core.flows
|
package net.corda.core.flows
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import com.natpryce.hamkrest.assertion.assert
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
import net.corda.core.flows.mixins.WithMockNet
|
import net.corda.core.flows.mixins.WithMockNet
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.utilities.UntrustworthyData
|
import net.corda.core.utilities.UntrustworthyData
|
||||||
@ -10,11 +10,10 @@ import net.corda.testing.core.singleIdentity
|
|||||||
import net.corda.testing.internal.matchers.flow.willReturn
|
import net.corda.testing.internal.matchers.flow.willReturn
|
||||||
import net.corda.testing.node.internal.InternalMockNetwork
|
import net.corda.testing.node.internal.InternalMockNetwork
|
||||||
import net.corda.testing.node.internal.TestStartedNode
|
import net.corda.testing.node.internal.TestStartedNode
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
|
||||||
import org.junit.AfterClass
|
import org.junit.AfterClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class ReceiveMultipleFlowTests : WithMockNet {
|
class ReceiveMultipleFlowTests : WithMockNet {
|
||||||
companion object {
|
companion object {
|
||||||
@ -52,13 +51,13 @@ class ReceiveMultipleFlowTests : WithMockNet {
|
|||||||
// this is a closure, meaning you can access variables outside its scope e.g., `answer`.
|
// this is a closure, meaning you can access variables outside its scope e.g., `answer`.
|
||||||
val receivedMessage = session.receive<String>().unwrap { it }
|
val receivedMessage = session.receive<String>().unwrap { it }
|
||||||
logger.info("Got message from counterParty: $receivedMessage.")
|
logger.info("Got message from counterParty: $receivedMessage.")
|
||||||
assertThat(receivedMessage).isEqualTo(message)
|
assertEquals(message, receivedMessage)
|
||||||
session.send(answer)
|
session.send(answer)
|
||||||
}
|
}
|
||||||
} as FlowLogic<Unit>
|
} as FlowLogic<Unit>
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
nodes[0].startFlowAndRunNetwork(initiatingFlow),
|
nodes[0].startFlowAndRunNetwork(initiatingFlow),
|
||||||
willReturn(answer as Any))
|
willReturn(answer as Any))
|
||||||
}
|
}
|
||||||
@ -70,7 +69,7 @@ class ReceiveMultipleFlowTests : WithMockNet {
|
|||||||
val stringValue = "Thriller"
|
val stringValue = "Thriller"
|
||||||
nodes[2].registerAnswer(AlgorithmDefinition::class, stringValue)
|
nodes[2].registerAnswer(AlgorithmDefinition::class, stringValue)
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
nodes[0].startFlowAndRunNetwork(ParallelAlgorithmMap(nodes[1].info.singleIdentity(), nodes[2].info.singleIdentity())),
|
nodes[0].startFlowAndRunNetwork(ParallelAlgorithmMap(nodes[1].info.singleIdentity(), nodes[2].info.singleIdentity())),
|
||||||
willReturn(doubleValue * stringValue.length))
|
willReturn(doubleValue * stringValue.length))
|
||||||
}
|
}
|
||||||
@ -82,7 +81,7 @@ class ReceiveMultipleFlowTests : WithMockNet {
|
|||||||
val value2 = 6.0
|
val value2 = 6.0
|
||||||
nodes[2].registerAnswer(ParallelAlgorithmList::class, value2)
|
nodes[2].registerAnswer(ParallelAlgorithmList::class, value2)
|
||||||
|
|
||||||
assert.that(
|
assertThat(
|
||||||
nodes[0].startFlowAndRunNetwork(ParallelAlgorithmList(nodes[1].info.singleIdentity(), nodes[2].info.singleIdentity())),
|
nodes[0].startFlowAndRunNetwork(ParallelAlgorithmList(nodes[1].info.singleIdentity(), nodes[2].info.singleIdentity())),
|
||||||
willReturn(listOf(value1, value2)))
|
willReturn(listOf(value1, value2)))
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ dependencies {
|
|||||||
// Web stuff: for HTTP[S] servlets
|
// Web stuff: for HTTP[S] servlets
|
||||||
testCompile "org.eclipse.jetty:jetty-servlet:${jetty_version}"
|
testCompile "org.eclipse.jetty:jetty-servlet:${jetty_version}"
|
||||||
testCompile "org.eclipse.jetty:jetty-webapp:${jetty_version}"
|
testCompile "org.eclipse.jetty:jetty-webapp:${jetty_version}"
|
||||||
testCompile "javax.servlet:javax.servlet-api:3.1.0"
|
testCompile "javax.servlet:javax.servlet-api:${servlet_version}"
|
||||||
|
|
||||||
// Jersey for JAX-RS implementation for use in Jetty
|
// Jersey for JAX-RS implementation for use in Jetty
|
||||||
testCompile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
|
testCompile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
|
||||||
|
@ -33,8 +33,8 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
||||||
compile "javax.servlet:javax.servlet-api:3.1.0"
|
compile "javax.servlet:javax.servlet-api:${servlet_version}"
|
||||||
compile "javax.ws.rs:javax.ws.rs-api:2.0.1"
|
compile "javax.ws.rs:javax.ws.rs-api:2.1.1"
|
||||||
cordaCompile project(':client:rpc')
|
cordaCompile project(':client:rpc')
|
||||||
|
|
||||||
// Cordformation needs a SLF4J implementation when executing the Network
|
// Cordformation needs a SLF4J implementation when executing the Network
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
|
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
|
||||||
classpath "io.spring.gradle:dependency-management-plugin:1.0.4.RELEASE"
|
classpath "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile group: 'commons-io', name: 'commons-io', version: '2.5'
|
compile "commons-io:commons-io:$commons_io_version"
|
||||||
compile project(":samples:irs-demo:web")
|
compile project(":samples:irs-demo:web")
|
||||||
compile('org.springframework.boot:spring-boot-starter-web') {
|
compile('org.springframework.boot:spring-boot-starter-web') {
|
||||||
exclude module: "spring-boot-starter-logging"
|
exclude module: "spring-boot-starter-logging"
|
||||||
|
@ -23,7 +23,7 @@ dependencies {
|
|||||||
|
|
||||||
// Cordapp dependencies
|
// Cordapp dependencies
|
||||||
// Specify your cordapp's dependencies below, including dependent cordapps
|
// Specify your cordapp's dependencies below, including dependent cordapps
|
||||||
compile group: 'commons-io', name: 'commons-io', version: '2.5'
|
compile "commons-io:commons-io:$commons_io_version"
|
||||||
|
|
||||||
testCompile project(':node-driver')
|
testCompile project(':node-driver')
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.yaml:snakeyaml:1.19"
|
classpath "org.yaml:snakeyaml:1.24"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,12 +40,13 @@ dependencies {
|
|||||||
// Web stuff: for HTTP[S] servlets
|
// Web stuff: for HTTP[S] servlets
|
||||||
compile "org.eclipse.jetty:jetty-servlet:${jetty_version}"
|
compile "org.eclipse.jetty:jetty-servlet:${jetty_version}"
|
||||||
compile "org.eclipse.jetty:jetty-webapp:${jetty_version}"
|
compile "org.eclipse.jetty:jetty-webapp:${jetty_version}"
|
||||||
compile "javax.servlet:javax.servlet-api:3.1.0"
|
compile "javax.servlet:javax.servlet-api:${servlet_version}"
|
||||||
|
|
||||||
compile "org.gradle:gradle-tooling-api:${gradle.gradleVersion}"
|
compile "org.gradle:gradle-tooling-api:${gradle.gradleVersion}"
|
||||||
|
|
||||||
// Jersey for JAX-RS implementation for use in Jetty
|
// Jersey for JAX-RS implementation for use in Jetty
|
||||||
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
|
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
|
||||||
|
compile "org.glassfish.jersey.inject:jersey-hk2:${jersey_version}"
|
||||||
compile "org.glassfish.jersey.containers:jersey-container-servlet-core:${jersey_version}"
|
compile "org.glassfish.jersey.containers:jersey-container-servlet-core:${jersey_version}"
|
||||||
compile "org.glassfish.jersey.containers:jersey-container-jetty-http:${jersey_version}"
|
compile "org.glassfish.jersey.containers:jersey-container-jetty-http:${jersey_version}"
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ dependencies {
|
|||||||
runtimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit_jupiter_version}"
|
runtimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit_jupiter_version}"
|
||||||
runtimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
|
runtimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
|
||||||
|
|
||||||
compile 'org.hamcrest:hamcrest-library:1.3'
|
compile 'org.hamcrest:hamcrest-library:2.1'
|
||||||
compile "com.nhaarman:mockito-kotlin:$mockito_kotlin_version"
|
compile "com.nhaarman:mockito-kotlin:$mockito_kotlin_version"
|
||||||
compile "org.mockito:mockito-core:$mockito_version"
|
compile "org.mockito:mockito-core:$mockito_version"
|
||||||
compile "org.assertj:assertj-core:$assertj_version"
|
compile "org.assertj:assertj-core:$assertj_version"
|
||||||
|
@ -65,7 +65,7 @@ class ANSIProgressRendererTest {
|
|||||||
|
|
||||||
private fun checkTrackingState(captor: KArgumentCaptor<Ansi>, updates: Int, trackerState: List<String>) {
|
private fun checkTrackingState(captor: KArgumentCaptor<Ansi>, updates: Int, trackerState: List<String>) {
|
||||||
verify(printWriter, times(updates)).print(captor.capture())
|
verify(printWriter, times(updates)).print(captor.capture())
|
||||||
assertThat(captor.lastValue.toString()).containsSequence(trackerState)
|
assertThat(captor.lastValue.toString()).containsSubsequence(trackerState)
|
||||||
verify(printWriter, times(updates)).flush()
|
verify(printWriter, times(updates)).flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ dependencies {
|
|||||||
// Web stuff: for HTTP[S] servlets
|
// Web stuff: for HTTP[S] servlets
|
||||||
compile "org.eclipse.jetty:jetty-servlet:$jetty_version"
|
compile "org.eclipse.jetty:jetty-servlet:$jetty_version"
|
||||||
compile "org.eclipse.jetty:jetty-webapp:$jetty_version"
|
compile "org.eclipse.jetty:jetty-webapp:$jetty_version"
|
||||||
compile "javax.servlet:javax.servlet-api:3.1.0"
|
compile "javax.servlet:javax.servlet-api:${servlet_version}"
|
||||||
compile "commons-fileupload:commons-fileupload:$fileupload_version"
|
compile "commons-fileupload:commons-fileupload:$fileupload_version"
|
||||||
|
|
||||||
// Log4J: logging framework (with SLF4J bindings)
|
// Log4J: logging framework (with SLF4J bindings)
|
||||||
@ -54,7 +54,7 @@ dependencies {
|
|||||||
compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
|
compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
|
||||||
|
|
||||||
// For rendering the index page.
|
// For rendering the index page.
|
||||||
compile "org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.3"
|
compile "org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.12"
|
||||||
|
|
||||||
// Capsule is a library for building independently executable fat JARs.
|
// Capsule is a library for building independently executable fat JARs.
|
||||||
// We only need this dependency to compile our Caplet against.
|
// We only need this dependency to compile our Caplet against.
|
||||||
|
Loading…
Reference in New Issue
Block a user