Wednesday, May 15, 2013

How to Convert JMeter Responses' Content-Type Header to any Format



How to Convert JMeter Responses' Content-Type Header to any Format: 


There are situations where you will get different formatted responses in JMeter.

As an example you will get binary response which is not readable. i.e: "Content-Type: application/octet-stream"
 Yet, you want to convert them to human readable format such as "Content-Type: application/xml"

To Convert the content-Type format, "Accept" header in HTTP Header Manager can be used.
ex:
Accept: application/xml or Aceept: text/xml, application/xhtml+xml

Send JMeter requests such as POST, PUT, GET, DELETE and view the message format with TCPMON.
(TCPMon is a utility that allows the messages to be viewed and resent. It is very much useful as a debug tool. http://ws.apache.org/tcpmon/)

tcpmon response from backend:

HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=83A7EAF464474482FAB4ACE810E14592; Path=/jaxrs_basic_44/; HttpOnly
Date: Thu, 16 May 2013 04:51:13 GMTfr
Content-Type: application/octet-stream
Content-Length: 115
Server: WSO2 Carbon Server

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <Customer>
      <id>123</id>
      <name>method : test1</name>
   </Customer>


Binary format Response at user level: 

HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Server: WSO2 Carbon Server
Set-Cookie: JSESSIONID=83A7EAF464474482FAB4ACE810E14592; Path=/jaxrs_basic_44/; HttpOnly
Date: Thu, 16 May 2013 04:51:13 GMT
Transfer-Encoding: chunked
Connection: keep-alive

fb
<axis2ns11:binary xmlns:axis2ns11="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxDdXN0b21lcj48aWQ+MTIzPC9pZD48bmFtZT5tZXRob2QgOiB0ZXN0MTwvbmFtZT48L0N1c3RvbWVyPg==</axis2ns11:binary>0


After Using the "Accept" header in JMeter HTTP Header Manager (Refer the screenshot to add the Accept header):




Response at user level:
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Server: WSO2 Carbon Server
Set-Cookie: JSESSIONID=78A769D448B58BC8D0F2D7858AB20E63; Path=/jaxrs_basic_44/; HttpOnly
Date: Thu, 16 May 2013 06:16:36 GMT
Transfer-Encoding: chunked
Connection: keep-alive

3c
<Customer>
   <id>123</id>
   <name>method : test1</name></Customer>0


Friday, May 10, 2013

Step by step guide to configure multiple ActiveMQ instances in one Server


Step by step guide to configure multiple ActiveMQ instances in one Server:

Prerequisites:
1. Download ActiveMQ binary file
(ex: apache-activemq-5.4.2-bin.tar.gz from http://activemq.apache.org/activemq-542-release.html)
2. untar the .tar.gz file
tar -zxvf apache-activemq-5.4.2-bin.tar.gz

Create and Start instance 1:
1.  Navigate to ActiveMQ folder:
cd /home/test/apache-activemq-5.4.2
2. Create an ActiveMQ instance as instance1:
bin/activemq create instance1
(This will create a folder as instance1: "/home/test/apache-activemq-5.4.2/instance1")
3.  bin/activemq setup ~/.activemqrc-instance-instance1
4.  ln -s activemq bin/activemq-instance-instance1
5.  Give executable permission to instance:
chmod 755 instance1/bin/instance1
6.  cd instance1/bin (i.e: /home/test/apache-activemq-5.4.2/instance1/bin)
7.  Start intsnace1
./instance1 console

Create and Start instance 2:
8.   cd /home/test/apache-activemq-5.4.2
9.   bin/activemq create instance2
10. bin/activemq setup ~/.activemqrc-instance-instance2
11. ln -s activemq bin/activemq-instance-instance2
12. chmod 755 instance2/bin/instance2
13. Edit activemq.xml file and jetty.xml in /<instance>/conf folder
  • cd instance2 (i.e: /home/test/apache-activemq-5.4.2/instance2)
  • vi conf/activemq.xml
  • Edit “transportConnectors” port:
    (ex:<transportConnector name="openwire" uri="tcp://0.0.0.0:61617"/>)
Default setting as follows:
<transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> </transportConnectors>
  • save and exit

  • vi conf/jetty.xml
  • Edit “Connector” port
    (ex: <property name="port" value="8162" />
Default setting as follows:
<property name="connectors"> <list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8161" />
</bean>
</list>
</property>
  • save and exit
14. cd instance2/bin (i.e: /home/test/apache-activemq-5.4.2/instance2/bin)
15. Start intsnace2
./instance2 console

Note: Any number of instances can be configured and started accordingly.