mirror of
https://github.com/corda/corda.git
synced 2025-06-14 21:28:14 +00:00
Merge remote-tracking branch 'open/master' into anthony-os-merge-2
# Conflicts: # .ci/api-current.txt # client/jfx/src/integration-test/kotlin/net/corda/client/jfx/NodeMonitorModelTest.kt # client/rpc/src/integration-test/kotlin/net/corda/client/rpc/FlowsExecutionModeRpcTest.kt # docs/source/example-code/src/integration-test/kotlin/net/corda/docs/IntegrationTestingTutorial.kt # docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/mocknetwork/TutorialMockNetwork.kt # finance/src/test/kotlin/net/corda/finance/flows/CashPaymentFlowTests.kt # node/src/integration-test/kotlin/net/corda/node/CordappScanningDriverTest.kt # node/src/integration-test/kotlin/net/corda/node/NodePerformanceTests.kt # node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt # node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt # node/src/integration-test/kotlin/net/corda/node/services/network/NetworkMapTest.kt # node/src/integration-test/kotlin/net/corda/node/services/rpc/RpcSslTest.kt # node/src/integration-test/kotlin/net/corda/node/services/statemachine/FlowVersioningTest.kt # node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt # node/src/integration-test/kotlin/net/corda/services/messaging/MQSecurityTest.kt # node/src/integration-test/kotlin/net/corda/services/messaging/P2PMessagingTest.kt # node/src/integration-test/kotlin/net/corda/test/node/NodeStatePersistenceTests.kt # node/src/test/kotlin/net/corda/node/CordaRPCOpsImplTest.kt # node/src/test/kotlin/net/corda/node/modes/draining/ScheduledFlowsDrainingModeTest.kt # node/src/test/kotlin/net/corda/node/services/messaging/ArtemisMessagingTest.kt # node/src/test/kotlin/net/corda/node/services/statemachine/FlowFrameworkTests.kt # node/src/test/kotlin/net/corda/node/services/transactions/MaxTransactionSizeTests.kt # samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt # testing/node-driver/src/main/kotlin/net/corda/testing/node/InMemoryMessagingNetwork.kt # testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt # testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/NodeBasedTest.kt # verifier/src/integration-test/kotlin/net/corda/verifier/VerifierTests.kt
This commit is contained in:
@ -16,7 +16,7 @@ import net.corda.core.transactions.TransactionBuilder
|
||||
import net.corda.core.utilities.unwrap
|
||||
import net.corda.finance.contracts.asset.Cash
|
||||
import net.corda.finance.schemas.CashSchemaV1
|
||||
import net.corda.testing.core.chooseIdentity
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import java.util.*
|
||||
|
||||
@CordaSerializable
|
||||
@ -74,7 +74,7 @@ private fun prepareOurInputsAndOutputs(serviceHub: ServiceHub, lockId: UUID, req
|
||||
val outputs = if (residual > 0L) {
|
||||
// Build an output state for the residual change back to us
|
||||
val residualAmount = Amount(residual, sellAmount.token)
|
||||
val residualOutput = Cash.State(residualAmount, serviceHub.myInfo.chooseIdentity())
|
||||
val residualOutput = Cash.State(residualAmount, serviceHub.myInfo.singleIdentity())
|
||||
listOf(transferedFundsOutput, residualOutput)
|
||||
} else {
|
||||
listOf(transferedFundsOutput)
|
||||
|
@ -10,7 +10,7 @@ import net.corda.core.transactions.LedgerTransaction
|
||||
import net.corda.core.transactions.TransactionBuilder
|
||||
import net.corda.finance.contracts.asset.Cash
|
||||
import net.corda.finance.utils.sumCashBy
|
||||
import net.corda.testing.core.chooseIdentityAndCert
|
||||
import net.corda.testing.core.singleIdentityAndCert
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
|
||||
@ -112,7 +112,7 @@ class CommercialPaper : Contract {
|
||||
services = services,
|
||||
tx = tx,
|
||||
amount = paper.state.data.faceValue.withoutIssuer(),
|
||||
ourIdentity = services.myInfo.chooseIdentityAndCert(),
|
||||
ourIdentity = services.myInfo.singleIdentityAndCert(),
|
||||
to = paper.state.data.owner
|
||||
)
|
||||
tx.addInputState(paper)
|
||||
|
@ -73,32 +73,32 @@ class TutorialMockNetwork {
|
||||
mockNet.stopNodes()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `fail if initiated doesn't send back 1 on first result`() {
|
||||
// @Test
|
||||
// fun `fail if initiated doesn't send back 1 on first result`() {
|
||||
|
||||
// DOCSTART 1
|
||||
// modify message if it's 1
|
||||
nodeB.setMessagingServiceSpy(object : MessagingServiceSpy(nodeB.network) {
|
||||
|
||||
override fun send(message: Message, target: MessageRecipients, retryId: Long?, sequenceKey: Any) {
|
||||
val messageData = message.data.deserialize<Any>() as? ExistingSessionMessage
|
||||
val payload = messageData?.payload
|
||||
if (payload is DataSessionMessage && payload.payload.deserialize() == 1) {
|
||||
val alteredMessageData = messageData.copy(payload = payload.copy(99.serialize())).serialize().bytes
|
||||
messagingService.send(InMemoryMessagingNetwork.InMemoryMessage(message.topic, OpaqueBytes(alteredMessageData), message.uniqueMessageId), target, retryId)
|
||||
} else {
|
||||
messagingService.send(message, target, retryId)
|
||||
}
|
||||
}
|
||||
})
|
||||
// TODO: Fix this test - accessing the MessagingService directly exposes internal interfaces
|
||||
// nodeB.setMessagingServiceSpy(object : MessagingServiceSpy(nodeB.network) {
|
||||
// override fun send(message: Message, target: MessageRecipients, retryId: Long?, sequenceKey: Any, additionalHeaders: Map<String, String>) {
|
||||
// val messageData = message.data.deserialize<Any>() as? ExistingSessionMessage
|
||||
// val payload = messageData?.payload
|
||||
//
|
||||
// if (payload is DataSessionMessage && payload.payload.deserialize() == 1) {
|
||||
// val alteredMessageData = messageData.copy(payload = payload.copy(99.serialize())).serialize().bytes
|
||||
// messagingService.send(InMemoryMessagingNetwork.InMemoryMessage(message.topic, OpaqueBytes(alteredMessageData), message.uniqueMessageId), target, retryId)
|
||||
// } else {
|
||||
// messagingService.send(message, target, retryId)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// DOCEND 1
|
||||
|
||||
val initiatingReceiveFlow = nodeA.services.startFlow(FlowA(nodeB.info.legalIdentities.first()))
|
||||
|
||||
mockNet.runNetwork()
|
||||
|
||||
expectedEx.expect(IllegalArgumentException::class.java)
|
||||
expectedEx.expectMessage("Expected to receive 1")
|
||||
initiatingReceiveFlow.getOrThrow()
|
||||
}
|
||||
// val initiatingReceiveFlow = nodeA.startFlow(FlowA(nodeB.info.legalIdentities.first()))
|
||||
//
|
||||
// mockNet.runNetwork()
|
||||
//
|
||||
// expectedEx.expect(IllegalArgumentException::class.java)
|
||||
// expectedEx.expectMessage("Expected to receive 1")
|
||||
// initiatingReceiveFlow.getOrThrow()
|
||||
// }
|
||||
}
|
Reference in New Issue
Block a user