How to take file path from command line for sending jms file on queue.
Below is code for producing message. My requirement is to send file on JMS queue.
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder
import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint
import hermes.Hermes
import javax.jms.*
import javax.mail.internet.MimeBodyPart
import javax.activation.*;
Properties properties = new Properties()
//'C:/Users/mahekumar/Desktop/testProperty.properties'
def filePath=testRunner.testCase.testSuite.getPropertyValue( "config-filePath" )
File propertiesFile = new File(filePath)
propertiesFile.withInputStream {
properties.load(it)
}
def Queue1_jmsEndpoint = new JMSEndpoint(properties.Queue1);
def Queue1_hermes = HermesUtils.getHermes( context.testCase.testSuite.project, Queue1_jmsEndpoint.sessionName)
def Queue1_jmsConnectionHolder = new JMSConnectionHolder( Queue1_jmsEndpoint, Queue1_hermes, false, null ,null ,null);
Session Queue1_queueSession = Queue1_jmsConnectionHolder.getSession();
Queue Queue1_queueSend = Queue1_jmsConnectionHolder.getQueue(Queue1_jmsConnectionHolder.getJmsEndpoint().getSend() );
MessageProducer Queue1_messageProducer =Queue1_queueSession.createProducer(Queue1_queueSend );
TextMessage Queue1_textMessageSend = Queue1_queueSession.createTextMessage();
Queue1_textMessageSend.setStringProperty("Organization", properties.Queue1_organization);
Queue1_textMessageSend.setStringProperty("Hostname", properties.Queue1_host);
Queue1_textMessageSend.setStringProperty("User", properties.Queue1_user);
Queue1_textMessageSend.setText(properties.jmsMessage);
//Here, I need to implement file sending logic
Queue1_jmsConnectionHolder.closeAll()