Groovy library
Select For Update (atomic transaction)
Below an example of Groovy script used to open an sql connection, update a column of the first row of a table, then close the connection.
sql = groovy.sql.Sql.newInstance('jdbc:mysql://localhost/step','step','init')
sql.execute('begin')
sql.firstRow('select myColumn from myTable for update')[0]
sql.execute('update myTable set myColumn = myColumn + 1');
sql.execute('commit')
sql.close()Copy a file from a path to another
java.nio.file.Files.copy(java.nio.file.Paths.get(file), java.nio.file.Paths.get(file+'2'))REST call with JSON response
response = new URL("http://localhost:8080/rest/grid/agent").text
json = new com.fasterxml.jackson.databind.ObjectMapper().readValue(response, Class.forName('java.util.List'))