Skip to content
This repository was archived by the owner on May 15, 2020. It is now read-only.

Java blacklist #97

Open
wants to merge 2 commits into
base: release-V4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions blacklist/.idea/runConfigurations/Debug_CorDapp.xml

This file was deleted.

23 changes: 0 additions & 23 deletions blacklist/.idea/runConfigurations/Run_Contract_Tests.xml

This file was deleted.

23 changes: 0 additions & 23 deletions blacklist/.idea/runConfigurations/Run_Flow_Tests.xml

This file was deleted.

21 changes: 0 additions & 21 deletions blacklist/.idea/runConfigurations/Unit_tests.xml

This file was deleted.

15 changes: 0 additions & 15 deletions blacklist/.idea/runConfigurations/Upload_blacklist.xml

This file was deleted.

28 changes: 25 additions & 3 deletions blacklist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,36 @@ See https://docs.corda.net/getting-set-up.html.

See https://docs.corda.net/tutorial-cordapp.html#running-the-example-cordapp.

Java nodes
```
./gradlew workflows-java:deployNodes
```
```
./workflows-java/build/nodes/runnodes
```

Kotlin nodes
```
./gradlew workflows-kotlin:deployNodes
```
```
./workflows-kotlin/build/nodes/runnodes
```

## Uploading the blacklist:
Note: The nodes must be running before attempting this step

Before attempting to reach any agreements, you must upload the blacklist as an attachment to each node that you want to
be able to *initiate* an agreement. The blacklist can be uploaded via RPC by running the following command from the
project's root folder:

* Unix/Mac OSX: `./gradlew uploadBlacklist`
* Windows: `gradlew uploadBlacklist`
Java version
* Unix/Mac OSX: ` ./gradlew clients-java:uploadBlacklist`
* Windows: `gradlew clients-java:uploadBlacklist`

Kotlin version
* Unix/Mac OSX: `./gradlew clients-kotlin:uploadBlacklist`
* Windows: `gradlew clinets-kotlin:uploadBlacklist`

Or by running the `Upload blacklist` run configuration from IntelliJ.

Expand All @@ -52,7 +74,7 @@ the shell of Monogram Bank:

start ProposeFlow agreementTxt: "A and B agree Y", counterparty: "Hiseville Deposit Bank", untrustedPartiesAttachment: "4CEC607599723D7E0393EB5F05F24562732CD1B217DEAEDEABD4C25AFE5B333A"

If you now run `run vaultQuery contractStateType: net.corda.examples.attachments.state.AgreementState` on either the
If you now run `run vaultQuery contractStateType: net.corda.examples.attachments.states.AgreementState` on either the
Monogram Bank or Hiseville Deposit Bank node, you should see the agreement stored:

data: !<net.corda.examples.attachments.state.AgreementState>
Expand Down
128 changes: 28 additions & 100 deletions blacklist/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.31'
Properties constants = new Properties()
file("$projectDir/../constants.properties").withInputStream { constants.load(it) }

Expand All @@ -12,6 +13,8 @@ buildscript {
log4j_version = constants.getProperty("log4jVersion")
slf4j_version = constants.getProperty("slf4jVersion")
corda_platform_version = constants.getProperty("platformVersion")
spring_boot_version = '2.0.2.RELEASE'
ext.spring_boot_gradle_plugin_version = '2.0.2.RELEASE'
}

repositories {
Expand All @@ -26,114 +29,39 @@ buildscript {
classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version"
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version"
}
}

apply from: 'repositories.gradle'
allprojects {

apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.quasar-utils'

cordapp {
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion corda_platform_version.toInteger()
contract {
name "Blacklist"
vendor "Corda Open Source"
licence "Apache License, Version 2.0"
versionId 1
}
workflow {
name "Blacklist"
vendor "Corda Open Source"
licence "Apache License, Version 2.0"
versionId 1
}
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "junit:junit:$junit_version"

// This is for the deployNodes task only.
cordaRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"

// Corda dependencies.
cordaCompile "$corda_release_group:corda-core:$corda_release_version"
cordaCompile "$corda_release_group:corda-jackson:$corda_release_version"
cordaCompile "$corda_release_group:corda-rpc:$corda_release_version"
cordaCompile "$corda_release_group:corda-node-api:$corda_release_version"
cordaRuntime "$corda_release_group:corda:$corda_release_version"

testCompile "$corda_release_group:corda-node-driver:$corda_release_version"

// CorDapp dependencies.
}

jar {
// CorDapps do not configure the Node's logging!
exclude '**/log4j2*.xml'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = "1.8"
javaParameters = true // Useful for reflection.
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' }
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
}

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
node {
name "O=Notary,L=London,C=GB"
notary = [validating : true]
p2pPort 10002
rpcSettings {
address("localhost:10003")
adminAddress("localhost:10043")
}
projectCordapp {
deploy = false
}
}
node {
name "O=Monogram Bank,L=London,C=GB"
p2pPort 10006
rpcSettings {
address("localhost:10007")
adminAddress("localhost:10047")
configurations {
compile {
// We want to use SLF4J's version of these bindings: jcl-over-slf4j
// Remove any transitive dependency on Apache's version.
exclude group: 'commons-logging', module: 'commons-logging'
}
cordapps = []
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=Hiseville Deposit Bank,L=Sao Paulo,C=BR"
p2pPort 10009
rpcSettings {
address("localhost:10010")
adminAddress("localhost:10050")
}
cordapps = []
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]

tasks.withType(JavaCompile) {
options.compilerArgs << "-parameters" // Required for shell commands.
}
node {
name "O=George State Bank,L=New York,C=US"
p2pPort 10012
rpcSettings {
address("localhost:10013")
adminAddress("localhost:10053")

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = "1.8"
javaParameters = true // Useful for reflection.
}
cordapps = []
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
}

task uploadBlacklist(type: JavaExec, dependsOn: compileTestKotlin) {
classpath = sourceSets.test.runtimeClasspath
main = 'net.corda.examples.attachments.tests.client.ClientKt'
args 'localhost:10007', 'localhost:10010', 'localhost:10013'
}
}
43 changes: 43 additions & 0 deletions blacklist/clients-java/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apply plugin: 'org.springframework.boot'
apply plugin: 'java'

sourceSets {
main {
resources {
srcDir rootProject.file("config/dev")
}
}
}

dependencies {
// Corda dependencies.
compile "$corda_release_group:corda-rpc:$corda_release_version"

// CorDapp dependencies.
compile project(":contracts-java")
compile project(":workflows-java")

compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
}

compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}"
compile "org.apache.logging.log4j:log4j-web:${log4j_version}"
compile "org.slf4j:jul-to-slf4j:$slf4j_version"
}

springBoot {
mainClassName = "net.corda.examples.attachments.webserver.Server"
}

task runWebServer(type: JavaExec, dependsOn: assemble) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.corda.examples.attachments.webserver.Starter'
args '--server.port=10050', '--config.rpc.host=localhost', '--config.rpc.port=10006', '--config.rpc.username=user1', '--config.rpc.password=test'
}

task uploadBlacklist(type: JavaExec, dependsOn: assemble) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.corda.examples.attachments.client.Client'
args 'localhost:10006', 'localhost:10009', 'localhost:10012'
}
Loading