mirror of
https://github.com/corda/corda.git
synced 2025-06-14 05:08:18 +00:00
Merge remote-tracking branch 'remotes/open/master' into merges/may-14-15-21
# Conflicts: # .idea/compiler.xml # constants.properties # experimental/behave/src/main/kotlin/net/corda/behave/network/Network.kt # experimental/behave/src/main/kotlin/net/corda/behave/node/Distribution.kt # experimental/behave/src/test/kotlin/net/corda/behave/service/PostreSQLServiceTests.kt # node-api/src/main/kotlin/net/corda/nodeapi/internal/bridging/AMQPBridgeManager.kt # node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/CordaPersistence.kt # node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/HibernateConfiguration.kt # node-api/src/main/kotlin/net/corda/nodeapi/internal/protonwrapper/netty/AMQPChannelHandler.kt # node-api/src/main/kotlin/net/corda/nodeapi/internal/protonwrapper/netty/AMQPClient.kt # node/src/integration-test/kotlin/net/corda/node/AuthDBTests.kt # node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt # node/src/main/kotlin/net/corda/node/internal/NodeStartup.kt # node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt # node/src/main/kotlin/net/corda/node/services/messaging/MessagingExecutor.kt # node/src/main/kotlin/net/corda/node/services/persistence/AbstractPartyToX500NameAsStringConverter.kt # node/src/main/kotlin/net/corda/node/services/persistence/DBTransactionMappingStorage.kt # node/src/main/kotlin/net/corda/node/utilities/AddOrRemove.kt # node/src/test/kotlin/net/corda/node/services/config/NodeConfigurationImplTest.kt # samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt # samples/irs-demo/web/src/test/kotlin/net/corda/irs/web/IrsDemoWebApplicationTests.kt # samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt # testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt # testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalTestUtils.kt # testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/RPCDriver.kt # testing/smoke-test-utils/src/main/kotlin/net/corda/smoketesting/NodeConfig.kt # webserver/src/integration-test/kotlin/net/corda/webserver/WebserverDriverTests.kt
This commit is contained in:
@ -476,7 +476,7 @@ public class FlowCookbookJava {
|
||||
subFlow(new SendStateAndRefFlow(counterpartySession, dummyStates));
|
||||
|
||||
// On the receive side ...
|
||||
List<StateAndRef<DummyState>> resolvedStateAndRef = subFlow(new ReceiveStateAndRefFlow<DummyState>(counterpartySession));
|
||||
List<StateAndRef<DummyState>> resolvedStateAndRef = subFlow(new ReceiveStateAndRefFlow<>(counterpartySession));
|
||||
// DOCEND 14
|
||||
|
||||
try {
|
||||
|
@ -60,7 +60,7 @@ public class CommercialPaper implements Contract {
|
||||
requireThat(require -> {
|
||||
require.using("the paper must have matured", time.isAfter(input.getMaturityDate()));
|
||||
require.using("the received amount equals the face value", received == input.getFaceValue());
|
||||
require.using("the paper must be destroyed", outputs.size() == 0);
|
||||
require.using("the paper must be destroyed", outputs.isEmpty());
|
||||
require.using("the transaction is signed by the owner of the CP", cmd.getSigners().contains(input.getOwner().getOwningKey()));
|
||||
return null;
|
||||
});
|
||||
|
@ -153,9 +153,8 @@ object TopupIssuerFlow {
|
||||
// now invoke Cash subflow to Move issued assetType to issue requester
|
||||
progressTracker.currentStep = TRANSFERRING
|
||||
val moveCashFlow = CashPaymentFlow(amount, issueTo, anonymous = false)
|
||||
val moveTx = subFlow(moveCashFlow)
|
||||
// NOTE: CashFlow PayCash calls FinalityFlow which performs a Broadcast (which stores a local copy of the txn to the ledger)
|
||||
return moveTx
|
||||
return subFlow(moveCashFlow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ enum class WorkflowState {
|
||||
REJECTED
|
||||
}
|
||||
|
||||
val TRADE_APPROVAL_PROGRAM_ID = "net.corda.docs.TradeApprovalContract"
|
||||
const val TRADE_APPROVAL_PROGRAM_ID = "net.corda.docs.TradeApprovalContract"
|
||||
|
||||
/**
|
||||
* Minimal contract to encode a simple workflow with one initial state and two possible eventual states.
|
||||
|
@ -14,7 +14,7 @@ import net.corda.core.contracts.CommandData
|
||||
import net.corda.core.contracts.Contract
|
||||
import net.corda.core.transactions.LedgerTransaction
|
||||
|
||||
val TEMPLATE_CONTRACT_ID = "com.template.TemplateContract"
|
||||
const val TEMPLATE_CONTRACT_ID = "com.template.TemplateContract"
|
||||
|
||||
open class TemplateContract : Contract {
|
||||
// A transaction is considered valid if the verify() function of the contract of each of the transaction's input
|
||||
|
@ -18,20 +18,12 @@ import net.corda.core.flows.FlowSession
|
||||
import net.corda.core.flows.InitiatedBy
|
||||
import net.corda.core.flows.InitiatingFlow
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.messaging.MessageRecipients
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.core.utilities.unwrap
|
||||
import net.corda.node.services.messaging.Message
|
||||
import net.corda.node.services.statemachine.DataSessionMessage
|
||||
import net.corda.node.services.statemachine.ExistingSessionMessage
|
||||
import net.corda.testing.node.*
|
||||
import net.corda.testing.node.MockNetwork
|
||||
import net.corda.testing.node.StartedMockNode
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.ExpectedException
|
||||
|
||||
class TutorialMockNetwork {
|
||||
@ -63,9 +55,9 @@ class TutorialMockNetwork {
|
||||
}
|
||||
}
|
||||
|
||||
lateinit private var mockNet: MockNetwork
|
||||
lateinit private var nodeA: StartedMockNode
|
||||
lateinit private var nodeB: StartedMockNode
|
||||
private lateinit var mockNet: MockNetwork
|
||||
private lateinit var nodeA: StartedMockNode
|
||||
private lateinit var nodeB: StartedMockNode
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@ -86,8 +78,8 @@ class TutorialMockNetwork {
|
||||
// @Test
|
||||
// fun `fail if initiated doesn't send back 1 on first result`() {
|
||||
|
||||
// DOCSTART 1
|
||||
// TODO: Fix this test - accessing the MessagingService directly exposes internal interfaces
|
||||
// DOCSTART 1
|
||||
// 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
|
||||
@ -101,7 +93,7 @@ class TutorialMockNetwork {
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// DOCEND 1
|
||||
// DOCEND 1
|
||||
|
||||
// val initiatingReceiveFlow = nodeA.startFlow(FlowA(nodeB.info.legalIdentities.first()))
|
||||
//
|
||||
|
@ -19,7 +19,7 @@ import net.corda.core.transactions.LedgerTransaction
|
||||
import net.corda.core.contracts.*
|
||||
|
||||
// Replace IOUContract's contract ID and definition with:
|
||||
val IOU_CONTRACT_ID = "com.template.IOUContract"
|
||||
const val IOU_CONTRACT_ID = "com.template.IOUContract"
|
||||
|
||||
class IOUContract : Contract {
|
||||
// Our Create command.
|
||||
|
@ -14,19 +14,15 @@ package net.corda.docs.tutorial.twoparty
|
||||
import co.paralleluniverse.fibers.Suspendable
|
||||
import net.corda.core.contracts.Command
|
||||
import net.corda.core.contracts.StateAndContract
|
||||
import net.corda.core.flows.*
|
||||
import net.corda.core.flows.CollectSignaturesFlow
|
||||
import net.corda.core.flows.FinalityFlow
|
||||
import net.corda.core.flows.FlowLogic
|
||||
import net.corda.core.flows.InitiatingFlow
|
||||
import net.corda.core.flows.StartableByRPC
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.messaging.CordaRPCOps
|
||||
import net.corda.core.serialization.SerializationWhitelist
|
||||
import net.corda.core.transactions.TransactionBuilder
|
||||
import net.corda.core.utilities.ProgressTracker
|
||||
import net.corda.webserver.services.WebServerPluginRegistry
|
||||
import java.util.function.Function
|
||||
import javax.ws.rs.GET
|
||||
import javax.ws.rs.Path
|
||||
import javax.ws.rs.Produces
|
||||
import javax.ws.rs.core.MediaType
|
||||
import javax.ws.rs.core.Response
|
||||
|
||||
// DOCEND 01
|
||||
|
||||
@InitiatingFlow
|
||||
|
@ -34,7 +34,6 @@ import net.corda.node.services.vault.VaultSchemaV1
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import net.corda.testing.node.MockNetwork
|
||||
import net.corda.testing.node.StartedMockNode
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.assertj.core.api.Assertions.assertThatCode
|
||||
import org.junit.After
|
||||
import org.junit.Assert
|
||||
@ -115,12 +114,12 @@ class CustomVaultQueryTest {
|
||||
val balancesNodesA = nodeA.transaction {
|
||||
nodeA.services.getCashBalances()
|
||||
}
|
||||
println("BalanceA\n" + balancesNodesA)
|
||||
println("BalanceA\n$balancesNodesA")
|
||||
|
||||
val balancesNodesB = nodeB.transaction {
|
||||
nodeB.services.getCashBalances()
|
||||
}
|
||||
println("BalanceB\n" + balancesNodesB)
|
||||
println("BalanceB\n$balancesNodesB")
|
||||
|
||||
return Pair(balancesNodesA, balancesNodesB)
|
||||
}
|
||||
|
@ -14,9 +14,13 @@ import net.corda.core.identity.Party
|
||||
import net.corda.core.toFuture
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import net.corda.core.utilities.getOrThrow
|
||||
import net.corda.finance.*
|
||||
import net.corda.finance.DOLLARS
|
||||
import net.corda.finance.GBP
|
||||
import net.corda.finance.POUNDS
|
||||
import net.corda.finance.USD
|
||||
import net.corda.finance.contracts.getCashBalances
|
||||
import net.corda.finance.flows.CashIssueFlow
|
||||
import net.corda.finance.issuedBy
|
||||
import net.corda.testing.core.singleIdentity
|
||||
import net.corda.testing.node.MockNetwork
|
||||
import net.corda.testing.node.StartedMockNode
|
||||
@ -80,8 +84,8 @@ class FxTransactionBuildTutorialTest {
|
||||
nodeB.services.getCashBalances()
|
||||
}
|
||||
|
||||
println("BalanceA\n" + balancesA)
|
||||
println("BalanceB\n" + balancesB)
|
||||
println("BalanceA\n$balancesA")
|
||||
println("BalanceB\n$balancesB")
|
||||
// Verify the transfers occurred as expected
|
||||
assertEquals(POUNDS(100), balancesA[GBP])
|
||||
assertEquals(DOLLARS(1000 - 200), balancesA[USD])
|
||||
|
@ -13,7 +13,6 @@ package net.corda.docs.tutorial.testdsl
|
||||
import com.nhaarman.mockito_kotlin.doReturn
|
||||
import com.nhaarman.mockito_kotlin.whenever
|
||||
import net.corda.core.contracts.TransactionVerificationException
|
||||
import net.corda.core.crypto.generateKeyPair
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.node.services.IdentityService
|
||||
import net.corda.core.utilities.days
|
||||
@ -24,11 +23,14 @@ import net.corda.finance.contracts.CommercialPaper
|
||||
import net.corda.finance.contracts.ICommercialPaperState
|
||||
import net.corda.finance.contracts.asset.CASH
|
||||
import net.corda.finance.contracts.asset.Cash
|
||||
import net.corda.testing.core.*
|
||||
import net.corda.testing.core.ALICE_NAME
|
||||
import net.corda.testing.core.BOB_NAME
|
||||
import net.corda.testing.core.DUMMY_NOTARY_NAME
|
||||
import net.corda.testing.core.SerializationEnvironmentRule
|
||||
import net.corda.testing.core.TestIdentity
|
||||
import net.corda.testing.internal.rigorousMock
|
||||
import net.corda.testing.node.MockServices
|
||||
import net.corda.testing.node.ledger
|
||||
import net.corda.testing.node.makeTestIdentityService
|
||||
import net.corda.testing.node.transaction
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
Reference in New Issue
Block a user