Skip to content

Commit

Permalink
Get rid of CSDE across the code and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-subbotin committed Feb 27, 2024
1 parent 0716005 commit 9b36681
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 75 deletions.
3 changes: 1 addition & 2 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@Library('corda-shared-build-pipeline-steps@5.1') _
@Library('corda-shared-build-pipeline-steps@5.2') _

cordaPipeline(
nexusAppId: 'com.corda.CSDE-kotlin.5.0',
publishRepoPrefix: '',
slimBuild: true,
runUnitTests: false,
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
# CSDE-cordapp-template-kotlin
# release-V5 cordapp-template-kotlin


To help make the process of prototyping CorDapps on Corda 5 release more straight forward we have developed the Cordapp Standard Development Environment (CSDE).

The CSDE is obtained by cloning this CSDE-Cordapp-Template-Kotlin repository to your local machine. The CSDE provides:
This template repository provides:

- A pre-setup Cordapp Project which you can use as a starting point to develop your own prototypes.

- A base Gradle configuration which brings in the dependencies you need to write and test a Corda 5 Cordapp.

- A set of Gradle helper tasks which speed up and simplify the development and deployment process.
- A set of Gradle helper tasks, provided by the [Corda runtime gradle plugin](https://github.com/corda/corda-runtime-os/tree/release/os/5.2/tools/corda-runtime-gradle-plugin#readme), which speed up and simplify the development and deployment process.

- Debug configuration for debugging a local Corda cluster.

- The MyFirstFlow code which forms the basis of this getting started documentation, this is located in package com.r3.developers.csdetemplate.flowexample
- The MyFirstFlow code which forms the basis of this getting started documentation, this is located in package com.r3.developers.cordapptemplate.flowexample

- A UTXO example in package com.r3.developers.csdetemplate.utxoexample packages
- A UTXO example in package com.r3.developers.cordapptemplate.utxoexample packages

- Ability to configure the Members of the Local Corda Network.

To find out how to use the CSDE, please refer to the *Getting Started Using the CSDE* subsection within the *Developing Applications* section in the latest Corda 5 documentation at https://docs.r3.com/
To find out how to use the template, please refer to the *<new section name goes here>* subsection within the *Developing Applications* section in the latest Corda 5 documentation at https://docs.r3.com/


## Chat app
Expand All @@ -31,19 +28,22 @@ In this app you can:
3. Individually query out the history of one chat entry. `GetChatFlowArgs`
4. Continue chatting within the chat entry with the counterparty. `UpdateChatFlow`

### Prerequisites
Corda CLI must be installed. It is used by the Corda runtime gradle plugin internally, as well as by the example Docker compose file to create necessary Kafka topics. The version of Corda CLI should match that of Corda combined worker image used in the compose file.

### Setting up

1. We will begin our test deployment with clicking the `startCorda`. This task will load up the combined Corda workers in docker.
A successful deployment will allow you to open the REST APIs at: https://localhost:8888/api/v1/swagger#. You can test out some of the
A successful deployment will allow you to open the REST APIs at: https://localhost:8888/api/v5_2/swagger#. You can test out some of the
functions to check connectivity. (GET /cpi function call should return an empty list as for now.)
2. We will now deploy the cordapp with a click of `5-vNodeSetup` task. Upon successful deployment of the CPI, the GET /cpi function call should now return the meta data of the cpi you just upload
2. We will now deploy the cordapp with a click of `vNodeSetup` task. Upon successful deployment of the CPI, the GET /cpi function call should now return the meta data of the cpi you just upload



### Running the chat app

In Corda 5, flows will be triggered via `POST /flow/{holdingidentityshorthash}` and flow result will need to be view at `GET /flow/{holdingidentityshorthash}/{clientrequestid}`
* holdingidentityshorthash: the id of the network participants, ie Bob, Alice, Charlie. You can view all the short hashes of the network member with another gradle task called `ListVNodes`
* holdingidentityshorthash: the id of the network participants, ie Bob, Alice, Charlie. You can view all the short hashes of the network member with another gradle task called `listVNodes`
* clientrequestid: the id you specify in the flow requestBody when you trigger a flow.

#### Step 1: Create Chat Entry
Expand All @@ -53,7 +53,7 @@ Go to `POST /flow/{holdingidentityshorthash}`, enter the identity short hash(Ali
```
{
"clientRequestId": "create-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.CreateNewChatFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.CreateNewChatFlow",
"requestBody": {
"chatName":"Chat with Bob",
"otherMember":"CN=Bob, OU=Test Dept, O=R3, L=London, C=GB",
Expand All @@ -70,7 +70,7 @@ Go to `POST /flow/{holdingidentityshorthash}`, enter the identity short hash(Ali
```
{
"clientRequestId": "list-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.ListChatsFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.ListChatsFlow",
"requestBody": {}
}
```
Expand All @@ -85,7 +85,7 @@ this message will be recorded as a message from Alice, vice versa. And the id fi
```
{
"clientRequestId": "update-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.UpdateChatFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.UpdateChatFlow",
"requestBody": {
"id":" ** fill in id **",
"message": "How are you today?"
Expand All @@ -100,7 +100,7 @@ After a few back and forth of the messaging, you can view entire chat history by
```
{
"clientRequestId": "get-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.GetChatFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.GetChatFlow",
"requestBody": {
"id":" ** fill in id **",
"numberOfRecords":"4"
Expand Down
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ plugins {
}

allprojects {
group 'com.r3.developers.csdetemplate'
group 'com.r3.developers.cordapptemplate'
version '1.0-SNAPSHOT'

def javaVersion = VERSION_17

// New Corda gradle plugin
cordaRuntimeGradlePlugin {
notaryVersion = "5.2.0.0-RC02"

// Use compose file to start the Combined Worker with Postgres and Kafka
// Note: To ensure that the Combined Worker starts correctly, Corda CLI needs to be used to create necessary topics.
// Corda CLI version should be aligned with the Combined Worker version
composeFilePath = "config/combined-worker-kafka-compose.yaml"
// composeFilePath = "config/combined-worker-compose.yaml"

// Alternatively, you can use a Database-only combined worker:
// composeFilePath = "config/combined-worker-compose.yaml"

// Only need to supply these if you want to use an unpublished version
artifactoryUsername = findProperty('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME')
Expand Down Expand Up @@ -100,7 +106,7 @@ allprojects {
publishing {
publications {
maven(MavenPublication) {
artifactId "corda-CSDE-kotlin-sample"
artifactId "corda-dev-template-kotlin-sample"
groupId project.group
artifact jar
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r3.developers.csdetemplate.utxoexample.contracts
package com.r3.developers.cordapptemplate.utxoexample.contracts

import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.base.exceptions.CordaRuntimeException
import net.corda.v5.ledger.utxo.Command
import net.corda.v5.ledger.utxo.Contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r3.developers.csdetemplate.utxoexample.states
package com.r3.developers.cordapptemplate.utxoexample.states

import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract
import net.corda.v5.base.types.MemberX500Name
import net.corda.v5.ledger.utxo.BelongsToContract
import net.corda.v5.ledger.utxo.ContractState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.security.PublicKey
import java.util.UUID

/**
* The following is the base implementation of the Contract Tests for the Apples CSDE-template-tutorial.
* The following is the base implementation of the Contract Tests for the Apples CorDapp template tutorial.
*
* - The AppleContractTest abstract class implements the ContractTest class.
* - For full contract test coverage, we generally create a class for every command scenario for every state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package com.r3.developers.csdetemplate.utxoexample.contracts
package com.r3.developers.cordapptemplate.utxoexample.contracts

import com.r3.corda.ledger.utxo.testing.ContractTest
import com.r3.corda.ledger.utxo.testing.buildTransaction
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.CREATE_COMMAND_SHOULD_HAVE_NO_INPUT_STATES
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.CREATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.REQUIRE_SINGLE_COMMAND
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.UNKNOWN_COMMAND
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Create
import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import net.corda.v5.crypto.SecureHash
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.CREATE_COMMAND_SHOULD_HAVE_NO_INPUT_STATES
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.CREATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.REQUIRE_SINGLE_COMMAND
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.UNKNOWN_COMMAND
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.ledger.utxo.Command
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import java.util.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.r3.developers.csdetemplate.utxoexample.contracts
package com.r3.developers.cordapptemplate.utxoexample.contracts

import com.r3.corda.ledger.utxo.testing.ContractTest
import com.r3.corda.ledger.utxo.testing.buildTransaction
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_CHATNAME_SHOULD_NOT_CHANGE
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_ID_SHOULD_NOT_CHANGE
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_PARTICIPANTS_SHOULD_NOT_CHANGE
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE
import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE
import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_CHATNAME_SHOULD_NOT_CHANGE
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_ID_SHOULD_NOT_CHANGE
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_PARTICIPANTS_SHOULD_NOT_CHANGE
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract.Companion.UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.ledger.utxo.StateAndRef
import org.junit.jupiter.api.Test
import java.util.*
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cordaNotaryPluginsVersion=5.2.0.0-RC02
# Specify the version of the cordapp-cpb and cordapp-cpk plugins
cordaPluginsVersion=7.0.4

# Specify the version of the CSDE gradle plugin to use
# Specify the version of the Corda runtime Gradle plugin to use
cordaGradlePluginVersion=5.2.0.0-RC02

# Specify the name of the workflows module
Expand Down Expand Up @@ -67,9 +67,9 @@ processorTimeout=-1
# Value is in milliseconds
vnodeRegistrationTimeoutDefault=30000

# Specify if you want to run the contracts and workflows tests as part of the CSDE-cordapp > 3-buildCpis task
# False by default, will execute the tests every time you stand the CSDE up - gives extra protection
# Set to true to skip the tests, making the CSDE launching process quicker. You will be responsible for running workflow tests yourself
# Specify if you want to run the contracts and workflows tests as part of the corda-runtime-plugin-cordapp > buildCpis task
# False by default, will execute the tests every time you stand the template up - gives extra protection
# Set to true to skip the tests, making the launching process quicker. You will be responsible for running workflow tests yourself
skipTestsDuringBuildCpis=false

# R3 internal repository
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pluginManagement {
}

// Root project name, used in naming the project as a whole and used in naming objects built by the project.
rootProject.name = 'csde-cordapp-template-kotlin'
rootProject.name = 'cordapp-template-kotlin'
include ':workflows'
include ':contracts'

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.r3.developers.csdetemplate.flowexample.workflows
package com.r3.developers.cordapptemplate.flowexample.workflows

import net.corda.v5.application.flows.*
import net.corda.v5.application.marshalling.JsonMarshallingService
Expand Down Expand Up @@ -146,7 +146,7 @@ class MyFirstFlowResponder: ResponderFlow {
RequestBody for triggering the flow via REST:
{
"clientRequestId": "r1",
"flowClassName": "com.r3.developers.csdetemplate.flowexample.workflows.MyFirstFlow",
"flowClassName": "com.r3.developers.cordapptemplate.flowexample.workflows.MyFirstFlow",
"requestBody": {
"otherMember":"CN=Bob, OU=Test Dept, O=R3, L=London, C=GB"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.r3.developers.csdetemplate.utxoexample.workflows
package com.r3.developers.cordapptemplate.utxoexample.workflows

import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract
import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.application.flows.*
import net.corda.v5.application.marshalling.JsonMarshallingService
import net.corda.v5.application.membership.MemberLookup
Expand Down Expand Up @@ -102,7 +102,7 @@ class CreateNewChatFlow: ClientStartableFlow {
RequestBody for triggering the flow via REST:
{
"clientRequestId": "create-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.CreateNewChatFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.CreateNewChatFlow",
"requestBody": {
"chatName":"Chat with Bob",
"otherMember":"CN=Bob, OU=Test Dept, O=R3, L=London, C=GB",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r3.developers.csdetemplate.utxoexample.workflows
package com.r3.developers.cordapptemplate.utxoexample.workflows

import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.application.flows.*
import net.corda.v5.application.messaging.FlowMessaging
import net.corda.v5.application.messaging.FlowSession
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r3.developers.csdetemplate.utxoexample.workflows
package com.r3.developers.cordapptemplate.utxoexample.workflows

import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.application.flows.ClientRequestBody
import net.corda.v5.application.flows.ClientStartableFlow
import net.corda.v5.application.flows.CordaInject
Expand Down Expand Up @@ -107,7 +107,7 @@ class GetChatFlow: ClientStartableFlow {
RequestBody for triggering the flow via REST:
{
"clientRequestId": "get-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.GetChatFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.GetChatFlow",
"requestBody": {
"id":"** fill in id **",
"numberOfRecords":"4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r3.developers.csdetemplate.utxoexample.workflows
package com.r3.developers.cordapptemplate.utxoexample.workflows

import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.application.flows.ClientRequestBody
import net.corda.v5.application.flows.ClientStartableFlow
import net.corda.v5.application.flows.CordaInject
Expand Down Expand Up @@ -55,7 +55,7 @@ class ListChatsFlow : ClientStartableFlow {
RequestBody for triggering the flow via REST:
{
"clientRequestId": "list-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.ListChatsFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.ListChatsFlow",
"requestBody": {}
}
*/
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.r3.developers.csdetemplate.utxoexample.workflows
package com.r3.developers.cordapptemplate.utxoexample.workflows

import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.base.annotations.Suspendable
import net.corda.v5.base.exceptions.CordaRuntimeException
import net.corda.v5.base.types.MemberX500Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.r3.developers.csdetemplate.utxoexample.workflows
package com.r3.developers.cordapptemplate.utxoexample.workflows

import com.r3.developers.csdetemplate.utxoexample.contracts.ChatContract
import com.r3.developers.csdetemplate.utxoexample.states.ChatState
import com.r3.developers.cordapptemplate.utxoexample.contracts.ChatContract
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState
import net.corda.v5.application.flows.*
import net.corda.v5.application.marshalling.JsonMarshallingService
import net.corda.v5.application.membership.MemberLookup
Expand Down Expand Up @@ -483,7 +483,7 @@ class TestContractFlow: ClientStartableFlow {
/*
{
"clientRequestId": "dummy-1",
"flowClassName": "com.r3.developers.csdetemplate.utxoexample.workflows.TestContractFlow",
"flowClassName": "com.r3.developers.cordapptemplate.utxoexample.workflows.TestContractFlow",
"requestBody": {
"otherMember":"CN=Bob, OU=Test Dept, O=R3, L=London, C=GB"
}
Expand Down
Loading

0 comments on commit 9b36681

Please sign in to comment.