Ask a Question

Dynamically set JMS Properties from groovy code

SOLVED
nmrao
Community Hero

Re: Dynamically set JMS Properties from groovy code

Are you using SoapUI Pro?


Regards,
Rao.
qazwsx
Occasional Contributor

Re: Dynamically set JMS Properties from groovy code

Yes, I'm using SoapUI Pro.

tc.png

 

nmrao
Community Hero

Re: Dynamically set JMS Properties from groovy code

Thanks, moved to right forum.

Do you able to use datasource values in SubmitListener.beforeSubmit()?


Regards,
Rao.
nmrao
Community Hero

Re: Dynamically set JMS Properties from groovy code

@qazwsx ,

 

Can you quickly try with below change?

 

From:

def existingProperties = step.httpRequest.getJMSPropertiesConfig().getJMSProperties()

 

To

def existingProperties = ((com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStepWithProperties)step).httpRequest.getJMSPropertiesConfig().getJMSProperties()

 



Regards,
Rao.
qazwsx
Occasional Contributor

Re: Dynamically set JMS Properties from groovy code

With this change I got this error:

groovy.lang.MissingPropertyException: No such property: httpRequest for class: com.eviware.soapui.impl.wsdl.teststeps.JMSTestStep error at line: 23

nmrao
Community Hero

Re: Dynamically set JMS Properties from groovy code

What about this?

Do you able to use datasource values in SubmitListener.beforeSubmit()?


Regards,
Rao.
qazwsx
Occasional Contributor

Re: Dynamically set JMS Properties from groovy code

I think I will able to use it. Or at least I will try.

nmrao
Community Hero

Re: Dynamically set JMS Properties from groovy code

@qazwsx 

 

Ok. Try to put below code in SubmitListener.beforeSubmit

 

 

import com.eviware.soapui.config.JMSPropertyConfig

//Assign your data from datasource into map below - have your logic; otherwise try with fixed data
def map = [a: 'one', b:'two']
if ('JMSRequestReply' == submit.request.name) {
    def existingProperties = submit.request.getJMSPropertiesConfig().getJMSProperties()

   def newList = new ArrayList<JMSPropertyConfig>()
   map.each { key, value ->
	def jmsPropertyConfig = JMSPropertyConfig.Factory.newInstance()
	jmsPropertyConfig.setName(key)
	jmsPropertyConfig.setValue(value)
	newList.add(jmsPropertyConfig)
   }
           
   existingProperties.clear()
   existingProperties.addAll(newList)

}

 



Regards,
Rao.

View solution in original post

qazwsx
Occasional Contributor

Re: Dynamically set JMS Properties from groovy code

Thank you it's working. For now, I tried with static data, but it's working.

nmrao
Community Hero

Re: Dynamically set JMS Properties from groovy code

Glad to know. Would you like to mark it the above solution as solved?


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: