Tuesday, April 28, 2015

Reset password of MYSQL in Mac

If you need to reset/forgot your password of MYSQL server, go through follow steps and terminal commands.

1.Stop the mysqld server if it is already running.

2.Run the server in safe mode with privilege bypass.

sudo mysqld_safe --skip-grant-tables

3.In a new window connect to the database, set a new password and flush the permissions & quit:

mysql -u root

UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';

FLUSH PRIVILEGES;

\q

4.Stop the safe mode server and start your regular server back.

Friday, April 24, 2015

SOAPUI 5.0 freezing issue in Mac

If you are a Mac user, then you surely came across this annoying issue. To overcome this, follow given steps.

1. Through finder, right click on soapUI icon under Applications.
2. Select 'Show package content' option
3. Go to contents/plugins and delete 'jre.bundle'.

Now you should be able to restart soapUI and get it to work!!

Tuesday, April 21, 2015

Useful commands/keyboard shortcuts for Devs

Using a Mac pc as a developer can be quite challenging, as it has it's own isolated commands unlike Linux based computers. Following are some useful shortcuts/ terminal commands that comes in handy as a developer.
Values included in <> are to be replaced with your run time values.

1. Extract a jar file :   jar tf  <jar-file>

2. Search for a string in all files :   grep -r <carbon_event_processing_version> *

3. Find the process running in a specific port (port 80 in this case) :  sudo lsof -i :80

4.Printscreen command in Mac :  ctrl+shift + 4

5. In terminal (vi) go to end of a file : G

6. In terminal (vi) go to the top of a file : G1 

7. Zip content in Mac :  zip -r -X ClaimsApprovalTask3.zip ClaimsApprovalTask2 
 ( Remember to add option -X ,else your zipped file will contain mac resource files( _MACOSX/.ds store))

8.After traversing the pathof a file/folder  through terminal , open it in finder (Mac specific) : open .

 


Remote debug WSO2 products/ tests

When it comes to remote debugging(with maven)  your test cases, place the breakpoints in the code, and add below command to the terminal.

mvn clean install -Dmaven.surefire.debug

Once it reaches to "Listening to port 5005" ,start remote debug on port 5005 in your IDE. This will trigger the build process with remote debugging.


If you need to debug your code, while executing some process using the product (ex: Running a human task sample using WSO2 BPS ) , place below command on the terminal.


$ ./wso2server.sh debug 5005



Thursday, April 2, 2015

Download and setup logica SMS Simulator

Sending sms notifications for various tasks/products is a quite popular feature. In order to test such a feature you would require a SMS simulator which is an application that would act as a Short Message Service Center(SMSC) In this post , I will explain how you can setup logica SMS Simulator.

1. Download https://github.com/smn/logica-smpp-sim as a zip folder .
2. Unzip the folder and you should find a start.sh inside it.
3. From your terminal go to the unzipped folder location and execute start.sh like below.

4. select option 1 and it will ask for the required port number. Once you provide your details it will start listening in for any sms.

Note: inside the unzipped folder you can find user.txt file. This is where you can add your configurations regarding your systemId, password and timeout details. For example, say that you use axis2, and have a configuration as below.

<transportsender class="org.apache.axis2.transport.sms.SMSSender" name="sms">
<parameter name="systemType"></parameter>
<parameter name="systemId">bps1</parameter>
<parameter name="password">bps123</parameter>
<parameter name="host">localhost</parameter>
<parameter name="port">2775</parameter>
<parameter name="phoneNumber">BPS1</parameter>
</transportsender>

So in order to capture messages sent through this transport, you need to add below content to user.txt before you start the simulator. And also when requested for port number, you should provide 2775 as the value according to above example.

name=bps1
password=bps123
timeout=unlimited


Note: When adding a new user definition in user.txt file , remember not to add any spaces between name value pairs. For example, name= bps1 and name=bps1 are considered as two users. Since the spaces won't be removed this can cause an error where bps1 user will not be authenticated. Also do not add any blank lines between a user definition, as a new line interprets a new user.