groovy

ext and code block's meaning in the gradle file

给你一囗甜甜゛ 提交于 2020-07-02 06:16:07
问题 ext { springVersion = "3.1.0.RELEASE" emailNotification = "build@master.org" } Above code is the snippet of build.gradle I understand that call ext method with { } closure parameter. it's right? So I think gradle is accessing springVersion and emailNotification. I'm gonna verify my assumption with below code def ext(data) { println data.springVersion } ext { springVersion = "3.1.0.RELEASE" emailNotification = "build@master.org" } but run that code below Error occured. groovy.lang

Issue while connecting JMeter to MongoDb: com.mongodb.CommandFailureException … Authentication failed

匆匆过客 提交于 2020-06-29 04:24:27
问题 This is how I am connecting successfully from Spring Data to MongoDb running on my local Docker: aplication.yml: spring: data: mongodb: host: localhost port: 27017 database: demodb authentication-database: admin username: root password: rootpassword Unfortunatelly I am stuck to connect from JMeter to same MongoDb. After several searches around I reached this Grovy Code (it is my first time using Grovy): import com.mongodb.* import com.mongodb.BasicDBObject import org.bson.* MongoCredential

JMeter - User defined counter not incrementing for a Loop

夙愿已清 提交于 2020-06-29 04:02:17
问题 I am quite new to JMeter and I was trying to increment a counter variable pre-defined in User Defined Variables using a Loop Controller and a JSR223 PostProcessor and it seems not working well. I looked at various examples on JMeter loop and counter examples to work this out but the config element Counter was also not incrementing with the loop. Could anybody please let me know what I am doing wrong? This is the user defined variable counter: This is how I do loop: And this is how I am trying

Incomplete XSL transformation if using ErrorListener, ONLY on Jenkins

一个人想着一个人 提交于 2020-06-29 03:58:26
问题 I am trying to have an XSL transformation to run on a Jenkins pipeline. I need to catch XSL transformation's xsl:message . In order to achieve so, I added an ErrorListener : final ErrorListener errorListener = new ErrorListener() { final public List<TransformerException> errorList = new LinkedList<>() @Override void warning(final TransformerException e) throws TransformerException { errorList.add(e) } @Override void error(final TransformerException e) throws TransformerException { errorList

Incomplete XSL transformation if using ErrorListener, ONLY on Jenkins

故事扮演 提交于 2020-06-29 03:58:10
问题 I am trying to have an XSL transformation to run on a Jenkins pipeline. I need to catch XSL transformation's xsl:message . In order to achieve so, I added an ErrorListener : final ErrorListener errorListener = new ErrorListener() { final public List<TransformerException> errorList = new LinkedList<>() @Override void warning(final TransformerException e) throws TransformerException { errorList.add(e) } @Override void error(final TransformerException e) throws TransformerException { errorList

Convert a Map value to String

Deadly 提交于 2020-06-29 03:51:16
问题 I am trying to convert a map value to String . I tried toString() method but it still returns an Object instead of String response = WS.sendRequest(findTestObject('api/test/TD-4_01_01-Valid')) Map parsed = response.getHeaderFields() String messageId = parsed.get('x-message-id').toString(); println messageId Actual Output: [C5yZC5hcy5sb2NhbC0xMjgyNi05MzE1LTE=] Expected Output: C5yZC5hcy5sb2NhbC0xMjgyNi05MzE1LTE= 回答1: ResponseObject#getHeaderFields returns a Map of String keys to a List of

GroovyShell().parse passing parameters

前提是你 提交于 2020-06-28 03:00:26
问题 I have a groovy script that needs to parse a class from an external groovy script. I am not sure how to pass parameters. Here is what works: Groovy script I am running is using this line to parse the external class from external.groovy: new GroovyShell().parse(new File('External.groovy')) Here is what external.groovy looks like: class External { public external() { println "Hello" } } It works. The problem I am having, I cant find a way to pass parameters to the external method. Here is what

How do I use the firstLine argument in eachLine

浪子不回头ぞ 提交于 2020-06-27 07:39:09
问题 I can't seem to make eachLine skip the first line, according to this there is an integer argument that can be passed to eachLine but I can't figure out the syntax http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/File.html#eachLine(int, groovy.lang.Closure) #doesn't work new FileReader('myfile.txt').eachLine firstLine=2,{ line-> println line } #nope new FileReader('myfile.txt').eachLine(2){ line-> println line } 回答1: I think you are misunderstanding what the 'firstLine' parameter is

Sed inside jenkins pipeline

不问归期 提交于 2020-06-25 18:10:08
问题 I am trying to run the below in jenkins and i get error any suggestions? sh ''' sed -i \':a;N;$!ba;s/\\n/\\|\\#\\|/g\' ${concl} ''' Error - Why isnt the ${concl} being repalced with filename inside the shell script? + sed -i ':a;N;$!ba;s/\n/\|\#\|/g' sed: no input files 回答1: I would suggest running bash command in double quotes and escape $ and \ character. Consider following Jenkins pipeline exemplary script: #!/usr/bin/env groovy pipeline { agent any stages { stage('Build') { steps { echo

Sed inside jenkins pipeline

一个人想着一个人 提交于 2020-06-25 18:09:41
问题 I am trying to run the below in jenkins and i get error any suggestions? sh ''' sed -i \':a;N;$!ba;s/\\n/\\|\\#\\|/g\' ${concl} ''' Error - Why isnt the ${concl} being repalced with filename inside the shell script? + sed -i ':a;N;$!ba;s/\n/\|\#\|/g' sed: no input files 回答1: I would suggest running bash command in double quotes and escape $ and \ character. Consider following Jenkins pipeline exemplary script: #!/usr/bin/env groovy pipeline { agent any stages { stage('Build') { steps { echo