Skip to content

Commit

Permalink
add description for building and running
Browse files Browse the repository at this point in the history
  • Loading branch information
abelhegedus committed Nov 8, 2019
1 parent d8cb634 commit 2d67063
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ The easiest way to set up the environment is to:
2. Clone this repository.
3. Open IntelliJ IDEA and open project. `File -> Open.. -> <project_path>` (Select `Gradle` if needed.)
4. `Build -> Build Project`
5. `Run -> Run... -> com.incquerylabs.vhci.modelaccess.twc.rest.Crawler.kt`

## Run the crawler

### From IntelliJ IDEA

1. `Run -> Run... -> com.incquerylabs.vhci.modelaccess.twc.rest.Crawler.kt` (set arguments in Configuration)

### Application

1. `gradle shadowJar` or download from GitHub releases
1. `java -jar build/libs/vhci.modelaccess.twc.rest-1.0-SNAPSHOT-all.jar <args>` with arguments (see below)


## Example arguments

### OpenSE Cookbook model on twc.openmbee.org

-S twc.openmbee.org -P 8111 -ssl -W 9c368adc-10cc-45d9-bec6-27aedc80e68b -R c6bede89-cd5e-487b-aca8-a4f384370759 -B 29110c0f-bdc1-4294-ae24-9fd608629cac -REV 350 -C 2000 openmbeeguest guest
`-S twc.openmbee.org -P 8111 -ssl -W 9c368adc-10cc-45d9-bec6-27aedc80e68b -R c6bede89-cd5e-487b-aca8-a4f384370759 -B 29110c0f-bdc1-4294-ae24-9fd608629cac -REV 350 -C 2000 -u openmbeeguest -pw guest`

### TMT on twc.openmbee.org

-S twc.openmbee.org -P 8111 -ssl -W 9c368adc-10cc-45d9-bec6-27aedc80e68b -R 6819171d-1f52-4792-a08d-15d50d47985a -B a95e8bd1-f7d2-433e-a0a1-0c1cd7702e59 -REV 229 -C 2000 openmbeeguest guest
`-S twc.openmbee.org -P 8111 -ssl -W 9c368adc-10cc-45d9-bec6-27aedc80e68b -R 6819171d-1f52-4792-a08d-15d50d47985a -B a95e8bd1-f7d2-433e-a0a1-0c1cd7702e59 -REV 229 -C 2000 -u openmbeeguest -pw guest`
2 changes: 1 addition & 1 deletion com.incquerylabs.vhci.modelaccess.twc.rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ compileTestKotlin {
}

vertx {
mainVerticle = 'com.incquerylabs.vhci.modelaccess.twc.rest.verticles.MainVerticle'
launcher = 'com.incquerylabs.vhci.modelaccess.twc.rest.CrawlerKt'
}

wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,23 @@ fun main(args: Array<String>) {

val cli = CLI.create("crawler")
.setSummary("A REST Client to query all model element from server.")
.addArguments(
listOf(
Argument()
.setArgName("username")
.setIndex(0)
.setDefaultValue("admin")
.setDescription("TWC username."),
Argument()
.setArgName("password")
.setIndex(1)
.setDefaultValue("admin")
.setDescription("TWC password.")
)
)
.addOptions(
listOf(
Option()
.setLongName("help")
.setShortName("h")
.setDescription("Show help site.")
.setFlag(true),
Option()
.setLongName("username")
.setShortName("u")
.setDefaultValue("admin")
.setDescription("TWC username."),
Option()
.setLongName("password")
.setShortName("pw")
.setDefaultValue("admin")
.setDescription("TWC password."),
Option()
.setLongName("server")
.setShortName("S")
Expand Down Expand Up @@ -106,6 +102,8 @@ fun main(args: Array<String>) {
val sd = vertx.sharedData()
val twcMap = sd.getLocalMap<Any, Any>("twcMap")

val usr = commandLine.getOptionValue<String>("username")
val pswd = commandLine.getOptionValue<String>("password")
val serverOpt = commandLine.getOptionValue<String>("server")
val portOpt = commandLine.getOptionValue<String>("port")
val isSslEnabled = commandLine.isFlagEnabled("ssl")
Expand Down Expand Up @@ -205,8 +203,6 @@ fun main(args: Array<String>) {
error("Deploy failed: ${deploy.cause().message}")
} else {

val usr = commandLine.getArgumentValue<String>("username")
val pswd = commandLine.getArgumentValue<String>("password")
twcMap["credential"] =
"Basic ${java.util.Base64.getEncoder().encodeToString("${usr}:${pswd}".toByteArray())}"
twcMap["username"] = usr
Expand Down

0 comments on commit 2d67063

Please sign in to comment.