This is cool. Thanks, Rao. I am not a developer so this code is hard for me to understand.
I added your code to my Groovy script (below) and yielded the following results:
Is there any way to equate these results to a variable; like Message1 = FlowId:1, Status:0? This way, I can control the log.info and report file better. I will run this Groovy for thousands times so, ideally, it will be better if log.info is one line per MDSISDN.
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsiDataResponse ==> FlowId: 1, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeMsisdnDataResponse ==> FlowId: 2, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsSubscriberDataResponse ==> FlowId: 3, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsSubscriberDataResponse ==> FlowId: 8, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsPrivateUserDataResponse ==> FlowId: 4, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsPublicUserDataResponse ==> FlowId: 5, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsPublicUserDataResponse ==> FlowId: 6, Status: 0
Wed Jun 23 09:38:39 EDT 2021:INFO:changeImsPublicUserDataResponse ==> FlowId: 7, Status: 0
-----------------------------------------------------------------------------------------------------------------------------------------------------------
def xmlResponse = tStep.getPropertyValue("Response")
def holder = groovyUtils.getXmlHolder(xmlResponse)
def xml = new XmlSlurper().parseText(xmlResponse)
//Closure to show the details of the item as input data
def showDetails = { item ->
def sdms = xml.'**'.findAll {it.name() == item }*.parent()
sdms.each {
// log.info "${item} ==> FlowId: ${it.@flowId}, ResultCode: ${it."$item".@resultCode}, Message: ${it."$item".@message}"
log.info "${item} ==> FlowId: ${it.@flowId}, Status: ${it."$item".@resultCode}"
}
}
showDetails('changeImsiDataResponse')
showDetails('changeMsisdnDataResponse')
showDetails('changeImsSubscriberDataResponse')
showDetails('changeImsPrivateUserDataResponse')
showDetails('changeImsPublicUserDataResponse')
//Closure to show the details of the item as input data
def showDetails = { item ->
def sdms = xml.'**'.findAll {it.name() == item }*.parent()
sdms.each {
// log.info "${item} ==> FlowId: ${it.@flowId}, ResultCode: ${it."$item".@resultCode}, Message: ${it."$item".@message}"
log.info "${item} ==> FlowId: ${it.@flowId}, Status: ${it."$item".@resultCode}"
}
}
showDetails('changeImsiDataResponse')
showDetails('changeMsisdnDataResponse')
showDetails('changeImsSubscriberDataResponse')
showDetails('changeImsPrivateUserDataResponse')
showDetails('changeImsPublicUserDataResponse')