mirror of
https://github.com/corda/corda.git
synced 2025-04-07 11:27:01 +00:00
CORDA-1838: A few misc fixes (#4126)
* Remove unused code * Make comment readable * Remove joptsimple from node/shell * tabs vs whitespace
This commit is contained in:
parent
1de56550b0
commit
30fedec343
@ -96,9 +96,6 @@ dependencies {
|
||||
// For async logging
|
||||
compile "com.lmax:disruptor:$disruptor_version"
|
||||
|
||||
// JOpt: for command line flags.
|
||||
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
||||
|
||||
// Artemis: for reliable p2p message queues.
|
||||
// TODO: remove the forced update of commons-collections and beanutils when artemis updates them
|
||||
compile "org.apache.commons:commons-collections4:${commons_collections_version}"
|
||||
|
@ -1,39 +0,0 @@
|
||||
package net.corda.node.utilities
|
||||
|
||||
import joptsimple.OptionException
|
||||
import joptsimple.OptionParser
|
||||
import joptsimple.OptionSet
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
abstract class AbstractArgsParser<out T : Any> {
|
||||
protected val optionParser = OptionParser()
|
||||
private val helpOption = optionParser.acceptsAll(listOf("h", "help"), "show help").forHelp()
|
||||
|
||||
/**
|
||||
* Parses the given [args] or exits the process if unable to, printing the help output to stderr.
|
||||
* If the help option is specified then the process is also shutdown after printing the help output to stdout.
|
||||
*/
|
||||
fun parseOrExit(vararg args: String): T {
|
||||
try {
|
||||
val optionSet = optionParser.parse(*args)
|
||||
if (optionSet.has(helpOption)) {
|
||||
optionParser.printHelpOn(System.out)
|
||||
exitProcess(0)
|
||||
}
|
||||
return doParse(optionSet)
|
||||
} catch (e: Exception) {
|
||||
when (e) {
|
||||
is OptionException, is IllegalArgumentException -> {
|
||||
System.err.println(e.message ?: "Unable to parse arguments.")
|
||||
optionParser.printHelpOn(System.err)
|
||||
exitProcess(1)
|
||||
}
|
||||
else -> throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun parse(vararg args: String): T = doParse(optionParser.parse(*args))
|
||||
|
||||
protected abstract fun doParse(optionSet: OptionSet): T
|
||||
}
|
@ -71,6 +71,10 @@ dependencies {
|
||||
compile project(":client:jackson")
|
||||
compile project(":test-utils")
|
||||
compile project(path: ":samples:irs-demo:cordapp", configuration: "demoArtifacts")
|
||||
|
||||
// JOpt: for command line flags.
|
||||
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
||||
|
||||
testCompile('org.springframework.boot:spring-boot-starter-test') {
|
||||
exclude module: "spring-boot-starter-logging"
|
||||
exclude module: "logback-classic"
|
||||
|
@ -48,6 +48,9 @@ dependencies {
|
||||
compile 'org.controlsfx:controlsfx:8.40.12'
|
||||
// This provide com.apple.eawt stub for non-mac system.
|
||||
compile 'com.yuvimasory:orange-extensions:1.3.0'
|
||||
|
||||
// JOpt: for command line flags.
|
||||
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
|
@ -124,10 +124,10 @@ class Main : App(MainView::class) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This main method will starts 5 nodes (Notary, USA Bank, UK Bank, Bob and Alice) locally for UI testing,
|
||||
* they will be on localhost ports 20005, 20008, 20011, 20014 and 20017 respectively.
|
||||
* This main method will start 5 nodes (Notary, USA Bank, UK Bank, Bob and Alice) locally for UI testing,
|
||||
* which will bind to ports 20005, 20008, 20011, 20014 and 20017 locally.
|
||||
*
|
||||
* The simulation start with pre-allocating chunks of cash to each of the party in 2 currencies (USD, GBP), then it enter a loop to generate random events.
|
||||
* The simulation starts by pre-allocating chunks of cash to each of the parties in 2 currencies (USD, GBP), then it enters a loop which generates random events.
|
||||
* On each iteration, the issuers will execute a Cash Issue or Cash Exit flow (at a 9:1 ratio) and a random party will execute a move of cash to another random party.
|
||||
*/
|
||||
fun main(args: Array<String>) {
|
||||
|
@ -39,10 +39,6 @@ dependencies {
|
||||
// Jackson support: serialisation to/from JSON, YAML, etc.
|
||||
compile project(':client:jackson')
|
||||
|
||||
|
||||
// JOpt: for command line flags.
|
||||
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
|
||||
|
||||
// CRaSH: An embeddable monitoring and admin shell with support for adding new commands written in Groovy.
|
||||
compile("com.github.corda.crash:crash.shell:$crash_version") {
|
||||
exclude group: "org.slf4j", module: "slf4j-jdk14"
|
||||
|
Loading…
x
Reference in New Issue
Block a user