Collection: It is an object that represents a group of objects.

Java Collections Framework is all about how we store group of objects and manipulate them.

It reduces the programming effort and increases performance while providing high interoperability.

This post guides how to create a maven project from the scratch and integrate it with TestNG. If you are a beginner at test automation, this post may help you.

Setting up Eclipse

  1. Download Eclipse from here, make sure you select Eclipse for Java Developers.
  2. Make sure you install testng plugin for Eclipse from Eclipse Market space. Help -> Eclipse Marketspace and search for testng, and install it

Creating a Maven Project

  1. Let’s first create a maven project. Go to File -> New -> Project -> Maven Project.
  2. Let’s create a project from an archetype. An archetype is nothing but a template. In the filter section type…

Paxos algorithm is used to achieve consensus among a distributed set of computers that communicate via an asynchronous network.

We will understand the Paxos Algorithm by taking a simple problem such as detecting Prime Numbers in a distributed environment.

In order to start the consensus, first, we need to have a coordinator node in our cluster. It is explained in my previous article how can we decide the master node in a distributed environment using the Bully Algorithm. You can check that here.

Once the master node is decided, it starts its work as described below.

  • Firstly master node checks…

This blog post explains the end to end implementation of the Bully Algorithm which is a leader election algorithm in Distributed Systems.

What is a Distributed System

A distributed system is a collection of independent computers that appears to its users as a single coherent system.

These multiple nodes are physically separate but linked with each other. They communicate with each other to complete each others’ and one end goal.

Distributed Algorithms

Distributed Algorithms run in a Distributed System. We have two types of Distributed algorithms which are Leader Election Algorithms and Consensus Algorithms.

In a clustered system, Leader Election Algorithms helps nodes to decide who the…

Assume that your actual Rest API gets a number of identical hits, but actually that Rest Endpoint expects only one hit in order to proceed with the rest of the work!

How to handle this?

In Python, we can handle the scenario by developing a proxy.

Assume that our actual API resides at ‘http://localhost:6001/response’

But we need to send only one request to this API, but actually it getting hit by 100 calls. In order to avoid this, we can make this simple trick.

Create another API as below and count the number of hits.

@app.route('/proxy', methods=['POST'])
def proxy()…

We can invoke APIs using a request payload or sending them in the URL as query parameters.

We can do several operations using the property mediator with the query parameters.

We can check this using a simple property as below. Assume my URL is as below. We can check if all these query params exist in the URL. The query params in this URL are name, term, and amount.


You can further read about Query Parameters from this doc.

Let’s look at the following scenario. Assume the user enters the customer name, term, and loan amount in the request…

Using WSO2 Enrich mediator

Assume we need to copy a whole message context to a property for further use. As an example, if we use Amazon SQS Connector, we may need that message to send it to a Queue as the message body, but we need to pass it as a property. How can we achieve this?

Let’s assume that we are building a message which needs to be passed to the SimpleStockQuote. The request simply follows like this.

<m0:getQuote xmlns:m0="http://services.samples">

Thinking from the ease of the user, we do not want the user to send…

By default XPath 2.0 functions are disabled in WSO2 EI. In this post, we will look at how can we use them in EI 6 and EI7.

  1. Download WSO2 EI 7 from here.
  2. Go to <PRODUCT-HOME>/conf/deployment.toml file and add the following.
  1. Download WSO2 EI 6 from here.
  2. Go to <PRODUCT-HOME>/conf/ file uncomment the following.

Assume we get the following request payload from the user.

The QueueURL contains QueueId and the QueueName. Assume we need to extract only the QueueId which is ‘728847610545’.

We can simply substring the URL by using XPath 2.0 functions. …

We can build messages via sending parameters in the URL or as a payload as a POST request. In both ways, we can build a customized message using Payload Factory.

  • Start the SimpleStockQuote Service since we use this as our backend.

Starting SimpleStockQuote Service

  1. Download WSO2 EI 6.6.0 Distribution from here.
  2. Go to <PRODUCT-HOME>/samples/axis2Server and run the following command to start the axis2Server.

3. Go to <PRODUCT-HOME>/samples/axis2Server/src/SimpleStockQuoteService folder and build it using the following command.


Sending as the Payload as a POST request

Let’s move to our first scenario.

Below will be the payload that the user needs to send.


Below is the…

This tutorial guides you on how to expose the data in a CSV file as a data service using WSO2 Integration Studio and WSO2 Micro Integrator.

Picture Courtesy:

Creating the Data Service using WSO2 Integration Studio

  1. Download and install the WSO2 Integration Studio from here.
  2. From the Getting Started page, you can select Create Data Service Project in the Data Service tab. (If you do not see this page, you can get this through Help -> Getting Started) Provide a name for the Data Service Project and click on Finish.

Isuru Uyanage

Senior Software Engineer — QA at WSO2

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store