cancel
Showing results for 
Search instead for 
Did you mean: 

How do I retrieve a JMS Security exception object in SoapUI?

AlexDa
Occasional Contributor

How do I retrieve a JMS Security exception object in SoapUI?

How do I retrieve a JMS Security exception object in SoapUI, to extract and parse the message in groovy script? The default JMS Status assertion is not suitable, as I would like to test a negative scenario, such as having the wrong username/password when reading/writing on a queue. I want the custom assertion to pass, by parsing the message from the exception object and validating it.

10 REPLIES 10
nmrao
Community Hero

Re: How do I retrieve a JMS Security exception object in SoapUI?

Are you using jms to send a soap message? which vendor?


Regards,
Rao.
AlexDa
Occasional Contributor

Re: How do I retrieve a JMS Security exception object in SoapUI?

I am sending a trying to read from a JMS queue ( Apache ActiveMQ), but I have invalid username/password combo. The broker responds with a JMSSecurityExceptions object, that is processed by the SoapUI source code and I get the message body form the exception object in the JMS Status assertion, but the assertion fails. I want to create a script assertion, that retrieves the object and parses the message from the object, and if it contains something like "user/pass invalid", the assertion should pass.

nmrao
Community Hero

Re: How do I retrieve a JMS Security exception object in SoapUI?

I meant Is it a soap request type test step?


Regards,
Rao.
AlexDa
Occasional Contributor

Re: How do I retrieve a JMS Security exception object in SoapUI?

Yes, it is a SOAP type request

AlexDa
Occasional Contributor

Re: How do I retrieve a JMS Security exception object in SoapUI?

Yes, it is a SOAP type request

nmrao
Community Hero

Re: How do I retrieve a JMS Security exception object in SoapUI?

Ok.
Just going thru your previous messages once again.
For now, disable JMS Status assertion, and do script assertion. Does it sound good?


Regards,
Rao.
AlexDa
Occasional Contributor

Re: How do I retrieve a JMS Security exception object in SoapUI?

The JMS Status assertion is deactivated. A script assertion was my intention, but I have no idea how to catch the JMSSecurity exception object that is thrown by the AMQ server. If you take a look at the SoapUI source code, you will see that the JMS Status assertion treats the exception (name is jmse), by printing the message inside the exception object to the log. I would want to somehow take that message and to perform some kind of parsing on it (like if the message is: "Username/password used is not valid" than the custom assertion should pass)

Capture.JPG

nmrao
Community Hero

Re: How do I retrieve a JMS Security exception object in SoapUI?

Hmm.
Can you please show the raw response? Please make sure the jms status assertion is disabled before hitting the ws call.


Regards,
Rao.
AlexDa
Occasional Contributor

Re: How do I retrieve a JMS Security exception object in SoapUI?

"vThere is no raw response. The AMQ doesn't return any kind of message, except by sending, somehow, a serialised exception object to SoapUI. SoapUI ,then, treats the exception by printing the error message in the error log and in the JMS status assertion.

Capture.JPG

 

 

The stack trace in the SoapUI error log prints: 

 

Wed Feb 24 15:11:01 EET 2016:ERROR:javax.jms.JMSException: User application1 is not authorized to create: queue://TestReadWriteQueue.test10
javax.jms.JMSException: User application1 is not authorized to create: queue://TestReadWriteQueue.test10
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1377)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1305)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1795)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:277)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:212)
at org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:269)
at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport.send(HermesJmsRequestTransport.java:239)
at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport.messageSend(HermesJmsRequestTransport.java:226)
at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestSendTransport.execute(HermesJmsRequestSendTransport.java:44)
at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport.sendRequest(HermesJmsRequestTransport.java:77)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:119)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.SecurityException: User application1 is not authorized to create: queue://TestReadWriteQueue.test10
at org.apache.activemq.security.AuthorizationBroker.addDestination(AuthorizationBroker.java:115)
at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:178)
at org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:462)
at org.apache.activemq.broker.jmx.ManagedRegionBroker.send(ManagedRegionBroker.java:296)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:153)
at org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:96)
at org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:293)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:153)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:153)
at org.apache.activemq.security.AuthorizationBroker.send(AuthorizationBroker.java:223)
at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:158)
at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:547)
at org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:768)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:339)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:188)
at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:125)
at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:300)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)
at java.lang.Thread.run(Thread.java:722)

 

 

 

 

Don't get me wrong, it's good that I get no response, as I am doing negative testing ( verifiying that wrong username/password combo doesn't work). My issue is that I have no way of validating the result, as the default JMS Status assertion fails ( and if I insert these tests into Jenkins I will have bad statistics). I want a custom script assertion that doesn't fail when AMQ responds with "User application1 is not authorized to create: queue://TestReadWriteQueue.test10"

 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors