0

Integration testing with Mockito and Spring Boot

Within this post, I show you how to setup properly a Unit Test in Spring Boot performing HTTP requests with Mockito. In this case, I’m testing directly against data to be placed into the model, but a similar test could be written for checking a REST API.

Sometimes testing web access with Spring Boot can be tricky. There are some specific annotations to be used, being the configuration to use maybe the most important one.

Continue Reading

0

Mapping REST API to Plain Java Objects (POJOs)

Let’s say you want to connect your web/application with a third party REST API. Within this article I’ll put as example the SonarQube API, given that is the one I’ve used in my last personal project (see post).

In this post I’ll describe how I solved the situation of having no schema for the data that you’re retrieving from the REST API. How can we map this structure to Java Objects?

Continue Reading

11

A gamification experiment with SonarQube

Some time ago I finished a gamification MOOC by Coursera and then I decided to put it into practice in my current job since I found it really interesting. I set up a game in which the more Sonar issues you resolve, the more points you get, and you can rank in a leaderboard and obtain badges.

In this post, I’d like to share with you the results of this experiment, how people were the key to success by resolving many potential bugs and reducing our technical debt.

Update: code is now on github.

Continue Reading

2

How to redirect JBoss / Wildfly logs to Logstash using syslog

Logstash is a fantastic product to parse and process logs and events from other systems. You can store the resulting data in ElasticSearch and later visualize and analyze the results with Kibana. The combination of the three is called ELK and it produces a really powerful way of working with data, from processing and storing it to its visualization in many forms.

If you work with a web application deployed in JBoss or Wildfly (I’ll cover in this article Wildfly 8.2.0) you can send your all your logs or only the ones coming from your application to Logstash, for further processing. You can use it for example to visualize in Kibana how many errors your application threw, or how many times a specific event was triggered.

Continue Reading

10

How to deploy a Spring Boot WAR in Wildfly / JBoss

This is a short guide on how to deploy a war packaged Spring Boot application in Wildfly. As you know Wildfly is the new name for JBoss AS since 8.0 version, so this configuration should work in JBoss as well.

Spring Boot guys encourage you to deploy your application in the embedded Tomcat server when you package the jar file. That is really powerful but sometimes you need to deploy your application in an existing application server such as Wildfly or JBoss, and for that, you need a deployable WAR file.

Continue Reading