Tuesday, May 28, 2013
Runs previous command replacing the typo
when we run a command with a typo, we can correct the typo and re-run the command by the following command.
^wrong^right
Here are the examples:
The man command is wrongly typed as many
[root@test /]# many head
-bash: many: command not found
The y is replaced with empty character.
[root@test /]# ^y
man head
--------------------------------------------------------------
Here man is typed as
Pushd and popd in bash
Push your present working directory to a stack that you can pop later If are a Bash user and you are in a directory and need to go else where for a while but don't want to lose where you were, use pushd instead of cd. cd /home/complicated/path/.I/dont/want/to/forget pushd /tmp cd thing/in/tmp popd (returns you to /home/complicated/path/.I/dont/want/to/forget)
Friday, May 24, 2013
awk one-liner Tips
Print column1, column5 and column7 of a data file or output of any columns list
$awk ‘{print $1, $5, $7}’ data_file$cat file_name |awk ‘{print $1 $5 $7}’$ls –al |awk ‘{print $1, $5, $7}’ -- Prints file_permissions,size and date
Syntax of running an awk program
Awk ‘program’ input file(s)
List all files names whose file size greater than zero.
$ls –al |awk ‘$5 > 0 {print $9}’
List all
Wednesday, May 15, 2013
How to check if I am running a uniprocessor kernel or a multiprocessor kernel?
/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file /unix it links to.
The following are the three possible outputs from the ls -l /unix command and their corresponding kernels:
/unix -> /usr/lib/boot/unix_up # 32 bit uniprocessor kernel/unix -> /usr/lib/boot/
Sunday, May 12, 2013
Memory utilisation of processes in AIX
For memory information, we use the command svmon.svmon shows the total usage of physical and paging memory.
Command to display top ten processes and userssvmon -P -v -t 10 | moreDisplaying top CPU_consuming processes:ps aux | head -1; ps aux | sort -rn +2Displaying top memory-consuming processes:ps aux | head -1; ps aux | sort -rn +3 | headDisplaying process in order of priority:ps -eakl |
Saturday, May 11, 2013
The simplest possible way to simulate a backend service delay
When testing service integrations, we usually want to simulate the delayed responses from backend web services. For example, if you want to test how WSO2 ESB or Apache Synapse reacts when the backend service takes large amount of time for responding, there are many approaches to introduce delay to backend web service. I have observed that, most of the people modify the backend web services to add Thread.sleep() when they need to introduce a delay in service invocation.
If you are not testing the backend web service and just want to test the integration (e.g:- outgoing calls from ESB), I cannot think of a better solution than using soapUI mock services.
Add the following groovy script inside the OnRequest Script editor to introduce 1 minute delay.
sleep(60000)
Now, send a request to the mock service. You will notice that all requests will respond back to the caller after 1 minute of delay.
Read chapter 6 (Web service simulation with soapUI) and 11 (Extending soapUI with Scripting) of Web Services Testing with soapUI book for more information about soapUI scripting capabilities.
If you are not testing the backend web service and just want to test the integration (e.g:- outgoing calls from ESB), I cannot think of a better solution than using soapUI mock services.
Step 1
Add a new mock service to soapUI project. This can be done at the time of creating the project or by selecting a particular interface (binding) of a wsdl based project.
Step 2
Select the mock service in soapUI navigator and open the mock service editor. In the mock service editor, select OnRequest script.
Step 3
Add the following groovy script inside the OnRequest Script editor to introduce 1 minute delay.
sleep(60000)
Now, send a request to the mock service. You will notice that all requests will respond back to the caller after 1 minute of delay.
Read chapter 6 (Web service simulation with soapUI) and 11 (Extending soapUI with Scripting) of Web Services Testing with soapUI book for more information about soapUI scripting capabilities.
Sunday, May 5, 2013
Testing one-way operations which do not return HTTP 202 responses
When you invoke a one-way (in-Only) operation of a web service over HTTP, it responds with HTTP 202 accepted message. Many web service clients such as soapUI or Jmeter waits till they receive a response from the web service.
Waiting for HTTP 202 response is always not desirable since there are situations where you do not even get a 202 response. For example, if you invoke one-way JMS operation, it does not send a reply back to the client.
Look at a scenario similar to the following.
A client sends a message over HTTP to a proxy service in WSO2 ESB. The proxy service places the message in a JMS queue and does not expect a response back. In this case, client does not even get a HTTP 202 response hence it waits and eventually timed out. This prevents you using the tools like soapUI, Apache Jmeter in these scenarios. How can we fix this so that the client always get a HTTP 202 response back?
Let's go through the procedure in detail.
Use soapUI (or SOAP/XML-RPC sampler in Apache Jmeter) and send a SOAP request to the above proxy service. You will get "java.net.SocketTimeoutException: Read timed out" in soapUI log. This explains the behavior of HTTP client waiting for HTTP 202 response.
There is an useful property, FORCE_SC_ACCEPTED which can be used inside the inSequence of the proxy service to send HTTP 202 Accepted response back to the client in case of one-way JMS operations.
Add this property to the inSequence of the above proxy service.
Re-send a SOAP message to the proxy service using soapUI. You will get a HTTP 202 response.
HTTP/1.1 202 Accepted
Content-Type: text/xml; charset=UTF-8
Date: Sun, 05 May 2013 07:42:27 GMT
Server: WSO2-PassThrough-HTTP
Transfer-Encoding: chunked
Waiting for HTTP 202 response is always not desirable since there are situations where you do not even get a 202 response. For example, if you invoke one-way JMS operation, it does not send a reply back to the client.
Look at a scenario similar to the following.
A client sends a message over HTTP to a proxy service in WSO2 ESB. The proxy service places the message in a JMS queue and does not expect a response back. In this case, client does not even get a HTTP 202 response hence it waits and eventually timed out. This prevents you using the tools like soapUI, Apache Jmeter in these scenarios. How can we fix this so that the client always get a HTTP 202 response back?
Let's go through the procedure in detail.
Step 1:
Configure Apache ActiveMQ JMS broker with WSO2 ESB as explained here.Step 2:
Create a queue in ActiveMQ. You could access ActiveMQ console application through http://localhost:8161/admin and create a new queue. Name it as "onewaytest".Step 3:
Create a simple proxy service in WSO2 ESB as shown below. This proxy service just forwards the incoming SOAP messages into the "onewaytest" JMS queue which we have created in the previous step.<proxy xmlns="http://ws.apache.org/ns/synapse" name="onewayProxy" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/onewaytest?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description></description>
</proxy>
Step 4:
Use soapUI (or SOAP/XML-RPC sampler in Apache Jmeter) and send a SOAP request to the above proxy service. You will get "java.net.SocketTimeoutException: Read timed out" in soapUI log. This explains the behavior of HTTP client waiting for HTTP 202 response.
Step 5:
There is an useful property, FORCE_SC_ACCEPTED which can be used inside the inSequence of the proxy service to send HTTP 202 Accepted response back to the client in case of one-way JMS operations.
Add this property to the inSequence of the above proxy service.
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" />
Step 6:
Re-send a SOAP message to the proxy service using soapUI. You will get a HTTP 202 response.
HTTP/1.1 202 Accepted
Content-Type: text/xml; charset=UTF-8
Date: Sun, 05 May 2013 07:42:27 GMT
Server: WSO2-PassThrough-HTTP
Transfer-Encoding: chunked
Saturday, May 4, 2013
Execute a command without saving it in the history
Prepending one or more spaces to your command won't be saved in history.
It i very useful for hiding your commands which consists of passwords on the commandline.
This is tested in bash shell and works successfully.
Example :
$ echo this goes to history
this goes to history
$ echo this wont go to history
this wont go to history
$ history
1 echo this goes to history
2 history
The manual
Subscribe to:
Comments (Atom)
