groovy

Sorted maps in groovy

醉酒当歌 提交于 2020-01-20 17:08:25
问题 I am interested in using a sorted map in groovy (with gremlin which is a DSL for graph databases). I have looked at this blog post on sorted maps here, but I am still a bit confused. How are sorted maps declared? Is it any different from the standard way for maps y = [:] ? When using a sorted map, are items inserted into the list going to be in the order they are inserted? Or will I have to run sort{} before the items in the sorted map are sorted? 回答1: If you just declare a map like so: def m

Sorted maps in groovy

橙三吉。 提交于 2020-01-20 17:04:04
问题 I am interested in using a sorted map in groovy (with gremlin which is a DSL for graph databases). I have looked at this blog post on sorted maps here, but I am still a bit confused. How are sorted maps declared? Is it any different from the standard way for maps y = [:] ? When using a sorted map, are items inserted into the list going to be in the order they are inserted? Or will I have to run sort{} before the items in the sorted map are sorted? 回答1: If you just declare a map like so: def m

Sorted maps in groovy

烂漫一生 提交于 2020-01-20 17:03:24
问题 I am interested in using a sorted map in groovy (with gremlin which is a DSL for graph databases). I have looked at this blog post on sorted maps here, but I am still a bit confused. How are sorted maps declared? Is it any different from the standard way for maps y = [:] ? When using a sorted map, are items inserted into the list going to be in the order they are inserted? Or will I have to run sort{} before the items in the sorted map are sorted? 回答1: If you just declare a map like so: def m

Elasticsearch: remove/update field inside nested object

你。 提交于 2020-01-20 06:49:18
问题 { "_index" : "test", "_type" : "test", "_id" : "1212", "_version" : 5, "found" : true, "_source" : { "count" : 42, "list_data" : [ { "list_id" : 11, "timestamp" : 1469125397 }, { "list_id" : 122, "timestamp" : 1469050965 } ] } } This is my document schema. list_data is nested object. I have requirement to update/delete particular filed inside list_data . I am able to update count field using groovy script. $ curl -XPOST 'localhost:9200/index/type/1212/_update?pretty' -d ' { "script" : "ctx.

DriverManager doesn't see dependency in gradle custom plugin's task

允我心安 提交于 2020-01-20 05:20:06
问题 I'm writing some gradle plugin and now I've faced with a problem that DriverManager doesn't see JDBC driver defined in buildscript dependency: I have next build.gradle file: buildscript { repositories { mavenCentral() } dependencies { classpath("com.h2database:h2:1.4.196") } } plugins { id "someplugin" } apply plugin: 'groovy' And when I invoke command defined in task that extends DefaultTask DriverManager.getConnection("jdbc:h2:mem:", "sa", "") I receive exception No suitable driver found

Start a job multiple times concurrently with workflow plugin

六眼飞鱼酱① 提交于 2020-01-20 02:26:52
问题 I am trying to run one job 5 times concurrently using the workflow plugin. here is the snippet: def concurrent=[:] for (int i = 0; i < 5; i++) { concurrent["concurrent${i}"] = { build job: 'test_job', parameters: [[$class: 'StringParameterValue', name:'queue', value: 'automation_prod.q'],[$class: 'StringParameterValue', name:'dummy', value: "${i}"]] } } parallel concurrent this snippet causes the the test_job to run only once. I need it running 5 times concurrently. thanks! 回答1: There is no

Start a job multiple times concurrently with workflow plugin

不打扰是莪最后的温柔 提交于 2020-01-20 02:26:39
问题 I am trying to run one job 5 times concurrently using the workflow plugin. here is the snippet: def concurrent=[:] for (int i = 0; i < 5; i++) { concurrent["concurrent${i}"] = { build job: 'test_job', parameters: [[$class: 'StringParameterValue', name:'queue', value: 'automation_prod.q'],[$class: 'StringParameterValue', name:'dummy', value: "${i}"]] } } parallel concurrent this snippet causes the the test_job to run only once. I need it running 5 times concurrently. thanks! 回答1: There is no

How do I create and access the global variables in Groovy?

吃可爱长大的小学妹 提交于 2020-01-18 19:44:30
问题 I need to store a value in a variable in one method and then I need to use that value from that variable in another method or closure. How can I share this value? 回答1: In a Groovy script the scoping can be different than expected. That is because a Groovy script in itself is a class with a method that will run the code, but that is all done runtime. We can define a variable to be scoped to the script by either omitting the type definition or in Groovy 1.8 we can add the @Field annotation.

How do I create and access the global variables in Groovy?

馋奶兔 提交于 2020-01-18 19:40:25
问题 I need to store a value in a variable in one method and then I need to use that value from that variable in another method or closure. How can I share this value? 回答1: In a Groovy script the scoping can be different than expected. That is because a Groovy script in itself is a class with a method that will run the code, but that is all done runtime. We can define a variable to be scoped to the script by either omitting the type definition or in Groovy 1.8 we can add the @Field annotation.

How do I create and access the global variables in Groovy?

末鹿安然 提交于 2020-01-18 19:39:12
问题 I need to store a value in a variable in one method and then I need to use that value from that variable in another method or closure. How can I share this value? 回答1: In a Groovy script the scoping can be different than expected. That is because a Groovy script in itself is a class with a method that will run the code, but that is all done runtime. We can define a variable to be scoped to the script by either omitting the type definition or in Groovy 1.8 we can add the @Field annotation.