Unit Testing for Camel Rest DSL and Spring Boot

Hopefully by now, you know how to write your first Rest DSL Camel Route using Spring Boot.  If not, check this post first. Now that you have your route written, it’s time to write a unit test for it.  Many people find Apache Camel unit testing a big struggle to figure out.  Luckily, when using Spring Boot with the Apache Camel Rest DSL testing, a Rest Route isn’t too difficult.

Continue reading “Unit Testing for Camel Rest DSL and Spring Boot”

Share
Eclipse Vert.x logo

Some REST with Vert.x (Part 3 of Introduction to Vert.x)

This post is the third in a series on the Introduction to Eclipse Vert.x. So, let’s have a quick look back at the content of the previous posts. In the first post, we developed a very simple Eclipse Vert.x application and saw how this application can be tested, packaged, and executed. In the second post, we saw how this application became configurable and how we can use a random port in a test.

Well, nothing fancy… Let’s go a bit further this time and develop a CRUD-ish / REST-ish application. So an application exposing an HTML page interacting with the backend using a REST API. The level of RESTfulness of the API is not the topic of this post; I leave it you to decide as it’s a very slippery topic.

So, in other words, we are going to see:

  • Vert.x Web – a framework to let you create web applications easily using Vert.x.
  • How to expose static resources.
  • How to develop a REST API.

Continue reading “Some REST with Vert.x (Part 3 of Introduction to Vert.x)”

Share

Writing Your First Camel Spring Boot Project With the Rest DSL

Rest services are becoming more and more popular for communication between systems.  Now that Red Hat supports the use of Red Hat JBoss Fuse with Apache Camel Spring Boot, learn how you can get started with the Rest DSL and Spring Boot.  These directions will use the camel-servlet component, although various components can be used.

Continue reading “Writing Your First Camel Spring Boot Project With the Rest DSL”

Share

Handling Exception Scenarios in REST API developed using JAX-RS

Prerequisite: Hands on Knowledge of REST API Development using JAX-RS.

REST Services has been an integral part of complex enterprise applications for several years. Developers generally prefer two APIs listed below for building REST API in their enterprise applications.

  1. JAX-RS – Part of JEE Specification with different implementations like RestEasy, Jersey, Restlet etc.
  2. Spring Boot  An OpenSource Spring Community Project best suited for Microservices-based applications.

In this Article, we will learn how to handle Exceptions gracefully in Rest APIs which are built using JAX-RS.

Continue reading “Handling Exception Scenarios in REST API developed using JAX-RS”

Share

Know how RESTful your API is: An Overview of the Richardson Maturity Model

Most of the time, I see developers are bit confused about the term REST. For some enterprise application developers, the meaning of REST is JSON i.e. if they are using JSON in their application, which means they working on REST API, which is not true to some extent. Let’s take a look what exactly a REST API is.

Continue reading “Know how RESTful your API is: An Overview of the Richardson Maturity Model”

Share

Testing REST APIs with REST Assured

Note: This is an updated version of a post I wrote for my private blog years ago.

While working on the REST API of RHQ a long time ago, I had started writing some integration tests against it. Doing this via pure HTTP calls is very tedious and brittle. So, I was looking for a testing framework to help me and found one that I used for some time. I tried to enhance it a bit to better suit my needs but didn’t really get it to work.

I started searching again and this time found REST Assured, which is almost perfect as it provides a high-level fluent Java API to write tests. REST Assured can be used with the classic test runners like JUnit or TestNG.

Continue reading “Testing REST APIs with REST Assured”

Share